diff --git a/package.json b/package.json index dbdcd4c..a241579 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "vitegil-sdk", "type": "module", - "version": "1.0.0", + "version": "1.1.0", "packageManager": "pnpm@7.9.0", "description": "Vitegil tracker SDK for frontend monitoring, built with rollup", "homepage": "https://github.com/vitegil/vitegil-sdk", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1db7ec0..c989a5b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -38,7 +38,7 @@ packages: eslint-plugin-eslint-comments: 3.2.0_eslint@8.22.0 eslint-plugin-html: 7.1.0 eslint-plugin-import: 2.26.0_3bh5nkk7utn7e74vrwtv6rxmt4 - eslint-plugin-jsonc: 2.3.1_eslint@8.22.0 + eslint-plugin-jsonc: 2.4.0_eslint@8.22.0 eslint-plugin-markdown: 3.0.0_eslint@8.22.0 eslint-plugin-n: 15.2.4_eslint@8.22.0 eslint-plugin-promise: 6.0.0_eslint@8.22.0 @@ -114,7 +114,7 @@ packages: eslint-plugin-eslint-comments: 3.2.0_eslint@8.22.0 eslint-plugin-html: 7.1.0 eslint-plugin-import: 2.26.0_3bh5nkk7utn7e74vrwtv6rxmt4 - eslint-plugin-jsonc: 2.3.1_eslint@8.22.0 + eslint-plugin-jsonc: 2.4.0_eslint@8.22.0 eslint-plugin-n: 15.2.4_eslint@8.22.0 eslint-plugin-promise: 6.0.0_eslint@8.22.0 eslint-plugin-unicorn: 43.0.2_eslint@8.22.0 @@ -918,8 +918,8 @@ packages: - supports-color dev: true - /eslint-plugin-jsonc/2.3.1_eslint@8.22.0: - resolution: {integrity: sha512-8sgWGWiVRMFL6xGawRymrE4RjZJgiU0rXYgFFb71wvdwuUkPgWSvfFtc8jfwcgjjqFjis8vzCUFsg7SciMEDWw==} + /eslint-plugin-jsonc/2.4.0_eslint@8.22.0: + resolution: {integrity: sha512-YXy5PjyUL9gFYal6pYijd8P6EmpeWskv7PVhB9Py/AwKPn+hwnQHcIzQILiLfxztfhtWiRIUSzoLe/JThZgSUw==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: '>=6.0.0' diff --git a/rollup.config.js b/rollup.config.js index 121329c..d9bf42f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -12,14 +12,17 @@ export default [ { file: path.resolve(__dirname, './dist/index.esm.js'), format: 'esm', + exports: 'auto', }, { file: path.resolve(__dirname, './dist/index.cjs.js'), format: 'cjs', + exports: 'auto', }, { file: path.resolve(__dirname, './dist/index.js'), format: 'umd', + exports: 'auto', name: 'Tracker', }, ], @@ -45,6 +48,7 @@ export default [ output: { file: path.resolve(__dirname, './dist/index.d.ts'), format: 'es', + exports: 'auto', }, plugins: [dts()], }, diff --git a/src/core/index.ts b/src/core/index.ts index 67dc3e2..d736538 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -127,7 +127,7 @@ export default class Tracker { /** * 上报用户uuid(计算uv) */ - private reportID(): void { + private reportId(): void { if (this.data.lazyReport) { this.saveTracker({ event: 'uv-event', @@ -345,7 +345,7 @@ export default class Tracker { */ private installTracker(): void { if (this.data.uuid) - this.reportID() + this.reportId() if (this.data.historyTracker) { this.captureEvents( diff --git a/src/lib/device.ts b/src/lib/device.ts index 7aabb11..6d5a236 100644 --- a/src/lib/device.ts +++ b/src/lib/device.ts @@ -101,8 +101,8 @@ function getOsVersion(os: string | undefined, u: string): string { } function getNetwork(navigator: any) { - const netWork = navigator && navigator.connection && navigator.connection.effectiveType - return netWork + const network = navigator && navigator.connection && navigator.connection.effectiveType + return network } function getLanguage(navigator: any) { @@ -171,7 +171,7 @@ export function getDeviceData() { screenHeight: _window.screen.height, screenWidth: _window.screen.width, language: getLanguage(navigator), - netWork: getNetwork(navigator), + network: getNetwork(navigator), orientation: getOrientationStatus(_window), browser: getValue(map, BrowserType), browserInfo: getBrowserInfo(map, ua), diff --git a/src/types/device.ts b/src/types/device.ts index 86b5044..39a169f 100644 --- a/src/types/device.ts +++ b/src/types/device.ts @@ -216,7 +216,7 @@ export const OsVersionMap: version = { * @screenHeight 屏幕高 * @screenWidth 屏幕宽 * @language 当前使用的语言-国家 - * @netWork 联网类型 + * @network 联网类型 * @orientation 横竖屏 * @browser 浏览器类型 * @browserInfo 浏览器信息 @@ -228,7 +228,7 @@ export interface DeviceData { screenHeight: number | undefined screenWidth: number | undefined language: string | undefined - netWork: string | undefined + network: string | undefined orientation: string | undefined browser: string | undefined browserInfo: string | undefined