@tourmind-frontend/monitor-plugin-webpack 1.2.0 → 1.4.0

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/index.cjs CHANGED
@@ -82,7 +82,10 @@ async function uploadFiles({ url, query, files }) {
82
82
  var UploadSourceMapPlugin = class {
83
83
  constructor(options) {
84
84
  if (!options.url) throw new Error(`${LOG_PREFIX} "url" is required`);
85
- if (!options.token) throw new Error(`${LOG_PREFIX} "token" is required`);
85
+ if (!options.authToken) throw new Error(`${LOG_PREFIX} "authToken" is required`);
86
+ if (!options.authToken.startsWith("fm_at_")) {
87
+ throw new Error(`${LOG_PREFIX} "authToken" must start with "fm_at_"; do not use the client key here`);
88
+ }
86
89
  if (!options.commit) throw new Error(`${LOG_PREFIX} "commit" is required`);
87
90
  this.options = options;
88
91
  }
@@ -104,7 +107,7 @@ var UploadSourceMapPlugin = class {
104
107
  const { commit } = options;
105
108
  const timestamp = (_a2 = options.timestamp) != null ? _a2 : Date.now();
106
109
  const query = {
107
- token: options.token,
110
+ token: options.authToken,
108
111
  timestamp: String(timestamp)
109
112
  };
110
113
  query.commit = commit;
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ import { Compiler } from "webpack";
2
2
  export interface UploadSourceMapOptions {
3
3
  /** monitor 服务的 base URL,例如 `https://monitor.example.com`。内部拼接 `/api/upload`。 */
4
4
  url: string;
5
- /** monitor 项目 token,从 web 控制台创建项目后获取,内部已绑定仓库 + 分支。 */
6
- token: string;
5
+ /** monitor 项目 auth token(前缀 `fm_at_`),仅供 CI / 构建机使用,从 web 控制台「项目」页获取。 */
6
+ authToken: string;
7
7
  /** Commit hash,由调用方自行解析(如 `git rev-parse HEAD`)。 */
8
8
  commit: string;
9
9
  /** 构建时间戳(毫秒),未设置时取上传时刻的 `Date.now()`。 */
package/dist/index.js CHANGED
@@ -48,7 +48,10 @@ async function uploadFiles({ url, query, files }) {
48
48
  var UploadSourceMapPlugin = class {
49
49
  constructor(options) {
50
50
  if (!options.url) throw new Error(`${LOG_PREFIX} "url" is required`);
51
- if (!options.token) throw new Error(`${LOG_PREFIX} "token" is required`);
51
+ if (!options.authToken) throw new Error(`${LOG_PREFIX} "authToken" is required`);
52
+ if (!options.authToken.startsWith("fm_at_")) {
53
+ throw new Error(`${LOG_PREFIX} "authToken" must start with "fm_at_"; do not use the client key here`);
54
+ }
52
55
  if (!options.commit) throw new Error(`${LOG_PREFIX} "commit" is required`);
53
56
  this.options = options;
54
57
  }
@@ -70,7 +73,7 @@ var UploadSourceMapPlugin = class {
70
73
  const { commit } = options;
71
74
  const timestamp = (_a2 = options.timestamp) != null ? _a2 : Date.now();
72
75
  const query = {
73
- token: options.token,
76
+ token: options.authToken,
74
77
  timestamp: String(timestamp)
75
78
  };
76
79
  query.commit = commit;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tourmind-frontend/monitor-plugin-webpack",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Webpack plugin that uploads sourcemaps to a frontend-monitor server.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",