trackersdk2 1.0.0 → 1.0.2

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "trackersdk2",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "一个适用于uni-app h5的前端埋点SDK,支持多种数据上报方式,帮助开发者轻松收集和分析用户行为数据。",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
7
7
  "browser": "dist/index.js",
8
+ "types": "dist/index.d.ts",
8
9
  "scripts": {
9
10
  "build": "rollup -c",
10
11
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -21,6 +22,9 @@
21
22
  "license": "MIT",
22
23
  "homepage": "https://gitee.com/hwjstore/tracker-sdk",
23
24
  "devDependencies": {
25
+ "@babel/core": "^7.28.5",
26
+ "@babel/preset-env": "^7.28.5",
27
+ "@rollup/plugin-babel": "^6.1.0",
24
28
  "rollup": "^4.55.1",
25
29
  "rollup-plugin-dts": "^6.3.0",
26
30
  "rollup-plugin-typescript2": "^0.36.0",
@@ -28,5 +32,8 @@
28
32
  },
29
33
  "dependencies": {
30
34
  "web-vitals": "^5.1.0"
35
+ },
36
+ "engines": {
37
+ "node": ">=19.3.0"
31
38
  }
32
39
  }
@@ -1,10 +1,13 @@
1
- // import ts from 'rollup-plugin-typescript2'
2
- // import path from 'path'
3
- // import dts from 'rollup-plugin-dts';
4
- const ts = require('rollup-plugin-typescript2')
5
- const path = require('node:path')
6
- const dts = require('rollup-plugin-dts').default
7
- module.exports = [{
1
+ import ts from 'rollup-plugin-typescript2'
2
+ import path, { dirname } from 'path'
3
+ import dts from 'rollup-plugin-dts';
4
+ import babel from '@rollup/plugin-babel';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const extensions = ['.js', '.ts'];
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = dirname(__filename);
10
+ export default [{
8
11
  //入口文件
9
12
  input: "./src/core/index.ts",
10
13
  output: [
@@ -20,7 +23,6 @@ module.exports = [{
20
23
  },
21
24
  //打包 AMD CMD UMD
22
25
  {
23
- input: "./src/core/index.ts",
24
26
  file: path.resolve(__dirname, './dist/index.js'),
25
27
  format: "umd",
26
28
  name: "tracker"
@@ -30,6 +32,16 @@ module.exports = [{
30
32
  //配置ts
31
33
  plugins: [
32
34
  ts(),
35
+ babel({
36
+ extensions,
37
+ babelHelpers: 'bundled',
38
+ exclude: /node_modules/,
39
+ presets: [
40
+ ['@babel/preset-env', {
41
+ targets: { browsers: ['> 1%', 'last 2 versions', 'not dead'] }
42
+ }]
43
+ ]
44
+ })
33
45
  ]
34
46
 
35
47
  }, {
@@ -433,11 +433,11 @@ export class TrackerSDK {
433
433
  });
434
434
  }
435
435
  /**
436
- * @description vue3 全局错误处理器
436
+ * @description vue 全局错误处理器
437
437
  */
438
438
  setupVueErrorHandlder(app: any) {
439
439
  app.config.errorHandler = (err: Error, instance: any, info: string) => {
440
- console.log("🚀 ~ vue3 全局错误处理器捕获了");
440
+ console.log("🚀 ~ vue 全局错误处理器捕获了");
441
441
  // setTimeout(() => {
442
442
  // throw err;
443
443
  // }, 0);
package/src/core/index.ts CHANGED
@@ -3,7 +3,9 @@ import type { TrackerConfig } from "./types";
3
3
  export default {
4
4
  install(app: any, options: TrackerConfig) {
5
5
  tracker.init(options);
6
- app.provide("tracker", tracker);
6
+ if (app.provide) {
7
+ app.provide("tracker", tracker);
8
+ }
7
9
  // 自动化埋点,存在 performance
8
10
  if (options.autoTrack) {
9
11
  tracker.enableAutoTracking();
package/tsconfig.json CHANGED
@@ -1,19 +1,16 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "ES2018",
4
- "module": "ESNext",
5
- "lib": ["DOM", "ES2020"],
6
- "moduleResolution": "node",
7
- "declaration": true,
8
- "outDir": "./dist",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true
13
- },
14
- "include": ["src/**/*"],
15
- "exclude": ["node_modules"]
16
- }
17
-
18
-
19
-
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "ESNext",
5
+ "lib": ["DOM", "ES2020"],
6
+ "moduleResolution": "node",
7
+ "declaration": true,
8
+ "outDir": "./dist",
9
+ "strict": true,
10
+ "esModuleInterop": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true
13
+ },
14
+ "include": ["src/**/*"],
15
+ "exclude": ["node_modules"]
16
+ }