@module-federation/modern-js 0.0.0-next-20240819112150 → 0.0.0-next-20240821075411

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 +3 -9
  5. package/dist/cjs/runtime/index.js +1 -4
  6. package/dist/cjs/ssr-runtime/plugin.js +7 -8
  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 +2 -7
  11. package/dist/esm/runtime/index.js +1 -3
  12. package/dist/esm/ssr-runtime/plugin.js +10 -8
  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 +2 -7
  17. package/dist/esm-node/runtime/index.js +1 -3
  18. package/dist/esm-node/ssr-runtime/plugin.js +7 -8
  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 -11
  23. package/package.json +11 -40
  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 -288
  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 -325
  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 -252
  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
@@ -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
  });
@@ -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 import_enhanced = require("@module-federation/enhanced");
38
+ var import_webpack = require("@module-federation/enhanced/webpack");
39
39
  var import_rspack = require("@module-federation/enhanced/rspack");
40
- var import_node = require("@module-federation/node");
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 import_enhanced.ModuleFederationPlugin(userConfig.ssrConfig);
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(import_node.UniverseEntryChunkTrackerPlugin);
144
+ chain.plugin("UniverseEntryChunkTrackerPlugin").use(import_universe_entry_chunk_tracker_plugin.default);
145
145
  }
146
146
  }
147
147
  if (import_constant.isDev && !isServer) {
@@ -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");
@@ -85,11 +84,7 @@ const replaceRemoteUrl = (mfConfig, remoteIpStrategy) => {
85
84
  if (typeof remoteObject === "string") {
86
85
  return;
87
86
  }
88
- if (remoteObject.entry && typeof remoteObject.entry === "string") {
89
- remoteObject.entry = remoteObject.entry.replace(import_constant.LOCALHOST, ipv4);
90
- } else {
91
- handleRemoteObject(remoteObject);
92
- }
87
+ handleRemoteObject(remoteObject);
93
88
  });
