@module-federation/modern-js 0.0.0-next-20241104024700 → 0.0.0-next-20241104073605

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": "*"
115
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
116
116
  }
117
117
  }
118
118
  },
@@ -40,7 +40,6 @@ 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"));
44
43
  function setEnv() {
45
44
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
46
45
  process.env["MF_SSR_PRJ"] = "true";
@@ -118,13 +117,15 @@ const moduleFederationSSRPlugin = (userConfig) => ({
118
117
  import_utils.fs.statSync(filepath);
119
118
  res.setHeader("Access-Control-Allow-Origin", "*");
120
119
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
121
- res.setHeader("Access-Control-Allow-Headers", "*");
120
+ res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
122
121
  import_utils.fs.createReadStream(filepath).pipe(res);
123
122
  } else {
124
123
  next();
125
124
  }
126
125
  } catch (err) {
127
- import_logger.default.debug(err);
126
+ if (process.env.FEDERATION_DEBUG) {
127
+ console.error(err);
128
+ }
128
129
  next();
129
130
  }
130
131
  }
@@ -40,7 +40,6 @@ 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"));
44
43
  const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
45
44
  const isDev = process.env.NODE_ENV === "development";
46
45
  const getMFConfig = async (userConfig) => {
@@ -226,7 +225,7 @@ function patchBundlerConfig(options) {
226
225
  }
227
226
  if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
228
227
  bundlerConfig.optimization.splitChunks.chunks = "async";
229
- import_logger.default.warn(`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
228
+ console.warn(`${import_constant.PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
230
229
  }
231
230
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
232
231
  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": "*"
99
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
100
100
  }
101
101
  }
102
102
  },
@@ -7,7 +7,6 @@ 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";
11
10
  function setEnv() {
12
11
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
13
12
  process.env["MF_SSR_PRJ"] = "true";
@@ -100,13 +99,15 @@ var moduleFederationSSRPlugin = function(userConfig) {
100
99
  fs.statSync(filepath);
101
100
  res.setHeader("Access-Control-Allow-Origin", "*");
102
101
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
103
- res.setHeader("Access-Control-Allow-Headers", "*");
102
+ res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
104
103
  fs.createReadStream(filepath).pipe(res);
105
104
  } else {
106
105
  next();
107
106
  }
108
107
  } catch (err) {
109
- logger.debug(err);
108
+ if (process.env.FEDERATION_DEBUG) {
109
+ console.error(err);
110
+ }
110
111
  next();
111
112
  }
112
113
  }
@@ -9,7 +9,6 @@ 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";
13
12
  var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
14
13
  var isDev = process.env.NODE_ENV === "development";
15
14
  var getMFConfig = function() {
@@ -222,7 +221,7 @@ function patchBundlerConfig(options) {
222
221
  }
223
222
  if (!isServer && enableSSR && _type_of((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
224
223
  bundlerConfig.optimization.splitChunks.chunks = "async";
225
- logger.warn('splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"');
224
+ console.warn("".concat(PLUGIN_IDENTIFIER, ' splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"'));
226
225
  }
227
226
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
228
227
  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": "*"
79
+ "Access-Control-Allow-Headers": "X-Requested-With, content-type, Authorization"
80
80
  }
81
81
  }
82
82
  },
@@ -5,7 +5,6 @@ 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";
9
8
  function setEnv() {
10
9
  process.env["MF_DISABLE_EMIT_STATS"] = "true";
11
10
  process.env["MF_SSR_PRJ"] = "true";
@@ -83,13 +82,15 @@ const moduleFederationSSRPlugin = (userConfig) => ({
83
82
  fs.statSync(filepath);
84
83
  res.setHeader("Access-Control-Allow-Origin", "*");
85
84
  res.setHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, PATCH, OPTIONS");
86
- res.setHeader("Access-Control-Allow-Headers", "*");
85
+ res.setHeader("Access-Control-Allow-Headers", "X-Requested-With, content-type, Authorization");
87
86
  fs.createReadStream(filepath).pipe(res);
88
87
  } else {
89
88
  next();
90
89
  }
91
90
  } catch (err) {
92
- logger.debug(err);
91
+ if (process.env.FEDERATION_DEBUG) {
92
+ console.error(err);
93
+ }
93
94
  next();
94
95
  }
95
96
  }
@@ -3,7 +3,6 @@ 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";
7
6
  const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
8
7
  const isDev = process.env.NODE_ENV === "development";
9
8
  const getMFConfig = async (userConfig) => {
@@ -189,7 +188,7 @@ function patchBundlerConfig(options) {
189
188
  }
190
189
  if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
191
190
  bundlerConfig.optimization.splitChunks.chunks = "async";
192
- logger.warn(`splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
191
+ console.warn(`${PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
193
192
  }
194
193
  if (isDev && ((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
195
194
  var _modernjsConfig_dev, _modernjsConfig_server1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20241104024700",
3
+ "version": "0.0.0-next-20241104073605",
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.0.0-next-20241104024700",
65
- "@module-federation/node": "0.0.0-next-20241104024700",
66
- "@module-federation/sdk": "0.0.0-next-20241104024700"
64
+ "@module-federation/enhanced": "0.0.0-next-20241104073605",
65
+ "@module-federation/node": "0.0.0-next-20241104073605",
66
+ "@module-federation/sdk": "0.0.0-next-20241104073605"
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.0.0-next-20241104024700"
75
+ "@module-federation/manifest": "0.0.0-next-20241104073605"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "react": ">=17",
@@ -1,27 +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 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;
@@ -1,7 +0,0 @@
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
- };
@@ -1,7 +0,0 @@
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
- };
@@ -1,2 +0,0 @@
1
- declare const logger: import("@module-federation/sdk").Logger;
2
- export default logger;