@lark-apaas/miaoda-presets 0.1.0-alpha.15 → 0.1.0-alpha.18

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.
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.createRecommendRspackConfig = createRecommendRspackConfig;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const core_1 = __importDefault(require("@rspack/core"));
9
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
9
10
  const RouteParserPlugin = require('../rspack-plugins/route-parser-plugin');
10
11
  // eslint-disable-next-line max-lines-per-function
11
12
  function createRecommendRspackConfig(options) {
12
- const { enableReactRefresh = false, isDev = true, needRoutes = true, } = options;
13
+ const { enableReactRefresh = false, isDev = true, needRoutes = true, fullStackMode = true, } = options;
13
14
  return {
14
15
  experiments: {
15
16
  css: true,
@@ -114,6 +115,7 @@ function createRecommendRspackConfig(options) {
114
115
  new core_1.default.DefinePlugin({
115
116
  'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
116
117
  'process.env.CWD': JSON.stringify(process.cwd()),
118
+ 'process.env.fullstack': JSON.stringify(fullStackMode),
117
119
  }),
118
120
  new core_1.default.optimize.LimitChunkCountPlugin({
119
121
  maxChunks: 1,
@@ -170,5 +172,24 @@ function createRecommendRspackConfig(options) {
170
172
  splitChunks: false, // 禁用代码分割,保持单文件输出
171
173
  },
172
174
  devtool: isDev ? 'source-map' : false, // 对应vite的sourcemap配置
175
+ devServer: {
176
+ headers: (req) => {
177
+ // 获取请求的Origin头
178
+ const requestOrigin = req.headers.origin ?? '';
179
+ // 定义允许的域名白名单
180
+ const allowedOrigins = [
181
+ 'https://miaoda.feishu.cn',
182
+ 'https://miaoda.feishu-boe.cn',
183
+ 'https://miaoda.feishu-pre.cn',
184
+ ];
185
+ // 检查请求的Origin是否在允许的列表中
186
+ const allowedOrigin = allowedOrigins.includes(requestOrigin)
187
+ ? requestOrigin
188
+ : allowedOrigins[0]; // 默认返回第一个允许的域名
189
+ return {
190
+ 'Access-Control-Allow-Origin': allowedOrigin,
191
+ };
192
+ },
193
+ },
173
194
  };
174
195
  }
@@ -29,6 +29,7 @@ function createRspackConfig(options) {
29
29
  enableReactRefresh,
30
30
  isDev: isDevBuildMode,
31
31
  needRoutes: false,
32
+ fullStackMode: false,
32
33
  });
33
34
  return (0, webpack_merge_1.default)(recommendConfig, {
34
35
  mode: isDevBuildMode ? 'development' : 'production',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-presets",
3
- "version": "0.1.0-alpha.15",
3
+ "version": "0.1.0-alpha.18",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
@@ -26,8 +26,8 @@
26
26
  "@babel/traverse": "^7.28.0",
27
27
  "@babel/types": "^7.28.2",
28
28
  "@eslint/js": "^9.34.0",
29
- "@lark-apaas/miaoda-inspector-babel-plugin": "workspace:*",
30
- "@lark-apaas/miaoda-inspector-jsx-runtime": "workspace:*",
29
+ "@lark-apaas/miaoda-inspector-babel-plugin": "0.1.0-alpha.5",
30
+ "@lark-apaas/miaoda-inspector-jsx-runtime": "0.1.0-alpha.6",
31
31
  "@react-dev-inspector/middleware": "^2.0.1",
32
32
  "@rsdoctor/rspack-plugin": "^1.1.8",
33
33
  "@rspack/dev-server": "^1.1.3",