@module-federation/modern-js 0.0.0-next-20240815094326 → 0.0.0-next-20240816090839
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/constant.js +0 -6
- package/dist/cjs/cli/index.js +1 -6
- package/dist/cjs/cli/ssrPlugin.js +4 -4
- package/dist/cjs/cli/utils.js +2 -4
- package/dist/cjs/runtime/index.js +1 -4
- package/dist/cjs/ssr-runtime/plugin.js +7 -5
- package/dist/esm/cli/constant.js +0 -4
- package/dist/esm/cli/index.js +1 -6
- package/dist/esm/cli/ssrPlugin.js +2 -2
- package/dist/esm/cli/utils.js +1 -2
- package/dist/esm/runtime/index.js +1 -3
- package/dist/esm/ssr-runtime/plugin.js +10 -5
- package/dist/esm-node/cli/constant.js +0 -4
- package/dist/esm-node/cli/index.js +1 -6
- package/dist/esm-node/cli/ssrPlugin.js +2 -2
- package/dist/esm-node/cli/utils.js +1 -2
- package/dist/esm-node/runtime/index.js +1 -3
- package/dist/esm-node/ssr-runtime/plugin.js +7 -5
- package/dist/types/cli/constant.d.ts +0 -2
- package/dist/types/cli/utils.d.ts +0 -1
- package/dist/types/runtime/index.d.ts +0 -1
- package/dist/types/types/index.d.ts +0 -18
- package/package.json +11 -37
- package/dist/cjs/cli/ast/constant.js +0 -49
- package/dist/cjs/cli/ast/generateRoutes.js +0 -140
- package/dist/cjs/cli/ast/generateSerializableRoutes.js +0 -91
- package/dist/cjs/cli/ast/generateSlimRoutes.js +0 -106
- package/dist/cjs/cli/ast/index.js +0 -34
- package/dist/cjs/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -65
- package/dist/cjs/cli/dataLoaderPlugin.js +0 -281
- package/dist/cjs/cli/server/dataLoaderPlugin.js +0 -83
- package/dist/cjs/interfaces/route.js +0 -16
- package/dist/cjs/runtime/constant.js +0 -34
- package/dist/cjs/runtime/dataLoader.js +0 -87
- package/dist/cjs/runtime/utils.js +0 -43
- package/dist/cjs/runtime/withMFRouteId.js +0 -31
- package/dist/esm/cli/ast/constant.js +0 -18
- package/dist/esm/cli/ast/generateRoutes.js +0 -107
- package/dist/esm/cli/ast/generateSerializableRoutes.js +0 -58
- package/dist/esm/cli/ast/generateSlimRoutes.js +0 -75
- package/dist/esm/cli/ast/index.js +0 -8
- package/dist/esm/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -45
- package/dist/esm/cli/dataLoaderPlugin.js +0 -326
- package/dist/esm/cli/server/dataLoaderPlugin.js +0 -146
- package/dist/esm/interfaces/route.js +0 -0
- package/dist/esm/runtime/constant.js +0 -8
- package/dist/esm/runtime/dataLoader.js +0 -125
- package/dist/esm/runtime/utils.js +0 -16
- package/dist/esm/runtime/withMFRouteId.js +0 -7
- package/dist/esm-node/cli/ast/constant.js +0 -18
- package/dist/esm-node/cli/ast/generateRoutes.js +0 -106
- package/dist/esm-node/cli/ast/generateSerializableRoutes.js +0 -57
- package/dist/esm-node/cli/ast/generateSlimRoutes.js +0 -72
- package/dist/esm-node/cli/ast/index.js +0 -8
- package/dist/esm-node/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -30
- package/dist/esm-node/cli/dataLoaderPlugin.js +0 -245
- package/dist/esm-node/cli/server/dataLoaderPlugin.js +0 -63
- package/dist/esm-node/interfaces/route.js +0 -0
- package/dist/esm-node/runtime/constant.js +0 -8
- package/dist/esm-node/runtime/dataLoader.js +0 -63
- package/dist/esm-node/runtime/utils.js +0 -19
- package/dist/esm-node/runtime/withMFRouteId.js +0 -7
- package/dist/types/cli/ast/constant.d.ts +0 -8
- package/dist/types/cli/ast/generateRoutes.d.ts +0 -7
- package/dist/types/cli/ast/generateSerializableRoutes.d.ts +0 -5
- package/dist/types/cli/ast/generateSlimRoutes.d.ts +0 -7
- package/dist/types/cli/ast/index.d.ts +0 -3
- package/dist/types/cli/bundler-plugins/SerializableRoutesPlugin.d.ts +0 -12
- package/dist/types/cli/dataLoaderPlugin.d.ts +0 -6
- package/dist/types/cli/server/dataLoaderPlugin.d.ts +0 -5
- package/dist/types/interfaces/route.d.ts +0 -13
- package/dist/types/runtime/constant.d.ts +0 -3
- package/dist/types/runtime/dataLoader.d.ts +0 -7
- package/dist/types/runtime/utils.d.ts +0 -1
- package/dist/types/runtime/withMFRouteId.d.ts +0 -1
package/dist/cjs/cli/constant.js
CHANGED
|
@@ -18,17 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var constant_exports = {};
|
|
20
20
|
__export(constant_exports, {
|
|
21
|
-
META_NAME: () => META_NAME,
|
|
22
|
-
MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME: () => MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME,
|
|
23
21
|
isDev: () => isDev
|
|
24
22
|
});
|
|
25
23
|
module.exports = __toCommonJS(constant_exports);
|
|
26
24
|
const isDev = process.env.NODE_ENV === "development";
|
|
27
|
-
const MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
|
|
28
|
-
const META_NAME = "modern-js";
|
|
29
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
26
|
0 && (module.exports = {
|
|
31
|
-
META_NAME,
|
|
32
|
-
MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME,
|
|
33
27
|
isDev
|
|
34
28
|
});
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -27,7 +27,6 @@ var import_enhanced = require("@module-federation/enhanced");
|
|
|
27
27
|
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
28
28
|
var import_configPlugin = require("./configPlugin");
|
|
29
29
|
var import_ssrPlugin = require("./ssrPlugin");
|
|
30
|
-
var import_dataLoaderPlugin = require("./dataLoaderPlugin");
|
|
31
30
|
var import_enhanced2 = require("@module-federation/enhanced");
|
|
32
31
|
const moduleFederationPlugin = (userConfig = {}) => {
|
|
33
32
|
const internalModernPluginOptions = {
|
|
@@ -80,11 +79,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
|
|
|
80
79
|
},
|
|
81
80
|
usePlugins: [
|
|
82
81
|
(0, import_configPlugin.moduleFederationConfigPlugin)(internalModernPluginOptions),
|
|
83
|
-
(0, import_ssrPlugin.moduleFederationSSRPlugin)(internalModernPluginOptions)
|
|
84
|
-
(0, import_dataLoaderPlugin.moduleFederationDataLoaderPlugin)(Boolean(userConfig.dataLoader), internalModernPluginOptions, {
|
|
85
|
-
baseName: "",
|
|
86
|
-
...userConfig.dataLoader
|
|
87
|
-
})
|
|
82
|
+
(0, import_ssrPlugin.moduleFederationSSRPlugin)(internalModernPluginOptions)
|
|
88
83
|
]
|
|
89
84
|
};
|
|
90
85
|
};
|
|
@@ -35,9 +35,9 @@ __export(ssrPlugin_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(ssrPlugin_exports);
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
37
|
var import_utils = require("@modern-js/utils");
|
|
38
|
-
var
|
|
38
|
+
var import_webpack = require("@module-federation/enhanced/webpack");
|
|
39
39
|
var import_rspack = require("@module-federation/enhanced/rspack");
|
|
40
|
-
var
|
|
40
|
+
var import_universe_entry_chunk_tracker_plugin = __toESM(require("@module-federation/node/universe-entry-chunk-tracker-plugin"));
|
|
41
41
|
var import_manifest = require("./manifest");
|
|
42
42
|
var import_constant = require("./constant");
|
|
43
43
|
function setEnv() {
|
|
@@ -101,7 +101,7 @@ const moduleFederationSSRPlugin = (userConfig) => ({
|
|
|
101
101
|
if (isServer) {
|
|
102
102
|
if (!userConfig.nodePlugin) {
|
|
103
103
|
var _config_plugins;
|
|
104
|
-
userConfig.nodePlugin = new
|
|
104
|
+
userConfig.nodePlugin = new import_webpack.ModuleFederationPlugin(userConfig.ssrConfig);
|
|
105
105
|
(_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
|
|
106
106
|
}
|
|
107
107
|
} else {
|
|
@@ -141,7 +141,7 @@ const moduleFederationSSRPlugin = (userConfig) => ({
|
|
|
141
141
|
if (isServer) {
|
|
142
142
|
chain.target("async-node");
|
|
143
143
|
if (import_constant.isDev) {
|
|
144
|
-
chain.plugin("UniverseEntryChunkTrackerPlugin").use(
|
|
144
|
+
chain.plugin("UniverseEntryChunkTrackerPlugin").use(import_universe_entry_chunk_tracker_plugin.default);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
if (import_constant.isDev && !isServer) {
|
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -32,8 +32,7 @@ __export(utils_exports, {
|
|
|
32
32
|
getMFConfig: () => getMFConfig,
|
|
33
33
|
patchBundlerConfig: () => patchBundlerConfig,
|
|
34
34
|
patchIgnoreWarning: () => patchIgnoreWarning,
|
|
35
|
-
patchMFConfig: () => patchMFConfig
|
|
36
|
-
replaceRemoteUrl: () => replaceRemoteUrl
|
|
35
|
+
patchMFConfig: () => patchMFConfig
|
|
37
36
|
});
|
|
38
37
|
module.exports = __toCommonJS(utils_exports);
|
|
39
38
|
var import_sdk = require("@module-federation/sdk");
|
|
@@ -330,6 +329,5 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
|
|
|
330
329
|
getMFConfig,
|
|
331
330
|
patchBundlerConfig,
|
|
332
331
|
patchIgnoreWarning,
|
|
333
|
-
patchMFConfig
|
|
334
|
-
replaceRemoteUrl
|
|
332
|
+
patchMFConfig
|
|
335
333
|
});
|
|
@@ -19,16 +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
|
-
createRemoteSSRComponent: () => import_createRemoteSSRComponent.createRemoteSSRComponent
|
|
23
|
-
withMFRouteId: () => import_withMFRouteId.withMFRouteId
|
|
22
|
+
createRemoteSSRComponent: () => import_createRemoteSSRComponent.createRemoteSSRComponent
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(runtime_exports);
|
|
26
25
|
__reExport(runtime_exports, require("@module-federation/enhanced/runtime"), module.exports);
|
|
27
26
|
var import_createRemoteSSRComponent = require("./createRemoteSSRComponent");
|
|
28
|
-
var import_withMFRouteId = require("./withMFRouteId");
|
|
29
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
30
28
|
0 && (module.exports = {
|
|
31
29
|
createRemoteSSRComponent,
|
|
32
|
-
withMFRouteId,
|
|
33
30
|
...require("@module-federation/enhanced/runtime")
|
|
34
31
|
});
|
|
@@ -34,15 +34,15 @@ module.exports = __toCommonJS(plugin_exports);
|
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_hoist_non_react_statics = __toESM(require("hoist-non-react-statics"));
|
|
36
36
|
var import_SSRLiveReload = require("./SSRLiveReload");
|
|
37
|
-
console.log("mfSSRPlugin trigger");
|
|
38
37
|
const mfSSRPlugin = () => ({
|
|
39
38
|
name: "@module-federation/modern-js",
|
|
40
39
|
setup: () => {
|
|
41
40
|
return {
|
|
42
|
-
async
|
|
43
|
-
console.log(111, "beforeRender");
|
|
41
|
+
async init({ context }, next) {
|
|
44
42
|
if (typeof window !== "undefined") {
|
|
45
|
-
return
|
|
43
|
+
return next({
|
|
44
|
+
context
|
|
45
|
+
});
|
|
46
46
|
}
|
|
47
47
|
globalThis.shouldUpdate = false;
|
|
48
48
|
const nodeUtils = await Promise.resolve().then(() => __toESM(require("@module-federation/node/utils")));
|
|
@@ -52,7 +52,9 @@ const mfSSRPlugin = () => ({
|
|
|
52
52
|
await nodeUtils.flushChunks();
|
|
53
53
|
globalThis.shouldUpdate = true;
|
|
54
54
|
}
|
|
55
|
-
return
|
|
55
|
+
return next({
|
|
56
|
+
context
|
|
57
|
+
});
|
|
56
58
|
},
|
|
57
59
|
wrapRoot(App) {
|
|
58
60
|
const AppWrapper = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
package/dist/esm/cli/constant.js
CHANGED
package/dist/esm/cli/index.js
CHANGED
|
@@ -1,11 +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";
|
|
3
2
|
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
4
3
|
import { ModuleFederationPlugin as WebpackModuleFederationPlugin, AsyncBoundaryPlugin } from "@module-federation/enhanced";
|
|
5
4
|
import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
6
5
|
import { moduleFederationConfigPlugin } from "./configPlugin";
|
|
7
6
|
import { moduleFederationSSRPlugin } from "./ssrPlugin";
|
|
8
|
-
import { moduleFederationDataLoaderPlugin } from "./dataLoaderPlugin";
|
|
9
7
|
var moduleFederationPlugin = function() {
|
|
10
8
|
var userConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
11
9
|
var internalModernPluginOptions = {
|
|
@@ -81,10 +79,7 @@ var moduleFederationPlugin = function() {
|
|
|
81
79
|
}(),
|
|
82
80
|
usePlugins: [
|
|
83
81
|
moduleFederationConfigPlugin(internalModernPluginOptions),
|
|
84
|
-
moduleFederationSSRPlugin(internalModernPluginOptions)
|
|
85
|
-
moduleFederationDataLoaderPlugin(Boolean(userConfig.dataLoader), internalModernPluginOptions, _object_spread({
|
|
86
|
-
baseName: ""
|
|
87
|
-
}, userConfig.dataLoader))
|
|
82
|
+
moduleFederationSSRPlugin(internalModernPluginOptions)
|
|
88
83
|
]
|
|
89
84
|
};
|
|
90
85
|
};
|
|
@@ -2,9 +2,9 @@ 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 path from "path";
|
|
4
4
|
import { fs } from "@modern-js/utils";
|
|
5
|
-
import { ModuleFederationPlugin } from "@module-federation/enhanced";
|
|
5
|
+
import { ModuleFederationPlugin } from "@module-federation/enhanced/webpack";
|
|
6
6
|
import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
7
|
-
import
|
|
7
|
+
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
8
8
|
import { updateStatsAndManifest } from "./manifest";
|
|
9
9
|
import { isDev } from "./constant";
|
|
10
10
|
function setEnv() {
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -4,22 +4,24 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
6
6
|
import { SSRLiveReload } from "./SSRLiveReload";
|
|
7
|
-
console.log("mfSSRPlugin trigger");
|
|
8
7
|
var mfSSRPlugin = function() {
|
|
9
8
|
return {
|
|
10
9
|
name: "@module-federation/modern-js",
|
|
11
10
|
setup: function() {
|
|
12
11
|
return {
|
|
13
|
-
|
|
12
|
+
init: function init(param, next) {
|
|
13
|
+
var context = param.context;
|
|
14
14
|
return _async_to_generator(function() {
|
|
15
15
|
var nodeUtils, shouldUpdate;
|
|
16
16
|
return _ts_generator(this, function(_state) {
|
|
17
17
|
switch (_state.label) {
|
|
18
18
|
case 0:
|
|
19
|
-
console.log(111, "beforeRender");
|
|
20
19
|
if (typeof window !== "undefined") {
|
|
21
20
|
return [
|
|
22
|
-
2
|
|
21
|
+
2,
|
|
22
|
+
next({
|
|
23
|
+
context
|
|
24
|
+
})
|
|
23
25
|
];
|
|
24
26
|
}
|
|
25
27
|
globalThis.shouldUpdate = false;
|
|
@@ -51,7 +53,10 @@ var mfSSRPlugin = function() {
|
|
|
51
53
|
_state.label = 4;
|
|
52
54
|
case 4:
|
|
53
55
|
return [
|
|
54
|
-
2
|
|
56
|
+
2,
|
|
57
|
+
next({
|
|
58
|
+
context
|
|
59
|
+
})
|
|
55
60
|
];
|
|
56
61
|
}
|
|
57
62
|
});
|
|
@@ -2,7 +2,6 @@ import { ModuleFederationPlugin as WebpackModuleFederationPlugin, AsyncBoundaryP
|
|
|
2
2
|
import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
3
3
|
import { moduleFederationConfigPlugin } from "./configPlugin";
|
|
4
4
|
import { moduleFederationSSRPlugin } from "./ssrPlugin";
|
|
5
|
-
import { moduleFederationDataLoaderPlugin } from "./dataLoaderPlugin";
|
|
6
5
|
const moduleFederationPlugin = (userConfig = {}) => {
|
|
7
6
|
const internalModernPluginOptions = {
|
|
8
7
|
csrConfig: void 0,
|
|
@@ -54,11 +53,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
|
|
|
54
53
|
},
|
|
55
54
|
usePlugins: [
|
|
56
55
|
moduleFederationConfigPlugin(internalModernPluginOptions),
|
|
57
|
-
moduleFederationSSRPlugin(internalModernPluginOptions)
|
|
58
|
-
moduleFederationDataLoaderPlugin(Boolean(userConfig.dataLoader), internalModernPluginOptions, {
|
|
59
|
-
baseName: "",
|
|
60
|
-
...userConfig.dataLoader
|
|
61
|
-
})
|
|
56
|
+
moduleFederationSSRPlugin(internalModernPluginOptions)
|
|
62
57
|
]
|
|
63
58
|
};
|
|
64
59
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { fs } from "@modern-js/utils";
|
|
3
|
-
import { ModuleFederationPlugin } from "@module-federation/enhanced";
|
|
3
|
+
import { ModuleFederationPlugin } from "@module-federation/enhanced/webpack";
|
|
4
4
|
import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
5
|
-
import
|
|
5
|
+
import UniverseEntryChunkTrackerPlugin from "@module-federation/node/universe-entry-chunk-tracker-plugin";
|
|
6
6
|
import { updateStatsAndManifest } from "./manifest";
|
|
7
7
|
import { isDev } from "./constant";
|
|
8
8
|
function setEnv() {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import hoistNonReactStatics from "hoist-non-react-statics";
|
|
3
3
|
import { SSRLiveReload } from "./SSRLiveReload";
|
|
4
|
-
console.log("mfSSRPlugin trigger");
|
|
5
4
|
const mfSSRPlugin = () => ({
|
|
6
5
|
name: "@module-federation/modern-js",
|
|
7
6
|
setup: () => {
|
|
8
7
|
return {
|
|
9
|
-
async
|
|
10
|
-
console.log(111, "beforeRender");
|
|
8
|
+
async init({ context }, next) {
|
|
11
9
|
if (typeof window !== "undefined") {
|
|
12
|
-
return
|
|
10
|
+
return next({
|
|
11
|
+
context
|
|
12
|
+
});
|
|
13
13
|
}
|
|
14
14
|
globalThis.shouldUpdate = false;
|
|
15
15
|
const nodeUtils = await import("@module-federation/node/utils");
|
|
@@ -19,7 +19,9 @@ const mfSSRPlugin = () => ({
|
|
|
19
19
|
await nodeUtils.flushChunks();
|
|
20
20
|
globalThis.shouldUpdate = true;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return next({
|
|
23
|
+
context
|
|
24
|
+
});
|
|
23
25
|
},
|
|
24
26
|
wrapRoot(App) {
|
|
25
27
|
const AppWrapper = (props) => /* @__PURE__ */ _jsxs(_Fragment, {
|
|
@@ -4,7 +4,6 @@ import { PluginOptions } from '../types';
|
|
|
4
4
|
import { BundlerConfig } from '../interfaces/bundler';
|
|
5
5
|
export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
|
|
6
6
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
7
|
-
export declare const replaceRemoteUrl: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, remoteIpStrategy?: "ipv4" | "inherit") => void;
|
|
8
7
|
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean, remoteIpStrategy?: "ipv4" | "inherit") => moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
9
8
|
export declare function patchIgnoreWarning<T extends Bundler>(bundlerConfig: BundlerConfig<T>): void;
|
|
10
9
|
export declare function patchBundlerConfig<T extends Bundler>(options: {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
2
|
import type { ModuleFederationPlugin as WebpackModuleFederationPlugin } from '@module-federation/enhanced';
|
|
3
3
|
import type { ModuleFederationPlugin as RspackModuleFederationPlugin } from '@module-federation/enhanced/rspack';
|
|
4
|
-
import type { init } from '@module-federation/enhanced/runtime';
|
|
5
4
|
export interface PluginOptions {
|
|
6
5
|
config?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
7
6
|
configPath?: string;
|
|
8
7
|
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
9
|
-
dataLoader?: false | Pick<DataLoaderOptions, 'baseName' | 'partialSSRRemotes'>;
|
|
10
8
|
}
|
|
11
9
|
export interface InternalModernPluginOptions {
|
|
12
10
|
csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
@@ -18,19 +16,3 @@ export interface InternalModernPluginOptions {
|
|
|
18
16
|
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
19
17
|
}
|
|
20
18
|
export type BundlerPlugin = WebpackModuleFederationPlugin | RspackModuleFederationPlugin;
|
|
21
|
-
export type TransformRuntimeOptions = (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions) => Parameters<typeof init>[0];
|
|
22
|
-
export type DataLoaderOptions = {
|
|
23
|
-
baseName: string;
|
|
24
|
-
partialSSRRemotes?: string[];
|
|
25
|
-
metaName?: string;
|
|
26
|
-
serverPlugin?: string;
|
|
27
|
-
transformRuntimeOptions?: TransformRuntimeOptions;
|
|
28
|
-
fetchSSRByRouteIds?: (partialSSRRemotes: string[], mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, transformRuntimeOptions: TransformRuntimeOptions) => Promise<string[] | undefined>;
|
|
29
|
-
patchMFConfig?: (options: {
|
|
30
|
-
mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
31
|
-
baseName: string;
|
|
32
|
-
metaName: string;
|
|
33
|
-
isServer: boolean;
|
|
34
|
-
routesFilePath: string;
|
|
35
|
-
}) => void;
|
|
36
|
-
};
|
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-20240816090839",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -23,19 +23,6 @@
|
|
|
23
23
|
"types": "./dist/types/ssr-runtime/index.d.ts",
|
|
24
24
|
"default": "./dist/esm/ssr-runtime/index.js"
|
|
25
25
|
},
|
|
26
|
-
"./data-loader": {
|
|
27
|
-
"types": "./dist/types/runtime/dataLoader.d.ts",
|
|
28
|
-
"default": "./dist/esm/runtime/dataLoader.js"
|
|
29
|
-
},
|
|
30
|
-
"./data-loader-server": {
|
|
31
|
-
"types": "./dist/types/cli/server/dataLoaderPlugin.d.ts",
|
|
32
|
-
"default": "./dist/cjs/cli/server/dataLoaderPlugin.js"
|
|
33
|
-
},
|
|
34
|
-
"./data-loader-plugin": {
|
|
35
|
-
"import": "./dist/esm/cli/dataLoaderPlugin.js",
|
|
36
|
-
"require": "./dist/cjs/cli/dataLoaderPlugin.js",
|
|
37
|
-
"types": "./dist/types/cli/dataLoaderPlugin.d.ts"
|
|
38
|
-
},
|
|
39
26
|
"./config-plugin": {
|
|
40
27
|
"import": "./dist/esm/cli/configPlugin.js",
|
|
41
28
|
"require": "./dist/cjs/cli/configPlugin.js",
|
|
@@ -60,12 +47,6 @@
|
|
|
60
47
|
],
|
|
61
48
|
"ssr-plugin": [
|
|
62
49
|
"./dist/types/cli/ssrPlugin.d.ts"
|
|
63
|
-
],
|
|
64
|
-
"data-loader-plugin": [
|
|
65
|
-
"./dist/types/cli/dataLoaderPlugin.d.ts"
|
|
66
|
-
],
|
|
67
|
-
"data-loader": [
|
|
68
|
-
"./dist/types/runtime/dataLoader.d.ts"
|
|
69
50
|
]
|
|
70
51
|
}
|
|
71
52
|
},
|
|
@@ -74,31 +55,24 @@
|
|
|
74
55
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
75
56
|
"license": "MIT",
|
|
76
57
|
"dependencies": {
|
|
77
|
-
"@swc/helpers": "0.5.
|
|
58
|
+
"@swc/helpers": "0.5.12",
|
|
78
59
|
"@modern-js/utils": "2.54.2",
|
|
79
60
|
"@modern-js/node-bundle-require": "2.54.2",
|
|
80
61
|
"node-fetch": "~3.3.0",
|
|
81
62
|
"react-error-boundary": "4.0.13",
|
|
82
63
|
"hoist-non-react-statics": "3.3.2",
|
|
83
|
-
"@
|
|
84
|
-
"@
|
|
85
|
-
"@
|
|
86
|
-
"@babel/types": "7.25.2",
|
|
87
|
-
"@module-federation/sdk": "0.0.0-next-20240815094326",
|
|
88
|
-
"@module-federation/enhanced": "0.0.0-next-20240815094326",
|
|
89
|
-
"@module-federation/node": "0.0.0-next-20240815094326"
|
|
64
|
+
"@module-federation/sdk": "0.0.0-next-20240816090839",
|
|
65
|
+
"@module-federation/enhanced": "0.0.0-next-20240816090839",
|
|
66
|
+
"@module-federation/node": "0.0.0-next-20240816090839"
|
|
90
67
|
},
|
|
91
68
|
"devDependencies": {
|
|
92
|
-
"@types/babel__traverse": "7.20.6",
|
|
93
|
-
"@types/babel__generator": "7.6.8",
|
|
94
69
|
"@types/hoist-non-react-statics": "3.3.2",
|
|
95
|
-
"@modern-js/
|
|
96
|
-
"@modern-js/
|
|
97
|
-
"@modern-js/
|
|
98
|
-
"@modern-js/
|
|
99
|
-
"@modern-js/
|
|
100
|
-
"@
|
|
101
|
-
"@module-federation/manifest": "0.0.0-next-20240815094326"
|
|
70
|
+
"@modern-js/app-tools": "2.57.0",
|
|
71
|
+
"@modern-js/core": "2.57.0",
|
|
72
|
+
"@modern-js/runtime": "2.57.0",
|
|
73
|
+
"@modern-js/module-tools": "2.57.0",
|
|
74
|
+
"@modern-js/tsconfig": "2.57.0",
|
|
75
|
+
"@module-federation/manifest": "0.0.0-next-20240816090839"
|
|
102
76
|
},
|
|
103
77
|
"peerDependencies": {
|
|
104
78
|
"react": ">=17",
|
|
@@ -1,49 +0,0 @@
|
|
|
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 constant_exports = {};
|
|
20
|
-
__export(constant_exports, {
|
|
21
|
-
COMPONENT: () => COMPONENT,
|
|
22
|
-
ELEMENT: () => ELEMENT,
|
|
23
|
-
ID: () => ID,
|
|
24
|
-
IS_ROOT: () => IS_ROOT,
|
|
25
|
-
LAZY_COMPONENT: () => LAZY_COMPONENT,
|
|
26
|
-
LOADER: () => LOADER,
|
|
27
|
-
PRIVATE_COMPONENT: () => PRIVATE_COMPONENT,
|
|
28
|
-
SHOULD_REVALIDATE: () => SHOULD_REVALIDATE
|
|
29
|
-
});
|
|
30
|
-
module.exports = __toCommonJS(constant_exports);
|
|
31
|
-
const IS_ROOT = "isRoot";
|
|
32
|
-
const ID = "id";
|
|
33
|
-
const COMPONENT = "component";
|
|
34
|
-
const LAZY_COMPONENT = "lazyImport";
|
|
35
|
-
const SHOULD_REVALIDATE = "shouldRevalidate";
|
|
36
|
-
const PRIVATE_COMPONENT = "_component";
|
|
37
|
-
const ELEMENT = "element";
|
|
38
|
-
const LOADER = "loader";
|
|
39
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
-
0 && (module.exports = {
|
|
41
|
-
COMPONENT,
|
|
42
|
-
ELEMENT,
|
|
43
|
-
ID,
|
|
44
|
-
IS_ROOT,
|
|
45
|
-
LAZY_COMPONENT,
|
|
46
|
-
LOADER,
|
|
47
|
-
PRIVATE_COMPONENT,
|
|
48
|
-
SHOULD_REVALIDATE
|
|
49
|
-
});
|