@module-federation/modern-js 0.0.0-next-20241213035216 → 0.0.0-next-20241216024258

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.
@@ -36,8 +36,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
36
36
  nodePlugin: void 0,
37
37
  distOutputDir: "",
38
38
  originPluginOptions: userConfig,
39
- remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
40
- userConfig
39
+ remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy
41
40
  };
42
41
  return {
43
42
  name: "@modern-js/plugin-module-federation",
@@ -45,17 +45,17 @@ function setEnv() {
45
45
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
46
46
  process.env["MF_SSR_PRJ"] = "true";
47
47
  }
48
- const moduleFederationSSRPlugin = (pluginOptions) => ({
48
+ const moduleFederationSSRPlugin = (userConfig) => ({
49
49
  name: "@modern-js/plugin-module-federation-ssr",
50
50
  pre: [
51
51
  "@modern-js/plugin-module-federation-config",
52
52
  "@modern-js/plugin-module-federation"
53
53
  ],
54
54
  setup: async ({ useConfigContext, useAppContext }) => {
55
- var _modernjsConfig_server, _pluginOptions_userConfig;
55
+ var _modernjsConfig_server;
56
56
  const modernjsConfig = useConfigContext();
57
57
  const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
58
- if (!enableSSR || ((_pluginOptions_userConfig = pluginOptions.userConfig) === null || _pluginOptions_userConfig === void 0 ? void 0 : _pluginOptions_userConfig.disableSSR)) {
58
+ if (!enableSSR) {
59
59
  return {};
60
60
  }
61
61
  setEnv();
@@ -82,26 +82,26 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
82
82
  tools: {
83
83
  rspack(config, { isServer }) {
84
84
  if (isServer) {
85
- if (!pluginOptions.nodePlugin) {
85
+ if (!userConfig.nodePlugin) {
86
86
  var _config_plugins;
87
- pluginOptions.nodePlugin = new import_rspack.ModuleFederationPlugin(pluginOptions.ssrConfig);
88
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
87
+ userConfig.nodePlugin = new import_rspack.ModuleFederationPlugin(userConfig.ssrConfig);
88
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
89
89
  }
90
90
  } else {
91
91
  var _config_output;
92
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
92
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
93
93
  }
94
94
  },
95
95
  webpack(config, { isServer }) {
96
96
  if (isServer) {
97
- if (!pluginOptions.nodePlugin) {
97
+ if (!userConfig.nodePlugin) {
98
98
  var _config_plugins;
99
- pluginOptions.nodePlugin = new import_webpack.ModuleFederationPlugin(pluginOptions.ssrConfig);
100
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
99
+ userConfig.nodePlugin = new import_webpack.ModuleFederationPlugin(userConfig.ssrConfig);
100
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
101
101
  }
102
102
  } else {
103
103
  var _config_output;
104
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
104
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
105
105
  }
106
106
  },
107
107
  devServer: {
@@ -147,11 +147,11 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
147
147
  };
148
148
  },
149
149
  afterBuild: () => {
150
- const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
150
+ const { nodePlugin, browserPlugin, distOutputDir } = userConfig;
151
151
  (0, import_manifest.updateStatsAndManifest)(nodePlugin, browserPlugin, distOutputDir);
152
152
  },
153
153
  afterDev: () => {
154
- const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
154
+ const { nodePlugin, browserPlugin, distOutputDir } = userConfig;
155
155
  (0, import_manifest.updateStatsAndManifest)(nodePlugin, browserPlugin, distOutputDir);
156
156
  }
157
157
  };
@@ -14,8 +14,7 @@ var moduleFederationPlugin = function() {
14
14
  nodePlugin: void 0,
15
15
  distOutputDir: "",
16
16
  originPluginOptions: userConfig,
17
- remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
18
- userConfig
17
+ remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy
19
18
  };
20
19
  return {
21
20
  name: "@modern-js/plugin-module-federation",
@@ -12,7 +12,7 @@ function setEnv() {
12
12
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
13
13
  process.env["MF_SSR_PRJ"] = "true";
14
14
  }
15
- var moduleFederationSSRPlugin = function(pluginOptions) {
15
+ var moduleFederationSSRPlugin = function(userConfig) {
16
16
  return {
17
17
  name: "@modern-js/plugin-module-federation-ssr",
18
18
  pre: [
@@ -21,12 +21,12 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
21
21
  ],
22
22
  setup: function() {
23
23
  var _ref = _async_to_generator(function(param) {
24
- var useConfigContext, useAppContext, _modernjsConfig_server, _pluginOptions_userConfig, modernjsConfig, enableSSR;
24
+ var useConfigContext, useAppContext, _modernjsConfig_server, modernjsConfig, enableSSR;
25
25
  return _ts_generator(this, function(_state) {
26
26
  useConfigContext = param.useConfigContext, useAppContext = param.useAppContext;
27
27
  modernjsConfig = useConfigContext();
28
28
  enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
29
- if (!enableSSR || ((_pluginOptions_userConfig = pluginOptions.userConfig) === null || _pluginOptions_userConfig === void 0 ? void 0 : _pluginOptions_userConfig.disableSSR)) {
29
+ if (!enableSSR) {
30
30
  return [
31
31
  2,
32
32
  {}
@@ -63,27 +63,27 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
63
63
  rspack: function rspack(config, param2) {
64
64
  var isServer = param2.isServer;
65
65
  if (isServer) {
66
- if (!pluginOptions.nodePlugin) {
66
+ if (!userConfig.nodePlugin) {
67
67
  var _config_plugins;
68
- pluginOptions.nodePlugin = new RspackModuleFederationPlugin(pluginOptions.ssrConfig);
69
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
68
+ userConfig.nodePlugin = new RspackModuleFederationPlugin(userConfig.ssrConfig);
69
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
70
70
  }
71
71
  } else {
72
72
  var _config_output;
73
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
73
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
74
74
  }
75
75
  },
76
76
  webpack: function webpack(config, param2) {
77
77
  var isServer = param2.isServer;
78
78
  if (isServer) {
79
- if (!pluginOptions.nodePlugin) {
79
+ if (!userConfig.nodePlugin) {
80
80
  var _config_plugins;
81
- pluginOptions.nodePlugin = new ModuleFederationPlugin(pluginOptions.ssrConfig);
82
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
81
+ userConfig.nodePlugin = new ModuleFederationPlugin(userConfig.ssrConfig);
82
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
83
83
  }
84
84
  } else {
85
85
  var _config_output;
86
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
86
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
87
87
  }
88
88
  },
89
89
  devServer: {
@@ -132,11 +132,11 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
132
132
  });
133
133
  }),
134
134
  afterBuild: function() {
135
- var nodePlugin = pluginOptions.nodePlugin, browserPlugin = pluginOptions.browserPlugin, distOutputDir = pluginOptions.distOutputDir;
135
+ var nodePlugin = userConfig.nodePlugin, browserPlugin = userConfig.browserPlugin, distOutputDir = userConfig.distOutputDir;
136
136
  updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
137
137
  },
138
138
  afterDev: function() {
139
- var nodePlugin = pluginOptions.nodePlugin, browserPlugin = pluginOptions.browserPlugin, distOutputDir = pluginOptions.distOutputDir;
139
+ var nodePlugin = userConfig.nodePlugin, browserPlugin = userConfig.browserPlugin, distOutputDir = userConfig.distOutputDir;
140
140
  updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
141
141
  }
142
142
  }
@@ -10,8 +10,7 @@ const moduleFederationPlugin = (userConfig = {}) => {
10
10
  nodePlugin: void 0,
11
11
  distOutputDir: "",
12
12
  originPluginOptions: userConfig,
13
- remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy,
14
- userConfig
13
+ remoteIpStrategy: userConfig === null || userConfig === void 0 ? void 0 : userConfig.remoteIpStrategy
15
14
  };
16
15
  return {
17
16
  name: "@modern-js/plugin-module-federation",
@@ -10,17 +10,17 @@ function setEnv() {
10
10
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
11
11
  process.env["MF_SSR_PRJ"] = "true";
12
12
  }
13
- const moduleFederationSSRPlugin = (pluginOptions) => ({
13
+ const moduleFederationSSRPlugin = (userConfig) => ({
14
14
  name: "@modern-js/plugin-module-federation-ssr",
15
15
  pre: [
16
16
  "@modern-js/plugin-module-federation-config",
17
17
  "@modern-js/plugin-module-federation"
18
18
  ],
19
19
  setup: async ({ useConfigContext, useAppContext }) => {
20
- var _modernjsConfig_server, _pluginOptions_userConfig;
20
+ var _modernjsConfig_server;
21
21
  const modernjsConfig = useConfigContext();
22
22
  const enableSSR = Boolean(modernjsConfig === null || modernjsConfig === void 0 ? void 0 : (_modernjsConfig_server = modernjsConfig.server) === null || _modernjsConfig_server === void 0 ? void 0 : _modernjsConfig_server.ssr);
23
- if (!enableSSR || ((_pluginOptions_userConfig = pluginOptions.userConfig) === null || _pluginOptions_userConfig === void 0 ? void 0 : _pluginOptions_userConfig.disableSSR)) {
23
+ if (!enableSSR) {
24
24
  return {};
25
25
  }
26
26
  setEnv();
@@ -47,26 +47,26 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
47
47
  tools: {
48
48
  rspack(config, { isServer }) {
49
49
  if (isServer) {
50
- if (!pluginOptions.nodePlugin) {
50
+ if (!userConfig.nodePlugin) {
51
51
  var _config_plugins;
52
- pluginOptions.nodePlugin = new RspackModuleFederationPlugin(pluginOptions.ssrConfig);
53
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
52
+ userConfig.nodePlugin = new RspackModuleFederationPlugin(userConfig.ssrConfig);
53
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
54
54
  }
55
55
  } else {
56
56
  var _config_output;
57
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
57
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
58
58
  }
59
59
  },
60
60
  webpack(config, { isServer }) {
61
61
  if (isServer) {
62
- if (!pluginOptions.nodePlugin) {
62
+ if (!userConfig.nodePlugin) {
63
63
  var _config_plugins;
64
- pluginOptions.nodePlugin = new ModuleFederationPlugin(pluginOptions.ssrConfig);
65
- (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(pluginOptions.nodePlugin);
64
+ userConfig.nodePlugin = new ModuleFederationPlugin(userConfig.ssrConfig);
65
+ (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(userConfig.nodePlugin);
66
66
  }
67
67
  } else {
68
68
  var _config_output;
69
- pluginOptions.distOutputDir = pluginOptions.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
69
+ userConfig.distOutputDir = userConfig.distOutputDir || ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
70
70
  }
71
71
  },
72
72
  devServer: {
@@ -112,11 +112,11 @@ const moduleFederationSSRPlugin = (pluginOptions) => ({
112
112
  };
113
113
  },
114
114
  afterBuild: () => {
115
- const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
115
+ const { nodePlugin, browserPlugin, distOutputDir } = userConfig;
116
116
  updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
117
117
  },
118
118
  afterDev: () => {
119
- const { nodePlugin, browserPlugin, distOutputDir } = pluginOptions;
119
+ const { nodePlugin, browserPlugin, distOutputDir } = userConfig;
120
120
  updateStatsAndManifest(nodePlugin, browserPlugin, distOutputDir);
121
121
  }
122
122
  };
@@ -1,5 +1,5 @@
1
1
  import type { CliPlugin, AppTools } from '@modern-js/app-tools';
2
2
  import type { InternalModernPluginOptions } from '../types';
3
3
  export declare function setEnv(): void;
4
- export declare const moduleFederationSSRPlugin: (pluginOptions: Required<InternalModernPluginOptions>) => CliPlugin<AppTools>;
4
+ export declare const moduleFederationSSRPlugin: (userConfig: Required<InternalModernPluginOptions>) => CliPlugin<AppTools>;
5
5
  export default moduleFederationSSRPlugin;
@@ -4,7 +4,6 @@ import type { ModuleFederationPlugin as RspackModuleFederationPlugin } from '@mo
4
4
  export interface PluginOptions {
5
5
  config?: moduleFederationPlugin.ModuleFederationPluginOptions;
6
6
  configPath?: string;
7
- disableSSR?: boolean;
8
7
  remoteIpStrategy?: 'ipv4' | 'inherit';
9
8
  }
10
9
  export interface InternalModernPluginOptions {
@@ -15,6 +14,5 @@ export interface InternalModernPluginOptions {
15
14
  browserPlugin?: BundlerPlugin;
16
15
  nodePlugin?: BundlerPlugin;
17
16
  remoteIpStrategy?: 'ipv4' | 'inherit';
18
- userConfig?: PluginOptions;
19
17
  }
20
18
  export type BundlerPlugin = WebpackModuleFederationPlugin | RspackModuleFederationPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20241213035216",
3
+ "version": "0.0.0-next-20241216024258",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -90,9 +90,9 @@
90
90
  "hoist-non-react-statics": "3.3.2",
91
91
  "node-fetch": "~3.3.0",
92
92
  "react-error-boundary": "4.0.13",
93
- "@module-federation/enhanced": "0.0.0-next-20241213035216",
94
- "@module-federation/node": "0.0.0-next-20241213035216",
95
- "@module-federation/sdk": "0.0.0-next-20241213035216"
93
+ "@module-federation/enhanced": "0.0.0-next-20241216024258",
94
+ "@module-federation/node": "0.0.0-next-20241216024258",
95
+ "@module-federation/sdk": "0.0.0-next-20241216024258"
96
96
  },
97
97
  "devDependencies": {
98
98
  "@modern-js/app-tools": "2.60.6",
@@ -101,7 +101,7 @@
101
101
  "@modern-js/runtime": "2.60.6",
102
102
  "@modern-js/tsconfig": "2.60.6",
103
103
  "@types/hoist-non-react-statics": "3.3.5",
104
- "@module-federation/manifest": "0.0.0-next-20241213035216"
104
+ "@module-federation/manifest": "0.0.0-next-20241216024258"
105
105
  },
106
106
  "peerDependencies": {
107
107
  "react": ">=17",