better-auth-nuxt 0.0.7 → 0.0.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/README.md CHANGED
@@ -26,13 +26,13 @@ A Nuxt module for simple, flexible authentication in your Nuxt applications.
26
26
 
27
27
  ```bash
28
28
  # Using npm
29
- npm install better-auth-nuxt
29
+ npm install better-auth-nuxt better-auth
30
30
 
31
31
  # Using yarn
32
- yarn add better-auth-nuxt
32
+ yarn add better-auth-nuxt better-auth
33
33
 
34
34
  # Using pnpm
35
- pnpm add better-auth-nuxt
35
+ pnpm add better-auth-nuxt better-auth
36
36
  ```
37
37
 
38
38
  2. Add the module to your `nuxt.config.ts`:
@@ -209,10 +209,12 @@ You can create configuration files to customize authentication:
209
209
  Create a `*.better-auth.ts` file to configure server-side auth:
210
210
 
211
211
  ```ts
212
- // app/my-auth.better-auth.ts
213
- export default {
212
+ // server/my-auth.better-auth.ts
213
+ import type { BetterAuthOptions } from 'better-auth'
214
+
215
+ export default () => ({
214
216
  // Custom server-side auth configuration
215
- }
217
+ } satisfies BetterAuthOptions)
216
218
  ```
217
219
 
218
220
  ### Client Configuration
@@ -221,11 +223,15 @@ Create a `*.better-auth-client.ts` file to configure client-side auth:
221
223
 
222
224
  ```ts
223
225
  // app/my-auth.better-auth-client.ts
226
+ import type { ClientOptions } from 'better-auth'
227
+
224
228
  export default {
225
229
  // Custom client-side auth configuration
226
- }
230
+ } satisfies ClientOptions
227
231
  ```
228
232
 
233
+ > **Note**: After adding or modifying configuration files, run `pnpm nuxt prepare` to ensure your changes are properly recognized by Nuxt.
234
+
229
235
  ## Contribution
230
236
 
231
237
  <details>
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "better-auth",
3
3
  "configKey": "betterAuth",
4
- "version": "0.0.7",
4
+ "version": "0.0.9",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
7
7
  "unbuild": "3.5.0"
