@witchcraft/nuxt-auth 0.2.2 → 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.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "auth",
3
3
  "configKey": "auth",
4
- "version": "0.2.2",
4
+ "version": "0.3.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -2,7 +2,7 @@ import { crop } from '@alanscodelog/utils/crop';
2
2
  import { defineNuxtModule, useLogger, createResolver, addComponentsDir, addImportsDir, addServerScanDir, addServerImportsDir, addServerImports, addTemplate, addRouteMiddleware } from '@nuxt/kit';
3
3
  import { defu } from 'defu';
4
4
 
5
- const module = defineNuxtModule({
5
+ const module$1 = defineNuxtModule({
6
6
  meta: {
7
7
  name: "auth",
8
8
  configKey: "auth"
@@ -79,7 +79,7 @@ const module = defineNuxtModule({
79
79
  options
80
80
  );
81
81
  delete nuxt.options.runtimeConfig.public.auth.useGlobalMiddleware;
82
- nuxt.options.alias["#auth"] = resolve("runtime");
82
+ nuxt.options.alias["#witchcraft-nuxt-auth"] = resolve("runtime");
83
83
  addImportsDir(resolve("runtime/composables"));
84
84
  addImportsDir(resolve("runtime/utils"));
85
85
  addServerScanDir(resolve("runtime/server"));
@@ -134,4 +134,4 @@ const module = defineNuxtModule({
134
134
  }
135
135
  });
136
136
 
137
- export { module as default };
137
+ export { module$1 as default };
@@ -5,12 +5,12 @@ type __VLS_Props = {
5
5
  useAuthOptions?: UseAuthComposableOptions;
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
- declare var __VLS_19: {
8
+ declare var __VLS_20: {
9
9
  class: string;
10
10
  iconClass: string;
11
11
  };
12
12
  type __VLS_Slots = {} & {
13
- extra?: (props: typeof __VLS_19) => any;
13
+ extra?: (props: typeof __VLS_20) => any;
14
14
  };
15
15
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
16
  providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
@@ -5,12 +5,12 @@ type __VLS_Props = {
5
5
  useAuthOptions?: UseAuthComposableOptions;
6
6
  loginOptions?: Parameters<ReturnType<typeof useAuth>["login"]>[1];
7
7
  };
8
- declare var __VLS_19: {
8
+ declare var __VLS_20: {
9
9
  class: string;
10
10
  iconClass: string;
11
11
  };
12
12
  type __VLS_Slots = {} & {
13
- extra?: (props: typeof __VLS_19) => any;
13
+ extra?: (props: typeof __VLS_20) => any;
14
14
  };
15
15
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
16
16
  providerStyles: Record<ProviderNames, Partial<ProviderStyle>>;
@@ -8,10 +8,10 @@ declare var __VLS_1: {
8
8
  authRoutes: any;
9
9
  }, __VLS_3: {
10
10
  user: any;
11
- }, __VLS_18: {
11
+ }, __VLS_19: {
12
12
  user: any;
13
13
  authRoutes: any;
14
- }, __VLS_33: {
14
+ }, __VLS_35: {
15
15
  authRoutes: any;
16
16
  };
17
17
  type __VLS_Slots = {} & {
@@ -19,9 +19,9 @@ type __VLS_Slots = {} & {
19
19
  } & {
20
20
  user?: (props: typeof __VLS_3) => any;
21
21
  } & {
22
- 'authenticated-unregistered'?: (props: typeof __VLS_18) => any;
22
+ 'authenticated-unregistered'?: (props: typeof __VLS_19) => any;
23
23
  } & {
24
- unauthenticated?: (props: typeof __VLS_33) => any;
24
+ unauthenticated?: (props: typeof __VLS_35) => any;
25
25
  };
26
26
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
27
  usernameLink: (user: AuthUser) => string;
@@ -8,10 +8,10 @@ declare var __VLS_1: {
8
8
  authRoutes: any;
9
9
  }, __VLS_3: {
10
10
  user: any;
11
- }, __VLS_18: {
11
+ }, __VLS_19: {
12
12
  user: any;
13
13
  authRoutes: any;
14
- }, __VLS_33: {
14
+ }, __VLS_35: {
15
15
  authRoutes: any;
16
16
  };
17
17
  type __VLS_Slots = {} & {
@@ -19,9 +19,9 @@ type __VLS_Slots = {} & {
19
19
  } & {
20
20
  user?: (props: typeof __VLS_3) => any;
21
21
  } & {
22
- 'authenticated-unregistered'?: (props: typeof __VLS_18) => any;
22
+ 'authenticated-unregistered'?: (props: typeof __VLS_19) => any;
23
23
  } & {
24
- unauthenticated?: (props: typeof __VLS_33) => any;
24
+ unauthenticated?: (props: typeof __VLS_35) => any;
25
25
  };
26
26
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
27
27
  usernameLink: (user: AuthUser) => string;
@@ -6,20 +6,20 @@ type __VLS_Props = {
6
6
  onSubmitRegistration?: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
7
7
  id?: string;
8
8
  };
9
- declare var __VLS_17: {}, __VLS_24: {}, __VLS_31: {}, __VLS_38: {}, __VLS_45: {
9
+ declare var __VLS_20: {}, __VLS_27: {}, __VLS_34: {}, __VLS_41: {}, __VLS_49: {
10
10
  error: any;
11
11
  registrationError: any;
12
12
  };
13
13
  type __VLS_Slots = {} & {
14
- 'username-icon-loading'?: (props: typeof __VLS_17) => any;
14
+ 'username-icon-loading'?: (props: typeof __VLS_20) => any;
15
15
  } & {
16
- 'username-icon-valid'?: (props: typeof __VLS_24) => any;
16
+ 'username-icon-valid'?: (props: typeof __VLS_27) => any;
17
17
  } & {
18
- 'username-icon-invalid'?: (props: typeof __VLS_31) => any;
18
+ 'username-icon-invalid'?: (props: typeof __VLS_34) => any;
19
19
  } & {
20
- default?: (props: typeof __VLS_38) => any;
20
+ default?: (props: typeof __VLS_41) => any;
21
21
  } & {
22
- error?: (props: typeof __VLS_45) => any;
22
+ error?: (props: typeof __VLS_49) => any;
23
23
  };
24
24
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
25
  debounce: number;
@@ -6,20 +6,20 @@ type __VLS_Props = {
6
6
  onSubmitRegistration?: (event: Event, username: string, error: Ref<string>, redirectUrl: string, deeplink?: string) => void;
7
7
  id?: string;
8
8
  };
9
- declare var __VLS_17: {}, __VLS_24: {}, __VLS_31: {}, __VLS_38: {}, __VLS_45: {
9
+ declare var __VLS_20: {}, __VLS_27: {}, __VLS_34: {}, __VLS_41: {}, __VLS_49: {
10
10
  error: any;
11
11
  registrationError: any;
12
12
  };
13
13
  type __VLS_Slots = {} & {
14
- 'username-icon-loading'?: (props: typeof __VLS_17) => any;
14
+ 'username-icon-loading'?: (props: typeof __VLS_20) => any;
15
15
  } & {
16
- 'username-icon-valid'?: (props: typeof __VLS_24) => any;
16
+ 'username-icon-valid'?: (props: typeof __VLS_27) => any;
17
17
  } & {
18
- 'username-icon-invalid'?: (props: typeof __VLS_31) => any;
18
+ 'username-icon-invalid'?: (props: typeof __VLS_34) => any;
19
19
  } & {
20
- default?: (props: typeof __VLS_38) => any;
20
+ default?: (props: typeof __VLS_41) => any;
21
21
  } & {
22
- error?: (props: typeof __VLS_45) => any;
22
+ error?: (props: typeof __VLS_49) => any;
23
23
  };
24
24
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
25
25
  debounce: number;
@@ -13,10 +13,11 @@ export default defineNuxtRouteMiddleware(async (_to, _from) => {
13
13
  if (import.meta.client && import.meta.dev) {
14
14
  console.log({ ns: "auth:middleware:authGlobal", doFetch: doFetch.value, userData: userData.value });
15
15
  }
16
- if (!doFetch.value) return;
17
- const res = await useFetch(getAuthApiRoute(useRuntimeConfig().public, "usersInfo"));
18
- doFetch.value = false;
19
- userData.value = res.data.value;
16
+ if (doFetch.value) {
17
+ const res = await useFetch(getAuthApiRoute(useRuntimeConfig().public, "usersInfo"));
18
+ doFetch.value = false;
19
+ userData.value = res.data.value;
20
+ }
20
21
  if (import.meta.client && !userData.value) {
21
22
  const user = jsonSafeParse(localStorage.getItem("auth:user") ?? "null");
22
23
  if (user.isOk && user.value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@witchcraft/nuxt-auth",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "description": "Nuxt module for logging.",
5
5
  "repository": "witchcraftjs/nuxt-auth",
6
6
  "license": "MIT",
@@ -69,7 +69,7 @@
69
69
  "electron": "^38.2.2",
70
70
  "eslint": "^9.37.0",
71
71
  "husky": "^9.1.7",
72
- "nuxt": "^4.1.3",
72
+ "nuxt": "^4.2.1",
73
73
  "reka-ui": "^2.5.1",
74
74
  "tailwindcss": "^4.1.14",
75
75
  "typescript": "^5.9.3",