g-ui-web 1.4.46 → 1.4.48

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.
@@ -4,6 +4,8 @@ interface ComponentUsageOptions {
4
4
  libraryName?: string;
5
5
  /** 后端接收数据的 URL */
6
6
  reportUrl?: string;
7
+ /** 缓存 key */
8
+ key?: string;
7
9
  /** 额外需要上报的数据 */
8
10
  extraData?: Record<string, any>;
9
11
  /** 是否在开发模式下启用,默认 false */
@@ -91,7 +91,7 @@ var init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then(({ export
91
91
  var import_fs = require("fs");
92
92
  var import_path = require("path");
93
93
  function componentUsagePlugin(options = {}) {
94
- const { libraryName = "", reportUrl = "", extraData = {}, enableInDev = false } = options;
94
+ const { libraryName = "", reportUrl = "", key = "", extraData = {}, enableInDev = false } = options;
95
95
  const importStats = {
96
96
  // 组件引用次数:{ Button: 5, Input: 3 }
97
97
  componentCount: /* @__PURE__ */ new Map(),
@@ -255,18 +255,24 @@ function componentUsagePlugin(options = {}) {
255
255
  const response = await fetch(reportUrl, {
256
256
  method: "POST",
257
257
  headers: {
258
- "Content-Type": "application/json"
258
+ "Content-Type": "application/json",
259
+ "Authorization": "Bearer ciFeBuild-2026-118029f9df6c6de78b5a4d43b934ccb7",
260
+ "syscode": "matrix"
259
261
  },
260
- body: JSON.stringify(reportData)
262
+ body: JSON.stringify({ prefix: "guiUsage", key, value: reportData })
261
263
  });
262
264
  if (response.ok) {
263
- console.log(`
265
+ const result = await response.json();
266
+ if (result.code === 200) {
267
+ console.log(`
264
268
  \u2705 \u7EDF\u8BA1\u6570\u636E\u5DF2\u53D1\u9001\u81F3: ${reportUrl}`);
269
+ } else {
270
+ console.warn(`
271
+ \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: code=${result.code} ${result.message || ""}`);
272
+ }
265
273
  } else {
266
- console.warn(
267
- `
268
- \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: ${response.status} ${response.statusText}`
269
- );
274
+ console.warn(`
275
+ \u26A0\uFE0F \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`);
270
276
  }
271
277
  } catch (error) {
272
278
  console.error(`
@@ -65,7 +65,7 @@ var init = WebAssembly.compile(E()).then(WebAssembly.instantiate).then(({ export
65
65
  import { writeFileSync, mkdirSync } from "fs";
66
66
  import { resolve, dirname } from "path";
67
67
  function componentUsagePlugin(options = {}) {
68
- const { libraryName = "", reportUrl = "", extraData = {}, enableInDev = false } = options;
68
+ const { libraryName = "", reportUrl = "", key = "", extraData = {}, enableInDev = false } = options;
69
69
  const importStats = {
70
70
  // 组件引用次数:{ Button: 5, Input: 3 }
71
71
  componentCount: /* @__PURE__ */ new Map(),
@@ -229,18 +229,24 @@ function componentUsagePlugin(options = {}) {
229
229
  const response = await fetch(reportUrl, {
230
230
  method: "POST",
231
231
  headers: {
232
- "Content-Type": "application/json"
232
+ "Content-Type": "application/json",
233
+ "Authorization": "Bearer ciFeBuild-2026-118029f9df6c6de78b5a4d43b934ccb7",
234
+ "syscode": "matrix"
233
235
  },
234
- body: JSON.stringify(reportData)
236
+ body: JSON.stringify({ prefix: "guiUsage", key, value: reportData })
235
237
  });
236
238
  if (response.ok) {
237
- console.log(`
239
+ const result = await response.json();
240
+ if (result.code === 200) {
241
+ console.log(`
238
242
  \u2705 \u7EDF\u8BA1\u6570\u636E\u5DF2\u53D1\u9001\u81F3: ${reportUrl}`);
243
+ } else {
244
+ console.warn(`
245
+ \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: code=${result.code} ${result.message || ""}`);
246
+ }
239
247
  } else {
240
- console.warn(
241
- `
242
- \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: ${response.status} ${response.statusText}`
243
- );
248
+ console.warn(`
249
+ \u26A0\uFE0F \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`);
244
250
  }
245
251
  } catch (error) {
246
252
  console.error(`
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "g-ui-web",
3
3
  "private": false,
4
4
  "description": "可视化组件库",
5
- "version": "1.4.46",
5
+ "version": "1.4.48",
6
6
  "author": "wyu",
7
7
  "license": "MIT",
8
8
  "type": "module",