@module-federation/modern-js 0.0.0-next-20240515104620 → 0.0.0-next-20240515113919

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.
@@ -0,0 +1 @@
1
+ # @module-federation/modern-js
package/dist/README.md ADDED
@@ -0,0 +1 @@
1
+ # @module-federation/modern-js
@@ -49,7 +49,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
49
49
  const enableSSR = Boolean(useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_server = useConfig.server) === null || _useConfig_server === void 0 ? void 0 : _useConfig_server.ssr);
50
50
  const mfConfig = await (0, import_utils2.getMFConfig)(userConfig);
51
51
  let outputDir = "";
52
- const WebpackPluginConstructor = userConfig.webpackPluginImplementation || import_enhanced.ModuleFederationPlugin;
52
+ const PluginConstructor = userConfig.bundlerPluginImplementation || import_enhanced.ModuleFederationPlugin;
53
53
  let browserPlugin;
54
54
  let nodePlugin;
55
55
  return {
@@ -65,13 +65,13 @@ const moduleFederationPlugin = (userConfig = {}) => ({
65
65
  const envConfig = (0, import_utils2.getTargetEnvConfig)(mfConfig, isServer);
66
66
  if (isServer) {
67
67
  var _config_plugins, _config_plugins1;
68
- nodePlugin = new WebpackPluginConstructor(envConfig);
68
+ nodePlugin = new PluginConstructor(envConfig);
69
69
  (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(nodePlugin);
70
70
  (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(new import_node.StreamingTargetPlugin(envConfig));
71
71
  } else {
72
72
  var _config_output, _config_plugins2;
73
73
  outputDir = ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || import_path.default.resolve(process.cwd(), "dist");
74
- browserPlugin = new WebpackPluginConstructor(envConfig);
74
+ browserPlugin = new PluginConstructor(envConfig);
75
75
  (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
76
76
  }
77
77
  (0, import_utils2.patchWebpackConfig)({
@@ -13,7 +13,7 @@ var moduleFederationPlugin = function() {
13
13
  name: "@modern-js/plugin-module-federation",
14
14
  setup: function() {
15
15
  var _ref = _async_to_generator(function(param) {
16
- var useConfigContext, _useConfig_server, useConfig, enableSSR, mfConfig, outputDir, WebpackPluginConstructor, browserPlugin, nodePlugin;
16
+ var useConfigContext, _useConfig_server, useConfig, enableSSR, mfConfig, outputDir, PluginConstructor, browserPlugin, nodePlugin;
17
17
  return _ts_generator(this, function(_state) {
18
18
  switch (_state.label) {
19
19
  case 0:
@@ -27,7 +27,7 @@ var moduleFederationPlugin = function() {
27
27
  case 1:
28
28
  mfConfig = _state.sent();
29
29
  outputDir = "";
30
- WebpackPluginConstructor = userConfig.webpackPluginImplementation || ModuleFederationPlugin;
30
+ PluginConstructor = userConfig.bundlerPluginImplementation || ModuleFederationPlugin;
31
31
  return [
32
32
  2,
33
33
  {
@@ -44,13 +44,13 @@ var moduleFederationPlugin = function() {
44
44
  var envConfig = getTargetEnvConfig(mfConfig, isServer);
45
45
  if (isServer) {
46
46
  var _config_plugins, _config_plugins1;
47
- nodePlugin = new WebpackPluginConstructor(envConfig);
47
+ nodePlugin = new PluginConstructor(envConfig);
48
48
  (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(nodePlugin);
49
49
  (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(new StreamingTargetPlugin(envConfig));
50
50
  } else {
51
51
  var _config_output, _config_plugins2;
52
52
  outputDir = ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
53
- browserPlugin = new WebpackPluginConstructor(envConfig);
53
+ browserPlugin = new PluginConstructor(envConfig);
54
54
  (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
55
55
  }
56
56
  patchWebpackConfig({
@@ -13,7 +13,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
13
13
  const enableSSR = Boolean(useConfig === null || useConfig === void 0 ? void 0 : (_useConfig_server = useConfig.server) === null || _useConfig_server === void 0 ? void 0 : _useConfig_server.ssr);
14
14
  const mfConfig = await getMFConfig(userConfig);
15
15
  let outputDir = "";
16
- const WebpackPluginConstructor = userConfig.webpackPluginImplementation || ModuleFederationPlugin;
16
+ const PluginConstructor = userConfig.bundlerPluginImplementation || ModuleFederationPlugin;
17
17
  let browserPlugin;
18
18
  let nodePlugin;
19
19
  return {
@@ -29,13 +29,13 @@ const moduleFederationPlugin = (userConfig = {}) => ({
29
29
  const envConfig = getTargetEnvConfig(mfConfig, isServer);
30
30
  if (isServer) {
31
31
  var _config_plugins, _config_plugins1;
32
- nodePlugin = new WebpackPluginConstructor(envConfig);
32
+ nodePlugin = new PluginConstructor(envConfig);
33
33
  (_config_plugins = config.plugins) === null || _config_plugins === void 0 ? void 0 : _config_plugins.push(nodePlugin);
34
34
  (_config_plugins1 = config.plugins) === null || _config_plugins1 === void 0 ? void 0 : _config_plugins1.push(new StreamingTargetPlugin(envConfig));
35
35
  } else {
36
36
  var _config_output, _config_plugins2;
37
37
  outputDir = ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.path) || path.resolve(process.cwd(), "dist");
38
- browserPlugin = new WebpackPluginConstructor(envConfig);
38
+ browserPlugin = new PluginConstructor(envConfig);
39
39
  (_config_plugins2 = config.plugins) === null || _config_plugins2 === void 0 ? void 0 : _config_plugins2.push(browserPlugin);
40
40
  }
41
41
  patchWebpackConfig({
@@ -1,2 +1,2 @@
1
- import { ModuleFederationPlugin } from '@module-federation/enhanced';
2
- export declare function updateStatsAndManifest(nodePlugin: ModuleFederationPlugin, browserPlugin: ModuleFederationPlugin, outputDir: string): void;
1
+ import { BundlerPlugin } from '../types';
2
+ export declare function updateStatsAndManifest(nodePlugin: BundlerPlugin, browserPlugin: BundlerPlugin, outputDir: string): void;
@@ -1,9 +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
+ export type BundlerPluginImplementation = typeof WebpackModuleFederationPlugin | typeof RspackModuleFederationPlugin;
5
+ export type BundlerPlugin = WebpackModuleFederationPlugin | RspackModuleFederationPlugin;
4
6
  export interface PluginOptions {
5
7
  config?: moduleFederationPlugin.ModuleFederationPluginOptions;
6
8
  configPath?: string;
7
- webpackPluginImplementation?: typeof WebpackModuleFederationPlugin;
8
- rspackPluginImplementation?: typeof RspackModuleFederationPlugin;
9
+ bundlerPluginImplementation?: BundlerPluginImplementation;
9
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20240515104620",
3
+ "version": "0.0.0-next-20240515113919",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -38,9 +38,9 @@
38
38
  "@swc/helpers": "0.5.3",
39
39
  "@modern-js/utils": "^2.49.2",
40
40
  "@modern-js/node-bundle-require": "^2.49.2",
41
- "@module-federation/sdk": "0.0.0-next-20240515104620",
42
- "@module-federation/enhanced": "0.0.0-next-20240515104620",
43
- "@module-federation/node": "0.0.0-next-20240515104620"
41
+ "@module-federation/sdk": "0.0.0-next-20240515113919",
42
+ "@module-federation/enhanced": "0.0.0-next-20240515113919",
43
+ "@module-federation/node": "0.0.0-next-20240515113919"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@modern-js/app-tools": "^2.49.2",
@@ -48,7 +48,7 @@
48
48
  "@modern-js/runtime": "^2.49.2",
49
49
  "@modern-js/module-tools": "^2.35.0",
50
50
  "@modern-js/tsconfig": "^2.35.0",
51
- "@module-federation/manifest": "0.0.0-next-20240515104620"
51
+ "@module-federation/manifest": "0.0.0-next-20240515113919"
52
52
  },
53
53
  "scripts": {
54
54
  "build": "modern build"