package/dist/module.mjs CHANGED
@@ -13,6 +13,11 @@ async function serverAuth({ options }) {
13
13
  ...options.configs.map((config) => {
14
14
  return `import ${config.key} from "${config.path}"`;
15
15
  }),
16
+ "",
17
+ "let _auth",
18
+ "",
19
+ "export function useAuth() {",
20
+ " if (!_auth) {",
16
21
  "const betterAuthConfigs = mergeDeep({all: true})({},",
17
22
  "{",
18
23
  ...options.moduleOptions?.options?.server ? Object.entries(options.moduleOptions.options.server).map(([key, value]) => {
@@ -20,14 +25,10 @@ async function serverAuth({ options }) {
20
25
  }) : [],
21
26
  "},",
22
27
  ...options.configs.map((config) => {
23
- return `${config.key},`;
28
+ return `${config.key}(),`;
24
29
  }),
25
30
  ")",
26
31
  "",
27
- "let _auth",
28
- "",
29
- "export function useAuth() {",
30
- " if (!_auth) {",
31
32
  " _auth = betterAuth(betterAuthConfigs)",
32
33
  " }",
33
34
  " return _auth",
@@ -253,7 +254,7 @@ const module = defineNuxtModule({
253
254
  }),
254
255
  "const betterAuthConfigs = mergeDeep({all: true})({},",
255
256
  ...serverConfigs.map((config) => {
256
- return `${config.key},`;
257
+ return `${config.key}(),`;
257
258
  }),
258
259
  ")",
259
260
  "export type BetterAuth = ReturnType<typeof betterAuth<typeof betterAuthConfigs>>",
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").RouteMiddleware;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,2 +1,2 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
1
+ declare const _default: any;
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- declare const _default: {
1
+ declare const _default: () => {
2
2
  disabledPaths: never[];
3
3
  plugins: never[];
4
4
  trustedOrigins: never[];
@@ -1,5 +1,5 @@
1
- export default {
1
+ export default () => ({
2
2
  disabledPaths: [],
3
3
  plugins: [],
4
4
  trustedOrigins: []
5
- };
5
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-auth-nuxt",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Better Auth Nuxt Module",
5
5
  "repository": "productdevbook/better-auth-nuxt",
6
6
  "license": "MIT",
@@ -22,47 +22,45 @@
22
22
  "files": [
23
23
  "dist"
24
24
  ],
25
+ "peerDependencies": {
26
+ "better-auth": ">=1.2.7"
27
+ },
28
+ "dependencies": {
29
+ "@fastify/deepmerge": "^3.1.0",
30
+ "@nuxt/kit": "^3.17.3",
31
+ "defu": "^6.1.4",
32
+ "ohash": "^2.0.11",
33
+ "pathe": "^2.0.3",
34
+ "scule": "^1.3.0",
35
+ "tinyglobby": "^0.2.13"
36
+ },
37
+ "devDependencies": {
38
+ "@nuxt/devtools": "^2.4.1",
39
+ "@nuxt/eslint-config": "^1.4.0",
40
+ "@nuxt/module-builder": "^1.0.1",
41
+ "@nuxt/schema": "^3.17.3",
42
+ "@nuxt/test-utils": "^3.19.0",
43
+ "@tailwindcss/vite": "^4.1.7",
44
+ "@types/better-sqlite3": "^7.6.13",
45
+ "@types/node": "latest",
46
+ "better-auth": "^1.2.8",
47
+ "better-sqlite3": "^11.10.0",
48
+ "changelogen": "^0.6.1",
49
+ "eslint": "^9.26.0",
50
+ "nuxt": "^3.17.3",
51
+ "typescript": "~5.8.3",
52
+ "vitest": "^3.1.3",
53
+ "vue-tsc": "^2.2.10"
54
+ },
25
55
  "scripts": {
26
- "prepack": "nuxt-module-build build",
27
56
  "dev": "nuxi dev playground",
28
57
  "dev:build": "nuxi build playground",
29
58
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
30
- "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
59
+ "release": "npm run lint && npm run test && npm run prepack && changelogen --release && pnpm publish --no-git-checks --access public && git push --follow-tags",
31
60
  "lint": "eslint .",
32
61
  "lint:fix": "eslint . --fix",
33
62
  "test": "vitest run",
34
63
  "test:watch": "vitest watch",
35
64
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
36
- },
37
- "peerDependencies": {
38
- "better-auth": ">=1.2.7"
39
- },
40
- "dependencies": {
41
- "@fastify/deepmerge": "catalog:",
42
- "@nuxt/kit": "catalog:",
43
- "defu": "catalog:",
44
- "ohash": "catalog:",
45
- "pathe": "catalog:",
46
- "scule": "catalog:",
47
- "tinyglobby": "catalog:"
48
- },
49
- "devDependencies": {
50
- "@nuxt/devtools": "catalog:",
51
- "@nuxt/eslint-config": "catalog:",
52
- "@nuxt/module-builder": "catalog:",
53
- "@nuxt/schema": "catalog:",
54
- "@nuxt/test-utils": "catalog:",
55
- "@tailwindcss/vite": "catalog:",
56
- "@types/better-sqlite3": "catalog:",
57
- "@types/node": "latest",
58
- "better-auth": "catalog:",
59
- "better-sqlite3": "catalog:",
60
- "changelogen": "catalog:",
61
- "eslint": "catalog:",
62
- "nuxt": "catalog:",
63
- "typescript": "catalog:",
64
- "vitest": "catalog:",
65
- "vue-tsc": "catalog:"
66
- },
67
- "packageManager": "pnpm@10.10.0"
68
- }
65
+ }
66
+ }