@module-federation/modern-js 0.0.0-next-20241117192957 → 0.0.0-next-20241118091452
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.
|
@@ -139,57 +139,54 @@ function collectSSRAssets(options) {
|
|
|
139
139
|
];
|
|
140
140
|
}
|
|
141
141
|
function createRemoteSSRComponent(info) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
+
});
|
|
154
|
+
const Com = m[exportName];
|
|
155
|
+
if (exportName in m && typeof Com === "function") {
|
|
156
|
+
return {
|
|
157
|
+
default: () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
158
|
+
children: [
|
|
159
|
+
assets,
|
|
160
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Com, {
|
|
161
|
+
...props
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
} else {
|
|
167
|
+
throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
|
|
168
|
+
}
|
|
169
|
+
} catch (err) {
|
|
170
|
+
if (!info.fallback) {
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
const FallbackFunctionComponent = info.fallback;
|
|
174
|
+
const FallbackNode = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackFunctionComponent, {
|
|
175
|
+
error: err,
|
|
176
|
+
resetErrorBoundary: () => {
|
|
177
|
+
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
178
|
+
}
|
|
179
|
+
});
|
|
155
180
|
return {
|
|
156
|
-
default: (
|
|
157
|
-
children: [
|
|
158
|
-
assets,
|
|
159
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Com, {
|
|
160
|
-
...props
|
|
161
|
-
})
|
|
162
|
-
]
|
|
163
|
-
})
|
|
181
|
+
default: () => FallbackNode
|
|
164
182
|
};
|
|
165
|
-
} else {
|
|
166
|
-
throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
|
|
167
183
|
}
|
|
168
|
-
}
|
|
169
|
-
if (!info.fallback) {
|
|
170
|
-
throw err;
|
|
171
|
-
}
|
|
172
|
-
const FallbackFunctionComponent = info.fallback;
|
|
173
|
-
const FallbackNode = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FallbackFunctionComponent, {
|
|
174
|
-
error: err,
|
|
175
|
-
resetErrorBoundary: () => {
|
|
176
|
-
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
return {
|
|
180
|
-
default: () => FallbackNode
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return (props) => {
|
|
185
|
-
const { key, ...args } = props;
|
|
184
|
+
});
|
|
186
185
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_error_boundary.ErrorBoundary, {
|
|
187
186
|
FallbackComponent: info.fallback,
|
|
188
187
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.default.Suspense, {
|
|
189
188
|
fallback: info.loading,
|
|
190
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LazyComponent, {
|
|
191
|
-
...args
|
|
192
|
-
})
|
|
189
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LazyComponent, {})
|
|
193
190
|
})
|
|
194
191
|
});
|
|
195
192
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
2
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
3
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
-
import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
|
|
5
4
|
import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
|
|
6
5
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
7
6
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -98,89 +97,86 @@ function collectSSRAssets(options) {
|
|
|
98
97
|
return _to_consumable_array(scripts).concat(_to_consumable_array(links));
|
|
99
98
|
}
|
|
100
99
|
function createRemoteSSRComponent(info) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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
|
+
});
|
|
126
|
+
Com = m[exportName];
|
|
127
|
+
if (exportName in m && typeof Com === "function") {
|
|
128
|
+
return [
|
|
129
|
+
2,
|
|
130
|
+
{
|
|
131
|
+
default: function() {
|
|
132
|
+
return /* @__PURE__ */ _jsxs(_Fragment, {
|
|
133
|
+
children: [
|
|
134
|
+
assets,
|
|
135
|
+
/* @__PURE__ */ _jsx(Com, _object_spread({}, props))
|
|
136
|
+
]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
} else {
|
|
142
|
+
throw Error("Make sure that ".concat(moduleId, " has the correct export when export is ").concat(String(exportName)));
|
|
143
|
+
}
|
|
144
|
+
return [
|
|
145
|
+
3,
|
|
146
|
+
3
|
|
147
|
+
];
|
|
148
|
+
case 2:
|
|
149
|
+
err = _state.sent();
|
|
150
|
+
if (!info.fallback) {
|
|
151
|
+
throw err;
|
|
152
|
+
}
|
|
153
|
+
FallbackFunctionComponent = info.fallback;
|
|
154
|
+
FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
|
|
155
|
+
error: err,
|
|
156
|
+
resetErrorBoundary: function() {
|
|
157
|
+
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
158
|
+
}
|
|
159
|
+
});
|
|
128
160
|
return [
|
|
129
161
|
2,
|
|
130
162
|
{
|
|
131
|
-
default: function(
|
|
132
|
-
return
|
|
133
|
-
children: [
|
|
134
|
-
assets,
|
|
135
|
-
/* @__PURE__ */ _jsx(Com, _object_spread({}, props))
|
|
136
|
-
]
|
|
137
|
-
});
|
|
163
|
+
default: function() {
|
|
164
|
+
return FallbackNode;
|
|
138
165
|
}
|
|
139
166
|
}
|
|
140
167
|
];
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
case 2:
|
|
149
|
-
err = _state.sent();
|
|
150
|
-
if (!info.fallback) {
|
|
151
|
-
throw err;
|
|
152
|
-
}
|
|
153
|
-
FallbackFunctionComponent = info.fallback;
|
|
154
|
-
FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
|
|
155
|
-
error: err,
|
|
156
|
-
resetErrorBoundary: function() {
|
|
157
|
-
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return [
|
|
161
|
-
2,
|
|
162
|
-
{
|
|
163
|
-
default: function() {
|
|
164
|
-
return FallbackNode;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
];
|
|
168
|
-
case 3:
|
|
169
|
-
return [
|
|
170
|
-
2
|
|
171
|
-
];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
}));
|
|
175
|
-
return function(props) {
|
|
176
|
-
var key = props.key, args = _object_without_properties(props, [
|
|
177
|
-
"key"
|
|
178
|
-
]);
|
|
168
|
+
case 3:
|
|
169
|
+
return [
|
|
170
|
+
2
|
|
171
|
+
];
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}));
|
|
179
175
|
return /* @__PURE__ */ _jsx(ErrorBoundary, {
|
|
180
176
|
FallbackComponent: info.fallback,
|
|
181
177
|
children: /* @__PURE__ */ _jsx(React.Suspense, {
|
|
182
178
|
fallback: info.loading,
|
|
183
|
-
children: /* @__PURE__ */ _jsx(LazyComponent,
|
|
179
|
+
children: /* @__PURE__ */ _jsx(LazyComponent, {})
|
|
184
180
|
})
|
|
185
181
|
});
|
|
186
182
|
};
|
|
@@ -105,57 +105,54 @@ function collectSSRAssets(options) {
|
|
|
105
105
|
];
|
|
106
106
|
}
|
|
107
107
|
function createRemoteSSRComponent(info) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|
+
});
|
|
120
|
+
const Com = m[exportName];
|
|
121
|
+
if (exportName in m && typeof Com === "function") {
|
|
122
|
+
return {
|
|
123
|
+
default: () => /* @__PURE__ */ _jsxs(_Fragment, {
|
|
124
|
+
children: [
|
|
125
|
+
assets,
|
|
126
|
+
/* @__PURE__ */ _jsx(Com, {
|
|
127
|
+
...props
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
};
|
|
132
|
+
} else {
|
|
133
|
+
throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
|
|
134
|
+
}
|
|
135
|
+
} catch (err) {
|
|
136
|
+
if (!info.fallback) {
|
|
137
|
+
throw err;
|
|
138
|
+
}
|
|
139
|
+
const FallbackFunctionComponent = info.fallback;
|
|
140
|
+
const FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
|
|
141
|
+
error: err,
|
|
142
|
+
resetErrorBoundary: () => {
|
|
143
|
+
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
144
|
+
}
|
|
145
|
+
});
|
|
121
146
|
return {
|
|
122
|
-
default: (
|
|
123
|
-
children: [
|
|
124
|
-
assets,
|
|
125
|
-
/* @__PURE__ */ _jsx(Com, {
|
|
126
|
-
...props
|
|
127
|
-
})
|
|
128
|
-
]
|
|
129
|
-
})
|
|
147
|
+
default: () => FallbackNode
|
|
130
148
|
};
|
|
131
|
-
} else {
|
|
132
|
-
throw Error(`Make sure that ${moduleId} has the correct export when export is ${String(exportName)}`);
|
|
133
149
|
}
|
|
134
|
-
}
|
|
135
|
-
if (!info.fallback) {
|
|
136
|
-
throw err;
|
|
137
|
-
}
|
|
138
|
-
const FallbackFunctionComponent = info.fallback;
|
|
139
|
-
const FallbackNode = /* @__PURE__ */ _jsx(FallbackFunctionComponent, {
|
|
140
|
-
error: err,
|
|
141
|
-
resetErrorBoundary: () => {
|
|
142
|
-
console.log('SSR mode not support "resetErrorBoundary" !');
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
default: () => FallbackNode
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
return (props) => {
|
|
151
|
-
const { key, ...args } = props;
|
|
150
|
+
});
|
|
152
151
|
return /* @__PURE__ */ _jsx(ErrorBoundary, {
|
|
153
152
|
FallbackComponent: info.fallback,
|
|
154
153
|
children: /* @__PURE__ */ _jsx(React.Suspense, {
|
|
155
154
|
fallback: info.loading,
|
|
156
|
-
children: /* @__PURE__ */ _jsx(LazyComponent, {
|
|
157
|
-
...args
|
|
158
|
-
})
|
|
155
|
+
children: /* @__PURE__ */ _jsx(LazyComponent, {})
|
|
159
156
|
})
|
|
160
157
|
});
|
|
161
158
|
};
|
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-20241118091452",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"hoist-non-react-statics": "3.3.2",
|
|
62
62
|
"node-fetch": "~3.3.0",
|
|
63
63
|
"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-
|
|
64
|
+
"@module-federation/enhanced": "0.0.0-next-20241118091452",
|
|
65
|
+
"@module-federation/node": "0.0.0-next-20241118091452",
|
|
66
|
+
"@module-federation/sdk": "0.0.0-next-20241118091452"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@modern-js/app-tools": "2.60.6",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@modern-js/runtime": "2.60.6",
|
|
73
73
|
"@modern-js/tsconfig": "2.60.6",
|
|
74
74
|
"@types/hoist-non-react-statics": "3.3.5",
|
|
75
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
75
|
+
"@module-federation/manifest": "0.0.0-next-20241118091452"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
78
|
"react": ">=17",
|