@lenne.tech/nuxt-extensions 1.5.0 → 1.5.2

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/CLAUDE.md ADDED
@@ -0,0 +1,75 @@
1
+ # @lenne.tech/nuxt-extensions
2
+
3
+ Reusable Nuxt 4 module providing composables, components, utilities, and Better Auth integration for lenne.tech projects.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ src/
9
+ ├── module.ts # Nuxt module entry point (auto-imports, plugin registration)
10
+ ├── runtime/
11
+ │ ├── composables/ # Auto-imported composables
12
+ │ ├── components/ # Auto-imported components
13
+ │ ├── lib/ # Library exports (auth-client, helpers)
14
+ │ ├── middleware/ # Route middleware (auth)
15
+ │ ├── plugins/ # Nuxt plugins (auth initialization)
16
+ │ ├── server/ # Nitro server routes (auth proxy)
17
+ │ ├── testing/ # Playwright test helpers
18
+ │ ├── types/ # TypeScript type definitions
19
+ │ └── utils/ # Auto-imported utility functions
20
+ ```
21
+
22
+ ## Key Composables
23
+
24
+ | Composable | Purpose |
25
+ |-----------|---------|
26
+ | `useBetterAuth()` | Authentication state, login, logout, session management |
27
+ | `useAuthClient()` | Raw Better Auth client access |
28
+ | `useTusUpload()` | TUS resumable file uploads |
29
+
30
+ ## Module Configuration
31
+
32
+ Configure in `nuxt.config.ts`:
33
+
34
+ ```typescript
35
+ export default defineNuxtConfig({
36
+ modules: ['@lenne.tech/nuxt-extensions'],
37
+ lennetech: {
38
+ // API base URL for auth proxy
39
+ apiUrl: 'http://localhost:3000',
40
+ // Enable/disable features
41
+ betterAuth: true,
42
+ tusUpload: true,
43
+ }
44
+ })
45
+ ```
46
+
47
+ ## Authentication (Better Auth)
48
+
49
+ - SSR-safe session management via `useBetterAuth()`
50
+ - Auth proxy server route at `/api/auth/**` (proxies to backend)
51
+ - Middleware `auth` for protected routes
52
+ - Passkey (WebAuthn) support via `@better-auth/passkey` peer dependency
53
+ - 2FA (TOTP) support built-in
54
+
55
+ ### Auth Flow
56
+
57
+ 1. Frontend calls `useBetterAuth().signIn()` / `.signUp()`
58
+ 2. Request goes through Nitro proxy at `/api/auth/**`
59
+ 3. Proxy forwards to backend Better Auth endpoints
60
+ 4. Session cookie set via `httpOnly` cookie (SSR-safe)
61
+
62
+ ## Testing Helpers
63
+
64
+ Import from `@lenne.tech/nuxt-extensions/testing`:
65
+
66
+ ```typescript
67
+ import { createTestUser, loginTestUser } from '@lenne.tech/nuxt-extensions/testing';
68
+ ```
69
+
70
+ ## Development Rules
71
+
72
+ 1. **ALWAYS read source code** in `dist/runtime/` to understand available composables and components
73
+ 2. **Use `useBetterAuth()`** for authentication — never implement auth manually
74
+ 3. **Check existing composables** before creating new ones — this module may already provide what you need
75
+ 4. **Peer dependencies** (`better-auth`, `@better-auth/passkey`, `tus-js-client`) must be installed in the consuming project
package/dist/module.d.mts CHANGED
@@ -6,7 +6,7 @@ export { LtAuthModuleOptions, LtErrorTranslationModuleOptions, LtExtensionsModul
6
6
  export { LtErrorTranslationResponse, LtParsedError, UseLtErrorTranslationReturn } from '../dist/runtime/types/error.js';
7
7
 
8
8
  declare const name = "@lenne.tech/nuxt-extensions";
9
- declare const version = "1.4.0";
9
+ declare const version = "1.5.2";
10
10
  declare const configKey = "ltExtensions";
11
11
  declare const _default: _nuxt_schema.NuxtModule<LtExtensionsModuleOptions, LtExtensionsModuleOptions, false>;
12
12
 
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "configKey": "ltExtensions",
3
3
  "name": "@lenne.tech/nuxt-extensions",
4
- "version": "1.4.0",
4
+ "version": "1.5.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtModule, createResolver, addImports, addComponent, addPlugin, addRouteMiddleware } from '@nuxt/kit';
2
2
 
3
3
  const name = "@lenne.tech/nuxt-extensions";
4
- const version = "1.4.0";
4
+ const version = "1.5.2";
5
5
  const configKey = "ltExtensions";
6
6
  const defaultOptions = {
7
7
  auth: {
@@ -465,7 +465,7 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
465
465
  */
