@module-federation/modern-js 0.0.0-next-20240626050252 → 0.0.0-next-20240708090519
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/README.md +1 -256
- package/dist/cjs/runtime/createRemoteSSRComponent.js +1 -3
- package/dist/cjs/runtime/index.js +0 -5
- package/dist/cjs/ssr-runtime/plugin.js +17 -0
- package/dist/esm/runtime/createRemoteSSRComponent.js +1 -3
- package/dist/esm/runtime/index.js +1 -4
- package/dist/esm/ssr-runtime/plugin.js +19 -0
- package/dist/esm-node/runtime/createRemoteSSRComponent.js +1 -3
- package/dist/esm-node/runtime/index.js +1 -4
- package/dist/esm-node/ssr-runtime/plugin.js +17 -0
- package/dist/types/cli/utils.d.ts +30 -30
- package/dist/types/runtime/createRemoteSSRComponent.d.ts +0 -2
- package/dist/types/runtime/index.d.ts +1 -2
- package/dist/types/{runtime → ssr-runtime}/SSRLiveReload.d.ts +0 -1
- package/package.json +7 -5
- /package/dist/cjs/{runtime → ssr-runtime}/SSRLiveReload.js +0 -0
- /package/dist/esm/{runtime → ssr-runtime}/SSRLiveReload.js +0 -0
- /package/dist/esm-node/{runtime → ssr-runtime}/SSRLiveReload.js +0 -0
package/README.md
CHANGED
|
@@ -2,259 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
This plugin provides Module Federation supporting functions for Modern.js
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- modern.js ^2.54.2
|
|
8
|
-
- Server-Side Rendering
|
|
9
|
-
|
|
10
|
-
We highly recommend referencing this application which takes advantage of the best capabilities:
|
|
11
|
-
[module-federation example](https://github.com/module-federation/core/tree/feat/modernjs-ssr/apps/modernjs-ssr)
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
### Installation
|
|
16
|
-
|
|
17
|
-
You can install the plugin with the following commands:
|
|
18
|
-
|
|
19
|
-
import { PackageManagerTabs } from '@theme';
|
|
20
|
-
|
|
21
|
-
<PackageManagerTabs
|
|
22
|
-
command={{
|
|
23
|
-
npm: 'npm add @module-federation/modern-js --save',
|
|
24
|
-
yarn: 'yarn add @module-federation/modern-js --save',
|
|
25
|
-
pnpm: 'pnpm add @module-federation/modern-js --save',
|
|
26
|
-
bun: 'bun add @module-federation/modern-js --save',
|
|
27
|
-
}}
|
|
28
|
-
/>
|
|
29
|
-
|
|
30
|
-
### Apply Plugin
|
|
31
|
-
|
|
32
|
-
Apply this plugin in `plugins` of `modern.config.ts`:
|
|
33
|
-
|
|
34
|
-
```ts title="modern.config.ts"
|
|
35
|
-
import { appTools, defineConfig } from '@modern-js/app-tools';
|
|
36
|
-
import { moduleFederationPlugin } from '@module-federation/modern-js';
|
|
37
|
-
|
|
38
|
-
export default defineConfig({
|
|
39
|
-
dev: {
|
|
40
|
-
port: 3005,
|
|
41
|
-
},
|
|
42
|
-
runtime: {
|
|
43
|
-
router: true,
|
|
44
|
-
},
|
|
45
|
-
// moduleFederationPlugin is a plug-in for modern.js, which can make certain modifications to the build/runtime
|
|
46
|
-
plugins: [appTools(), moduleFederationPlugin()],
|
|
47
|
-
});
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Then create the `module-federation.config.ts` file and write the required configuration:
|
|
51
|
-
|
|
52
|
-
```ts title="module-federation.config.ts"
|
|
53
|
-
import { createModuleFederationConfig } from '@module-federation/modern-js';
|
|
54
|
-
export default createModuleFederationConfig({
|
|
55
|
-
name: 'host',
|
|
56
|
-
remotes: {
|
|
57
|
-
remote: 'remote@http://localhost:3006/mf-manifest.json',
|
|
58
|
-
},
|
|
59
|
-
shared: {
|
|
60
|
-
react: { singleton: true },
|
|
61
|
-
'react-dom': { singleton: true },
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Type support
|
|
67
|
-
|
|
68
|
-
add `/// <reference types='@module-federation/modern-js/types' />` in `modern-app-env.d.ts` to get type support.
|
|
69
|
-
|
|
70
|
-
```diff title='modern-app-env.d.ts'
|
|
71
|
-
+ /// <reference types='@module-federation/modern-js/types' />
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Server-Side Rendering
|
|
75
|
-
|
|
76
|
-
:::info
|
|
77
|
-
For a better performance experience, Module Federation X Modern.js SSR only supports stream SSR.
|
|
78
|
-
:::
|
|
79
|
-
|
|
80
|
-
There is no difference between using Module Federation in SSR scenarios and CSR scenarios. Developers can just keep following the original development behavior.
|
|
81
|
-
|
|
82
|
-
But for a better user experience, we provide supporting functions/components to help developers better use Module Federation.
|
|
83
|
-
|
|
84
|
-
### createRemoteSSRComponent
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
declare function createRemoteSSRComponent(
|
|
88
|
-
props: CreateRemoteSSRComponentOptions
|
|
89
|
-
): (props: ComponentType) => React.JSX.Element;
|
|
90
|
-
|
|
91
|
-
type CreateRemoteSSRComponentOptions = {
|
|
92
|
-
loader: () => Promise<T>;
|
|
93
|
-
loading: React.ReactNode;
|
|
94
|
-
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
95
|
-
injectScript?: boolean;
|
|
96
|
-
injectLink?: boolean;
|
|
97
|
-
export?: E;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
type ComponentType = T[E] extends (...args: any) => any
|
|
101
|
-
? Parameters<T[E]>[0] extends undefined
|
|
102
|
-
? Record<string, never>
|
|
103
|
-
: Parameters<T[E]>[0]
|
|
104
|
-
: Record<string, never>;
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
This function will also help inject the corresponding style tag/script while loading the component. This behavior can help avoid the CSS flickering problem caused by streaming rendering and accelerate the PID (first screen interactive time).
|
|
108
|
-
|
|
109
|
-
#### Example
|
|
110
|
-
|
|
111
|
-
```tsx
|
|
112
|
-
import React, { FC, memo, useEffect } from 'react';
|
|
113
|
-
import { registerRemotes, createRemoteSSRComponent } from '@modern-js/runtime/mf';
|
|
114
|
-
// The remote declared in the build plug-in can be imported directly at the top level
|
|
115
|
-
import RemoteComp from 'remote/Image';
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const RemoteSSRComponent = createRemoteSSRComponent({
|
|
119
|
-
// The remote declared in the build plug-in can also be loaded using this function: loader: () => import('remote/Image'),
|
|
120
|
-
loader: () => loadRemote('dynamic_remote/Image'),
|
|
121
|
-
loading: <div>loading...</div>,
|
|
122
|
-
fallback: ({ error }) => {
|
|
123
|
-
if (error instanceof Error && error.message.includes('not exist')) {
|
|
124
|
-
return <div>fallback - not existed id</div>;
|
|
125
|
-
}
|
|
126
|
-
return <div>fallback</div>;
|
|
127
|
-
},
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const Product: FC = () => {
|
|
131
|
-
registerRemotes([
|
|
132
|
-
{
|
|
133
|
-
name: 'dynamic_remote',
|
|
134
|
-
entry: 'http://localhost:3008/mf-manifest.json',
|
|
135
|
-
},
|
|
136
|
-
]);
|
|
137
|
-
|
|
138
|
-
const fallback = (err: Error) => {
|
|
139
|
-
if (err.message.includes('does not exist in container')) {
|
|
140
|
-
return <div>404</div>;
|
|
141
|
-
}
|
|
142
|
-
throw err;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
return <>
|
|
146
|
-
<RemoteSSRComponent />
|
|
147
|
-
<RemoteComp />
|
|
148
|
-
</>;
|
|
149
|
-
};
|
|
150
|
-
export default Product;
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
#### loading
|
|
154
|
-
|
|
155
|
-
- Type:`React.ReactNode`
|
|
156
|
-
- Required: Yes
|
|
157
|
-
- Default value: `undefined`
|
|
158
|
-
|
|
159
|
-
Set module loading status.
|
|
160
|
-
|
|
161
|
-
#### fallback
|
|
162
|
-
|
|
163
|
-
- Type:`((err: Error) => React.ReactElement)`
|
|
164
|
-
- Required: Yes
|
|
165
|
-
- Default value: `undefined`
|
|
166
|
-
|
|
167
|
-
A fault-tolerant component that is rendered when the component fails to **load** or **render**.
|
|
168
|
-
|
|
169
|
-
Note: This component only renders this fault-tolerant component on the client side when **rendering** fails.
|
|
170
|
-
|
|
171
|
-
#### injectLink
|
|
172
|
-
|
|
173
|
-
- Type:`boolean`
|
|
174
|
-
- Required: No
|
|
175
|
-
- Default value: `true`
|
|
176
|
-
|
|
177
|
-
Whether to inject the style of the corresponding component.
|
|
178
|
-
|
|
179
|
-
#### injectScript
|
|
180
|
-
|
|
181
|
-
- Type:`boolean`
|
|
182
|
-
- Required: No
|
|
183
|
-
- Default value: `true`
|
|
184
|
-
|
|
185
|
-
Whether to inject the script of the corresponding component.
|
|
186
|
-
|
|
187
|
-
### collectSSRAssets
|
|
188
|
-
|
|
189
|
-
```ts
|
|
190
|
-
declare function createRemoteSSRComponent(
|
|
191
|
-
props: CollectSSRAssetsOptions
|
|
192
|
-
): React.ReactNode[];
|
|
193
|
-
|
|
194
|
-
type CollectSSRAssetsOptions = {
|
|
195
|
-
id: string;
|
|
196
|
-
injectScript?: boolean;
|
|
197
|
-
injectLink?: boolean;
|
|
198
|
-
};
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
This function collects producer-related scripts and styles rendered on the server side and returns the script/link tag.
|
|
202
|
-
|
|
203
|
-
#### Example
|
|
204
|
-
|
|
205
|
-
```tsx
|
|
206
|
-
import React from 'react';
|
|
207
|
-
import { collectSSRAssets } from '@modern-js/runtime/mf';
|
|
208
|
-
import Comp from 'remote/Image';
|
|
209
|
-
|
|
210
|
-
export default (): JSX.Element => (
|
|
211
|
-
<div>
|
|
212
|
-
{collectSSRAssets({ id: 'remote/Image' })}
|
|
213
|
-
<Comp />
|
|
214
|
-
</div>
|
|
215
|
-
);
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
#### injectLink
|
|
219
|
-
|
|
220
|
-
- Type:`boolean`
|
|
221
|
-
- Required: No
|
|
222
|
-
- Default value: `true`
|
|
223
|
-
|
|
224
|
-
Whether to inject the style of the corresponding component.
|
|
225
|
-
|
|
226
|
-
#### injectScript
|
|
227
|
-
|
|
228
|
-
- Type:`boolean`
|
|
229
|
-
- Required: No
|
|
230
|
-
- Default value: `true`
|
|
231
|
-
|
|
232
|
-
Whether to inject the script of the corresponding component.
|
|
233
|
-
|
|
234
|
-
### SSRLiveReload
|
|
235
|
-
|
|
236
|
-
:::info
|
|
237
|
-
This component will not take effect in the production environment!
|
|
238
|
-
:::
|
|
239
|
-
|
|
240
|
-
```ts
|
|
241
|
-
declare function SSRLiveReload(): React.JSX.Element | null;
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
When remote components are updated, page reloads occur automatically.
|
|
245
|
-
|
|
246
|
-
#### Example
|
|
247
|
-
|
|
248
|
-
```tsx
|
|
249
|
-
import { Outlet } from '@modern-js/runtime/router';
|
|
250
|
-
import { SSRLiveReload } from '@modern-js/runtime/mf';
|
|
251
|
-
|
|
252
|
-
export default function Layout() {
|
|
253
|
-
return (
|
|
254
|
-
<div>
|
|
255
|
-
<SSRLiveReload />
|
|
256
|
-
<Outlet />
|
|
257
|
-
</div>
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
```
|
|
5
|
+
See [documentation](https://module-federation.io/guide/framework/modernjs.html) for more details .
|
|
@@ -149,9 +149,7 @@ function createRemoteSSRComponent(info) {
|
|
|
149
149
|
}
|
|
150
150
|
const moduleId = m && m[Symbol.for("mf_module_id")];
|
|
151
151
|
const assets = collectSSRAssets({
|
|
152
|
-
id: moduleId
|
|
153
|
-
injectLink: info.injectLink,
|
|
154
|
-
injectScript: info.injectScript
|
|
152
|
+
id: moduleId
|
|
155
153
|
});
|
|
156
154
|
const Com = m[exportName];
|
|
157
155
|
if (exportName in m && typeof Com === "function") {
|
|
@@ -19,18 +19,13 @@ 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
|
-
SSRLiveReload: () => import_SSRLiveReload.SSRLiveReload,
|
|
23
|
-
collectSSRAssets: () => import_createRemoteSSRComponent.collectSSRAssets,
|
|
24
22
|
createRemoteSSRComponent: () => import_createRemoteSSRComponent.createRemoteSSRComponent
|
|
25
23
|
});
|
|
26
24
|
module.exports = __toCommonJS(runtime_exports);
|
|
27
25
|
__reExport(runtime_exports, require("@module-federation/enhanced/runtime"), module.exports);
|
|
28
26
|
var import_createRemoteSSRComponent = require("./createRemoteSSRComponent");
|
|
29
|
-
var import_SSRLiveReload = require("./SSRLiveReload");
|
|
30
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
31
28
|
0 && (module.exports = {
|
|
32
|
-
SSRLiveReload,
|
|
33
|
-
collectSSRAssets,
|
|
34
29
|
createRemoteSSRComponent,
|
|
35
30
|
...require("@module-federation/enhanced/runtime")
|
|
36
31
|
});
|
|
@@ -31,6 +31,9 @@ __export(plugin_exports, {
|
|
|
31
31
|
mfPluginSSR: () => mfPluginSSR
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(plugin_exports);
|
|
34
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_hoist_non_react_statics = __toESM(require("hoist-non-react-statics"));
|
|
36
|
+
var import_SSRLiveReload = require("./SSRLiveReload");
|
|
34
37
|
const mfPluginSSR = () => ({
|
|
35
38
|
name: "@module-federation/modern-js",
|
|
36
39
|
setup: () => {
|
|
@@ -52,6 +55,20 @@ const mfPluginSSR = () => ({
|
|
|
52
55
|
return next({
|
|
53
56
|
context
|
|
54
57
|
});
|
|
58
|
+
},
|
|
59
|
+
hoc({ App, config }, next) {
|
|
60
|
+
const AppWrapper = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_SSRLiveReload.SSRLiveReload, {}),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(App, {
|
|
64
|
+
...props
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
return next({
|
|
69
|
+
App: (0, import_hoist_non_react_statics.default)(AppWrapper, App),
|
|
70
|
+
config
|
|
71
|
+
});
|
|
55
72
|
}
|
|
56
73
|
};
|
|
57
74
|
}
|
|
@@ -121,9 +121,7 @@ function createRemoteSSRComponent(info) {
|
|
|
121
121
|
}
|
|
122
122
|
moduleId = m && m[Symbol.for("mf_module_id")];
|
|
123
123
|
assets = collectSSRAssets({
|
|
124
|
-
id: moduleId
|
|
125
|
-
injectLink: info.injectLink,
|
|
126
|
-
injectScript: info.injectScript
|
|
124
|
+
id: moduleId
|
|
127
125
|
});
|
|
128
126
|
Com = m[exportName];
|
|
129
127
|
if (exportName in m && typeof Com === "function") {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export * from "@module-federation/enhanced/runtime";
|
|
2
|
-
import { createRemoteSSRComponent
|
|
3
|
-
import { SSRLiveReload } from "./SSRLiveReload";
|
|
2
|
+
import { createRemoteSSRComponent } from "./createRemoteSSRComponent";
|
|
4
3
|
export {
|
|
5
|
-
SSRLiveReload,
|
|
6
|
-
collectSSRAssets,
|
|
7
4
|
createRemoteSSRComponent
|
|
8
5
|
};
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
3
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
6
|
+
import { SSRLiveReload } from "./SSRLiveReload";
|
|
3
7
|
var mfPluginSSR = function() {
|
|
4
8
|
return {
|
|
5
9
|
name: "@module-federation/modern-js",
|
|
@@ -57,6 +61,21 @@ var mfPluginSSR = function() {
|
|
|
57
61
|
}
|
|
58
62
|
});
|
|
59
63
|
})();
|
|
64
|
+
},
|
|
65
|
+
hoc: function hoc(param, next) {
|
|
66
|
+
var App = param.App, config = param.config;
|
|
67
|
+
var AppWrapper = function(props) {
|
|
68
|
+
return /* @__PURE__ */ _jsxs(_Fragment, {
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ _jsx(SSRLiveReload, {}),
|
|
71
|
+
/* @__PURE__ */ _jsx(App, _object_spread({}, props))
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
return next({
|
|
76
|
+
App: hoistNonReactStatics(AppWrapper, App),
|
|
77
|
+
config
|
|
78
|
+
});
|
|
60
79
|
}
|
|
61
80
|
};
|
|
62
81
|
}
|
|
@@ -115,9 +115,7 @@ function createRemoteSSRComponent(info) {
|
|
|
115
115
|
}
|
|
116
116
|
const moduleId = m && m[Symbol.for("mf_module_id")];
|
|
117
117
|
const assets = collectSSRAssets({
|
|
118
|
-
id: moduleId
|
|
119
|
-
injectLink: info.injectLink,
|
|
120
|
-
injectScript: info.injectScript
|
|
118
|
+
id: moduleId
|
|
121
119
|
});
|
|
122
120
|
const Com = m[exportName];
|
|
123
121
|
if (exportName in m && typeof Com === "function") {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export * from "@module-federation/enhanced/runtime";
|
|
2
|
-
import { createRemoteSSRComponent
|
|
3
|
-
import { SSRLiveReload } from "./SSRLiveReload";
|
|
2
|
+
import { createRemoteSSRComponent } from "./createRemoteSSRComponent";
|
|
4
3
|
export {
|
|
5
|
-
SSRLiveReload,
|
|
6
|
-
collectSSRAssets,
|
|
7
4
|
createRemoteSSRComponent
|
|
8
5
|
};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
3
|
+
import { SSRLiveReload } from "./SSRLiveReload";
|
|
1
4
|
const mfPluginSSR = () => ({
|
|
2
5
|
name: "@module-federation/modern-js",
|
|
3
6
|
setup: () => {
|
|
@@ -19,6 +22,20 @@ const mfPluginSSR = () => ({
|
|
|
19
22
|
return next({
|
|
20
23
|
context
|
|
21
24
|
});
|
|
25
|
+
},
|
|
26
|
+
hoc({ App, config }, next) {
|
|
27
|
+
const AppWrapper = (props) => /* @__PURE__ */ _jsxs(_Fragment, {
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ _jsx(SSRLiveReload, {}),
|
|
30
|
+
/* @__PURE__ */ _jsx(App, {
|
|
31
|
+
...props
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
});
|
|
35
|
+
return next({
|
|
36
|
+
App: hoistNonReactStatics(AppWrapper, App),
|
|
37
|
+
config
|
|
38
|
+
});
|
|
22
39
|
}
|
|
23
40
|
};
|
|
24
41
|
}
|
|
@@ -5,39 +5,39 @@ export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T exte
|
|
|
5
5
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
6
6
|
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean) => {
|
|
7
7
|
runtimePlugins: string[];
|
|
8
|
-
exposes?: moduleFederationPlugin.Exposes
|
|
9
|
-
filename?: string
|
|
10
|
-
library?: moduleFederationPlugin.LibraryOptions
|
|
11
|
-
name?: string
|
|
12
|
-
remoteType?: moduleFederationPlugin.ExternalsType
|
|
13
|
-
remotes?: moduleFederationPlugin.Remotes
|
|
14
|
-
runtime?: moduleFederationPlugin.EntryRuntime
|
|
15
|
-
shareScope?: string
|
|
16
|
-
shared?: moduleFederationPlugin.Shared
|
|
17
|
-
getPublicPath?: string
|
|
18
|
-
implementation?: string
|
|
19
|
-
manifest?: boolean | moduleFederationPlugin.PluginManifestOptions
|
|
20
|
-
dev?: boolean | moduleFederationPlugin.PluginDevOptions
|
|
21
|
-
dts?: boolean | moduleFederationPlugin.PluginDtsOptions
|
|
22
|
-
async?: boolean | moduleFederationPlugin.AsyncBoundaryOptions
|
|
8
|
+
exposes?: moduleFederationPlugin.Exposes;
|
|
9
|
+
filename?: string;
|
|
10
|
+
library?: moduleFederationPlugin.LibraryOptions;
|
|
11
|
+
name?: string;
|
|
12
|
+
remoteType?: moduleFederationPlugin.ExternalsType;
|
|
13
|
+
remotes?: moduleFederationPlugin.Remotes;
|
|
14
|
+
runtime?: moduleFederationPlugin.EntryRuntime;
|
|
15
|
+
shareScope?: string;
|
|
16
|
+
shared?: moduleFederationPlugin.Shared;
|
|
17
|
+
getPublicPath?: string;
|
|
18
|
+
implementation?: string;
|
|
19
|
+
manifest?: boolean | moduleFederationPlugin.PluginManifestOptions;
|
|
20
|
+
dev?: boolean | moduleFederationPlugin.PluginDevOptions;
|
|
21
|
+
dts?: boolean | moduleFederationPlugin.PluginDtsOptions;
|
|
22
|
+
async?: boolean | moduleFederationPlugin.AsyncBoundaryOptions;
|
|
23
23
|
};
|
|
24
24
|
export declare function getTargetEnvConfig(mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean): {
|
|
25
25
|
runtimePlugins: string[];
|
|
26
|
-
exposes?: moduleFederationPlugin.Exposes
|
|
27
|
-
filename?: string
|
|
28
|
-
library?: moduleFederationPlugin.LibraryOptions
|
|
29
|
-
name?: string
|
|
30
|
-
remoteType?: moduleFederationPlugin.ExternalsType
|
|
31
|
-
remotes?: moduleFederationPlugin.Remotes
|
|
32
|
-
runtime?: moduleFederationPlugin.EntryRuntime
|
|
33
|
-
shareScope?: string
|
|
34
|
-
shared?: moduleFederationPlugin.Shared
|
|
35
|
-
getPublicPath?: string
|
|
36
|
-
implementation?: string
|
|
37
|
-
manifest?: boolean | moduleFederationPlugin.PluginManifestOptions
|
|
38
|
-
dev?: boolean | moduleFederationPlugin.PluginDevOptions
|
|
39
|
-
dts?: boolean | moduleFederationPlugin.PluginDtsOptions
|
|
40
|
-
async?: boolean | moduleFederationPlugin.AsyncBoundaryOptions
|
|
26
|
+
exposes?: moduleFederationPlugin.Exposes;
|
|
27
|
+
filename?: string;
|
|
28
|
+
library?: moduleFederationPlugin.LibraryOptions;
|
|
29
|
+
name?: string;
|
|
30
|
+
remoteType?: moduleFederationPlugin.ExternalsType;
|
|
31
|
+
remotes?: moduleFederationPlugin.Remotes;
|
|
32
|
+
runtime?: moduleFederationPlugin.EntryRuntime;
|
|
33
|
+
shareScope?: string;
|
|
34
|
+
shared?: moduleFederationPlugin.Shared;
|
|
35
|
+
getPublicPath?: string;
|
|
36
|
+
implementation?: string;
|
|
37
|
+
manifest?: boolean | moduleFederationPlugin.PluginManifestOptions;
|
|
38
|
+
dev?: boolean | moduleFederationPlugin.PluginDevOptions;
|
|
39
|
+
dts?: boolean | moduleFederationPlugin.PluginDtsOptions;
|
|
40
|
+
async?: boolean | moduleFederationPlugin.AsyncBoundaryOptions;
|
|
41
41
|
};
|
|
42
42
|
export declare function patchWebpackConfig<T>(options: {
|
|
43
43
|
bundlerConfig: ConfigType<T>;
|
|
@@ -10,8 +10,6 @@ export declare function createRemoteSSRComponent<T, E extends keyof T>(info: {
|
|
|
10
10
|
loader: () => Promise<T>;
|
|
11
11
|
loading: React.ReactNode;
|
|
12
12
|
fallback: ErrorBoundaryPropsWithComponent['FallbackComponent'];
|
|
13
|
-
injectScript?: boolean;
|
|
14
|
-
injectLink?: boolean;
|
|
15
13
|
export?: E;
|
|
16
14
|
}): (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
15
|
export {};
|
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-20240708090519",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -47,17 +47,19 @@
|
|
|
47
47
|
"@modern-js/node-bundle-require": "^2.54.2",
|
|
48
48
|
"node-fetch": "~3.3.0",
|
|
49
49
|
"react-error-boundary": "4.0.13",
|
|
50
|
-
"
|
|
51
|
-
"@module-federation/
|
|
52
|
-
"@module-federation/
|
|
50
|
+
"hoist-non-react-statics": "3.3.2",
|
|
51
|
+
"@module-federation/sdk": "0.0.0-next-20240708090519",
|
|
52
|
+
"@module-federation/enhanced": "0.0.0-next-20240708090519",
|
|
53
|
+
"@module-federation/node": "0.0.0-next-20240708090519"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
56
|
+
"@types/hoist-non-react-statics": "3.3.2",
|
|
55
57
|
"@modern-js/app-tools": "^2.54.2",
|
|
56
58
|
"@modern-js/core": "^2.54.2",
|
|
57
59
|
"@modern-js/runtime": "^2.54.2",
|
|
58
60
|
"@modern-js/module-tools": "^2.54.2",
|
|
59
61
|
"@modern-js/tsconfig": "^2.54.2",
|
|
60
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
62
|
+
"@module-federation/manifest": "0.0.0-next-20240708090519"
|
|
61
63
|
},
|
|
62
64
|
"peerDependencies": {
|
|
63
65
|
"react": ">=17",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|