@faststats/nuxt 0.2.14 → 0.3.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/module.mjs CHANGED
@@ -1,11 +1,9 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import { addPlugin, addTypeTemplate, createResolver, defineNuxtModule, useLogger } from "@nuxt/kit";
3
3
  import { defu } from "defu";
4
- //#region src/sdk.ts
5
- const SDK_NAME = "@faststats/nuxt";
6
- const SDK_VERSION = "0.2.14";
7
- //#endregion
8
4
  //#region src/module.ts
5
+ const SDK_NAME = "@faststats/nuxt";
6
+ const SDK_VERSION = "0.3.0";
9
7
  var module_default = defineNuxtModule({
10
8
  meta: {
11
9
  name: "@faststats/nuxt",
@@ -15,9 +13,7 @@ var module_default = defineNuxtModule({
15
13
  baseUrl: "https://metrics.faststats.dev",
16
14
  debug: false,
17
15
  autoTrack: true,
18
- trackErrors: true,
19
- trackWebVitals: true,
20
- trackReplay: true
16
+ trackErrors: true
21
17
  },
22
18
  setup(options, nuxt) {
23
19
  const logger = useLogger("faststats");
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/faststats-dev/faststats-javascript.git"
6
6
  },
7
- "version": "0.2.14",
7
+ "version": "0.3.0",
8
8
  "type": "module",
9
9
  "main": "./dist/module.mjs",
10
10
  "types": "./dist/module.d.mts",
@@ -31,7 +31,7 @@
31
31
  "nuxt": "^3.12.0 || ^4.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "@faststats/web": "^0.2.14",
34
+ "@faststats/web": "^0.3.0",
35
35
  "@nuxt/kit": "^4.4.0",
36
36
  "defu": "^6.1.4"
37
37
  },
@@ -6,6 +6,10 @@ import {
6
6
  } from "@faststats/web";
7
7
  import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
8
8
 
9
+ type FaststatsWindow = Window & {
10
+ __faststats?: { getInstance: typeof getInstance };
11
+ };
12
+
9
13
  function normalizeVueError(error: unknown, info?: string): Error {
10
14
  if (error instanceof Error) return error;
11
15
  const message = typeof error === "string" ? error : String(error);
@@ -17,17 +21,13 @@ export default defineNuxtPlugin((nuxtApp) => {
17
21
 
18
22
  new WebAnalytics(runtime as WebAnalyticsOptions);
19
23
 
24
+ if (typeof window !== "undefined") {
25
+ (window as FaststatsWindow).__faststats = { getInstance };
26
+ }
27
+
20
28
  const previousErrorHandler = nuxtApp.vueApp.config.errorHandler;
21
29
  nuxtApp.vueApp.config.errorHandler = (error, instance, info) => {
22
30
  reportError(normalizeVueError(error, info));
23
31
  previousErrorHandler?.(error, instance, info);
24
32
  };
25
-
26
- if (typeof window !== "undefined") {
27
- (
28
- window as Window & { __faststats?: { getInstance: typeof getInstance } }
29
- ).__faststats = {
30
- getInstance,
31
- };
32
- }
33
33
  });