@module-federation/modern-js 0.6.13 → 0.6.15

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.
@@ -112,7 +112,7 @@ const moduleFederationConfigPlugin = (userConfig) => ({
112
112
  headers: {
113
113
  "Access-Control-Allow-Origin": "*",
114
114
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
115
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
115
+ "Access-Control-Allow-Headers": "*"
116
116
  }
117
117
  }
118
118
  },
@@ -0,0 +1,27 @@
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 logger_exports = {};
20
+ __export(logger_exports, {
21
+ default: () => logger_default
22
+ });
23
+ module.exports = __toCommonJS(logger_exports);
24
+ var import_sdk = require("@module-federation/sdk");
25
+ var import_constant = require("../constant");
26
+ const logger = (0, import_sdk.createLogger)(import_constant.PLUGIN_IDENTIFIER);
27
+ var logger_default = logger;
@@ -40,6 +40,7 @@ var import_rspack = require("@module-federation/enhanced/rspack");
40
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
+ var import_logger = __toESM(require("./logger"));
43
44
  function setEnv() {
44
45
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
45
46
  process.env["MF_SSR_PRJ"] = "true";
@@ -117,15 +118,13 @@ const moduleFederationSSRPlugin = (userConfig) => ({
117
118
  import_utils.fs.statSync(filepath);
118
119
  res.setHeader("Access-Control-Allow-Origin", "*");
119
120
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
120
- res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
121
+ res.setHeader("Access-Control-Allow-Headers", "*");
121
122
  import_utils.fs.createReadStream(filepath).pipe(res);
122
123
  } else {
123
124
  next();
124
125
  }
125
126
  } catch (err) {
126
- if (process.env.FEDERATION_DEBUG) {
127
- console.error(err);
128
- }
127
+ import_logger.default.debug(err);
129
128
  next();
130
129
  }
131
130
  }
@@ -40,6 +40,7 @@ var import_path = __toESM(require("path"));
40
40
  var import_os = __toESM(require("os"));
41
41
  var import_node_bundle_require = require("@modern-js/node-bundle-require");
42
42
  var import_constant = require("../constant");
43
+ var import_logger = __toESM(require("./logger"));
43
44
  const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
44
45
  const isDev = process.env.NODE_ENV === "development";
45
46
  const getMFConfig = async (userConfig) => {
@@ -225,7 +226,7 @@ function patchBundlerConfig(options) {
225
226
  }
226
227
  if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
227
228
  bundlerConfig.optimization.splitChunks.chunks = "async";
228
- console.warn(`${import_constant.PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
229
+ import_logger.default.warn(`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
229
230
  }
230
231
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
231
232
  var _modernjsConfig_dev, _modernjsConfig_server1;
@@ -96,7 +96,7 @@ var moduleFederationConfigPlugin = function(userConfig) {
96
96
  headers: {
97
97
  "Access-Control-Allow-Origin": "*",
98
98
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
99
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
99
+ "Access-Control-Allow-Headers": "*"
100
100
  }
101
101
  }
102
102
  },
@@ -0,0 +1,7 @@
1
+ import { createLogger } from "@module-federation/sdk";
2
+ import { PLUGIN_IDENTIFIER } from "../constant";
3
+ var logger = createLogger(PLUGIN_IDENTIFIER);
4
+ var logger_default = logger;
5
+ export {
6
+ logger_default as default
7
+ };
@@ -7,6 +7,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
7
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
+ import logger from "./logger";
10
11
  function setEnv() {
11
12
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
12
13
  process.env["MF_SSR_PRJ"] = "true";
@@ -99,15 +100,13 @@ var moduleFederationSSRPlugin = function(userConfig) {
99
100
  fs.statSync(filepath);
100
101
  res.setHeader("Access-Control-Allow-Origin", "*");
101
102
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
102
- res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
103
+ res.setHeader("Access-Control-Allow-Headers", "*");
103
104
  fs.createReadStream(filepath).pipe(res);
104
105
  } else {
105
106
  next();
106
107
  }
107
108
  } catch (err) {
108
- if (process.env.FEDERATION_DEBUG) {
109
- console.error(err);
110
- }
109
+ logger.debug(err);
111
110
  next();
112
111
  }
113
112
  }
