@tourmind-frontend/monitor-plugin-nuxt 1.1.0 → 1.2.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
@@ -37,16 +37,16 @@ var import_node_path = require("path");
37
37
  var import_monitor_plugin_webpack = __toESM(require("@tourmind-frontend/monitor-plugin-webpack"));
38
38
  var LOG_PREFIX = "[frontend-monitor]";
39
39
  function MonitorModule(options) {
40
- if (!(options == null ? void 0 : options.token)) throw new Error(`${LOG_PREFIX} "token" is required`);
41
- if (!options.reportUrl) throw new Error(`${LOG_PREFIX} "reportUrl" is required`);
42
- if (!options.uploadUrl) throw new Error(`${LOG_PREFIX} "uploadUrl" is required`);
40
+ if (!options.url) throw new Error(`${LOG_PREFIX} "url" is required`);
41
+ if (!options.token) throw new Error(`${LOG_PREFIX} "token" is required`);
42
+ if (!options.commit) throw new Error(`${LOG_PREFIX} "commit" is required`);
43
43
  this.extendBuild((config, { isClient, isDev }) => {
44
44
  if (isDev || !isClient) return;
45
45
  config.devtool = "hidden-source-map";
46
46
  config.plugins = config.plugins || [];
47
47
  config.plugins.push(
48
48
  new import_monitor_plugin_webpack.default({
49
- url: options.uploadUrl,
49
+ url: options.url,
50
50
  token: options.token,
51
51
  commit: options.commit
52
52
  })
@@ -57,7 +57,7 @@ function MonitorModule(options) {
57
57
  fileName: "monitor-tracking.client.js",
58
58
  mode: "client",
59
59
  options: {
60
- url: options.reportUrl,
60
+ url: options.url,
61
61
  token: options.token
62
62
  }
63
63
  });
package/dist/index.d.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  export interface MonitorModuleOptions {
2
2
  /** monitor 项目 token,从 web 控制台创建项目后获取,内部已绑定仓库 + 分支。 */
3
3
  token: string;
4
- /** 上报接口地址,例如 `https://monitor.example.com/api/report`。 */
5
- reportUrl: string;
6
- /** sourcemap 上传接口地址,例如 `https://monitor.example.com/api/upload`。 */
7
- uploadUrl: string;
4
+ /** monitor 服务的 base URL,例如 `https://monitor.example.com`。`/api/report`、`/api/upload` 由下游 tracking / plugin-webpack 内部拼接。 */
5
+ url: string;
8
6
  /** Commit hash,由调用方自行解析(如 `git rev-parse HEAD`)。 */
9
- commit?: string;
7
+ commit: string;
10
8
  }
11
9
  interface NuxtBuildContext {
12
10
  isClient: boolean;
@@ -42,8 +40,7 @@ interface NuxtModuleThis {
42
40
  * module.exports = {
43
41
  * modules: [
44
42
  * ['@tourmind-frontend/monitor-plugin-nuxt', {
45
- * reportUrl: 'https://monitor.example.com/api/report',
46
- * uploadUrl: 'https://monitor.example.com/api/upload',
43
+ * url: 'https://monitor.example.com',
47
44
  * token: process.env.MONITOR_TOKEN,
48
45
  * commit: process.env.GIT_COMMIT,
49
46
  * }],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tourmind-frontend/monitor-plugin-nuxt",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Nuxt 2 module that captures runtime errors and uploads sourcemaps to a frontend-monitor server.",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.ts",
@@ -17,12 +17,12 @@
17
17
  "node": ">=13"
18
18
  },
19
19
  "dependencies": {
20
- "@tourmind-frontend/monitor-plugin-webpack": "^1.1.0"
20
+ "@tourmind-frontend/monitor-plugin-webpack": "^1.2.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "nuxt": "^2.4.0",
24
24
  "vue": "^2.5.0",
25
- "@tourmind-frontend/monitor-tracking": "^1.1.0"
25
+ "@tourmind-frontend/monitor-tracking": "^1.2.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/node": "^20.0.0",