@lark-apaas/fullstack-rspack-preset 1.0.8-alpha.log.2 → 1.0.8-alpha.log.4

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.
@@ -175,6 +175,15 @@ function logError(messages, noStacktrace = false) {
175
175
  return;
176
176
  }
177
177
  // 首次执行编译报错会走此处逻辑;
178
+ const parts = [];
179
+ for (const m of messages) {
180
+ if (m instanceof Error) {
181
+ parts.push(m.message, m);
182
+ }
183
+ else {
184
+ parts.push(m);
185
+ }
186
+ }
178
187
  const logJSON = {
179
188
  id: 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
180
189
  const r = Math.random() * 16 | 0;
@@ -183,13 +192,13 @@ function logError(messages, noStacktrace = false) {
183
192
  }),
184
193
  type: 'typedLogV2',
185
194
  level: 'error',
186
- args: messages.map(item => item instanceof Error ? `${item.message}\n${item.stack}\n` : item),
195
+ args: parts,
187
196
  meta: {
188
197
  noStacktrace,
189
198
  stacktrace: noStacktrace ? [] : undefined,
190
199
  }
191
200
  };
192
- sendPostMessage({ type: 'SELECTED_LOG', payload: logJSON });
201
+ sendPostMessage({ type: 'SELECTED_LOG', payload: JSON.stringify(logJSON) });
193
202
  }
194
203
  catch (e) {
195
204
  console.log('上报错误信息失败', e);
@@ -225,7 +234,7 @@ function render() {
225
234
  else if (currentRuntimeErrors.length) {
226
235
  currentMode = 'runtimeError';
227
236
  // 发送运行错误
228
- logError(['Uncaught Render Error', currentRuntimeErrors]);
237
+ logError(['Uncaught Render Error', ...currentRuntimeErrors]);
229
238
  // 叠加全部报错,将报错信息发送到妙搭
230
239
  ErrorContainer(rootDocument, root, '哎呀,出错了');
231
240
  }
@@ -102,7 +102,7 @@ function getSlardarScriptContent(option = {}) {
102
102
 
103
103
  // 添加 TTI 监控脚本
104
104
  const performanceScript = document.createElement('script');
105
- performanceScript.src = 'https://sf3-scmcdn-cn.feishucdn.com/obj/unpkg/byted/performance/0.1.0/dist/performance.iife.js';
105
+ performanceScript.src = 'https://sf3-scmcdn-cn.feishucdn.com/obj/unpkg/byted/performance/0.1.2/dist/performance.iife.js';
106
106
  document.head.appendChild(performanceScript);
107
107
  `;
108
108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-rspack-preset",
3
- "version": "1.0.8-alpha.log.2",
3
+ "version": "1.0.8-alpha.log.4",
4
4
  "files": [
5
5
  "lib",
6
6
  "preset.config.js"