@@ -9,6 +9,7 @@ import path from "path";
9
9
  import os from "os";
10
10
  import { bundle } from "@modern-js/node-bundle-require";
11
11
  import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
12
+ import logger from "./logger";
12
13
  var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
13
14
  var isDev = process.env.NODE_ENV === "development";
14
15
  var getMFConfig = function() {
@@ -221,7 +222,7 @@ function patchBundlerConfig(options) {
221
222
  }
222
223
  if (!isServer && enableSSR && _type_of((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
223
224
  bundlerConfig.optimization.splitChunks.chunks = "async";
224
- console.warn("".concat(PLUGIN_IDENTIFIER, ' splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"'));
225
+ logger.warn('splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
225
226
  }
226
227
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
227
228
  var _modernjsConfig_dev, _modernjsConfig_server1;
@@ -76,7 +76,7 @@ const moduleFederationConfigPlugin = (userConfig) => ({
76
76
  headers: {
77
77
  "Access-Control-Allow-Origin": "*",
78
78
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS",
79
- "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
79
+ "Access-Control-Allow-Headers": "*"
80
80
  }
81
81
  }
82
82
  },
@@ -0,0 +1,7 @@
1
+ import { createLogger } from "@module-federation/sdk";
2
+ import { PLUGIN_IDENTIFIER } from "../constant";
3
+ const logger = createLogger(PLUGIN_IDENTIFIER);
4
+ var logger_default = logger;
5
+ export {
6
+ logger_default as default
7
+ };
@@ -5,6 +5,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
5
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
+ import logger from "./logger";
8
9
  function setEnv() {
9
10
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
10
11
  process.env["MF_SSR_PRJ"] = "true";
@@ -82,15 +83,13 @@ const moduleFederationSSRPlugin = (userConfig) => ({
82
83
  fs.statSync(filepath);
83
84
  res.setHeader("Access-Control-Allow-Origin", "*");
84
85
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
85
- res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
86
+ res.setHeader("Access-Control-Allow-Headers", "*");
86
87
  fs.createReadStream(filepath).pipe(res);
87
88
  } else {
88
89
  next();
89
90
  }
90
91
  } catch (err) {
91
- if (process.env.FEDERATION_DEBUG) {
92
- console.error(err);
93
- }
92
+ logger.debug(err);
94
93
  next();
95
94
  }
96
95
  }
@@ -3,6 +3,7 @@ import path from "path";
3
3
  import os from "os";
4
4
  import { bundle } from "@modern-js/node-bundle-require";
5
5
  import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
6
+ import logger from "./logger";
6
7
  const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
7
8
  const isDev = process.env.NODE_ENV === "development";
8
9
  const getMFConfig = async (userConfig) => {
@@ -188,7 +189,7 @@ function patchBundlerConfig(options) {
188
189
  }
189
190
  if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
190
191
  bundlerConfig.optimization.splitChunks.chunks = "async";
191
- console.warn(`${PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
192
+ logger.warn(`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
192
193
  }
193
194
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
194
195
  var _modernjsConfig_dev, _modernjsConfig_server1;
@@ -0,0 +1,2 @@
1
+ declare const logger: import("@module-federation/sdk").Logger;
2
+ export default logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.6.13",
3
+ "version": "0.6.15",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -61,9 +61,9 @@
61
61
  "hoist-non-react-statics": "3.3.2",
62
62
  "node-fetch": "~3.3.0",
63
63
  "react-error-boundary": "4.0.13",
64
- "@module-federation/enhanced": "0.6.13",
65
- "@module-federation/node": "2.6.1",
66
- "@module-federation/sdk": "0.6.13"
64
+ "@module-federation/enhanced": "0.6.15",
65
+ "@module-federation/node": "2.6.3",
66
+ "@module-federation/sdk": "0.6.15"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@modern-js/app-tools": "2.60.3",
@@ -72,7 +72,7 @@
72
72
  "@modern-js/runtime": "2.60.3",
73
73
  "@modern-js/tsconfig": "2.60.3",
74
74
  "@types/hoist-non-react-statics": "3.3.5",
75
- "@module-federation/manifest": "0.6.13"
75
+ "@module-federation/manifest": "0.6.15"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": ">=17",