@lark-apaas/fullstack-rspack-preset 1.0.30 → 1.0.31-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.
- package/lib/overlay/index.js +14 -15
- package/lib/preset.js +8 -19
- package/package.json +4 -3
package/lib/overlay/index.js
CHANGED
|
@@ -129,35 +129,34 @@ function removeAllChildren(element, skip) {
|
|
|
129
129
|
element.removeChild(childList[i]);
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
function getEnvOrigin() {
|
|
133
|
+
return typeof process !== 'undefined' && process.env
|
|
134
|
+
? process.env.FORCE_FRAMEWORK_DOMAIN_MAIN
|
|
135
|
+
: undefined;
|
|
136
|
+
}
|
|
137
|
+
function getLegacyParentOrigin() {
|
|
138
|
+
const currentOrigin = window.location?.origin || '';
|
|
139
|
+
if (currentOrigin.includes('force.feishuapp.net')) {
|
|
136
140
|
return 'https://force.feishu.cn';
|
|
137
141
|
}
|
|
138
|
-
if (
|
|
142
|
+
if (currentOrigin.includes('force-pre.feishuapp.net')) {
|
|
139
143
|
return 'https://force.feishu-pre.cn';
|
|
140
144
|
}
|
|
141
|
-
|
|
142
|
-
if (origin.includes('force.byted.org')) {
|
|
145
|
+
if (currentOrigin.includes('force.byted.org')) {
|
|
143
146
|
return 'https://force.feishu-boe.cn';
|
|
144
147
|
}
|
|
145
|
-
|
|
146
|
-
if (origin.includes('feishuapp.cn') ||
|
|
147
|
-
origin.includes('miaoda.feishuapp.net')) {
|
|
148
|
+
if (currentOrigin.includes('feishuapp.cn') || currentOrigin.includes('miaoda.feishuapp.net')) {
|
|
148
149
|
return 'https://miaoda.feishu.cn';
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
-
if (origin.includes('fsapp.kundou.cn') ||
|
|
152
|
-
origin.includes('miaoda-pre.feishuapp.net')) {
|
|
151
|
+
if (currentOrigin.includes('fsapp.kundou.cn') || currentOrigin.includes('miaoda-pre.feishuapp.net')) {
|
|
153
152
|
return 'https://miaoda.feishu-pre.cn';
|
|
154
153
|
}
|
|
155
|
-
// MIAODA BOE 环境
|
|
156
154
|
return 'https://miaoda.feishu-boe.cn';
|
|
157
155
|
}
|
|
158
156
|
function sendPostMessage(message, targetOrigin) {
|
|
159
157
|
try {
|
|
160
|
-
const
|
|
158
|
+
const parentOrigin = getEnvOrigin() || getLegacyParentOrigin();
|
|
159
|
+
const origin = targetOrigin || parentOrigin;
|
|
161
160
|
window.parent.postMessage(message, origin);
|
|
162
161
|
}
|
|
163
162
|
catch (error) {
|
package/lib/preset.js
CHANGED
|
@@ -146,6 +146,7 @@ function createRecommendRspackConfig(options) {
|
|
|
146
146
|
'process.env.NODE_ENV': JSON.stringify(isDev ? 'development' : 'production'),
|
|
147
147
|
'process.env.runtimeMode': JSON.stringify('fullstack'),
|
|
148
148
|
'process.env.CLIENT_BASE_PATH': JSON.stringify(clientBasePath),
|
|
149
|
+
'process.env.FORCE_FRAMEWORK_DOMAIN_MAIN': JSON.stringify(process.env.FORCE_FRAMEWORK_DOMAIN_MAIN ?? ''),
|
|
149
150
|
'process.env.CWD': JSON.stringify(''),
|
|
150
151
|
// 解决 window 未定义问题
|
|
151
152
|
'typeof window': JSON.stringify('object'),
|
|
@@ -265,25 +266,13 @@ function createRecommendRspackConfig(options) {
|
|
|
265
266
|
},
|
|
266
267
|
overlay: false,
|
|
267
268
|
},
|
|
268
|
-
headers: (
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
'https://force.feishu-pre.cn',
|
|
276
|
-
'https://miaoda.feishu.cn',
|
|
277
|
-
'https://miaoda.feishu-boe.cn',
|
|
278
|
-
'https://miaoda.feishu-pre.cn',
|
|
279
|
-
];
|
|
280
|
-
// 检查请求的Origin是否在允许的列表中
|
|
281
|
-
const allowedOrigin = allowedOrigins.includes(requestOrigin)
|
|
282
|
-
? requestOrigin
|
|
283
|
-
: allowedOrigins[0]; // 默认返回第一个允许的域名
|
|
284
|
-
return {
|
|
285
|
-
'Access-Control-Allow-Origin': allowedOrigin,
|
|
286
|
-
};
|
|
269
|
+
headers: (_req) => {
|
|
270
|
+
const allowedOrigin = process.env.FORCE_FRAMEWORK_DOMAIN_MAIN;
|
|
271
|
+
const headers = {};
|
|
272
|
+
if (!allowedOrigin)
|
|
273
|
+
return headers;
|
|
274
|
+
headers['Access-Control-Allow-Origin'] = allowedOrigin;
|
|
275
|
+
return headers;
|
|
287
276
|
},
|
|
288
277
|
onListening(server) {
|
|
289
278
|
(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.
|
|
3
|
+
"version": "1.0.31-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": "
|
|
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",
|
|
@@ -56,5 +56,6 @@
|
|
|
56
56
|
"@rspack/core": "^1.5.5",
|
|
57
57
|
"react": ">=16.14.0",
|
|
58
58
|
"react-dom": ">=16.14.0"
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
|
+
"gitHead": "28506f3a156791edda1f6b56946b781cea9aca8a"
|
|
60
61
|
}
|