Skip to content

Commit d280e64

Browse files
committed
1.5.2: update deps, fix security vulnerabilities, fix TS2742 build errors, and add CLAUDE.md
1 parent d129a2c commit d280e64

File tree

12 files changed

+719
-578
lines changed

12 files changed

+719
-578
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Agent Memory Index
2+
3+
- [Project: nuxt-extensions structure](project_nuxt_extensions.md) — Module-only project with single runtime dep @nuxt/kit; all others are devDeps or peerDeps
4+
- [Feedback: Pre-existing TS2742 build errors](feedback_ts2742_build_error.md) — TS2742 errors in middleware/plugin mkdist .d.ts generation pre-existed; fix by explicit type annotations
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: TS2742 build errors in middleware and plugins
3+
description: Pre-existing TS2742 mkdist type generation errors in middleware/setup.ts and plugins/error-translation.client.ts
4+
type: feedback
5+
---
6+
7+
TS2742 "inferred type of 'default' cannot be named without a reference to nuxt/app" errors existed in the build BEFORE any maintenance changes. They are pre-existing bugs.
8+
9+
**Why:** `defineNuxtPlugin` and `defineNuxtRouteMiddleware` return types reference `nuxt/app` internals via pnpm's `.pnpm/` path which TypeScript cannot make portable in .d.ts files.
10+
11+
**How to apply:**
12+
- For `defineNuxtPlugin`: Add `import type { NuxtApp } from "#app"` and type the nuxtApp parameter as `NuxtApp`
13+
- For `defineNuxtRouteMiddleware`: Cast the export as `ReturnType<typeof defineNuxtRouteMiddleware>` — e.g., `export default defineNuxtRouteMiddleware(fn) as ReturnType<typeof defineNuxtRouteMiddleware>`
14+
15+
The middleware approach (type cast) works when the plugin approach (typing the argument) does not fully resolve the issue for middleware. Both should be applied together when fixing the build.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: nuxt-extensions project structure
3+
description: Key dependency and build facts about @lenne.tech/nuxt-extensions module
4+
type: project
5+
---
6+
7+
@lenne.tech/nuxt-extensions has only ONE runtime dependency: `@nuxt/kit` (used in src/module.ts). Everything else is devDependencies or peerDependencies.
8+
9+
**Why:** This is a Nuxt module library. Consumers install it as a peer dep; runtime deps must be minimal to avoid bloating consumer installs.
10+
11+
**How to apply:** When doing dependency maintenance, only @nuxt/kit belongs in `dependencies`. All build tools, test frameworks, and peer implementations (better-auth, @better-auth/passkey, tus-js-client, @playwright/test) go in devDependencies.
12+
13+
The `packageManager` field uses pnpm and is tracked in package.json — update it alongside pnpm version bumps.
14+
15+
Build command: `npm run prepack` (runs `nuxt-module-build build`). Tests: `pnpm test` (vitest). No test scripts configured via npm, use pnpm test directly.

CLAUDE.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.json

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@lenne.tech/nuxt-extensions",
3-
"version": "1.5.1",
3+
"version": "1.5.2",
44
"description": "Reusable Nuxt 4 composables, components, and Better-Auth integration for lenne.tech projects",
55
"repository": {
66
"type": "git",
@@ -12,7 +12,7 @@
1212
},
1313
"author": "lenne.Tech <info@lenne.tech> (https://lenne.tech)",
1414
"license": "MIT",
15-
"packageManager": "pnpm@10.32.1",
15+
"packageManager": "pnpm@10.33.0",
1616
"type": "module",
1717
"exports": {
1818
".": {
@@ -43,7 +43,8 @@
4343
}
4444
},
4545
"files": [
46-
"dist"
46+
"dist",
47+
"CLAUDE.md"
4748
],
4849
"scripts": {
4950
"prepare": "git config core.hooksPath .githooks",
@@ -93,36 +94,46 @@
9394
}
9495
},
9596
"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",
9899
"@nuxt/module-builder": "1.0.2",
99100
"@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",
105106
"nuxt": "4.4.2",
106-
"oxfmt": "0.40.0",
107-
"oxlint": "1.55.0",
107+
"oxfmt": "0.43.0",
108+
"oxlint": "1.58.0",
108109
"tus-js-client": "4.3.1",
109110
"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"
112113
},
113114
"pnpm": {
114115
"onlyBuiltDependencies": [
115116
"@parcel/watcher",
116117
"esbuild"
117118
],
118119
"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",
122131
"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",
124134
"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"
126137
}
127138
},
128139
"keywords": [

0 commit comments

Comments
 (0)