94
89
  } else if (typeof mfConfig.remotes !== "string") {
95
90
  handleRemoteObject(mfConfig.remotes);
@@ -334,6 +329,5 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
334
329
  getMFConfig,
335
330
  patchBundlerConfig,
336
331
  patchIgnoreWarning,
337
- patchMFConfig,
338
- replaceRemoteUrl
332
+ patchMFConfig
339
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,18 +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
- pre: [
41
- "@modern-js/plugin-router"
42
- ],
43
39
  setup: () => {
44
40
  return {
45
- async beforeRender() {
46
- console.log(111, "beforeRender");
41
+ async init({ context }, next) {
47
42
  if (typeof window !== "undefined") {
48
- return;
43
+ return next({
44
+ context
45
+ });
49
46
  }
50
47
  globalThis.shouldUpdate = false;
51
48
  const nodeUtils = await Promise.resolve().then(() => __toESM(require("@module-federation/node/utils")));
@@ -55,7 +52,9 @@ const mfSSRPlugin = () => ({
55
52
  await nodeUtils.flushChunks();
56
53
  globalThis.shouldUpdate = true;
57
54
  }
58
- return;
55
+ return next({
56
+ context
57
+ });
59
58
  },
60
59
  wrapRoot(App) {
61
60
  const AppWrapper = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
@@ -1,8 +1,4 @@
1
1
  var isDev = process.env.NODE_ENV === "development";
2
- var MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
3
- var META_NAME = "modern-js";
4
2
  export {
5
- META_NAME,
6
- MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME,
7
3
  isDev
8
4
  };
@@ -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 { UniverseEntryChunkTrackerPlugin } from "@module-federation/node";
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() {
@@ -79,11 +79,7 @@ var replaceRemoteUrl = function(mfConfig, remoteIpStrategy) {
79
79
  if (typeof remoteObject === "string") {
80
80
  return;
81
81
  }
82
- if (remoteObject.entry && typeof remoteObject.entry === "string") {
83
- remoteObject.entry = remoteObject.entry.replace(LOCALHOST, ipv4);
84
- } else {
85
- handleRemoteObject(remoteObject);
86
- }
82
+ handleRemoteObject(remoteObject);
87
83
  });
88
84
  } else if (typeof mfConfig.remotes !== "string") {
89
85
  handleRemoteObject(mfConfig.remotes);
@@ -343,6 +339,5 @@ export {
343
339
  getMFConfig,
344
340
  patchBundlerConfig,
345
341
  patchIgnoreWarning,
346
- patchMFConfig,
347
- replaceRemoteUrl
342
+ patchMFConfig
348
343
  };
@@ -1,7 +1,5 @@
1
1
  export * from "@module-federation/enhanced/runtime";
2
2
  import { createRemoteSSRComponent } from "./createRemoteSSRComponent";
3
- import { withMFRouteId } from "./withMFRouteId";
4
3
  export {
5
- createRemoteSSRComponent,
6
- withMFRouteId
4
+ createRemoteSSRComponent
7
5
  };
@@ -4,25 +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
- pre: [
12
- "@modern-js/plugin-router"
13
- ],
14
10
  setup: function() {
15
11
  return {
16
- beforeRender: function beforeRender() {
12
+ init: function init(param, next) {
13
+ var context = param.context;
17
14
  return _async_to_generator(function() {
18
15
  var nodeUtils, shouldUpdate;
19
16
  return _ts_generator(this, function(_state) {
20
17
  switch (_state.label) {
21
18
  case 0:
22
- console.log(111, "beforeRender");
23
19
  if (typeof window !== "undefined") {
24
20
  return [
25
- 2
21
+ 2,
22
+ next({
23
+ context
24
+ })
26
25
  ];
27
26
  }
28
27
  globalThis.shouldUpdate = false;
@@ -54,7 +53,10 @@ var mfSSRPlugin = function() {
54
53
  _state.label = 4;
55
54
  case 4:
56
55
  return [
57
- 2
56
+ 2,
57
+ next({
58
+ context
59
+ })
58
60
  ];
59
61
  }
60
62
  });
@@ -1,8 +1,4 @@
1
1
  const isDev = process.env.NODE_ENV === "development";
2
- const MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
3
- const META_NAME = "modern-js";
4
2
  export {
5
- META_NAME,
6
- MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME,
7
3
  isDev
8
4
  };
@@ -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 { UniverseEntryChunkTrackerPlugin } from "@module-federation/node";
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() {
@@ -47,11 +47,7 @@ const replaceRemoteUrl = (mfConfig, remoteIpStrategy) => {
47
47
  if (typeof remoteObject === "string") {
48
48
  return;
49
49
  }
50
- if (remoteObject.entry && typeof remoteObject.entry === "string") {
51
- remoteObject.entry = remoteObject.entry.replace(LOCALHOST, ipv4);
52
- } else {
53
- handleRemoteObject(remoteObject);
54
- }
50
+ handleRemoteObject(remoteObject);
55
51
  });
56
52
  } else if (typeof mfConfig.remotes !== "string") {
57
53
  handleRemoteObject(mfConfig.remotes);
@@ -295,6 +291,5 @@ export {
295
291
  getMFConfig,
296
292
  patchBundlerConfig,
297
293
  patchIgnoreWarning,
298
- patchMFConfig,
299
- replaceRemoteUrl
294
+ patchMFConfig
300
295
  };
@@ -1,7 +1,5 @@
1
1
  export * from "@module-federation/enhanced/runtime";
2
2
  import { createRemoteSSRComponent } from "./createRemoteSSRComponent";
3
- import { withMFRouteId } from "./withMFRouteId";
4
3
  export {
5
- createRemoteSSRComponent,
6
- withMFRouteId
4
+ createRemoteSSRComponent
7
5
  };
@@ -1,18 +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
- pre: [
8
- "@modern-js/plugin-router"
9
- ],
10
6
  setup: () => {
11
7
  return {
12
- async beforeRender() {
13
- console.log(111, "beforeRender");
8
+ async init({ context }, next) {
14
9
  if (typeof window !== "undefined") {
15
- return;
10
+ return next({
11
+ context
12
+ });
16
13
  }
17
14
  globalThis.shouldUpdate = false;
18
15
  const nodeUtils = await import("@module-federation/node/utils");
@@ -22,7 +19,9 @@ const mfSSRPlugin = () => ({
22
19
  await nodeUtils.flushChunks();
23
20
  globalThis.shouldUpdate = true;
24
21
  }
25
- return;
22
+ return next({
23
+ context
24
+ });
26
25
  },
27
26
  wrapRoot(App) {
28
27
  const AppWrapper = (props) => /* @__PURE__ */ _jsxs(_Fragment, {
@@ -1,3 +1 @@
1
1
  export declare const isDev: boolean;
2
- export declare const MODERN_JS_FILE_SYSTEM_ROUTES_FILE_NAME = "routes.js";
3
- export declare const META_NAME = "modern-js";
@@ -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,3 +1,2 @@
1
1
  export * from '@module-federation/enhanced/runtime';
2
2
  export { createRemoteSSRComponent } from './createRemoteSSRComponent';
3
- export { withMFRouteId } from './withMFRouteId';
@@ -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,12 +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
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20240819112150",
3
+ "version": "0.0.0-next-20240821075411",
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,15 +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
- ],
70
- "data-loader-server": [
71
- "./dist/types/cli/server/dataLoaderPlugin.d.ts"
72
50
  ]
73
51
  }
74
52
  },
@@ -77,31 +55,24 @@
77
55
  "author": "hanric <hanric.zhang@gmail.com>",
78
56
  "license": "MIT",
79
57
  "dependencies": {
80
- "@swc/helpers": "0.5.3",
58
+ "@swc/helpers": "0.5.12",
81
59
  "@modern-js/utils": "2.54.2",
82
60
  "@modern-js/node-bundle-require": "2.54.2",
83
61
  "node-fetch": "~3.3.0",
84
62
  "react-error-boundary": "4.0.13",
85
63
  "hoist-non-react-statics": "3.3.2",
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-20240819112150",
91
- "@module-federation/enhanced": "0.0.0-next-20240819112150",
92
- "@module-federation/node": "0.0.0-next-20240819112150"
64
+ "@module-federation/sdk": "0.0.0-next-20240821075411",
65
+ "@module-federation/enhanced": "0.0.0-next-20240821075411",
66
+ "@module-federation/node": "0.0.0-next-20240821075411"
93
67
  },
94
68
  "devDependencies": {
95
- "@types/babel__traverse": "7.20.6",
96
- "@types/babel__generator": "7.6.8",
97
69
  "@types/hoist-non-react-statics": "3.3.2",
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-20240819112150"
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-20240821075411"
105
76
  },
106
77
  "peerDependencies": {
107
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
- });