@module-federation/modern-js 0.0.0-next-20240623084034 → 0.0.0-next-20240624115757

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.
@@ -89,7 +89,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
89
89
  mfConfig: envConfig
90
90
  });
91
91
  };
92
- const ipv4 = await (0, import_utils2.lookupIpv4)();
92
+ const ipv4 = await (0, import_utils2.getIPV4)();
93
93
  return {
94
94
  tools: {
95
95
  rspack(config) {
@@ -28,17 +28,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var utils_exports = {};
30
30
  __export(utils_exports, {
31
+ getIPV4: () => getIPV4,
31
32
  getMFConfig: () => getMFConfig,
32
33
  getTargetEnvConfig: () => getTargetEnvConfig,
33
- lookupIpv4: () => lookupIpv4,
34
34
  patchMFConfig: () => patchMFConfig,
35
35
  patchWebpackConfig: () => patchWebpackConfig
36
36
  });
37
37
  module.exports = __toCommonJS(utils_exports);
38
38
  var import_sdk = require("@module-federation/sdk");
39
39
  var import_path = __toESM(require("path"));
40
+ var import_os = __toESM(require("os"));
40
41
  var import_node_bundle_require = require("@modern-js/node-bundle-require");
41
- var import_dns = __toESM(require("dns"));
42
42
  var import_constant = require("../constant");
43
43
  const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
44
44
  const getMFConfig = async (userConfig) => {
@@ -64,7 +64,7 @@ const replaceRemoteUrl = async (mfConfig) => {
64
64
  if (!mfConfig.remotes) {
65
65
  return;
66
66
  }
67
- const ipv4 = await lookupIpv4();
67
+ const ipv4 = getIPV4();
68
68
  const handleRemoteObject = (remoteObject) => {
69
69
  Object.keys(remoteObject).forEach((remoteKey) => {
70
70
  const remote = remoteObject[remoteKey];
@@ -95,6 +95,33 @@ const patchMFConfig = (mfConfig, isServer) => {
95
95
  const runtimePlugins = [
96
96
  ...mfConfig.runtimePlugins || []
97
97
  ];
98
+ const ModernJSRuntime = "@modern-js/runtime/mf";
99
+ if (mfConfig.dts !== false) {
100
+ var _mfConfig_dts, _mfConfig_dts1;
101
+ if (typeof mfConfig.dts === "boolean" || mfConfig.dts === void 0) {
102
+ mfConfig.dts = {
103
+ consumeTypes: {
104
+ runtimePkgs: [
105
+ ModernJSRuntime
106
+ ]
107
+ }
108
+ };
109
+ } else if (((_mfConfig_dts = mfConfig.dts) === null || _mfConfig_dts === void 0 ? void 0 : _mfConfig_dts.consumeTypes) || ((_mfConfig_dts1 = mfConfig.dts) === null || _mfConfig_dts1 === void 0 ? void 0 : _mfConfig_dts1.consumeTypes) === void 0) {
110
+ var _mfConfig_dts2;
111
+ if (typeof mfConfig.dts.consumeTypes === "boolean" || ((_mfConfig_dts2 = mfConfig.dts) === null || _mfConfig_dts2 === void 0 ? void 0 : _mfConfig_dts2.consumeTypes) === void 0) {
112
+ mfConfig.dts.consumeTypes = {
113
+ runtimePkgs: [
114
+ ModernJSRuntime
115
+ ]
116
+ };
117
+ } else {
118
+ mfConfig.dts.consumeTypes.runtimePkgs = mfConfig.dts.consumeTypes.runtimePkgs || [];
119
+ if (!mfConfig.dts.consumeTypes.runtimePkgs.includes(ModernJSRuntime)) {
120
+ mfConfig.dts.consumeTypes.runtimePkgs.push(ModernJSRuntime);
121
+ }
122
+ }
123
+ }
124
+ }
98
125
  injectRuntimePlugins(import_path.default.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
99
126
  if (isDev) {
100
127
  injectRuntimePlugins(import_path.default.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
@@ -178,16 +205,31 @@ function patchWebpackConfig(options) {
178
205
  };
179
206
  }
180
207
  }
181
- const lookupIpv4 = async () => {
208
+ const localIpv4 = "127.0.0.1";
209
+ const getIpv4Interfaces = () => {
182
210
  try {
183
- const res = await import_dns.default.promises.lookup(import_constant.LOCALHOST, {
184
- family: 4
211
+ const interfaces = import_os.default.networkInterfaces();
212
+ const ipv4Interfaces = [];
213
+ Object.values(interfaces).forEach((detail) => {
214
+ detail === null || detail === void 0 ? void 0 : detail.forEach((detail2) => {
215
+ const familyV4Value = typeof detail2.family === "string" ? "IPv4" : 4;
216
+ if (detail2.family === familyV4Value && detail2.address !== localIpv4) {
217
+ ipv4Interfaces.push(detail2);
218
+ }
219
+ });
185
220
  });
186
- return res.address;
187
- } catch (err) {
188
- return "127.0.0.1";
221
+ return ipv4Interfaces;
222
+ } catch (_err) {
223
+ return [];
189
224
  }
190
225
  };
226
+ const getIPV4 = () => {
227
+ const ipv4Interfaces = getIpv4Interfaces();
228
+ const ipv4Interface = ipv4Interfaces[0] || {
229
+ address: localIpv4
230
+ };
231
+ return ipv4Interface.address;
232
+ };
191
233
  const SPLIT_CHUNK_MAP = {
192
234
  REACT: "lib-react",
193
235
  ROUTER: "lib-router",
@@ -231,9 +273,9 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
231
273
  }
232
274
  // Annotate the CommonJS export names for ESM import in node:
233
275
  0 && (module.exports = {
276
+ getIPV4,
234
277
  getMFConfig,
235
278
  getTargetEnvConfig,
236
- lookupIpv4,
237
279
  patchMFConfig,
238
280
  patchWebpackConfig
239
281
  });
@@ -92,6 +92,13 @@ const mfConfig = {
92
92
  eager: true,
93
93
  singleton: true
94
94
  }
95
+ },
96
+ dts: {
97
+ consumeTypes: {
98
+ runtimePkgs: [
99
+ "@modern-js/runtime/mf"
100
+ ]
101
+ }
95
102
  }
96
103
  });
97
104
  });
@@ -16,13 +16,13 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var LiveReload_exports = {};
20
- __export(LiveReload_exports, {
21
- LiveReload: () => LiveReload
19
+ var SSRLiveReload_exports = {};
20
+ __export(SSRLiveReload_exports, {
21
+ SSRLiveReload: () => SSRLiveReload
22
22
  });
23
- module.exports = __toCommonJS(LiveReload_exports);
23
+ module.exports = __toCommonJS(SSRLiveReload_exports);
24
24
  var import_jsx_runtime = require("react/jsx-runtime");
25
- function LiveReload() {
25
+ function SSRLiveReload() {
26
26
  if (process.env.NODE_ENV !== "development") {
27
27
  return null;
28
28
  }
@@ -39,5 +39,5 @@ function LiveReload() {
39
39
  }
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
- LiveReload
42
+ SSRLiveReload
43
43
  });
@@ -26,12 +26,12 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var MFReactComponent_exports = {};
30
- __export(MFReactComponent_exports, {
31
- MFReactComponent: () => MFReactComponent,
32
- collectAssets: () => collectAssets
29
+ var createRemoteSSRComponent_exports = {};
30
+ __export(createRemoteSSRComponent_exports, {
31
+ collectSSRAssets: () => collectSSRAssets,
32
+ createRemoteSSRComponent: () => createRemoteSSRComponent
33
33
  });
34
- module.exports = __toCommonJS(MFReactComponent_exports);
34
+ module.exports = __toCommonJS(createRemoteSSRComponent_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = __toESM(require("react"));
37
37
  var import_runtime = require("@module-federation/enhanced/runtime");
@@ -84,7 +84,7 @@ function getTargetModuleInfo(id) {
84
84
  remoteEntry
85
85
  };
86
86
  }
87
- function collectAssets(options) {
87
+ function collectSSRAssets(options) {
88
88
  const { id, injectLink = true, injectScript = true } = typeof options === "string" ? {
89
89
  id: options
90
90
  } : options;
@@ -138,49 +138,63 @@ function collectAssets(options) {
138
138
  ...links
139
139
  ];
140
140
  }
141
- function MFReactComponent(props) {
142
- const { loading = "loading...", id, remoteProps = {}, fallback } = props;
143
- const Component = /* @__PURE__ */ import_react.default.lazy(() => (0, import_runtime.loadRemote)(id).then((mod) => {
144
- const assets = collectAssets(props);
145
- if (!mod) {
146
- throw new Error("load remote failed");
147
- }
148
- const Com = typeof mod === "object" ? "default" in mod ? mod.default : mod : mod;
149
- return {
150
- default: () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
151
- children: [
152
- assets,
153
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Com, {
154
- ...remoteProps
155
- })
156
- ]
157
- })
158
- };
159
- }).catch((err) => {
160
- if (!fallback) {
161
- throw err;
162
- }
163
- const FallbackFunctionComponent = fallback;
164
- const FallbackNode = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackFunctionComponent, {
165
- error: err,
166
- resetErrorBoundary: () => {
167
- console.log('SSR mode not support "resetErrorBoundary" !');
141
+ function createRemoteSSRComponent(info) {
142
+ return (props) => {
143
+ const exportName = (info === null || info === void 0 ? void 0 : info.export) || "default";
144
+ const LazyComponent = /* @__PURE__ */ import_react.default.lazy(async () => {
145
+ try {
146
+ const m = await info.loader();
147
+ if (!m) {
148
+ throw new Error("load remote failed");
149
+ }
150
+ const moduleId = m && m[Symbol.for("mf_module_id")];
151
+ const assets = collectSSRAssets({
152
+ id: moduleId,
153
+ injectLink: info.injectLink,
154
+ injectScript: info.injectScript
155
+ });
156
+ const Com = m[exportName];
157
+ if (exportName in m && typeof Com === "function") {
158
+ return {
159
+ default: () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
160
+ children: [
161
+ assets,
162
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Com, {
163
+ ...props
164
+ })
165
+ ]
166
+ })
167
+ };
168
+ } else {
169
+ throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
170
+ }
171
+ } catch (err) {
172
+ if (!info.fallback) {
173
+ throw err;
174
+ }
175
+ const FallbackFunctionComponent = info.fallback;
176
+ const FallbackNode = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackFunctionComponent, {
177
+ error: err,
178
+ resetErrorBoundary: () => {
179
+ console.log('SSR mode not support "resetErrorBoundary" !');
180
+ }
181
+ });
182
+ return {
183
+ default: () => FallbackNode
184
+ };
168
185
  }
169
186
  });
170
- return {
171
- default: () => FallbackNode
172
- };
173
- }));
174
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_error_boundary.ErrorBoundary, {
175
- FallbackComponent: fallback,
176
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Suspense, {
177
- fallback: loading,
178
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {})
179
- })
180
- });
187
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_error_boundary.ErrorBoundary, {
188
+ FallbackComponent: info.fallback,
189
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Suspense, {
190
+ fallback: info.loading,
191
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LazyComponent, {})
192
+ })
193
+ });
194
+ };
181
195
  }
182
196
  // Annotate the CommonJS export names for ESM import in node:
183
197
  0 && (module.exports = {
184
- MFReactComponent,
185
- collectAssets
198
+ collectSSRAssets,
199
+ createRemoteSSRComponent
186
200
  });
@@ -19,18 +19,18 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
19
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
20
  var runtime_exports = {};
21
21
  __export(runtime_exports, {
22
- LiveReload: () => import_LiveReload.LiveReload,
23
- MFReactComponent: () => import_MFReactComponent.MFReactComponent,
24
- collectAssets: () => import_MFReactComponent.collectAssets
22
+ SSRLiveReload: () => import_SSRLiveReload.SSRLiveReload,
23
+ collectSSRAssets: () => import_createRemoteSSRComponent.collectSSRAssets,
24
+ createRemoteSSRComponent: () => import_createRemoteSSRComponent.createRemoteSSRComponent
25
25
  });
26
26
  module.exports = __toCommonJS(runtime_exports);
27
27
  __reExport(runtime_exports, require("@module-federation/enhanced/runtime"), module.exports);
28
- var import_MFReactComponent = require("./MFReactComponent");
29
- var import_LiveReload = require("./LiveReload");
28
+ var import_createRemoteSSRComponent = require("./createRemoteSSRComponent");
29
+ var import_SSRLiveReload = require("./SSRLiveReload");
30
30
  // Annotate the CommonJS export names for ESM import in node:
31
31
  0 && (module.exports = {
32
- LiveReload,
33
- MFReactComponent,
34
- collectAssets,
32
+ SSRLiveReload,
33
+ collectSSRAssets,
34
+ createRemoteSSRComponent,
35
35
  ...require("@module-federation/enhanced/runtime")
36
36
  });
@@ -5,7 +5,7 @@ import { fs } from "@modern-js/utils";
5
5
  import { ModuleFederationPlugin as WebpackModuleFederationPlugin, AsyncBoundaryPlugin } from "@module-federation/enhanced";
6
6
  import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
7
7
  import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
8
- import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, lookupIpv4 } from "./utils";
8
+ import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, getIPV4 } from "./utils";
9
9
  import { updateStatsAndManifest } from "./manifest";
10
10
  import { MODERN_JS_SERVER_DIR } from "../constant";
11
11
  var SSR_PLUGIN_IDENTIFIER = "mfPluginSSR";
@@ -72,7 +72,7 @@ var moduleFederationPlugin = function() {
72
72
  };
73
73
  return [
74
74
  4,
75
- lookupIpv4()
75
+ getIPV4()
76
76
  ];
77
77
  case 1:
78
78
  ipv4 = _state2.sent();
@@ -5,8 +5,8 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
5
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
6
6
  import { encodeName } from "@module-federation/sdk";
7
7
  import path from "path";
8
+ import os from "os";
8
9
  import { bundle } from "@modern-js/node-bundle-require";
9
- import dns from "dns";
10
10
  import { LOCALHOST } from "../constant";
11
11
  var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
12
12
  var getMFConfig = function() {
@@ -64,47 +64,39 @@ var replaceRemoteUrl = function() {
64
64
  var _ref = _async_to_generator(function(mfConfig) {
65
65
  var ipv4, handleRemoteObject;
66
66
  return _ts_generator(this, function(_state) {
67
- switch (_state.label) {
68
- case 0:
69
- if (!mfConfig.remotes) {
70
- return [
71
- 2
72
- ];
67
+ if (!mfConfig.remotes) {
68
+ return [
69
+ 2
70
+ ];
71
+ }
72
+ ipv4 = getIPV4();
73
+ handleRemoteObject = function(remoteObject) {
74
+ Object.keys(remoteObject).forEach(function(remoteKey) {
75
+ var remote = remoteObject[remoteKey];
76
+ if (Array.isArray(remote)) {
77
+ return;
73
78
  }
74
- return [
75
- 4,
76
- lookupIpv4()
77
- ];
78
- case 1:
79
- ipv4 = _state.sent();
80
- handleRemoteObject = function(remoteObject) {
81
- Object.keys(remoteObject).forEach(function(remoteKey) {
82
- var remote = remoteObject[remoteKey];
83
- if (Array.isArray(remote)) {
84
- return;
85
- }
86
- if (typeof remote === "string" && remote.includes(LOCALHOST)) {
87
- remoteObject[remoteKey] = remote.replace(LOCALHOST, ipv4);
88
- }
89
- if (typeof remote === "object" && !Array.isArray(remote.external) && remote.external.includes(LOCALHOST)) {
90
- remote.external = remote.external.replace(LOCALHOST, ipv4);
91
- }
92
- });
93
- };
94
- if (Array.isArray(mfConfig.remotes)) {
95
- mfConfig.remotes.forEach(function(remoteObject) {
96
- if (typeof remoteObject === "string") {
97
- return;
98
- }
99
- handleRemoteObject(remoteObject);
100
- });
101
- } else if (typeof mfConfig.remotes !== "string") {
102
- handleRemoteObject(mfConfig.remotes);
79
+ if (typeof remote === "string" && remote.includes(LOCALHOST)) {
80
+ remoteObject[remoteKey] = remote.replace(LOCALHOST, ipv4);
103
81
  }
104
- return [
105
- 2
106
- ];
82
+ if (typeof remote === "object" && !Array.isArray(remote.external) && remote.external.includes(LOCALHOST)) {
83
+ remote.external = remote.external.replace(LOCALHOST, ipv4);
84
+ }
85
+ });
86
+ };
87
+ if (Array.isArray(mfConfig.remotes)) {
88
+ mfConfig.remotes.forEach(function(remoteObject) {
89
+ if (typeof remoteObject === "string") {
90
+ return;
91
+ }
92
+ handleRemoteObject(remoteObject);
93
+ });
94
+ } else if (typeof mfConfig.remotes !== "string") {
95
+ handleRemoteObject(mfConfig.remotes);
107
96
  }
97
+ return [
98
+ 2
99
+ ];
108
100
  });
109
101
  });
110
102
  return function replaceRemoteUrl2(mfConfig) {
@@ -114,6 +106,33 @@ var replaceRemoteUrl = function() {
114
106
  var patchMFConfig = function(mfConfig, isServer) {
115
107
  var isDev = process.env.NODE_ENV === "development";
116
108
  var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
109
+ var ModernJSRuntime = "@modern-js/runtime/mf";
110
+ if (mfConfig.dts !== false) {
111
+ var _mfConfig_dts, _mfConfig_dts1;
112
+ if (typeof mfConfig.dts === "boolean" || mfConfig.dts === void 0) {
113
+ mfConfig.dts = {
114
+ consumeTypes: {
115
+ runtimePkgs: [
116
+ ModernJSRuntime
117
+ ]
118
+ }
119
+ };
120
+ } else if (((_mfConfig_dts = mfConfig.dts) === null || _mfConfig_dts === void 0 ? void 0 : _mfConfig_dts.consumeTypes) || ((_mfConfig_dts1 = mfConfig.dts) === null || _mfConfig_dts1 === void 0 ? void 0 : _mfConfig_dts1.consumeTypes) === void 0) {
121
+ var _mfConfig_dts2;
122
+ if (typeof mfConfig.dts.consumeTypes === "boolean" || ((_mfConfig_dts2 = mfConfig.dts) === null || _mfConfig_dts2 === void 0 ? void 0 : _mfConfig_dts2.consumeTypes) === void 0) {
123
+ mfConfig.dts.consumeTypes = {
124
+ runtimePkgs: [
125
+ ModernJSRuntime
126
+ ]
127
+ };
128
+ } else {
129
+ mfConfig.dts.consumeTypes.runtimePkgs = mfConfig.dts.consumeTypes.runtimePkgs || [];
130
+ if (!mfConfig.dts.consumeTypes.runtimePkgs.includes(ModernJSRuntime)) {
131
+ mfConfig.dts.consumeTypes.runtimePkgs.push(ModernJSRuntime);
132
+ }
133
+ }
134
+ }
135
+ }
117
136
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
118
137
  if (isDev) {
119
138
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
@@ -191,47 +210,31 @@ function patchWebpackConfig(options) {
191
210
  });
192
211
  }
193
212
  }
194
- var lookupIpv4 = function() {
195
- var _ref = _async_to_generator(function() {
196
- var res, err;
197
- return _ts_generator(this, function(_state) {
198
- switch (_state.label) {
199
- case 0:
200
- _state.trys.push([
201
- 0,
202
- 2,
203
- ,
204
- 3
205
- ]);
206
- return [
207
- 4,
208
- dns.promises.lookup(LOCALHOST, {
209
- family: 4
210
- })
211
- ];
212
- case 1:
213
- res = _state.sent();
214
- return [
215
- 2,
216
- res.address
217
- ];
218
- case 2:
219
- err = _state.sent();
220
- return [
221
- 2,
222
- "127.0.0.1"
223
- ];
224
- case 3:
225
- return [
226
- 2
227
- ];
228
- }
213
+ var localIpv4 = "127.0.0.1";
214
+ var getIpv4Interfaces = function() {
215
+ try {
216
+ var interfaces = os.networkInterfaces();
217
+ var ipv4Interfaces = [];
218
+ Object.values(interfaces).forEach(function(detail) {
219
+ detail === null || detail === void 0 ? void 0 : detail.forEach(function(detail2) {
220
+ var familyV4Value = typeof detail2.family === "string" ? "IPv4" : 4;
221
+ if (detail2.family === familyV4Value && detail2.address !== localIpv4) {
222
+ ipv4Interfaces.push(detail2);
223
+ }
224
+ });
229
225
  });
230
- });
231
- return function lookupIpv42() {
232
- return _ref.apply(this, arguments);
226
+ return ipv4Interfaces;
227
+ } catch (_err) {
228
+ return [];
229
+ }
230
+ };
231
+ var getIPV4 = function() {
232
+ var ipv4Interfaces = getIpv4Interfaces();
233
+ var ipv4Interface = ipv4Interfaces[0] || {
234
+ address: localIpv4
233
235
  };
234
- }();
236
+ return ipv4Interface.address;
237
+ };
235
238
  var SPLIT_CHUNK_MAP = {
236
239
  REACT: "lib-react",
237
240
  ROUTER: "lib-router",
@@ -291,9 +294,9 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
291
294
  }
292
295
  }
293
296
  export {
297
+ getIPV4,
294
298
  getMFConfig,
295
299
  getTargetEnvConfig,
296
- lookupIpv4,
297
300
  patchMFConfig,
298
301
  patchWebpackConfig
299
302
  };
@@ -80,6 +80,13 @@ describe("getTargetEnvConfig", /* @__PURE__ */ _async_to_generator(function() {
80
80
  eager: true,
81
81
  singleton: true
82
82
  }
83
+ },
84
+ dts: {
85
+ consumeTypes: {
86
+ runtimePkgs: [
87
+ "@modern-js/runtime/mf"
88
+ ]
89
+ }
83
90
  }
84
91
  });
85
92
  return [
@@ -10,7 +10,7 @@ function _templateObject() {
10
10
  return data;
11
11
  }
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- function LiveReload() {
13
+ function SSRLiveReload() {
14
14
  if (process.env.NODE_ENV !== "development") {
15
15
  return null;
16
16
  }
@@ -22,5 +22,5 @@ function LiveReload() {
22
22
  });
23
23
  }
24
24
  export {
25
- LiveReload
25
+ SSRLiveReload
26
26
  };
@@ -1,9 +1,11 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
1
2
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
3
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
3
4
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
6
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
5
7
  import React from "react";
6
- import { loadRemote, getInstance } from "@module-federation/enhanced/runtime";
8
+ import { getInstance } from "@module-federation/enhanced/runtime";
7
9
  import { ErrorBoundary } from "react-error-boundary";
8
10
  function getLoadedRemoteInfos(instance, id) {
9
11
  var _ref = instance.remoteHandler.idToRemoteMap[id] || {}, name = _ref.name, expose = _ref.expose;
@@ -54,7 +56,7 @@ function getTargetModuleInfo(id) {
54
56
  remoteEntry
55
57
  };
56
58
  }
57
- function collectAssets(options) {
59
+ function collectSSRAssets(options) {
58
60
  var _ref = typeof options === "string" ? {
59
61
  id: options
60
62
  } : options, id = _ref.id, _ref_injectLink = _ref.injectLink, injectLink = _ref_injectLink === void 0 ? true : _ref_injectLink, _ref_injectScript = _ref.injectScript, injectScript = _ref_injectScript === void 0 ? true : _ref_injectScript;
@@ -94,52 +96,94 @@ function collectAssets(options) {
94
96
  }
95
97
  return _to_consumable_array(scripts).concat(_to_consumable_array(links));
96
98
  }
97
- function MFReactComponent(props) {
98
- var _props_loading = props.loading, loading = _props_loading === void 0 ? "loading..." : _props_loading, id = props.id, _props_remoteProps = props.remoteProps, remoteProps = _props_remoteProps === void 0 ? {} : _props_remoteProps, fallback = props.fallback;
99
- var Component = /* @__PURE__ */ React.lazy(function() {
100
- return loadRemote(id).then(function(mod) {
101
- var assets = collectAssets(props);
102
- if (!mod) {
103
- throw new Error("load remote failed");
104
- }
105
- var Com = typeof mod === "object" ? "default" in mod ? mod.default : mod : mod;
106
- return {
107
- default: function() {
108
- return /* @__PURE__ */ _jsxs(_Fragment, {
109
- children: [
110
- assets,
111
- /* @__PURE__ */ _jsx(Com, _object_spread({}, remoteProps))
112
- ]
113
- });
114
- }
115
- };
116
- }).catch(function(err) {
117
- if (!fallback) {
118
- throw err;
119
- }
120
- var FallbackFunctionComponent = fallback;
121
- var FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
122
- error: err,
123
- resetErrorBoundary: function() {
124
- console.log('SSR mode not support "resetErrorBoundary" !');
99
+ function createRemoteSSRComponent(info) {
100
+ return function(props) {
101
+ var exportName = (info === null || info === void 0 ? void 0 : info.export) || "default";
102
+ var LazyComponent = /* @__PURE__ */ React.lazy(/* @__PURE__ */ _async_to_generator(function() {
103
+ var m, moduleId, assets, Com, err, FallbackFunctionComponent, FallbackNode;
104
+ return _ts_generator(this, function(_state) {
105
+ switch (_state.label) {
106
+ case 0:
107
+ _state.trys.push([
108
+ 0,
109
+ 2,
110
+ ,
111
+ 3
112
+ ]);
113
+ return [
114
+ 4,
115
+ info.loader()
116
+ ];
117
+ case 1:
118
+ m = _state.sent();
119
+ if (!m) {
120
+ throw new Error("load remote failed");
121
+ }
122
+ moduleId = m && m[Symbol.for("mf_module_id")];
123
+ assets = collectSSRAssets({
124
+ id: moduleId,
125
+ injectLink: info.injectLink,
126
+ injectScript: info.injectScript
127
+ });
128
+ Com = m[exportName];
129
+ if (exportName in m && typeof Com === "function") {
130
+ return [
131
+ 2,
132
+ {
133
+ default: function() {
134
+ return /* @__PURE__ */ _jsxs(_Fragment, {
135
+ children: [
136
+ assets,
137
+ /* @__PURE__ */ _jsx(Com, _object_spread({}, props))
138
+ ]
139
+ });
140
+ }
141
+ }
142
+ ];
143
+ } else {
144
+ throw Error("Make sure that ".concat(moduleId, " has the correct export when export is ").concat(String(exportName)));
145
+ }
146
+ return [
147
+ 3,
148
+ 3
149
+ ];
150
+ case 2:
151
+ err = _state.sent();
152
+ if (!info.fallback) {
153
+ throw err;
154
+ }
155
+ FallbackFunctionComponent = info.fallback;
156
+ FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
157
+ error: err,
158
+ resetErrorBoundary: function() {
159
+ console.log('SSR mode not support "resetErrorBoundary" !');
160
+ }
161
+ });
162
+ return [
163
+ 2,
164
+ {
165
+ default: function() {
166
+ return FallbackNode;
167
+ }
168
+ }
169
+ ];
170
+ case 3:
171
+ return [
172
+ 2
173
+ ];
125
174
  }
126
175
  });
127
- return {
128
- default: function() {
129
- return FallbackNode;
130
- }
131
- };
176
+ }));
177
+ return /* @__PURE__ */ _jsx(ErrorBoundary, {
178
+ FallbackComponent: info.fallback,
179
+ children: /* @__PURE__ */ _jsx(React.Suspense, {
180
+ fallback: info.loading,
181
+ children: /* @__PURE__ */ _jsx(LazyComponent, {})
182
+ })
132
183
  });
133
- });
134
- return /* @__PURE__ */ _jsx(ErrorBoundary, {
135
- FallbackComponent: fallback,
136
- children: /* @__PURE__ */ _jsx(React.Suspense, {
137
- fallback: loading,
138
- children: /* @__PURE__ */ _jsx(Component, {})
139
- })
140
- });
184
+ };
141
185
  }
142
186
  export {
143
- MFReactComponent,
144
- collectAssets
187
+ collectSSRAssets,
188
+ createRemoteSSRComponent
145
189
  };
@@ -1,8 +1,8 @@
1
1
  export * from "@module-federation/enhanced/runtime";
2
- import { MFReactComponent, collectAssets } from "./MFReactComponent";
3
- import { LiveReload } from "./LiveReload";
2
+ import { createRemoteSSRComponent, collectSSRAssets } from "./createRemoteSSRComponent";
3
+ import { SSRLiveReload } from "./SSRLiveReload";
4
4
  export {
5
- LiveReload,
6
- MFReactComponent,
7
- collectAssets
5
+ SSRLiveReload,
6
+ collectSSRAssets,
7
+ createRemoteSSRComponent
8
8
  };
@@ -3,7 +3,7 @@ import { fs } from "@modern-js/utils";
3
3
  import { ModuleFederationPlugin as WebpackModuleFederationPlugin, AsyncBoundaryPlugin } from "@module-federation/enhanced";
4
4
  import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
5
5
  import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
6
- import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, lookupIpv4 } from "./utils";
6
+ import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, getIPV4 } from "./utils";
7
7
  import { updateStatsAndManifest } from "./manifest";
8
8
  import { MODERN_JS_SERVER_DIR } from "../constant";
9
9
  const SSR_PLUGIN_IDENTIFIER = "mfPluginSSR";
@@ -53,7 +53,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
53
53
  mfConfig: envConfig
54
54
  });
55
55
  };
56
- const ipv4 = await lookupIpv4();
56
+ const ipv4 = await getIPV4();
57
57
  return {
58
58
  tools: {
59
59
  rspack(config) {
@@ -1,7 +1,7 @@
1
1
  import { encodeName } from "@module-federation/sdk";
2
2
  import path from "path";
3
+ import os from "os";
3
4
  import { bundle } from "@modern-js/node-bundle-require";
4
- import dns from "dns";
5
5
  import { LOCALHOST } from "../constant";
6
6
  const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
7
7
  const getMFConfig = async (userConfig) => {
@@ -27,7 +27,7 @@ const replaceRemoteUrl = async (mfConfig) => {
27
27
  if (!mfConfig.remotes) {
28
28
  return;
29
29
  }
30
- const ipv4 = await lookupIpv4();
30
+ const ipv4 = getIPV4();
31
31
  const handleRemoteObject = (remoteObject) => {
32
32
  Object.keys(remoteObject).forEach((remoteKey) => {
33
33
  const remote = remoteObject[remoteKey];
@@ -58,6 +58,33 @@ const patchMFConfig = (mfConfig, isServer) => {
58
58
  const runtimePlugins = [
59
59
  ...mfConfig.runtimePlugins || []
60
60
  ];
61
+ const ModernJSRuntime = "@modern-js/runtime/mf";
62
+ if (mfConfig.dts !== false) {
63
+ var _mfConfig_dts, _mfConfig_dts1;
64
+ if (typeof mfConfig.dts === "boolean" || mfConfig.dts === void 0) {
65
+ mfConfig.dts = {
66
+ consumeTypes: {
67
+ runtimePkgs: [
68
+ ModernJSRuntime
69
+ ]
70
+ }
71
+ };
72
+ } else if (((_mfConfig_dts = mfConfig.dts) === null || _mfConfig_dts === void 0 ? void 0 : _mfConfig_dts.consumeTypes) || ((_mfConfig_dts1 = mfConfig.dts) === null || _mfConfig_dts1 === void 0 ? void 0 : _mfConfig_dts1.consumeTypes) === void 0) {
73
+ var _mfConfig_dts2;
74
+ if (typeof mfConfig.dts.consumeTypes === "boolean" || ((_mfConfig_dts2 = mfConfig.dts) === null || _mfConfig_dts2 === void 0 ? void 0 : _mfConfig_dts2.consumeTypes) === void 0) {
75
+ mfConfig.dts.consumeTypes = {
76
+ runtimePkgs: [
77
+ ModernJSRuntime
78
+ ]
79
+ };
80
+ } else {
81
+ mfConfig.dts.consumeTypes.runtimePkgs = mfConfig.dts.consumeTypes.runtimePkgs || [];
82
+ if (!mfConfig.dts.consumeTypes.runtimePkgs.includes(ModernJSRuntime)) {
83
+ mfConfig.dts.consumeTypes.runtimePkgs.push(ModernJSRuntime);
84
+ }
85
+ }
86
+ }
87
+ }
61
88
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
62
89
  if (isDev) {
63
90
  injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
@@ -141,16 +168,31 @@ function patchWebpackConfig(options) {
141
168
  };
142
169
  }
143
170
  }
144
- const lookupIpv4 = async () => {
171
+ const localIpv4 = "127.0.0.1";
172
+ const getIpv4Interfaces = () => {
145
173
  try {
146
- const res = await dns.promises.lookup(LOCALHOST, {
147
- family: 4
174
+ const interfaces = os.networkInterfaces();
175
+ const ipv4Interfaces = [];
176
+ Object.values(interfaces).forEach((detail) => {
177
+ detail === null || detail === void 0 ? void 0 : detail.forEach((detail2) => {
178
+ const familyV4Value = typeof detail2.family === "string" ? "IPv4" : 4;
179
+ if (detail2.family === familyV4Value && detail2.address !== localIpv4) {
180
+ ipv4Interfaces.push(detail2);
181
+ }
182
+ });
148
183
  });
149
- return res.address;
150
- } catch (err) {
151
- return "127.0.0.1";
184
+ return ipv4Interfaces;
185
+ } catch (_err) {
186
+ return [];
152
187
  }
153
188
  };
189
+ const getIPV4 = () => {
190
+ const ipv4Interfaces = getIpv4Interfaces();
191
+ const ipv4Interface = ipv4Interfaces[0] || {
192
+ address: localIpv4
193
+ };
194
+ return ipv4Interface.address;
195
+ };
154
196
  const SPLIT_CHUNK_MAP = {
155
197
  REACT: "lib-react",
156
198
  ROUTER: "lib-router",
@@ -193,9 +235,9 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
193
235
  }
194
236
  }
195
237
  export {
238
+ getIPV4,
196
239
  getMFConfig,
197
240
  getTargetEnvConfig,
198
- lookupIpv4,
199
241
  patchMFConfig,
200
242
  patchWebpackConfig
201
243
  };
@@ -69,6 +69,13 @@ describe("getTargetEnvConfig", async () => {
69
69
  eager: true,
70
70
  singleton: true
71
71
  }
72
+ },
73
+ dts: {
74
+ consumeTypes: {
75
+ runtimePkgs: [
76
+ "@modern-js/runtime/mf"
77
+ ]
78
+ }
72
79
  }
73
80
  });
74
81
  });
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- function LiveReload() {
2
+ function SSRLiveReload() {
3
3
  if (process.env.NODE_ENV !== "development") {
4
4
  return null;
5
5
  }
@@ -15,5 +15,5 @@ function LiveReload() {
15
15
  });
16
16
  }
17
17
  export {
18
- LiveReload
18
+ SSRLiveReload
19
19
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { loadRemote, getInstance } from "@module-federation/enhanced/runtime";
3
+ import { getInstance } from "@module-federation/enhanced/runtime";
4
4
  import { ErrorBoundary } from "react-error-boundary";
5
5
  function getLoadedRemoteInfos(instance, id) {
6
6
  const { name, expose } = instance.remoteHandler.idToRemoteMap[id] || {};
@@ -50,7 +50,7 @@ function getTargetModuleInfo(id) {
50
50
  remoteEntry
51
51
  };
52
52
  }
53
- function collectAssets(options) {
53
+ function collectSSRAssets(options) {
54
54
  const { id, injectLink = true, injectScript = true } = typeof options === "string" ? {
55
55
  id: options
56
56
  } : options;
@@ -104,48 +104,62 @@ function collectAssets(options) {
104
104
  ...links
105
105
  ];
106
106
  }
107
- function MFReactComponent(props) {
108
- const { loading = "loading...", id, remoteProps = {}, fallback } = props;
109
- const Component = /* @__PURE__ */ React.lazy(() => loadRemote(id).then((mod) => {
110
- const assets = collectAssets(props);
111
- if (!mod) {
112
- throw new Error("load remote failed");
113
- }
114
- const Com = typeof mod === "object" ? "default" in mod ? mod.default : mod : mod;
115
- return {
116
- default: () => /* @__PURE__ */ _jsxs(_Fragment, {
117
- children: [
118
- assets,
119
- /* @__PURE__ */ _jsx(Com, {
120
- ...remoteProps
121
- })
122
- ]
123
- })
124
- };
125
- }).catch((err) => {
126
- if (!fallback) {
127
- throw err;
128
- }
129
- const FallbackFunctionComponent = fallback;
130
- const FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
131
- error: err,
132
- resetErrorBoundary: () => {
133
- console.log('SSR mode not support "resetErrorBoundary" !');
107
+ function createRemoteSSRComponent(info) {
108
+ return (props) => {
109
+ const exportName = (info === null || info === void 0 ? void 0 : info.export) || "default";
110
+ const LazyComponent = /* @__PURE__ */ React.lazy(async () => {
111
+ try {
112
+ const m = await info.loader();
113
+ if (!m) {
114
+ throw new Error("load remote failed");
115
+ }
116
+ const moduleId = m && m[Symbol.for("mf_module_id")];
117
+ const assets = collectSSRAssets({
118
+ id: moduleId,
119
+ injectLink: info.injectLink,
120
+ injectScript: info.injectScript
121
+ });
122
+ const Com = m[exportName];
123
+ if (exportName in m && typeof Com === "function") {
124
+ return {
125
+ default: () => /* @__PURE__ */ _jsxs(_Fragment, {
126
+ children: [
127
+ assets,
128
+ /* @__PURE__ */ _jsx(Com, {
129
+ ...props
130
+ })
131
+ ]
132
+ })
133
+ };
134
+ } else {
135
+ throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
136
+ }
137
+ } catch (err) {
138
+ if (!info.fallback) {
139
+ throw err;
140
+ }
141
+ const FallbackFunctionComponent = info.fallback;
142
+ const FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
143
+ error: err,
144
+ resetErrorBoundary: () => {
145
+ console.log('SSR mode not support "resetErrorBoundary" !');
146
+ }
147
+ });
148
+ return {
149
+ default: () => FallbackNode
150
+ };
134
151
  }
135
152
  });
136
- return {
137
- default: () => FallbackNode
138
- };
139
- }));
140
- return /* @__PURE__ */ _jsx(ErrorBoundary, {
141
- FallbackComponent: fallback,
142
- children: /* @__PURE__ */ _jsx(React.Suspense, {
143
- fallback: loading,
144
- children: /* @__PURE__ */ _jsx(Component, {})
145
- })
146
- });
153
+ return /* @__PURE__ */ _jsx(ErrorBoundary, {
154
+ FallbackComponent: info.fallback,
155
+ children: /* @__PURE__ */ _jsx(React.Suspense, {
156
+ fallback: info.loading,
157
+ children: /* @__PURE__ */ _jsx(LazyComponent, {})
158
+ })
159
+ });
160
+ };
147
161
  }
148
162
  export {
149
- MFReactComponent,
150
- collectAssets
163
+ collectSSRAssets,
164
+ createRemoteSSRComponent
151
165
  };
@@ -1,8 +1,8 @@
1
1
  export * from "@module-federation/enhanced/runtime";
2
- import { MFReactComponent, collectAssets } from "./MFReactComponent";
3
- import { LiveReload } from "./LiveReload";
2
+ import { createRemoteSSRComponent, collectSSRAssets } from "./createRemoteSSRComponent";
3
+ import { SSRLiveReload } from "./SSRLiveReload";
4
4
  export {
5
- LiveReload,
6
- MFReactComponent,
7
- collectAssets
5
+ SSRLiveReload,
6
+ collectSSRAssets,
7
+ createRemoteSSRComponent
8
8
  };
@@ -43,4 +43,4 @@ export declare function patchWebpackConfig<T>(options: {
43
43
  modernjsConfig: UserConfig<AppTools>;
44
44
  mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
45
45
  }): void;
46
- export declare const lookupIpv4: () => Promise<string>;
46
+ export declare const getIPV4: () => string;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare function SSRLiveReload(): import("react").JSX.Element | null;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
3
+ type IProps = {
4
+ id: string;
5
+ injectScript?: boolean;
6
+ injectLink?: boolean;
7
+ };
8
+ export declare function collectSSRAssets(options: IProps): React.ReactNode[];
9
+ export declare function createRemoteSSRComponent<T, E extends keyof T>(info: {
10
+ loader: () => Promise<T>;
11
+ loading: React.ReactNode;
12
+ fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
13
+ injectScript?: boolean;
14
+ injectLink?: boolean;
15
+ export?: E;
16
+ }): (props: T[E] extends (...args: any) => any ? Parameters<T[E]>[0] extends undefined ? Record<string, never> : Parameters<T[E]>[0] : Record<string, never>) => React.JSX.Element;
17
+ export {};
@@ -1,3 +1,3 @@
1
1
  export * from '@module-federation/enhanced/runtime';
2
- export { MFReactComponent, collectAssets } from './MFReactComponent';
3
- export { LiveReload } from './LiveReload';
2
+ export { createRemoteSSRComponent, collectSSRAssets, } from './createRemoteSSRComponent';
3
+ export { SSRLiveReload } from './SSRLiveReload';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20240623084034",
3
+ "version": "0.0.0-next-20240624115757",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -47,9 +47,9 @@
47
47
  "@modern-js/node-bundle-require": "^2.49.2",
48
48
  "node-fetch": "~3.3.0",
49
49
  "react-error-boundary": "4.0.13",
50
- "@module-federation/sdk": "0.0.0-next-20240623084034",
51
- "@module-federation/enhanced": "0.0.0-next-20240623084034",
52
- "@module-federation/node": "0.0.0-next-20240623084034"
50
+ "@module-federation/sdk": "0.0.0-next-20240624115757",
51
+ "@module-federation/enhanced": "0.0.0-next-20240624115757",
52
+ "@module-federation/node": "0.0.0-next-20240624115757"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@modern-js/app-tools": "^2.49.2",
@@ -57,7 +57,7 @@
57
57
  "@modern-js/runtime": "^2.49.2",
58
58
  "@modern-js/module-tools": "^2.35.0",
59
59
  "@modern-js/tsconfig": "^2.35.0",
60
- "@module-federation/manifest": "0.0.0-next-20240623084034"
60
+ "@module-federation/manifest": "0.0.0-next-20240624115757"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "react": ">=17",
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function LiveReload(): import("react").JSX.Element | null;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { ErrorBoundaryPropsWithComponent } from 'react-error-boundary';
3
- type Id = string;
4
- type IProps = {
5
- id: Id;
6
- loading: React.ReactNode;
7
- fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
8
- injectScript?: boolean;
9
- injectLink?: boolean;
10
- remoteProps?: Record<string, any>;
11
- };
12
- declare function collectAssets(options: IProps): React.ReactNode[];
13
- declare function MFReactComponent(props: IProps): React.JSX.Element;
14
- export { MFReactComponent, collectAssets };