@lark-apaas/miaoda-presets 0.1.0-alpha.overlay.1 → 0.1.0-alpha.overlay.3

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.
@@ -141,18 +141,19 @@ async function copyToClipboard(text) {
141
141
  }
142
142
  // 获取父窗口 origin
143
143
  function getPreviewParentOrigin() {
144
- // 优先使用 document.referrer
145
- if (document.referrer) {
146
- try {
147
- const url = new URL(document.referrer);
148
- return url.origin;
149
- }
150
- catch (e) {
151
- console.error('解析 referrer 失败:', e);
152
- }
144
+ const { origin } = window.location;
145
+ // 线上环境
146
+ if (origin.includes('feishuapp.cn') ||
147
+ origin.includes('miaoda.feishuapp.net')) {
148
+ return 'https://miaoda.feishu.cn';
149
+ }
150
+ // PRE 环境
151
+ if (origin.includes('fsapp.kundou.cn') ||
152
+ origin.includes('miaoda-pre.feishuapp.net')) {
153
+ return 'https://miaoda.feishu-pre.cn';
153
154
  }
154
- // 降级方案:使用通配符(不安全,仅用于开发环境)
155
- return '*';
155
+ // BOE 环境
156
+ return 'https://miaoda.feishu-boe.cn';
156
157
  }
157
158
  /**
158
159
  * Creates the main `div` element for the overlay to render.
@@ -184,7 +185,7 @@ function render() {
184
185
  else if (currentRuntimeErrors.length) {
185
186
  currentMode = 'runtimeError';
186
187
  let errors = '';
187
- currentRuntimeErrors.forEach((error) => {
188
+ currentRuntimeErrors.forEach(error => {
188
189
  errors += `${error.message}\n${error.stack}\n`;
189
190
  });
190
191
  // 叠加全部报错,将报错信息发送到妙搭
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ const ReactRefreshPlugin = require('@rspack/plugin-react-refresh');
3
+ const path = require('path');
4
+ function createReactRefreshPlugin() {
5
+ return new ReactRefreshPlugin({
6
+ overlay: {
7
+ module: path.resolve(__dirname, 'overlay/index.js'),
8
+ },
9
+ });
10
+ }
11
+ module.exports = createReactRefreshPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-presets",
3
- "version": "0.1.0-alpha.overlay.1",
3
+ "version": "0.1.0-alpha.overlay.3",
4
4
  "files": [
5
5
  "lib"
6
6
  ],
@@ -1,12 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.pluginOption = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- exports.pluginOption = {
9
- overlay: {
10
- module: path_1.default.resolve(__dirname, 'overlay/index.js'),
11
- },
12
- };