@module-federation/modern-js 0.0.0-next-20240816084239 → 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.
Files changed (75) hide show
  1. package/dist/cjs/cli/constant.js +0 -6
  2. package/dist/cjs/cli/index.js +1 -6
  3. package/dist/cjs/cli/ssrPlugin.js +4 -4
  4. package/dist/cjs/cli/utils.js +2 -4
  5. package/dist/cjs/runtime/index.js +1 -4
  6. package/dist/cjs/ssr-runtime/plugin.js +7 -5
  7. package/dist/esm/cli/constant.js +0 -4
  8. package/dist/esm/cli/index.js +1 -6
  9. package/dist/esm/cli/ssrPlugin.js +2 -2
  10. package/dist/esm/cli/utils.js +1 -2
  11. package/dist/esm/runtime/index.js +1 -3
  12. package/dist/esm/ssr-runtime/plugin.js +10 -5
  13. package/dist/esm-node/cli/constant.js +0 -4
  14. package/dist/esm-node/cli/index.js +1 -6
  15. package/dist/esm-node/cli/ssrPlugin.js +2 -2
  16. package/dist/esm-node/cli/utils.js +1 -2
  17. package/dist/esm-node/runtime/index.js +1 -3
  18. package/dist/esm-node/ssr-runtime/plugin.js +7 -5
  19. package/dist/types/cli/constant.d.ts +0 -2
  20. package/dist/types/cli/utils.d.ts +0 -1
  21. package/dist/types/runtime/index.d.ts +0 -1
  22. package/dist/types/types/index.d.ts +0 -18
  23. package/package.json +11 -37
  24. package/dist/cjs/cli/ast/constant.js +0 -49
  25. package/dist/cjs/cli/ast/generateRoutes.js +0 -140
  26. package/dist/cjs/cli/ast/generateSerializableRoutes.js +0 -91
  27. package/dist/cjs/cli/ast/generateSlimRoutes.js +0 -106
  28. package/dist/cjs/cli/ast/index.js +0 -34
  29. package/dist/cjs/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -65
  30. package/dist/cjs/cli/dataLoaderPlugin.js +0 -281
  31. package/dist/cjs/cli/server/dataLoaderPlugin.js +0 -83
  32. package/dist/cjs/interfaces/route.js +0 -16
  33. package/dist/cjs/runtime/constant.js +0 -34
  34. package/dist/cjs/runtime/dataLoader.js +0 -87
  35. package/dist/cjs/runtime/utils.js +0 -43
  36. package/dist/cjs/runtime/withMFRouteId.js +0 -31
  37. package/dist/esm/cli/ast/constant.js +0 -18
  38. package/dist/esm/cli/ast/generateRoutes.js +0 -107
  39. package/dist/esm/cli/ast/generateSerializableRoutes.js +0 -58
  40. package/dist/esm/cli/ast/generateSlimRoutes.js +0 -75
  41. package/dist/esm/cli/ast/index.js +0 -8
  42. package/dist/esm/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -45
  43. package/dist/esm/cli/dataLoaderPlugin.js +0 -326
  44. package/dist/esm/cli/server/dataLoaderPlugin.js +0 -146
  45. package/dist/esm/interfaces/route.js +0 -0
  46. package/dist/esm/runtime/constant.js +0 -8
  47. package/dist/esm/runtime/dataLoader.js +0 -125
  48. package/dist/esm/runtime/utils.js +0 -16
  49. package/dist/esm/runtime/withMFRouteId.js +0 -7
  50. package/dist/esm-node/cli/ast/constant.js +0 -18
  51. package/dist/esm-node/cli/ast/generateRoutes.js +0 -106
  52. package/dist/esm-node/cli/ast/generateSerializableRoutes.js +0 -57
  53. package/dist/esm-node/cli/ast/generateSlimRoutes.js +0 -72
  54. package/dist/esm-node/cli/ast/index.js +0 -8
  55. package/dist/esm-node/cli/bundler-plugins/SerializableRoutesPlugin.js +0 -30
  56. package/dist/esm-node/cli/dataLoaderPlugin.js +0 -245
  57. package/dist/esm-node/cli/server/dataLoaderPlugin.js +0 -63
  58. package/dist/esm-node/interfaces/route.js +0 -0
  59. package/dist/esm-node/runtime/constant.js +0 -8
  60. package/dist/esm-node/runtime/dataLoader.js +0 -63
  61. package/dist/esm-node/runtime/utils.js +0 -19
  62. package/dist/esm-node/runtime/withMFRouteId.js +0 -7
  63. package/dist/types/cli/ast/constant.d.ts +0 -8
  64. package/dist/types/cli/ast/generateRoutes.d.ts +0 -7
  65. package/dist/types/cli/ast/generateSerializableRoutes.d.ts +0 -5
  66. package/dist/types/cli/ast/generateSlimRoutes.d.ts +0 -7
  67. package/dist/types/cli/ast/index.d.ts +0 -3
  68. package/dist/types/cli/bundler-plugins/SerializableRoutesPlugin.d.ts +0 -12
  69. package/dist/types/cli/dataLoaderPlugin.d.ts +0 -6
  70. package/dist/types/cli/server/dataLoaderPlugin.d.ts +0 -5
  71. package/dist/types/interfaces/route.d.ts +0 -13
  72. package/dist/types/runtime/constant.d.ts +0 -3
  73. package/dist/types/runtime/dataLoader.d.ts +0 -7
  74. package/dist/types/runtime/utils.d.ts +0 -1
  75. package/dist/types/runtime/withMFRouteId.d.ts +0 -1