466
466
  passkey: any;
467
467
  social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
468
- provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel";
468
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
469
469
  callbackURL?: string | undefined;
470
470
  newUserCallbackURL?: string | undefined;
471
471
  errorCallbackURL?: string | undefined;
@@ -489,7 +489,7 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
489
489
  loginHint?: string | undefined;
490
490
  additionalData?: Record<string, any> | undefined;
491
491
  }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth").Prettify<{
492
- provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel";
492
+ provider: (string & {}) | "linear" | "huggingface" | "github" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
493
493
  callbackURL?: string | undefined;
494
494
  newUserCallbackURL?: string | undefined;
495
495
  errorCallbackURL?: string | undefined;
@@ -39,7 +39,7 @@ export function getOrCreateLtAuthClient(config) {
39
39
  }
40
40
  export function createLtAuthClient(config = {}) {
41
41
  const useProxy = isLocalDevApiProxy();
42
- const defaultBaseURL = useProxy ? "" : import.meta.env?.VITE_API_URL || process.env.API_URL || "http://localhost:3000";
42
+ const defaultBaseURL = useProxy ? "" : import.meta.env?.VITE_API_URL || process.env.API_URL || "";
43
43
  const defaultBasePath = useProxy ? "/api/iam" : "/iam";
44
44
  const {
45
45
  baseURL = defaultBaseURL,
@@ -56,7 +56,7 @@ export declare function isLocalDevApiProxy(): boolean;
56
56
  * keys at build time so Nuxt knows which keys to override.
57
57
  *
58
58
  * ### SSR (Server-Side Rendering)
59
- * Fallback chain: `NUXT_API_URL` → `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `localhost:3000`
59
+ * Fallback chain: `NUXT_API_URL` → `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `""` (warns)
60
60
  *
61
61
  * `NUXT_API_URL` allows using an internal network address (e.g., `http://api.svc.cluster.local`)
62
62
  * that is never exposed to the client bundle. If not set, the public URL is used.
@@ -66,7 +66,7 @@ export declare function isLocalDevApiProxy(): boolean;
66
66
  * This ensures same-origin requests for cookies/WebAuthn. **Only for local development.**
67
67
  *
68
68
  * ### Client direct (deployed instances)
69
- * Fallback chain: `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `localhost:3000`
69
+ * Fallback chain: `NUXT_PUBLIC_API_URL` → `auth.baseURL` → `""` (warns)
70
70
  *
71
71
  * ## Deployment Scenarios
72
72
  *
@@ -31,16 +31,24 @@ export function buildLtApiUrl(path) {
31
31
  const publicUrl = runtimeConfig.public.apiUrl || "";
32
32
  const authBaseURL = runtimeConfig.public?.ltExtensions?.auth?.baseURL || "";
33
33
  if (import.meta.server) {
34
- const apiUrl2 = runtimeConfig.apiUrl || publicUrl || authBaseURL || "http://localhost:3000";
35
- return `${apiUrl2.replace(/\/+$/, "")}${path}`;
34
+ const apiUrl2 = runtimeConfig.apiUrl || publicUrl || authBaseURL;
35
+ if (!apiUrl2) {
36
+ console.warn(
37
+ "[LtExtensions] No API URL configured. Set NUXT_API_URL or NUXT_PUBLIC_API_URL."
38
+ );
39
+ }
40
+ return `${(apiUrl2 || "").replace(/\/+$/, "")}${path}`;
36
41
  }
37
42
  if (isLocalDevApiProxy()) {
38
43
  return `/api${path}`;
39
44
  }
40
- const apiUrl = publicUrl || authBaseURL || "http://localhost:3000";
41
- return `${apiUrl.replace(/\/+$/, "")}${path}`;
45
+ const apiUrl = publicUrl || authBaseURL;
46
+ if (!apiUrl) {
47
+ console.warn("[LtExtensions] No API URL configured. Set NUXT_PUBLIC_API_URL.");
48
+ }
49
+ return `${(apiUrl || "").replace(/\/+$/, "")}${path}`;
42
50
  } catch {
43
- return `http://localhost:3000${path}`;
51
+ return path;
44
52
  }
45
53
  }
