@module-federation/modern-js 0.0.0-next-20240819040425 → 0.0.0-next-20240820034939
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/ast/constant.js +49 -0
- package/dist/cjs/cli/ast/generateRoutes.js +140 -0
- package/dist/cjs/cli/ast/generateSerializableRoutes.js +91 -0
- package/dist/cjs/cli/ast/generateSlimRoutes.js +106 -0
- package/dist/cjs/cli/ast/index.js +34 -0
- package/dist/cjs/cli/bundler-plugins/SerializableRoutesPlugin.js +65 -0
- package/dist/cjs/cli/constant.js +6 -0
- package/dist/cjs/cli/dataLoaderPlugin.js +288 -0
- package/dist/cjs/cli/index.js +6 -1
- package/dist/cjs/cli/server/dataLoaderPlugin.js +83 -0
- package/dist/cjs/cli/ssrPlugin.js +4 -4
- package/dist/cjs/cli/utils.js +7 -3
- package/dist/cjs/interfaces/route.js +16 -0
- package/dist/cjs/runtime/constant.js +34 -0
- package/dist/cjs/runtime/dataLoader.js +87 -0
- package/dist/cjs/runtime/index.js +4 -1
- package/dist/cjs/runtime/utils.js +43 -0
- package/dist/cjs/runtime/withMFRouteId.js +31 -0
- package/dist/cjs/ssr-runtime/plugin.js +8 -7
- package/dist/esm/cli/ast/constant.js +18 -0
- package/dist/esm/cli/ast/generateRoutes.js +107 -0
- package/dist/esm/cli/ast/generateSerializableRoutes.js +58 -0
- package/dist/esm/cli/ast/generateSlimRoutes.js +75 -0
- package/dist/esm/cli/ast/index.js +8 -0
- package/dist/esm/cli/bundler-plugins/SerializableRoutesPlugin.js +45 -0
- package/dist/esm/cli/constant.js +4 -0
- package/dist/esm/cli/dataLoaderPlugin.js +325 -0
- package/dist/esm/cli/index.js +6 -1
- package/dist/esm/cli/server/dataLoaderPlugin.js +146 -0
- package/dist/esm/cli/ssrPlugin.js +2 -2
- package/dist/esm/cli/utils.js +5 -2
- package/dist/esm/interfaces/route.js +0 -0
- package/dist/esm/runtime/constant.js +8 -0
- package/dist/esm/runtime/dataLoader.js +125 -0
- package/dist/esm/runtime/index.js +3 -1
- package/dist/esm/runtime/utils.js +16 -0
- package/dist/esm/runtime/withMFRouteId.js +7 -0
- package/dist/esm/ssr-runtime/plugin.js +8 -10
- package/dist/esm-node/cli/ast/constant.js +18 -0
- package/dist/esm-node/cli/ast/generateRoutes.js +106 -0
- package/dist/esm-node/cli/ast/generateSerializableRoutes.js +57 -0
- package/dist/esm-node/cli/ast/generateSlimRoutes.js +72 -0
- package/dist/esm-node/cli/ast/index.js +8 -0
- package/dist/esm-node/cli/bundler-plugins/SerializableRoutesPlugin.js +30 -0
- package/dist/esm-node/cli/constant.js +4 -0
- package/dist/esm-node/cli/dataLoaderPlugin.js +252 -0
- package/dist/esm-node/cli/index.js +6 -1
- package/dist/esm-node/cli/server/dataLoaderPlugin.js +63 -0
- package/dist/esm-node/cli/ssrPlugin.js +2 -2
- package/dist/esm-node/cli/utils.js +5 -2
- package/dist/esm-node/interfaces/route.js +0 -0
- package/dist/esm-node/runtime/constant.js +8 -0
- package/dist/esm-node/runtime/dataLoader.js +63 -0
- package/dist/esm-node/runtime/index.js +3 -1
- package/dist/esm-node/runtime/utils.js +19 -0
- package/dist/esm-node/runtime/withMFRouteId.js +7 -0
- package/dist/esm-node/ssr-runtime/plugin.js +8 -7
- package/dist/types/cli/ast/constant.d.ts +8 -0
- package/dist/types/cli/ast/generateRoutes.d.ts +7 -0
- package/dist/types/cli/ast/generateSerializableRoutes.d.ts +5 -0
- package/dist/types/cli/ast/generateSlimRoutes.d.ts +7 -0
- package/dist/types/cli/ast/index.d.ts +3 -0
- package/dist/types/cli/bundler-plugins/SerializableRoutesPlugin.d.ts +12 -0
- package/dist/types/cli/constant.d.ts +2 -0
- package/dist/types/cli/dataLoaderPlugin.d.ts +6 -0
- package/dist/types/cli/server/dataLoaderPlugin.d.ts +5 -0
- package/dist/types/cli/utils.d.ts +2 -0
- package/dist/types/interfaces/route.d.ts +13 -0
- package/dist/types/runtime/constant.d.ts +3 -0
- package/dist/types/runtime/dataLoader.d.ts +7 -0
- package/dist/types/runtime/index.d.ts +1 -0
- package/dist/types/runtime/utils.d.ts +1 -0
- package/dist/types/runtime/withMFRouteId.d.ts +1 -0
- package/dist/types/types/index.d.ts +11 -0
- package/package.json +40 -11
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { getInstance, init } from "@module-federation/enhanced/runtime";
|
|
2
|
+
import { MF_SLIM_ROUTES } from "../../runtime/constant";
|
|
3
|
+
async function getSlimRemotes(mfInstance) {
|
|
4
|
+
return await Promise.all(mfInstance.options.remotes.map(async (remote) => {
|
|
5
|
+
const { routes, baseName } = await mfInstance.loadRemote(`${remote.name}/${MF_SLIM_ROUTES}`);
|
|
6
|
+
return {
|
|
7
|
+
routes,
|
|
8
|
+
baseName
|
|
9
|
+
};
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
var dataLoaderPlugin_default = (mfRuntimeOptions) => ({
|
|
13
|
+
name: "MFDataLoaderServerPlugin",
|
|
14
|
+
pre: [
|
|
15
|
+
"@modern-js/plugin-inject-resource"
|
|
16
|
+
],
|
|
17
|
+
setup(api) {
|
|
18
|
+
const { remotes, name } = mfRuntimeOptions;
|
|
19
|
+
if (!remotes.length) {
|
|
20
|
+
return {};
|
|
21
|
+
}
|
|
22
|
+
let isHandled = false;
|
|
23
|
+
return {
|
|
24
|
+
prepare() {
|
|
25
|
+
const { middlewares } = api.useAppContext();
|
|
26
|
+
middlewares.push({
|
|
27
|
+
name: "MFDataLoaderServerPlugin",
|
|
28
|
+
handler: async (c, next) => {
|
|
29
|
+
console.log("isHandled : ", isHandled);
|
|
30
|
+
const serverManifest = c.get("serverManifest");
|
|
31
|
+
const { loaderBundles, nestedRoutesJson } = serverManifest;
|
|
32
|
+
console.log("nestedRoutesJson: ", nestedRoutesJson);
|
|
33
|
+
console.log("loaderBundles.main.routes : ", loaderBundles.main.routes);
|
|
34
|
+
if (isHandled) {
|
|
35
|
+
await next();
|
|
36
|
+
} else {
|
|
37
|
+
const instance = getInstance() || init({
|
|
38
|
+
name,
|
|
39
|
+
remotes
|
|
40
|
+
});
|
|
41
|
+
const slimRoutes = await getSlimRemotes(instance);
|
|
42
|
+
slimRoutes.forEach((slimRoute) => {
|
|
43
|
+
const { routes, baseName } = slimRoute;
|
|
44
|
+
routes[0].path = `/${baseName}`;
|
|
45
|
+
loaderBundles.main.routes.push(...routes);
|
|
46
|
+
nestedRoutesJson.default.main.push(...routes);
|
|
47
|
+
});
|
|
48
|
+
console.log("push loaderBundles.main.routes done ");
|
|
49
|
+
isHandled = true;
|
|
50
|
+
await next();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
before: [
|
|
54
|
+
"render"
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
dataLoaderPlugin_default as default
|
|
63
|
+
};
|
|
@@ -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";
|
|
4
4
|
import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-federation/enhanced/rspack";
|
|
5
|
-
import UniverseEntryChunkTrackerPlugin from "@module-federation/node
|
|
5
|
+
import { UniverseEntryChunkTrackerPlugin } from "@module-federation/node";
|
|
6
6
|
import { updateStatsAndManifest } from "./manifest";
|
|
7
7
|
import { isDev } from "./constant";
|
|
8
8
|
function setEnv() {
|
|
@@ -47,7 +47,9 @@ const replaceRemoteUrl = (mfConfig, remoteIpStrategy) => {
|
|
|
47
47
|
if (typeof remoteObject === "string") {
|
|
48
48
|
return;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
if ("entry" in remoteObject && typeof remoteObject.entry === "string") {
|
|
51
|
+
remoteObject.entry = remoteObject.entry.replace(LOCALHOST, ipv4);
|
|
52
|
+
}
|
|
51
53
|
});
|
|
52
54
|
} else if (typeof mfConfig.remotes !== "string") {
|
|
53
55
|
handleRemoteObject(mfConfig.remotes);
|
|
@@ -291,5 +293,6 @@ export {
|
|
|
291
293
|
getMFConfig,
|
|
292
294
|
patchBundlerConfig,
|
|
293
295
|
patchIgnoreWarning,
|
|
294
|
-
patchMFConfig
|
|
296
|
+
patchMFConfig,
|
|
297
|
+
replaceRemoteUrl
|
|
295
298
|
};
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getInstance, loadRemote } from "@module-federation/enhanced/runtime";
|
|
3
|
+
import { MF_FULL_ROUTES } from "./constant";
|
|
4
|
+
globalThis.mfRemoteRoutes = globalThis.mfRemoteRoutes || [];
|
|
5
|
+
var _globalThis_mfHasLoadedRemoteRoutes;
|
|
6
|
+
globalThis.mfHasLoadedRemoteRoutes = (_globalThis_mfHasLoadedRemoteRoutes = globalThis.mfHasLoadedRemoteRoutes) !== null && _globalThis_mfHasLoadedRemoteRoutes !== void 0 ? _globalThis_mfHasLoadedRemoteRoutes : false;
|
|
7
|
+
async function loadRoutes() {
|
|
8
|
+
var _getInstance;
|
|
9
|
+
if (globalThis.mfHasLoadedRemoteRoutes) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const remotes = (_getInstance = getInstance()) === null || _getInstance === void 0 ? void 0 : _getInstance.options.remotes;
|
|
13
|
+
if (!remotes) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const remoteModuleIds = remotes.map((remote) => {
|
|
17
|
+
return `${remote.name}/${MF_FULL_ROUTES}`;
|
|
18
|
+
});
|
|
19
|
+
const traverse = (cRoutes, prefix) => {
|
|
20
|
+
cRoutes.forEach((i) => {
|
|
21
|
+
i.id = prefix + i.id;
|
|
22
|
+
const Comp = i.component;
|
|
23
|
+
i.element = /* @__PURE__ */ _jsx(Comp, {});
|
|
24
|
+
if (i.children) {
|
|
25
|
+
traverse(i.children, prefix);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
await Promise.all(remoteModuleIds.map(async (remoteModuleId) => {
|
|
30
|
+
const remoteName = remoteModuleId.split(`/${MF_FULL_ROUTES}`)[0];
|
|
31
|
+
const { routes, baseName } = await loadRemote(remoteModuleId);
|
|
32
|
+
routes[0].path = `/${baseName}`;
|
|
33
|
+
routes[0].isRoot = false;
|
|
34
|
+
globalThis.mfRemoteRoutes.push(...routes);
|
|
35
|
+
}));
|
|
36
|
+
globalThis.mfHasLoadedRemoteRoutes = true;
|
|
37
|
+
return globalThis.mfRemoteRoutes;
|
|
38
|
+
}
|
|
39
|
+
const ssrDataLoaderPlugin = () => {
|
|
40
|
+
return {
|
|
41
|
+
name: "@modern-js/plugin-mf-data-loader",
|
|
42
|
+
post: [
|
|
43
|
+
"@modern-js/plugin-router"
|
|
44
|
+
],
|
|
45
|
+
setup: () => {
|
|
46
|
+
return {
|
|
47
|
+
async beforeRender({ context }) {
|
|
48
|
+
console.log("init");
|
|
49
|
+
await loadRoutes();
|
|
50
|
+
},
|
|
51
|
+
modifyRoutes: (routes) => {
|
|
52
|
+
console.log("modifyRoutes");
|
|
53
|
+
routes.push(...globalThis.mfRemoteRoutes);
|
|
54
|
+
console.log("routes: ", routes);
|
|
55
|
+
return routes;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
ssrDataLoaderPlugin
|
|
63
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
function transformName2Prefix(name) {
|
|
2
|
+
const NameTransformSymbol = {
|
|
3
|
+
AT: "@",
|
|
4
|
+
HYPHEN: "-",
|
|
5
|
+
SLASH: "/",
|
|
6
|
+
UNDERLINE: "_"
|
|
7
|
+
};
|
|
8
|
+
const NameTransformMap = {
|
|
9
|
+
[NameTransformSymbol.AT]: "SCOPE",
|
|
10
|
+
[NameTransformSymbol.HYPHEN]: "HYPHEN",
|
|
11
|
+
[NameTransformSymbol.SLASH]: "SLASH",
|
|
12
|
+
[NameTransformSymbol.UNDERLINE]: "UNDERLINE"
|
|
13
|
+
};
|
|
14
|
+
const SPLIT_SYMBOL = "@";
|
|
15
|
+
return `${name.replace(new RegExp(`${NameTransformSymbol.AT}`, "g"), NameTransformMap[NameTransformSymbol.AT]).replace(new RegExp(`${NameTransformSymbol.HYPHEN}`, "g"), NameTransformMap[NameTransformSymbol.HYPHEN]).replace(new RegExp(`${NameTransformSymbol.SLASH}`, "g"), NameTransformMap[NameTransformSymbol.SLASH]).replace(new RegExp(`${NameTransformSymbol.UNDERLINE}`, "g"), NameTransformMap[NameTransformSymbol.UNDERLINE])}${SPLIT_SYMBOL}`;
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
transformName2Prefix
|
|
19
|
+
};
|
|
@@ -1,15 +1,18 @@
|
|
|
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");
|
|
4
5
|
const mfSSRPlugin = () => ({
|
|
5
6
|
name: "@module-federation/modern-js",
|
|
7
|
+
pre: [
|
|
8
|
+
"@modern-js/plugin-router"
|
|
9
|
+
],
|
|
6
10
|
setup: () => {
|
|
7
11
|
return {
|
|
8
|
-
async
|
|
12
|
+
async beforeRender() {
|
|
13
|
+
console.log(111, "beforeRender");
|
|
9
14
|
if (typeof window !== "undefined") {
|
|
10
|
-
return
|
|
11
|
-
context
|
|
12
|
-
});
|
|
15
|
+
return;
|
|
13
16
|
}
|
|
14
17
|
globalThis.shouldUpdate = false;
|
|
15
18
|
const nodeUtils = await import("@module-federation/node/utils");
|
|
@@ -19,9 +22,7 @@ const mfSSRPlugin = () => ({
|
|
|
19
22
|
await nodeUtils.flushChunks();
|
|
20
23
|
globalThis.shouldUpdate = true;
|
|
21
24
|
}
|
|
22
|
-
return
|
|
23
|
-
context
|
|
24
|
-
});
|
|
25
|
+
return;
|
|
25
26
|
},
|
|
26
27
|
wrapRoot(App) {
|
|
27
28
|
const AppWrapper = (props) => /* @__PURE__ */ _jsxs(_Fragment, {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const IS_ROOT = "isRoot";
|
|
2
|
+
export declare const ID = "id";
|
|
3
|
+
export declare const COMPONENT = "component";
|
|
4
|
+
export declare const LAZY_COMPONENT = "lazyImport";
|
|
5
|
+
export declare const SHOULD_REVALIDATE = "shouldRevalidate";
|
|
6
|
+
export declare const PRIVATE_COMPONENT = "_component";
|
|
7
|
+
export declare const ELEMENT = "element";
|
|
8
|
+
export declare const LOADER = "loader";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { webpack } from '@modern-js/app-tools';
|
|
2
|
+
export declare const SERIALIZABLE_ROUTES = "serializable-routes.json";
|
|
3
|
+
declare class SerializableRoutesPlugin implements webpack.WebpackPluginInstance {
|
|
4
|
+
routesFilePath: string;
|
|
5
|
+
prefix: string;
|
|
6
|
+
constructor(options: {
|
|
7
|
+
routesFilePath: string;
|
|
8
|
+
prefix: string;
|
|
9
|
+
});
|
|
10
|
+
apply(compiler: webpack.Compiler): void;
|
|
11
|
+
}
|
|
12
|
+
export { SerializableRoutesPlugin };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CliPlugin, AppTools } from '@modern-js/app-tools';
|
|
2
|
+
import type { DataLoaderOptions, InternalModernPluginOptions } from '../types';
|
|
3
|
+
import { generateRoutes, generateSlimRoutes } from './ast';
|
|
4
|
+
export declare const moduleFederationDataLoaderPlugin: (enable: boolean, internalOptions: InternalModernPluginOptions, userConfig: DataLoaderOptions) => CliPlugin<AppTools>;
|
|
5
|
+
export default moduleFederationDataLoaderPlugin;
|
|
6
|
+
export { generateRoutes, generateSlimRoutes };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServerPlugin } from '@modern-js/server-core';
|
|
2
|
+
import { init } from '@module-federation/enhanced/runtime';
|
|
3
|
+
type MFRuntimeOptions = Parameters<typeof init>[0];
|
|
4
|
+
declare const _default: (mfRuntimeOptions: MFRuntimeOptions) => ServerPlugin;
|
|
5
|
+
export default _default;
|
|
@@ -2,8 +2,10 @@ import type { webpack, UserConfig, AppTools, Rspack, Bundler } from '@modern-js/
|
|
|
2
2
|
import { moduleFederationPlugin } from '@module-federation/sdk';
|
|
3
3
|
import { PluginOptions } from '../types';
|
|
4
4
|
import { BundlerConfig } from '../interfaces/bundler';
|
|
5
|
+
import type { init } from '@module-federation/enhanced/runtime';
|
|
5
6
|
export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
|
|
6
7
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
8
|
+
export declare const replaceRemoteUrl: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions | Parameters<typeof init>[0], remoteIpStrategy?: "ipv4" | "inherit") => void;
|
|
7
9
|
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean, remoteIpStrategy?: "ipv4" | "inherit") => moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
8
10
|
export declare function patchIgnoreWarning<T extends Bundler>(bundlerConfig: BundlerConfig<T>): void;
|
|
9
11
|
export declare function patchBundlerConfig<T extends Bundler>(options: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type Route = {
|
|
2
|
+
id: string;
|
|
3
|
+
type: string;
|
|
4
|
+
loader?: boolean;
|
|
5
|
+
index?: boolean;
|
|
6
|
+
isRoot?: boolean;
|
|
7
|
+
children?: Route[];
|
|
8
|
+
};
|
|
9
|
+
export type MFModernRouteJson = {
|
|
10
|
+
baseName: string;
|
|
11
|
+
routes: Record<string, Route[]>;
|
|
12
|
+
prefix: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Plugin } from '@modern-js/runtime';
|
|
2
|
+
import { type RouteObject } from '@modern-js/runtime/router';
|
|
3
|
+
declare global {
|
|
4
|
+
var mfRemoteRoutes: RouteObject[];
|
|
5
|
+
var mfHasLoadedRemoteRoutes: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const ssrDataLoaderPlugin: () => Plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformName2Prefix(name: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withMFRouteId(id: string): string;
|
|
@@ -1,10 +1,12 @@
|
|
|
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';
|
|
4
5
|
export interface PluginOptions {
|
|
5
6
|
config?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
6
7
|
configPath?: string;
|
|
7
8
|
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
9
|
+
dataLoader?: false | Pick<DataLoaderOptions, 'baseName' | 'partialSSRRemotes'>;
|
|
8
10
|
}
|
|
9
11
|
export interface InternalModernPluginOptions {
|
|
10
12
|
csrConfig?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
@@ -16,3 +18,12 @@ export interface InternalModernPluginOptions {
|
|
|
16
18
|
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
17
19
|
}
|
|
18
20
|
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
|
+
};
|
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-20240820034939",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -23,6 +23,19 @@
|
|
|
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
|
+
},
|
|
26
39
|
"./config-plugin": {
|
|
27
40
|
"import": "./dist/esm/cli/configPlugin.js",
|
|
28
41
|
"require": "./dist/cjs/cli/configPlugin.js",
|
|
@@ -47,6 +60,15 @@
|
|
|
47
60
|
],
|
|
48
61
|
"ssr-plugin": [
|
|
49
62
|
"./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
|
+
],
|
|
70
|
+
"data-loader-server": [
|
|
71
|
+
"./dist/types/cli/server/dataLoaderPlugin.d.ts"
|
|
50
72
|
]
|
|
51
73
|
}
|
|
52
74
|
},
|
|
@@ -55,24 +77,31 @@
|
|
|
55
77
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
56
78
|
"license": "MIT",
|
|
57
79
|
"dependencies": {
|
|
58
|
-
"@swc/helpers": "0.5.
|
|
80
|
+
"@swc/helpers": "0.5.3",
|
|
59
81
|
"@modern-js/utils": "2.54.2",
|
|
60
82
|
"@modern-js/node-bundle-require": "2.54.2",
|
|
61
83
|
"node-fetch": "~3.3.0",
|
|
62
84
|
"react-error-boundary": "4.0.13",
|
|
63
85
|
"hoist-non-react-statics": "3.3.2",
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
86
|
+
"@babel/generator": "7.25.0",
|
|
87
|
+
"@babel/parser": "7.25.3",
|
|
88
|
+
"@babel/traverse": "7.25.3",
|
|
89
|
+
"@babel/types": "7.25.2",
|
|
90
|
+
"@module-federation/sdk": "0.0.0-next-20240820034939",
|
|
91
|
+
"@module-federation/enhanced": "0.0.0-next-20240820034939",
|
|
92
|
+
"@module-federation/node": "0.0.0-next-20240820034939"
|
|
67
93
|
},
|
|
68
94
|
"devDependencies": {
|
|
95
|
+
"@types/babel__traverse": "7.20.6",
|
|
96
|
+
"@types/babel__generator": "7.6.8",
|
|
69
97
|
"@types/hoist-non-react-statics": "3.3.2",
|
|
70
|
-
"@modern-js/
|
|
71
|
-
"@modern-js/
|
|
72
|
-
"@modern-js/
|
|
73
|
-
"@modern-js/
|
|
74
|
-
"@modern-js/
|
|
75
|
-
"@
|
|
98
|
+
"@modern-js/server-core": "0.0.0-next-20240816082741",
|
|
99
|
+
"@modern-js/app-tools": "0.0.0-next-20240816082741",
|
|
100
|
+
"@modern-js/core": "0.0.0-next-20240816082741",
|
|
101
|
+
"@modern-js/runtime": "0.0.0-next-20240816082741",
|
|
102
|
+
"@modern-js/module-tools": "0.0.0-next-20240816082741",
|
|
103
|
+
"@modern-js/tsconfig": "0.0.0-next-20240816082741",
|
|
104
|
+
"@module-federation/manifest": "0.0.0-next-20240820034939"
|
|
76
105
|
},
|
|
77
106
|
"peerDependencies": {
|
|
78
107
|
"react": ">=17",
|