@lark-apaas/fullstack-rspack-preset 1.0.28 → 1.0.30-alpha.0

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.
@@ -129,35 +129,13 @@ function removeAllChildren(element, skip) {
129
129
  element.removeChild(childList[i]);
130
130
  }
131
131
  }
132
- // 获取父窗口 origin
133
- function getPreviewParentOrigin() {
134
- const { origin } = window.location;
135
- if (origin.includes('force.feishuapp.net')) {
136
- return 'https://force.feishu.cn';
137
- }
138
- if (origin.includes('force-pre.feishuapp.net')) {
139
- return 'https://force.feishu-pre.cn';
140
- }
141
- // force BOE环境
142
- if (origin.includes('force.byted.org')) {
143
- return 'https://force.feishu-boe.cn';
144
- }
145
- // MIAODA 线上环境
146
- if (origin.includes('feishuapp.cn') ||
147
- origin.includes('miaoda.feishuapp.net')) {
148
- return 'https://miaoda.feishu.cn';
149
- }
150
- // MIAODA PRE 环境
151
- if (origin.includes('fsapp.kundou.cn') ||
152
- origin.includes('miaoda-pre.feishuapp.net')) {
153
- return 'https://miaoda.feishu-pre.cn';
154
- }
155
- // MIAODA BOE 环境
156
- return 'https://miaoda.feishu-boe.cn';
157
- }
158
132
  function sendPostMessage(message, targetOrigin) {
159
133
  try {
160
- const origin = targetOrigin || getPreviewParentOrigin();
134
+ const parentOrigin = globalThis.process?.env?.FORCE_FRAMEWORK_DOMAIN_MAIN;
135
+ const origin = targetOrigin || parentOrigin;
136
+ if (!origin) {
137
+ return;
138
+ }
161
139
  window.parent.postMessage(message, origin);
162
140
  }
163
141
  catch (error) {
package/lib/preset.js CHANGED
@@ -239,6 +239,7 @@ function createRecommendRspackConfig(options) {
239
239
  hot: true,
240
240
  liveReload: true,
241
241
  historyApiFallback: true,
242
+ compress: false,
242
243
  watchFiles: [{
243
244
  paths: [path_1.default.resolve(rootDir, 'client/src/api/**/*')],
244
245
  options: {
@@ -264,25 +265,13 @@ function createRecommendRspackConfig(options) {
264
265
  },
265
266
  overlay: false,
266
267
  },
267
- headers: (req) => {
268
- // 获取请求的Origin头
269
- const requestOrigin = req.headers.origin ?? '';
270
- // 定义允许的域名白名单
271
- const allowedOrigins = [
272
- 'https://force.feishu-boe.cn',
273
- 'https://force.feishu.cn',
274
- 'https://force.feishu-pre.cn',
275
- 'https://miaoda.feishu.cn',
276
- 'https://miaoda.feishu-boe.cn',
277
- 'https://miaoda.feishu-pre.cn',
278
- ];
279
- // 检查请求的Origin是否在允许的列表中
280
- const allowedOrigin = allowedOrigins.includes(requestOrigin)
281
- ? requestOrigin
282
- : allowedOrigins[0]; // 默认返回第一个允许的域名
283
- return {
284
- 'Access-Control-Allow-Origin': allowedOrigin,
285
- };
268
+ headers: (_req) => {
269
+ const allowedOrigin = process.env.FORCE_FRAMEWORK_DOMAIN_MAIN;
270
+ const headers = {};
271
+ if (!allowedOrigin)
272
+ return headers;
273
+ headers['Access-Control-Allow-Origin'] = allowedOrigin;
274
+ return headers;
286
275
  },
287
276
  onListening(server) {
288
277
  (0, dev_server_listener_1.listenHmrTiming)(server);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.28",
3
+ "version": "1.0.30-alpha.0",
4
4
  "files": [
5
5
  "lib",
6
6
  "patches",
@@ -31,7 +31,7 @@
31
31
  "@babel/parser": "^7.28.0",
32
32
  "@babel/traverse": "^7.28.0",
33
33
  "@babel/types": "^7.28.2",
34
- "@lark-apaas/devtool-kits": "^1.2.12",
34
+ "@lark-apaas/devtool-kits": "1.2.14-alpha.0",
35
35
  "@lark-apaas/miaoda-inspector-babel-plugin": "^1.0.0",
36
36
  "@lark-apaas/miaoda-inspector-jsx-runtime": "^1.0.0",
37
37
  "@rspack/plugin-react-refresh": "^1.5.1",