@lark-apaas/devtool-kits 1.0.7-alpha.0 → 1.0.8
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/dist/error.html +11 -11
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/error.html
CHANGED
|
@@ -277,23 +277,23 @@
|
|
|
277
277
|
// 发送 postMessage
|
|
278
278
|
function sendPostMessage(message, targetOrigin) {
|
|
279
279
|
const origin = targetOrigin || getPreviewParentOrigin();
|
|
280
|
-
console.log('sendPostMessage', message, origin);
|
|
281
280
|
window.parent.postMessage(message, origin);
|
|
282
281
|
}
|
|
283
282
|
|
|
284
283
|
// 获取父窗口 origin
|
|
285
284
|
function getPreviewParentOrigin() {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
285
|
+
// 优先使用 document.referrer
|
|
286
|
+
if (document.referrer) {
|
|
287
|
+
try {
|
|
288
|
+
const url = new URL(document.referrer);
|
|
289
|
+
return url.origin;
|
|
290
|
+
} catch (e) {
|
|
291
|
+
console.error('解析 referrer 失败:', e);
|
|
292
|
+
}
|
|
294
293
|
}
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
|
|
295
|
+
// 降级方案:使用通配符(不安全,仅用于开发环境)
|
|
296
|
+
return '*';
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
// 复制到剪贴板
|
package/dist/index.cjs
CHANGED
|
@@ -28624,7 +28624,7 @@ function handleDevProxyError(err, req, res, options) {
|
|
|
28624
28624
|
}
|
|
28625
28625
|
const template = getErrorHtmlTemplate();
|
|
28626
28626
|
const html = injectErrorData(template, errorLogs, clientBasePathWithoutSlash);
|
|
28627
|
-
res.writeHead(
|
|
28627
|
+
res.writeHead(200, {
|
|
28628
28628
|
"Content-Type": "text/html; charset=utf-8",
|
|
28629
28629
|
"Cache-Control": "no-cache, no-store, must-revalidate",
|
|
28630
28630
|
"X-Proxy-Error-Page": "true"
|