@module-federation/modern-js 0.0.0-next-20241126032801 → 0.0.0-next-20241127081350
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/utils.js +17 -11
- package/dist/cjs/cli/utils.spec.js +3 -4
- package/dist/esm/cli/utils.js +17 -11
- package/dist/esm/cli/utils.spec.js +3 -4
- package/dist/esm-node/cli/utils.js +17 -11
- package/dist/esm-node/cli/utils.spec.js +3 -4
- package/package.json +29 -5
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -135,16 +135,16 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
|
|
|
135
135
|
...mfConfig.runtimePlugins || []
|
|
136
136
|
];
|
|
137
137
|
patchDTSConfig(mfConfig, isServer);
|
|
138
|
-
injectRuntimePlugins(
|
|
138
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
139
139
|
if (isDev) {
|
|
140
|
-
injectRuntimePlugins(
|
|
140
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/resolve-entry-ipv4"), runtimePlugins);
|
|
141
141
|
}
|
|
142
142
|
if (isServer) {
|
|
143
143
|
injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
|
|
144
144
|
if (isDev) {
|
|
145
145
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
146
146
|
}
|
|
147
|
-
injectRuntimePlugins(
|
|
147
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
148
148
|
if (!mfConfig.library) {
|
|
149
149
|
mfConfig.library = {
|
|
150
150
|
type: "commonjs-module",
|
|
@@ -195,21 +195,27 @@ function patchBundlerConfig(options) {
|
|
|
195
195
|
bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
|
|
196
196
|
if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
197
197
|
if (bundlerConfig.watchOptions.ignored) {
|
|
198
|
-
bundlerConfig.watchOptions.ignored
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
if (typeof bundlerConfig.watchOptions.ignored !== "string") {
|
|
199
|
+
import_logger.default.warn(`Detect you have set watchOptions.ignore as regexp, please transform it to glob string array and add "**/@mf-types/**" to the array.`);
|
|
200
|
+
} else {
|
|
201
|
+
bundlerConfig.watchOptions.ignored = [
|
|
202
|
+
bundlerConfig.watchOptions.ignored
|
|
203
|
+
];
|
|
204
|
+
}
|
|
201
205
|
} else {
|
|
202
206
|
bundlerConfig.watchOptions.ignored = [];
|
|
203
207
|
}
|
|
204
208
|
}
|
|
205
|
-
if (
|
|
206
|
-
if (
|
|
207
|
-
|
|
209
|
+
if (Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
210
|
+
if (mfConfig.dts !== false) {
|
|
211
|
+
if (typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
|
|
212
|
+
bundlerConfig.watchOptions.ignored.push(`**/${mfConfig.dts.consumeTypes.remoteTypesFolder}/**`);
|
|
213
|
+
} else {
|
|
214
|
+
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
215
|
+
}
|
|
208
216
|
} else {
|
|
209
217
|
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
210
218
|
}
|
|
211
|
-
} else {
|
|
212
|
-
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
213
219
|
}
|
|
214
220
|
}
|
|
215
221
|
if (bundlerConfig.output) {
|
|
@@ -22,7 +22,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
var import_vitest = require("vitest");
|
|
25
|
-
var import_path = __toESM(require("path"));
|
|
26
25
|
var import_utils = require("./utils");
|
|
27
26
|
const mfConfig = {
|
|
28
27
|
name: "host",
|
|
@@ -60,9 +59,9 @@ const mfConfig = {
|
|
|
60
59
|
},
|
|
61
60
|
remoteType: "script",
|
|
62
61
|
runtimePlugins: [
|
|
63
|
-
|
|
62
|
+
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
64
63
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
65
|
-
|
|
64
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
66
65
|
],
|
|
67
66
|
shared: {
|
|
68
67
|
react: {
|
|
@@ -88,7 +87,7 @@ const mfConfig = {
|
|
|
88
87
|
},
|
|
89
88
|
remoteType: "script",
|
|
90
89
|
runtimePlugins: [
|
|
91
|
-
|
|
90
|
+
require.resolve("@module-federation/modern-js/shared-strategy")
|
|
92
91
|
],
|
|
93
92
|
shared: {
|
|
94
93
|
react: {
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -129,16 +129,16 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy) {
|
|
|
129
129
|
}
|
|
130
130
|
var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
|
|
131
131
|
patchDTSConfig(mfConfig, isServer);
|
|
132
|
-
injectRuntimePlugins(
|
|
132
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
133
133
|
if (isDev) {
|
|
134
|
-
injectRuntimePlugins(
|
|
134
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/resolve-entry-ipv4"), runtimePlugins);
|
|
135
135
|
}
|
|
136
136
|
if (isServer) {
|
|
137
137
|
injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
|
|
138
138
|
if (isDev) {
|
|
139
139
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
140
140
|
}
|
|
141
|
-
injectRuntimePlugins(
|
|
141
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
142
142
|
if (!mfConfig.library) {
|
|
143
143
|
mfConfig.library = {
|
|
144
144
|
type: "commonjs-module",
|
|
@@ -191,21 +191,27 @@ function patchBundlerConfig(options) {
|
|
|
191
191
|
bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
|
|
192
192
|
if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
193
193
|
if (bundlerConfig.watchOptions.ignored) {
|
|
194
|
-
bundlerConfig.watchOptions.ignored
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
if (typeof bundlerConfig.watchOptions.ignored !== "string") {
|
|
195
|
+
logger.warn('Detect you have set watchOptions.ignore as regexp, please transform it to glob string array and add "**/@mf-types/**" to the array.');
|
|
196
|
+
} else {
|
|
197
|
+
bundlerConfig.watchOptions.ignored = [
|
|
198
|
+
bundlerConfig.watchOptions.ignored
|
|
199
|
+
];
|
|
200
|
+
}
|
|
197
201
|
} else {
|
|
198
202
|
bundlerConfig.watchOptions.ignored = [];
|
|
199
203
|
}
|
|
200
204
|
}
|
|
201
|
-
if (
|
|
202
|
-
if (
|
|
203
|
-
|
|
205
|
+
if (Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
206
|
+
if (mfConfig.dts !== false) {
|
|
207
|
+
if (_type_of(mfConfig.dts) === "object" && _type_of(mfConfig.dts.consumeTypes) === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
|
|
208
|
+
bundlerConfig.watchOptions.ignored.push("**/".concat(mfConfig.dts.consumeTypes.remoteTypesFolder, "/**"));
|
|
209
|
+
} else {
|
|
210
|
+
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
211
|
+
}
|
|
204
212
|
} else {
|
|
205
213
|
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
206
214
|
}
|
|
207
|
-
} else {
|
|
208
|
-
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
209
215
|
}
|
|
210
216
|
}
|
|
211
217
|
if (bundlerConfig.output) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
3
3
|
import { it, expect, describe } from "vitest";
|
|
4
|
-
import path from "path";
|
|
5
4
|
import { patchMFConfig, patchBundlerConfig, getIPV4 } from "./utils";
|
|
6
5
|
var mfConfig = {
|
|
7
6
|
name: "host",
|
|
@@ -42,9 +41,9 @@ describe("patchMFConfig", /* @__PURE__ */ _async_to_generator(function() {
|
|
|
42
41
|
},
|
|
43
42
|
remoteType: "script",
|
|
44
43
|
runtimePlugins: [
|
|
45
|
-
|
|
44
|
+
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
46
45
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
47
|
-
|
|
46
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
48
47
|
],
|
|
49
48
|
shared: {
|
|
50
49
|
react: {
|
|
@@ -76,7 +75,7 @@ describe("patchMFConfig", /* @__PURE__ */ _async_to_generator(function() {
|
|
|
76
75
|
},
|
|
77
76
|
remoteType: "script",
|
|
78
77
|
runtimePlugins: [
|
|
79
|
-
|
|
78
|
+
require.resolve("@module-federation/modern-js/shared-strategy")
|
|
80
79
|
],
|
|
81
80
|
shared: {
|
|
82
81
|
react: {
|
|
@@ -98,16 +98,16 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy) => {
|
|
|
98
98
|
...mfConfig.runtimePlugins || []
|
|
99
99
|
];
|
|
100
100
|
patchDTSConfig(mfConfig, isServer);
|
|
101
|
-
injectRuntimePlugins(
|
|
101
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
102
102
|
if (isDev) {
|
|
103
|
-
injectRuntimePlugins(
|
|
103
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/resolve-entry-ipv4"), runtimePlugins);
|
|
104
104
|
}
|
|
105
105
|
if (isServer) {
|
|
106
106
|
injectRuntimePlugins(require.resolve("@module-federation/node/runtimePlugin"), runtimePlugins);
|
|
107
107
|
if (isDev) {
|
|
108
108
|
injectRuntimePlugins(require.resolve("@module-federation/node/record-dynamic-remote-entry-hash-plugin"), runtimePlugins);
|
|
109
109
|
}
|
|
110
|
-
injectRuntimePlugins(
|
|
110
|
+
injectRuntimePlugins(require.resolve("@module-federation/modern-js/inject-node-fetch"), runtimePlugins);
|
|
111
111
|
if (!mfConfig.library) {
|
|
112
112
|
mfConfig.library = {
|
|
113
113
|
type: "commonjs-module",
|
|
@@ -158,21 +158,27 @@ function patchBundlerConfig(options) {
|
|
|
158
158
|
bundlerConfig.watchOptions = bundlerConfig.watchOptions || {};
|
|
159
159
|
if (!Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
160
160
|
if (bundlerConfig.watchOptions.ignored) {
|
|
161
|
-
bundlerConfig.watchOptions.ignored
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
if (typeof bundlerConfig.watchOptions.ignored !== "string") {
|
|
162
|
+
logger.warn(`Detect you have set watchOptions.ignore as regexp, please transform it to glob string array and add "**/@mf-types/**" to the array.`);
|
|
163
|
+
} else {
|
|
164
|
+
bundlerConfig.watchOptions.ignored = [
|
|
165
|
+
bundlerConfig.watchOptions.ignored
|
|
166
|
+
];
|
|
167
|
+
}
|
|
164
168
|
} else {
|
|
165
169
|
bundlerConfig.watchOptions.ignored = [];
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
|
-
if (
|
|
169
|
-
if (
|
|
170
|
-
|
|
172
|
+
if (Array.isArray(bundlerConfig.watchOptions.ignored)) {
|
|
173
|
+
if (mfConfig.dts !== false) {
|
|
174
|
+
if (typeof mfConfig.dts === "object" && typeof mfConfig.dts.consumeTypes === "object" && mfConfig.dts.consumeTypes.remoteTypesFolder) {
|
|
175
|
+
bundlerConfig.watchOptions.ignored.push(`**/${mfConfig.dts.consumeTypes.remoteTypesFolder}/**`);
|
|
176
|
+
} else {
|
|
177
|
+
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
178
|
+
}
|
|
171
179
|
} else {
|
|
172
180
|
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
173
181
|
}
|
|
174
|
-
} else {
|
|
175
|
-
bundlerConfig.watchOptions.ignored.push("**/@mf-types/**");
|
|
176
182
|
}
|
|
177
183
|
}
|
|
178
184
|
if (bundlerConfig.output) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { it, expect, describe } from "vitest";
|
|
2
|
-
import path from "path";
|
|
3
2
|
import { patchMFConfig, patchBundlerConfig, getIPV4 } from "./utils";
|
|
4
3
|
const mfConfig = {
|
|
5
4
|
name: "host",
|
|
@@ -37,9 +36,9 @@ describe("patchMFConfig", async () => {
|
|
|
37
36
|
},
|
|
38
37
|
remoteType: "script",
|
|
39
38
|
runtimePlugins: [
|
|
40
|
-
|
|
39
|
+
require.resolve("@module-federation/modern-js/shared-strategy"),
|
|
41
40
|
require.resolve("@module-federation/node/runtimePlugin"),
|
|
42
|
-
|
|
41
|
+
require.resolve("@module-federation/modern-js/inject-node-fetch")
|
|
43
42
|
],
|
|
44
43
|
shared: {
|
|
45
44
|
react: {
|
|
@@ -65,7 +64,7 @@ describe("patchMFConfig", async () => {
|
|
|
65
64
|
},
|
|
66
65
|
remoteType: "script",
|
|
67
66
|
runtimePlugins: [
|
|
68
|
-
|
|
67
|
+
require.resolve("@module-federation/modern-js/shared-strategy")
|
|
69
68
|
],
|
|
70
69
|
shared: {
|
|
71
70
|
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-20241127081350",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -32,6 +32,21 @@
|
|
|
32
32
|
"import": "./dist/esm/cli/ssrPlugin.js",
|
|
33
33
|
"require": "./dist/cjs/cli/ssrPlugin.js",
|
|
34
34
|
"types": "./dist/types/cli/ssrPlugin.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./shared-strategy": {
|
|
37
|
+
"import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js",
|
|
38
|
+
"require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js",
|
|
39
|
+
"types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./resolve-entry-ipv4": {
|
|
42
|
+
"import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
|
|
43
|
+
"require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
|
|
44
|
+
"types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts"
|
|
45
|
+
},
|
|
46
|
+
"./inject-node-fetch": {
|
|
47
|
+
"import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
|
|
48
|
+
"require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
|
|
49
|
+
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
|
|
35
50
|
}
|
|
36
51
|
},
|
|
37
52
|
"typesVersions": {
|
|
@@ -47,6 +62,15 @@
|
|
|
47
62
|
],
|
|
48
63
|
"ssr-plugin": [
|
|
49
64
|
"./dist/types/cli/ssrPlugin.d.ts"
|
|
65
|
+
],
|
|
66
|
+
"shared-strategy": [
|
|
67
|
+
"./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts"
|
|
68
|
+
],
|
|
69
|
+
"resolve-entry-ipv4": [
|
|
70
|
+
"./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts"
|
|
71
|
+
],
|
|
72
|
+
"inject-node-fetch": [
|
|
73
|
+
"./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
|
|
50
74
|
]
|
|
51
75
|
}
|
|
52
76
|
},
|
|
@@ -61,9 +85,9 @@
|
|
|
61
85
|
"hoist-non-react-statics": "3.3.2",
|
|
62
86
|
"node-fetch": "~3.3.0",
|
|
63
87
|
"react-error-boundary": "4.0.13",
|
|
64
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
65
|
-
"@module-federation/node": "0.0.0-next-
|
|
66
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
88
|
+
"@module-federation/enhanced": "0.0.0-next-20241127081350",
|
|
89
|
+
"@module-federation/node": "0.0.0-next-20241127081350",
|
|
90
|
+
"@module-federation/sdk": "0.0.0-next-20241127081350"
|
|
67
91
|
},
|
|
68
92
|
"devDependencies": {
|
|
69
93
|
"@modern-js/app-tools": "2.60.6",
|
|
@@ -72,7 +96,7 @@
|
|
|
72
96
|
"@modern-js/runtime": "2.60.6",
|
|
73
97
|
"@modern-js/tsconfig": "2.60.6",
|
|
74
98
|
"@types/hoist-non-react-statics": "3.3.5",
|
|
75
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
99
|
+
"@module-federation/manifest": "0.0.0-next-20241127081350"
|
|
76
100
|
},
|
|
77
101
|
"peerDependencies": {
|
|
78
102
|
"react": ">=17",
|