File tree Expand file tree Collapse file tree 4 files changed +188
-176
lines changed
Expand file tree Collapse file tree 4 files changed +188
-176
lines changed Original file line number Diff line number Diff line change 66 "build:package" : " turbo run build --filter=@simpleanalytics/nuxt" ,
77 "postinstall" : " turbo run postinstall" ,
88 "dev:prepare" : " turbo run dev:prepare --filter=@simpleanalytics/nuxt" ,
9+ "pack:package" : " pnpm pack --filter=@simpleanalytics/nuxt" ,
910 "lint" : " turbo run lint" ,
1011 "format" : " prettier --write \" **/*.{ts,tsx,md}\" "
1112 },
1213 "devDependencies" : {
1314 "@changesets/cli" : " ^2.29.5" ,
1415 "turbo" : " ^2.5.5"
1516 },
16- "packageManager" : " pnpm@9 .15.0 "
17+ "packageManager" : " pnpm@10 .15.1 "
1718}
Original file line number Diff line number Diff line change 11import { useRuntimeConfig } from "#imports" ;
22import { defineNuxtPlugin } from "nuxt/app" ;
33
4- import SimpleAnalytics from "simple-analytics-vue" ;
4+ /* @ts -expect-error -- force ES module import */
5+ import SimpleAnalytics from "simple-analytics-vue/dist/index.mjs" ;
6+ import type { SimpleAnalyticsOptions } from "simple-analytics-vue" ;
7+ import type { App , Plugin } from "vue" ;
8+
9+ type SimpleAnalyticsPlugin = Plugin & {
10+ install ( app : App , options ?: SimpleAnalyticsOptions ) : void ;
11+ } ;
512
613export default defineNuxtPlugin ( ( nuxtApp ) => {
714 const config = useRuntimeConfig ( ) ;
815
9- nuxtApp . vueApp . use ( SimpleAnalytics , {
10- skip : ! config . public . simpleAnalytics . enabled ,
16+ // We have to cast the plugin here because the forced .mjs import
17+ nuxtApp . vueApp . use ( SimpleAnalytics as SimpleAnalyticsPlugin , {
18+ skip : config . public . simpleAnalytics . enabled === false ,
1119 domain : config . public . simpleAnalytics . domain ,
1220 } ) ;
1321} ) ;
Original file line number Diff line number Diff line change 11export { } ;
22
33declare module "@nuxt/schema" {
4+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
45 interface RuntimeConfig {
56 // Private runtime config (server-side only)
67 }
@@ -94,3 +95,9 @@ declare global {
9495 ) : void ;
9596 }
9697}
98+
99+ declare module "@vue/runtime-core" {
100+ interface InjectionKeys {
101+ saEvent : ( event : string ) => void ;
102+ }
103+ }
You can’t perform that action at this time.
0 commit comments