trackersdk2 1.0.0 → 1.0.1

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.js CHANGED
@@ -572,7 +572,9 @@ const tracker = new TrackerSDK();
572
572
  var index = {
573
573
  install(app, options) {
574
574
  tracker.init(options);
575
- app.provide("tracker", tracker);
575
+ if (app.provide) {
576
+ app.provide("tracker", tracker);
577
+ }
576
578
  // 自动化埋点,存在 performance
577
579
  if (options.autoTrack) {
578
580
  tracker.enableAutoTracking();
package/dist/index.esm.js CHANGED
@@ -568,7 +568,9 @@ const tracker = new TrackerSDK();
568
568
  var index = {
569
569
  install(app, options) {
570
570
  tracker.init(options);
571
- app.provide("tracker", tracker);
571
+ if (app.provide) {
572
+ app.provide("tracker", tracker);
573
+ }
572
574
  // 自动化埋点,存在 performance
573
575
  if (options.autoTrack) {
574
576
  tracker.enableAutoTracking();
package/dist/index.js CHANGED
@@ -572,7 +572,9 @@
572
572
  var index = {
573
573
  install(app, options) {
574
574
  tracker.init(options);
575
- app.provide("tracker", tracker);
575
+ if (app.provide) {
576
+ app.provide("tracker", tracker);
577
+ }
576
578
  // 自动化埋点,存在 performance
577
579
  if (options.autoTrack) {
578
580
  tracker.enableAutoTracking();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trackersdk2",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "一个适用于uni-app h5的前端埋点SDK,支持多种数据上报方式,帮助开发者轻松收集和分析用户行为数据。",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -28,5 +28,8 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "web-vitals": "^5.1.0"
31
+ },
32
+ "engines": {
33
+ "node": ">=19.3.0"
31
34
  }
32
35
  }
@@ -0,0 +1,86 @@
1
+ // const ts = require('rollup-plugin-typescript2')
2
+ // const path = require('node:path')
3
+ // const dts = require('rollup-plugin-dts').default
4
+ // module.exports = [{
5
+ // //入口文件
6
+ // input: "./src/core/index.ts",
7
+ // output: [
8
+ // //打包esModule
9
+ // {
10
+ // file: path.resolve(__dirname, './dist/index.esm.js'),
11
+ // format: "es"
12
+ // },
13
+ // //打包common js
14
+ // {
15
+ // file: path.resolve(__dirname, './dist/index.cjs.js'),
16
+ // format: "cjs"
17
+ // },
18
+ // //打包 AMD CMD UMD
19
+ // {
20
+ // input: "./src/core/index.ts",
21
+ // file: path.resolve(__dirname, './dist/index.js'),
22
+ // format: "umd",
23
+ // name: "tracker"
24
+ // }
25
+
26
+ // ],
27
+ // //配置ts
28
+ // plugins: [
29
+ // ts(),
30
+ // ]
31
+
32
+ // }, {
33
+ // //打包声明文件
34
+ // input: "./src/core/index.ts",
35
+ // output: {
36
+ // file: path.resolve(__dirname, './dist/index.d.ts'),
37
+ // format: "es",
38
+ // },
39
+ // plugins: [dts()]
40
+ // }]
41
+
42
+
43
+ import ts from 'rollup-plugin-typescript2'
44
+ import path, { dirname } from 'path'
45
+ import dts from 'rollup-plugin-dts';
46
+ import { fileURLToPath } from 'url';
47
+
48
+ const __filename = fileURLToPath(import.meta.url);
49
+ const __dirname = dirname(__filename);
50
+ export default [{
51
+ //入口文件
52
+ input: "./src/core/index.ts",
53
+ output: [
54
+ //打包esModule
55
+ {
56
+ file: path.resolve(__dirname, './dist/index.esm.js'),
57
+ format: "es"
58
+ },
59
+ //打包common js
60
+ {
61
+ file: path.resolve(__dirname, './dist/index.cjs.js'),
62
+ format: "cjs"
63
+ },
64
+ //打包 AMD CMD UMD
65
+ {
66
+ input: "./src/core/index.ts",
67
+ file: path.resolve(__dirname, './dist/index.js'),
68
+ format: "umd",
69
+ name: "tracker"
70
+ }
71
+
72
+ ],
73
+ //配置ts
74
+ plugins: [
75
+ ts(),
76
+ ]
77
+
78
+ }, {
79
+ //打包声明文件
80
+ input: "./src/core/index.ts",
81
+ output: {
82
+ file: path.resolve(__dirname, './dist/index.d.ts'),
83
+ format: "es",
84
+ },
85
+ plugins: [dts()]
86
+ }]
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/rollup.config.js DELETED
@@ -1,43 +0,0 @@
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 = [{
8
- //入口文件
9
- input: "./src/core/index.ts",
10
- output: [
11
- //打包esModule
12
- {
13
- file: path.resolve(__dirname, './dist/index.esm.js'),
14
- format: "es"
15
- },
16
- //打包common js
17
- {
18
- file: path.resolve(__dirname, './dist/index.cjs.js'),
19
- format: "cjs"
20
- },
21
- //打包 AMD CMD UMD
22
- {
23
- input: "./src/core/index.ts",
24
- file: path.resolve(__dirname, './dist/index.js'),
25
- format: "umd",
26
- name: "tracker"
27
- }
28
-
29
- ],
30
- //配置ts
31
- plugins: [
32
- ts(),
33
- ]
34
-
35
- }, {
36
- //打包声明文件
37
- input: "./src/core/index.ts",
38
- output: {
39
- file: path.resolve(__dirname, './dist/index.d.ts'),
40
- format: "es",
41
- },
42
- plugins: [dts()]
43
- }]