g-ui-web 1.4.47 → 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(),
@@ -256,19 +256,23 @@ function componentUsagePlugin(options = {}) {
256
256
  method: "POST",
257
257
  headers: {
258
258
  "Content-Type": "application/json",
259
- "gt-token": "9097b42a-74db-48cb-92f1-f5b3fac5adf9",
259
+ "Authorization": "Bearer ciFeBuild-2026-118029f9df6c6de78b5a4d43b934ccb7",
260
260
  "syscode": "matrix"
261
261
  },
262
- body: JSON.stringify({ prefix: "guiUsage", value: reportData })
262
+ body: JSON.stringify({ prefix: "guiUsage", key, value: reportData })
263
263
  });
264
264
  if (response.ok) {
265
- console.log(`
265
+ const result = await response.json();
266
+ if (result.code === 200) {
267
+ console.log(`
266
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
+ }
267
273
  } else {
268
- console.warn(
269
- `
270
- \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: ${response.status} ${response.statusText}`
271
- );
274
+ console.warn(`
275
+ \u26A0\uFE0F \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`);
272
276
  }
273
277
  } catch (error) {
274
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(),
@@ -230,19 +230,23 @@ function componentUsagePlugin(options = {}) {
230
230
  method: "POST",
231
231
  headers: {
232
232
  "Content-Type": "application/json",
233
- "gt-token": "9097b42a-74db-48cb-92f1-f5b3fac5adf9",
233
+ "Authorization": "Bearer ciFeBuild-2026-118029f9df6c6de78b5a4d43b934ccb7",
234
234
  "syscode": "matrix"
235
235
  },
236
- body: JSON.stringify({ prefix: "guiUsage", value: reportData })
236
+ body: JSON.stringify({ prefix: "guiUsage", key, value: reportData })
237
237
  });
238
238
  if (response.ok) {
239
- console.log(`
239
+ const result = await response.json();
240
+ if (result.code === 200) {
241
+ console.log(`
240
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
+ }
241
247
  } else {
242
- console.warn(
243
- `
244
- \u26A0\uFE0F \u53D1\u9001\u5931\u8D25: ${response.status} ${response.statusText}`
245
- );
248
+ console.warn(`
249
+ \u26A0\uFE0F \u8BF7\u6C42\u5931\u8D25: ${response.status} ${response.statusText}`);
246
250
  }
247
251
  } catch (error) {
248
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.47",
5
+ "version": "1.4.48",
6
6
  "author": "wyu",
7
7
  "license": "MIT",
8
8
  "type": "module",