46
54
  export function getLtAuthMode() {
@@ -8,5 +8,6 @@
8
8
  * - needsSetup === true AND route != setupPath -> redirect to setupPath
9
9
  * - needsSetup === false AND route === setupPath -> redirect to loginPath
10
10
  */
11
- declare const _default: import("nuxt/app").RouteMiddleware;
11
+ import type { RouteMiddleware } from "#app";
12
+ declare const _default: RouteMiddleware;
12
13
  export default _default;
@@ -4,5 +4,6 @@
4
4
  * Automatically loads error translations on app start.
5
5
  * Provides global helper methods: $ltTranslateError, $ltShowErrorToast
6
6
  */
7
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
7
+ import type { ObjectPlugin, Plugin } from "#app";
8
+ declare const _default: Plugin & ObjectPlugin;
8
9
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lenne.tech/nuxt-extensions",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "author": "lenne.Tech <info@lenne.tech> (https://lenne.tech)",
14
14
  "license": "MIT",
15
- "packageManager": "pnpm@10.32.1",
15
+ "packageManager": "pnpm@10.33.0",
16
16
  "type": "module",
17
17
  "exports": {
18
18
  ".": {
@@ -43,7 +43,8 @@
43
43
  }
44
44
  },
45
45
  "files": [
46
- "dist"
46
+ "dist",
47
+ "CLAUDE.md"
47
48
  ],
48
49
  "scripts": {
49
50
  "prepare": "git config core.hooksPath .githooks",
@@ -93,22 +94,22 @@
93
94
  }
94
95
  },
95
96
  "devDependencies": {
96
- "@better-auth/passkey": "1.5.5",
97
- "@nuxt/devtools": "3.2.3",
97
+ "@better-auth/passkey": "1.5.6",
98
+ "@nuxt/devtools": "3.2.4",
98
99
  "@nuxt/module-builder": "1.0.2",
99
100
  "@nuxt/schema": "4.4.2",
100
- "@playwright/test": "1.58.2",
101
- "@types/node": "25.5.0",
102
- "@vitest/coverage-v8": "4.1.0",
103
- "better-auth": "1.5.5",
104
- "happy-dom": "20.8.4",
101
+ "@playwright/test": "1.59.1",
102
+ "@types/node": "25.5.2",
103
+ "@vitest/coverage-v8": "4.1.2",
104
+ "better-auth": "1.5.6",
105
+ "happy-dom": "20.8.9",
105
106
  "nuxt": "4.4.2",
106
- "oxfmt": "0.40.0",
107
- "oxlint": "1.55.0",
107
+ "oxfmt": "0.43.0",
108
+ "oxlint": "1.58.0",
108
109
  "tus-js-client": "4.3.1",
109
110
  "typescript": "5.9.3",
110
- "vitest": "4.1.0",
111
- "vue-tsc": "3.2.5"
111
+ "vitest": "4.1.2",
112
+ "vue-tsc": "3.2.6"
112
113
  },
113
114
  "pnpm": {
114
115
  "onlyBuiltDependencies": [
@@ -116,13 +117,23 @@
116
117
  "esbuild"
117
118
  ],
118
119
  "overrides": {
119
- "minimatch@>=5.0.0 <5.1.8": "5.1.8",
120
- "minimatch@>=9.0.0 <9.0.7": "9.0.7",
121
- "minimatch@>=10.0.0 <10.2.3": "10.2.3",
120
+ "brace-expansion@<2.0.3": ">=2.0.3",
121
+ "brace-expansion@>=4.0.0 <5.0.5": ">=5.0.5",
122
+ "defu@<=6.1.4": ">=6.1.5",
123
+ "h3@<1.15.9": ">=1.15.9",
124
+ "lodash@<=4.17.23": ">=4.18.0",
125
+ "minimatch@>=5.0.0 <5.1.9": "5.1.9",
126
+ "minimatch@>=9.0.0 <9.0.9": "9.0.9",
127
+ "minimatch@>=10.0.0 <10.2.5": "10.2.5",
128
+ "node-forge@<1.4.0": ">=1.4.0",
129
+ "picomatch@<2.3.2": ">=2.3.2",
130
+ "picomatch@>=4.0.0 <4.0.4": ">=4.0.4",
122
131
  "rollup@>=4.0.0 <4.59.0": ">=4.59.0",
123
- "serialize-javascript@<=7.0.2": ">=7.0.3",
132
+ "serialize-javascript@<7.0.5": ">=7.0.5",
133
+ "srvx@<0.11.13": ">=0.11.13",
124
134
  "svgo@=4.0.0": ">=4.0.1",
125
- "tar@<7.5.11": "7.5.11"
135
+ "tar@<7.5.11": "7.5.11",
136
+ "yaml@>=2.0.0 <2.8.3": ">=2.8.3"
126
137
  }
127
138
  },
128
139
  "keywords": [