@brainfish-ai/web-tracker 0.0.4-alpha.8 → 0.0.4-alpha.9

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainfish-ai/web-tracker",
3
- "version": "0.0.4-alpha.8",
3
+ "version": "0.0.4-alpha.9",
4
4
  "module": "index.ts",
5
5
  "description": "Brainfish Tracker for Web",
6
6
  "private": false,
package/src/index.ts CHANGED
@@ -22,6 +22,8 @@ function toCamelCase(str: string) {
22
22
  );
23
23
  }
24
24
 
25
+ export const VERSION = import.meta.env.PACKAGE_VERSION as string;
26
+
25
27
  export class Tracker extends TrackerSdk {
26
28
  private lastPath = '';
27
29
  private debounceTimer: ReturnType<typeof setTimeout> | null = null;
@@ -30,7 +32,7 @@ export class Tracker extends TrackerSdk {
30
32
  constructor(public options: TrackerOptions) {
31
33
  super({
32
34
  sdk: 'web',
33
- sdkVersion: __PACKAGE_VERSION__,
35
+ sdkVersion: VERSION,
34
36
  ...options,
35
37
  });
36
38
 
package/src/vite-env.d.ts CHANGED
@@ -1 +1,7 @@
1
- declare const __PACKAGE_VERSION__: string;
1
+ interface ImportMetaEnv {
2
+ readonly PACKAGE_VERSION: string;
3
+ }
4
+
5
+ interface ImportMeta {
6
+ readonly env: ImportMetaEnv;
7
+ }
package/vite.config.ts CHANGED
@@ -4,7 +4,6 @@ import dts from 'vite-plugin-dts';
4
4
  import compression from 'vite-plugin-compression';
5
5
  import { visualizer } from 'rollup-plugin-visualizer';
6
6
  import tsconfigPaths from 'vite-tsconfig-paths';
7
- import { replaceCodePlugin } from 'vite-plugin-replace';
8
7
  import { version } from './package.json';
9
8
 
10
9
  export default defineConfig({
@@ -17,14 +16,6 @@ export default defineConfig({
17
16
  }),
18
17
  compression(),
19
18
  visualizer(),
20
- replaceCodePlugin({
21
- replacements: [
22
- {
23
- from: "__PACKAGE_VERSION__",
24
- to: `"${version}"`,
25
- },
26
- ],
27
- }),
28
19
  ],
29
20
  build: {
30
21
  target: 'esnext',
@@ -51,7 +42,7 @@ export default defineConfig({
51
42
  environment: 'jsdom',
52
43
  },
53
44
  define: {
54
- __PACKAGE_VERSION__: version,
45
+ 'import.meta.env.PACKAGE_VERSION': JSON.stringify(version)
55
46
  },
56
47
  optimizeDeps: {
57
48
  include: ['@brainfish-ai/tracker-sdk'],