@witchcraft/nuxt-auth 0.2.1 → 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.1",
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,13 +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 dependencies = {
6
- "@witchcraft/ui": "^0.3.5",
7
- "nuxt-security": "^2.4.0"};
8
- const pkg = {
9
- dependencies: dependencies};
10
-
11
- const module = defineNuxtModule({
5
+ const module$1 = defineNuxtModule({
12
6
  meta: {
13
7
  name: "auth",
14
8
  configKey: "auth"
@@ -57,11 +51,11 @@ const module = defineNuxtModule({
57
51
  },
58
52
  moduleDependencies: {
59
53
  "@witchcraft/ui": {
60
- version: pkg.dependencies["@witchcraft/ui"],
54
+ version: "^0.3.5",
61
55
  optional: true
62
56
  },
63
57
  "nuxt-security": {
64
- version: pkg.dependencies["nuxt-security"],
58
+ version: "^2.4.0",
65
59
  optional: true
66
60
  }
67
61
  },
@@ -85,7 +79,7 @@ const module = defineNuxtModule({
85
79
  options
86
80
  );
87
81
  delete nuxt.options.runtimeConfig.public.auth.useGlobalMiddleware;
88
- nuxt.options.alias["#auth"] = resolve("runtime");
82
+ nuxt.options.alias["#witchcraft-nuxt-auth"] = resolve("runtime");
89
83
  addImportsDir(resolve("runtime/composables"));
90
84
  addImportsDir(resolve("runtime/utils"));
91
85
  addServerScanDir(resolve("runtime/server"));
@@ -140,4 +134,4 @@ const module = defineNuxtModule({
140
134
  }
141
135
  });
142
136
 
143
- 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;
@@ -116,15 +116,15 @@ const props = defineProps({
116
116
  body: {
117
117
  username: username2
118
118
  }
119
- }).catch((e) => {
119
+ }).catch(async (e) => {
120
+ error2.value = `Registration Error: ${e.data.message}`;
120
121
  if (e?.data?.code === AUTH_ERROR.USER_ALREADY_REGISTERED) {
121
122
  useAuth().setFetchUserOnNavigation(true);
122
- navigateTo(redirectUrl, { external: true });
123
+ await navigateTo(redirectUrl, { external: true });
123
124
  }
124
- error2.value = `Registration Error: ${e.data.message}`;
125
125
  });
126
126
  if (typeof res === "object" && res.redirectUrl) {
127
- navigateTo(res.redirectUrl, { external: true });
127
+ await navigateTo(res.redirectUrl, { external: true });
128
128
  }
129
129
  } },
130
130
  id: { type: String, required: false }
@@ -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,106 +1,105 @@
1
1
  {
2
- "name": "@witchcraft/nuxt-auth",
3
- "version": "0.2.1",
4
- "description": "Nuxt module for logging.",
5
- "repository": "witchcraftjs/nuxt-auth",
6
- "license": "MIT",
7
- "type": "module",
8
- "sideEffects": false,
9
- "//exports": {
10
- "require in ./*": "Temporary for drizzle."
11
- },
12
- "exports": {
13
- ".": {
14
- "types": "./dist/types.d.mts",
15
- "import": "./dist/module.mjs"
16
- },
17
- "./*": {
18
- "types": "./dist/runtime/*.d.ts",
19
- "import": "./dist/runtime/*.js",
20
- "require": "./dist/runtime/*.js"
21
- }
22
- },
23
- "files": [
24
- "dist"
25
- ],
26
- "scripts": {
27
- "prepare": "husky && pnpm nuxt-module-build prepare && pnpm build:only && cd playground && pnpm i --ignore-scripts --ignore-workspace",
28
- "build": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'nuxt-module-build prepare && nuxt-module-build build && pnpm nuxi build playground'",
29
- "build:only": "nuxt-module-build build",
30
- "//": "drizzle requires we run from playground",
31
- "dev:playground": "cd playground && pnpm dev",
32
- "dev:prepare": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'pnpm nuxt-module-build build --stub && pnpm nuxt-module-build prepare && pnpm nuxi prepare playground'",
33
- "lint": "pnpm lint:eslint && pnpm lint:types && pnpm lint:commits",
34
- "lint:eslint": "eslint \"{src,test,playground/app}/**/*.{ts,vue}\" \"*.{js,cjs,mjs,ts}\"",
35
- "lint:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
36
- "lint:commits": "commitlint --from-last-tag --to HEAD --verbose",
37
- "test": "echo no tests and not working yet vitest run --exclude .direnv",
38
- "test:watch": "vitest watch --exclude .direnv"
39
- },
40
- "peerDependencies": {
41
- "drizzle-orm": "^0.44.3"
42
- },
43
- "@comments": {
44
- "dependencies": {
45
- "@witchcraft/nuxt-logger": "This is only for some types for the logger, but is otherwise unused."
46
- }
47
- },
48
- "dependencies": {
49
- "@alanscodelog/tsconfigs": "^6.2.0",
50
- "@alanscodelog/utils": "^6.0.2",
51
- "@iconify/json": "^2.2.393",
52
- "@nuxt/kit": "^4.1.3",
53
- "@oslojs/crypto": "^1.0.1",
54
- "@oslojs/encoding": "^1.1.0",
55
- "@types/jsonwebtoken": "^9.0.10",
56
- "@vueuse/core": "^13.9.0",
57
- "@witchcraft/nuxt-logger": "^0.0.6",
58
- "@witchcraft/ui": "^0.3.5",
59
- "arctic": "~3.7.0",
60
- "cookie-es": "^2.0.0",
61
- "defu": "latest",
62
- "h3": "1.15.4",
63
- "jsonwebtoken": "^9.0.2",
64
- "ms": "^2.1.3",
65
- "nuxt-security": "^2.4.0",
66
- "unplugin-icons": "^22.4.2",
67
- "unplugin-vue-components": "^29.1.0",
68
- "zod": "^4.1.12"
69
- },
70
- "devDependencies": {
71
- "@alanscodelog/eslint-config": "^6.3.1",
72
- "@alanscodelog/semantic-release-config": "^5.0.4",
73
- "@commitlint/cli": "^20.1.0",
74
- "@nuxt/eslint-config": "^1.9.0",
75
- "@nuxt/module-builder": "^1.0.2",
76
- "@nuxt/schema": "^4.1.3",
77
- "@nuxt/test-utils": "^3.19.2",
78
- "@tailwindcss/cli": "^4.1.14",
79
- "@types/node": "latest",
80
- "changelogen": "^0.6.2",
81
- "cross-env": "^10.1.0",
82
- "drizzle-orm": "^0.44.6",
83
- "electron": "^38.2.2",
84
- "eslint": "^9.37.0",
85
- "husky": "^9.1.7",
86
- "nuxt": "^4.1.3",
87
- "reka-ui": "^2.5.1",
88
- "tailwindcss": "^4.1.14",
89
- "typescript": "^5.9.3",
90
- "vitest": "^3.2.4",
91
- "vue-tsc": "^3.1.1"
92
- },
93
- "release": {
94
- "extends": [
95
- "@alanscodelog/semantic-release-config"
96
- ]
97
- },
98
- "commitlint": {
99
- "extends": [
100
- "@alanscodelog"
101
- ]
102
- },
103
- "publishConfig": {
104
- "access": "public"
105
- }
106
- }
2
+ "name": "@witchcraft/nuxt-auth",
3
+ "version": "0.3.0",
4
+ "description": "Nuxt module for logging.",
5
+ "repository": "witchcraftjs/nuxt-auth",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "sideEffects": false,
9
+ "//exports": {
10
+ "require in ./*": "Temporary for drizzle."
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/types.d.mts",
15
+ "import": "./dist/module.mjs"
16
+ },
17
+ "./*": {
18
+ "types": "./dist/runtime/*.d.ts",
19
+ "import": "./dist/runtime/*.js",
20
+ "require": "./dist/runtime/*.js"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "peerDependencies": {
27
+ "drizzle-orm": "^0.44.6"
28
+ },
29
+ "@comments": {
30
+ "dependencies": {
31
+ "@witchcraft/nuxt-logger": "This is only for some types for the logger, but is otherwise unused."
32
+ }
33
+ },
34
+ "dependencies": {
35
+ "@alanscodelog/tsconfigs": "^6.2.0",
36
+ "@alanscodelog/utils": "^6.0.2",
37
+ "@iconify/json": "^2.2.393",
38
+ "@nuxt/kit": "^4.1.3",
39
+ "@oslojs/crypto": "^1.0.1",
40
+ "@oslojs/encoding": "^1.1.0",
41
+ "@types/jsonwebtoken": "^9.0.10",
42
+ "@vueuse/core": "^13.9.0",
43
+ "@witchcraft/nuxt-logger": "^0.0.9",
44
+ "@witchcraft/ui": "^0.3.7",
45
+ "arctic": "^3.7.0",
46
+ "cookie-es": "^2.0.0",
47
+ "defu": "^6.1.4",
48
+ "h3": "1.15.4",
49
+ "jsonwebtoken": "^9.0.2",
50
+ "ms": "^2.1.3",
51
+ "nuxt-security": "^2.4.0",
52
+ "unplugin-icons": "^22.4.2",
53
+ "unplugin-vue-components": "^29.1.0",
54
+ "zod": "^4.1.12"
55
+ },
56
+ "devDependencies": {
57
+ "@alanscodelog/eslint-config": "^6.3.1",
58
+ "@alanscodelog/semantic-release-config": "^6.0.0",
59
+ "@commitlint/cli": "^20.1.0",
60
+ "@nuxt/eslint-config": "^1.9.0",
61
+ "@nuxt/module-builder": "^1.0.2",
62
+ "@nuxt/schema": "^4.1.3",
63
+ "@nuxt/test-utils": "^3.19.2",
64
+ "@tailwindcss/cli": "^4.1.14",
65
+ "@types/node": "latest",
66
+ "changelogen": "^0.6.2",
67
+ "cross-env": "^10.1.0",
68
+ "drizzle-orm": "^0.44.6",
69
+ "electron": "^38.2.2",
70
+ "eslint": "^9.37.0",
71
+ "husky": "^9.1.7",
72
+ "nuxt": "^4.2.1",
73
+ "reka-ui": "^2.5.1",
74
+ "tailwindcss": "^4.1.14",
75
+ "typescript": "^5.9.3",
76
+ "vitest": "^3.2.4",
77
+ "vue-tsc": "^3.1.1"
78
+ },
79
+ "release": {
80
+ "extends": [
81
+ "@alanscodelog/semantic-release-config"
82
+ ]
83
+ },
84
+ "commitlint": {
85
+ "extends": [
86
+ "@alanscodelog"
87
+ ]
88
+ },
89
+ "publishConfig": {
90
+ "access": "public"
91
+ },
92
+ "scripts": {
93
+ "build": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'nuxt-module-build prepare && nuxt-module-build build && pnpm nuxi build playground'",
94
+ "build:only": "nuxt-module-build build",
95
+ "//": "drizzle requires we run from playground",
96
+ "dev:playground": "cd playground && pnpm dev",
97
+ "dev:prepare": "cross-env-shell DISABLE_POSTGRES_ENSURE_ENV=true 'pnpm nuxt-module-build build --stub && pnpm nuxt-module-build prepare && pnpm nuxi prepare playground'",
98
+ "lint": "pnpm lint:eslint && pnpm lint:types && pnpm lint:commits",
99
+ "lint:eslint": "eslint \"{src,test,playground/app}/**/*.{ts,vue}\" \"*.{js,cjs,mjs,ts}\"",
100
+ "lint:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
101
+ "lint:commits": "commitlint --from-last-tag --to HEAD --verbose",
102
+ "test": "echo no tests and not working yet vitest run --exclude .direnv",
103
+ "test:watch": "vitest watch --exclude .direnv"
104
+ }
105
+ }