@@ -1,245 +0,0 @@
1
- import path from "path";
2
- import { fs } from "@modern-js/utils";
3
- import { transformName2Prefix } from "../runtime/utils";
4
- import { PLUGIN_IDENTIFIER } from "../constant";
5
- import { MF_FULL_ROUTES, MF_SLIM_ROUTES, MF_ROUTES_META } from "../runtime/constant";
6
- import { generateRoutes, generateSlimRoutes } from "./ast";
7
- import { MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME, META_NAME } from "./constant";
8
- import { getIPV4, replaceRemoteUrl } from "./utils";
9
- import { SerializableRoutesPlugin, SERIALIZABLE_ROUTES } from "./bundler-plugins/SerializableRoutesPlugin";
10
- function generateExtraExposeFiles(options) {
11
- const { routesFilePath, mfConfig, isServer, baseName } = options;
12
- const outputDir = path.resolve(process.cwd(), "node_modules/.federation");
13
- fs.ensureDirSync(outputDir);
14
- const addSuffix = (fileName) => {
15
- if (!isServer) {
16
- return `${fileName}.jsx`;
17
- }
18
- return `${fileName}.server.jsx`;
19
- };
20
- const routesFileContent = fs.readFileSync(routesFilePath, "utf-8");
21
- const outputSlimRoutesPath = path.resolve(outputDir, addSuffix(MF_SLIM_ROUTES));
22
- const outputFullRoutesPath = path.resolve(outputDir, addSuffix(MF_FULL_ROUTES));
23
- const outputRoutesMetaPath = path.resolve(outputDir, `${MF_ROUTES_META}.js`);
24
- generateSlimRoutes({
25
- sourceCode: routesFileContent,
26
- filePath: outputSlimRoutesPath,
27
- prefix: transformName2Prefix(mfConfig.name),
28
- baseName
29
- });
30
- generateRoutes({
31
- sourceCode: routesFileContent,
32
- filePath: outputFullRoutesPath,
33
- prefix: transformName2Prefix(mfConfig.name),
34
- baseName
35
- });
36
- fs.writeFileSync(outputRoutesMetaPath, `export const baseName = '${baseName}';`);
37
- return {
38
- outputSlimRoutesPath,
39
- outputFullRoutesPath,
40
- outputRoutesMetaPath
41
- };
42
- }
43
- function addExpose(options) {
44
- const { mfConfig } = options;
45
- const { outputSlimRoutesPath, outputFullRoutesPath, outputRoutesMetaPath } = generateExtraExposeFiles(options);
46
- const fullRoutesKey = `./${MF_FULL_ROUTES}`;
47
- const slimRoutesKey = `./${MF_SLIM_ROUTES}`;
48
- const routeMetaKey = `./${MF_ROUTES_META}`;
49
- if (!mfConfig.exposes) {
50
- mfConfig.exposes = {
51
- [fullRoutesKey]: outputFullRoutesPath,
52
- [slimRoutesKey]: outputSlimRoutesPath,
53
- [routeMetaKey]: outputRoutesMetaPath
54
- };
55
- } else {
56
- if (!Array.isArray(mfConfig.exposes)) {
57
- if (!mfConfig.exposes[fullRoutesKey]) {
58
- mfConfig.exposes[fullRoutesKey] = outputFullRoutesPath;
59
- }
60
- if (!mfConfig.exposes[slimRoutesKey]) {
61
- mfConfig.exposes[slimRoutesKey] = outputSlimRoutesPath;
62
- }
63
- if (!mfConfig.exposes[routeMetaKey]) {
64
- mfConfig.exposes[routeMetaKey] = outputRoutesMetaPath;
65
- }
66
- }
67
- }
68
- }
69
- function addShared(options) {
70
- const { metaName, mfConfig } = options;
71
- const alias = `@${metaName}/runtime/router`;
72
- if (!mfConfig.shared) {
73
- mfConfig.shared = {
74
- [alias]: {
75
- singleton: true
76
- }
77
- };
78
- } else {
79
- if (!Array.isArray(mfConfig.shared)) {
80
- mfConfig.shared[alias] = {
81
- singleton: true
82
- };
83
- } else {
84
- mfConfig.shared.push(alias);
85
- }
86
- }
87
- }
88
- function _pathMfConfig(options) {
89
- addShared(options);
90
- addExpose(options);
91
- }
92
- async function _fetchSSRByRouteIds(partialSSRRemotes, mfConfig, transformRuntimeFn) {
93
- const partialMfConfig = {
94
- name: mfConfig.name,
95
- remotes: {
96
- ...mfConfig.remotes
97
- }
98
- };
99
- replaceRemoteUrl(partialMfConfig, "ipv4");
100
- const runtimeInitOptions = transformRuntimeFn(partialMfConfig);
101
- if (!runtimeInitOptions.remotes.length || !partialSSRRemotes.length) {
102
- return void 0;
103
- }
104
- const remoteProviderRouteIds = /* @__PURE__ */ new Set();
105
- const collectIds = (route) => {
106
- remoteProviderRouteIds.add(route.id);
107
- if (route.children) {
108
- route.children.forEach((r) => {
109
- collectIds(r);
110
- });
111
- }
112
- };
113
- await Promise.all(runtimeInitOptions.remotes.map(async (remote) => {
114
- const entry = "entry" in remote ? remote.entry : "";
115
- if (!entry) {
116
- return void 0;
117
- }
118
- const ipv4 = getIPV4();
119
- const url = new URL(entry);
120
- const serializableRoutesUrl = url.href.replace(url.pathname, `/${SERIALIZABLE_ROUTES}`).replace("localhost", ipv4);
121
- const serializableRoutesRet = await fetch(serializableRoutesUrl);
122
- const serializableRoutes = await serializableRoutesRet.json();
123
- serializableRoutes.forEach((serializableRoute) => {
124
- collectIds(serializableRoute);
125
- });
126
- }));
127
- return [
128
- ...remoteProviderRouteIds
129
- ];
130
- }
131
- function _transformRuntimeOptions(buildOptions) {
132
- const remotes = buildOptions.remotes || {};
133
- const runtimeRemotes = Object.entries(remotes).map((remote) => {
134
- const [_alias, nameAndEntry] = remote;
135
- const [name, entry] = nameAndEntry.split("@");
136
- return {
137
- name,
138
- entry
139
- };
140
- });
141
- return {
142
- name: buildOptions.name,
143
- remotes: runtimeRemotes
144
- };
145
- }
146
- const moduleFederationDataLoaderPlugin = (enable, internalOptions, userConfig) => ({
147
- name: "@modern-js/plugin-module-federation-data-loader",
148
- pre: [
149
- "@modern-js/plugin-module-federation-config"
150
- ],
151
- post: [
152
- "@modern-js/plugin-router",
153
- "@modern-js/plugin-module-federation"
154
- ],
155
- setup: async ({ useConfigContext, useAppContext }) => {
156
- var _modernjsConfig_server, _internalOptions_csrConfig;
157
- if (!enable) {
158
- return;
159
- }
160
- const { baseName, partialSSRRemotes = [], fetchSSRByRouteIds, patchMFConfig, metaName = META_NAME, serverPlugin = "@module-federation/modern-js/data-loader-server", transformRuntimeOptions } = userConfig;
161
- if (!baseName) {
162
- throw new Error(`${PLUGIN_IDENTIFIER} 'baseName' is required if you enable 'dataLoader'!`);
163
- }
164
- const modernjsConfig = useConfigContext();
165
- const appContext = useAppContext();
166
- const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
167
- const name = (_internalOptions_csrConfig = internalOptions.csrConfig) === null || _internalOptions_csrConfig === void 0 ? void 0 : _internalOptions_csrConfig.name;
168
- const routesFilePath = path.resolve(appContext.internalDirectory.replace(META_NAME, metaName || META_NAME), `./main/${MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME}`);
169
- const transformRuntimeFn = transformRuntimeOptions || _transformRuntimeOptions;
170
- return {
171
- _internalRuntimePlugins: ({ entrypoint, plugins }) => {
172
- plugins.push({
173
- name: "ssrDataLoader",
174
- path: "@module-federation/modern-js/data-loader",
175
- config: {}
176
- });
177
- return {
178
- entrypoint,
179
- plugins
180
- };
181
- },
182
- _internalServerPlugins({ plugins }) {
183
- plugins.push({
184
- name: serverPlugin,
185
- options: transformRuntimeFn(internalOptions.csrConfig)
186
- });
187
- return {
188
- plugins
189
- };
190
- },
191
- config: async () => {
192
- const fetchFn = fetchSSRByRouteIds || _fetchSSRByRouteIds;
193
- const ssrByRouteIds = await fetchFn(partialSSRRemotes, internalOptions.csrConfig, transformRuntimeFn);
194
- const patchMFConfigFn = patchMFConfig || _pathMfConfig;
195
- return {
196
- server: {
197
- ssrByRouteIds
198
- },
199
- tools: {
200
- rspack(_config, { isServer }) {
201
- patchMFConfigFn({
202
- mfConfig: isServer ? internalOptions.ssrConfig : internalOptions.csrConfig,
203
- baseName,
204
- metaName,
205
- isServer,
206
- routesFilePath
207
- });
208
- },
209
- webpack(_config, { isServer }) {
210
- patchMFConfigFn({
211
- mfConfig: isServer ? internalOptions.ssrConfig : internalOptions.csrConfig,
212
- baseName,
213
- metaName,
214
- isServer,
215
- routesFilePath
216
- });
217
- },
218
- bundlerChain(chain, { isServer }) {
219
- if (!isServer && internalOptions.csrConfig && Object.keys(internalOptions.csrConfig.exposes).length) {
220
- chain.plugin("SerializableRoutesPlugin").use(SerializableRoutesPlugin, [
221
- {
222
- routesFilePath,
223
- prefix: transformName2Prefix(internalOptions.csrConfig.name)
224
- }
225
- ]);
226
- }
227
- }
228
- },
229
- source: {
230
- define: {
231
- MODERN_ROUTER_ID_PREFIX: JSON.stringify(transformName2Prefix(name))
232
- }
233
- }
234
- };
235
- }
236
- };
237
- }
238
- });
239
- var dataLoaderPlugin_default = moduleFederationDataLoaderPlugin;
240
- export {
241
- dataLoaderPlugin_default as default,
242
- generateRoutes,
243
- generateSlimRoutes,
244
- moduleFederationDataLoaderPlugin
245
- };
@@ -1,63 +0,0 @@
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
- };
File without changes
@@ -1,8 +0,0 @@
1
- const MF_SLIM_ROUTES = "mf-slim-routes";
2
- const MF_FULL_ROUTES = "mf-full-routes";
3
- const MF_ROUTES_META = "mf-routes-meta";
4
- export {
5
- MF_FULL_ROUTES,
6
- MF_ROUTES_META,
7
- MF_SLIM_ROUTES
8
- };
@@ -1,63 +0,0 @@
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
- };
@@ -1,19 +0,0 @@
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,7 +0,0 @@
1
- function withMFRouteId(id) {
2
- const prefix = typeof MODERN_ROUTER_ID_PREFIX === "string" ? MODERN_ROUTER_ID_PREFIX : "";
3
- return prefix + id;
4
- }
5
- export {
6
- withMFRouteId
7
- };
@@ -1,8 +0,0 @@
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";
@@ -1,7 +0,0 @@
1
- declare function generateRoutes({ sourceCode, filePath, prefix, baseName, }: {
2
- sourceCode: string;
3
- filePath: string;
4
- prefix: string;
5
- baseName: string;
6
- }): void;
7
- export { generateRoutes };
@@ -1,5 +0,0 @@
1
- declare function generateSerializableRoutes({ sourceCode, prefix, }: {
2
- sourceCode: string;
3
- prefix: string;
4
- }): string;
5
- export { generateSerializableRoutes };
@@ -1,7 +0,0 @@
1
- declare function generateSlimRoutes({ sourceCode, filePath, prefix, baseName, }: {
2
- sourceCode: string;
3
- filePath: string;
4
- prefix: string;
5
- baseName: string;
6
- }): void;
7
- export { generateSlimRoutes };
@@ -1,3 +0,0 @@
1
- export { generateRoutes } from './generateRoutes';
2
- export { generateSlimRoutes } from './generateSlimRoutes';
3
- export { generateSerializableRoutes } from './generateSerializableRoutes';
@@ -1,12 +0,0 @@
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 };
@@ -1,6 +0,0 @@
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 };
@@ -1,5 +0,0 @@
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;
@@ -1,13 +0,0 @@
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
- };
@@ -1,3 +0,0 @@
1
- export declare const MF_SLIM_ROUTES = "mf-slim-routes";
2
- export declare const MF_FULL_ROUTES = "mf-full-routes";
3
- export declare const MF_ROUTES_META = "mf-routes-meta";
@@ -1,7 +0,0 @@
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;
@@ -1 +0,0 @@
1
- export declare function transformName2Prefix(name: string): string;
@@ -1 +0,0 @@
1
- export declare function withMFRouteId(id: string): string;