@lenne.tech/nuxt-extensions 1.9.0 → 1.10.1
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.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +16 -3
- package/dist/runtime/lib/auth-client.d.ts +14 -8
- package/dist/runtime/lib/passkey-stub.d.ts +23 -0
- package/dist/runtime/lib/passkey-stub.js +10 -0
- package/package.json +25 -22
package/dist/module.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { LtExtensionsModuleOptions } from '../dist/runtime/types/index.js';
|
|
|
3
3
|
export * from '../dist/runtime/types/index.js';
|
|
4
4
|
|
|
5
5
|
declare const name = "@lenne.tech/nuxt-extensions";
|
|
6
|
-
declare const version = "1.
|
|
6
|
+
declare const version = "1.10.1";
|
|
7
7
|
declare const configKey = "ltExtensions";
|
|
8
8
|
declare const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
|
|
9
9
|
declare const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addImports, addComponent, addPlugin, addRouteMiddleware } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, tryResolveModule, addImports, addComponent, addPlugin, addRouteMiddleware } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const name = "@lenne.tech/nuxt-extensions";
|
|
4
|
-
const version = "1.
|
|
4
|
+
const version = "1.10.1";
|
|
5
5
|
const configKey = "ltExtensions";
|
|
6
6
|
const DEFAULT_LT_AUTH_STATE_COOKIE = "lt-auth-state";
|
|
7
7
|
const DEFAULT_LT_JWT_TOKEN_COOKIE = "lt-jwt-token";
|
|
@@ -66,6 +66,19 @@ const module$1 = defineNuxtModule({
|
|
|
66
66
|
i18n: { ...defaultOptions.i18n, ...options.i18n },
|
|
67
67
|
tus: { ...defaultOptions.tus, ...options.tus }
|
|
68
68
|
};
|
|
69
|
+
const passkeyAvailable = !!await tryResolveModule("@better-auth/passkey/client", new URL(import.meta.url));
|
|
70
|
+
if (!passkeyAvailable) {
|
|
71
|
+
const passkeyStub = resolve("./runtime/lib/passkey-stub");
|
|
72
|
+
nuxt.options.alias["@better-auth/passkey/client"] = passkeyStub;
|
|
73
|
+
nuxt.options.nitro ??= {};
|
|
74
|
+
nuxt.options.nitro.alias = { ...nuxt.options.nitro.alias, "@better-auth/passkey/client": passkeyStub };
|
|
75
|
+
}
|
|
76
|
+
const enablePasskey = (resolvedOptions.auth?.enablePasskey ?? true) && passkeyAvailable;
|
|
77
|
+
if ((resolvedOptions.auth?.enablePasskey ?? true) && !passkeyAvailable) {
|
|
78
|
+
console.warn(
|
|
79
|
+
`[${name}] Passkey support disabled: the optional peer dependency "@better-auth/passkey" is not installed. Install it to use passkeys, or set \`ltExtensions.auth.enablePasskey = false\` to silence this warning.`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
69
82
|
const rc = nuxt.options.runtimeConfig;
|
|
70
83
|
if (!rc.apiUrl) {
|
|
71
84
|
rc.apiUrl = "";
|
|
@@ -90,7 +103,7 @@ const module$1 = defineNuxtModule({
|
|
|
90
103
|
},
|
|
91
104
|
enabled: resolvedOptions.auth?.enabled ?? true,
|
|
92
105
|
enableAdmin: resolvedOptions.auth?.enableAdmin ?? true,
|
|
93
|
-
enablePasskey
|
|
106
|
+
enablePasskey,
|
|
94
107
|
enableTwoFactor: resolvedOptions.auth?.enableTwoFactor ?? true,
|
|
95
108
|
interceptor: {
|
|
96
109
|
enabled: resolvedOptions.auth?.interceptor?.enabled ?? true,
|
|
@@ -229,11 +229,6 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
229
229
|
priority?: RequestPriority | undefined;
|
|
230
230
|
cache?: RequestCache | undefined;
|
|
231
231
|
credentials?: RequestCredentials;
|
|
232
|
-
headers?: (HeadersInit & (HeadersInit | {
|
|
233
|
-
accept: "application/json" | "text/plain" | "application/octet-stream";
|
|
234
|
-
"content-type": "application/json" | "text/plain" | "application/x-www-form-urlencoded" | "multipart/form-data" | "application/octet-stream";
|
|
235
|
-
authorization: "Bearer" | "Basic";
|
|
236
|
-
})) | undefined;
|
|
237
232
|
integrity?: string | undefined;
|
|
238
233
|
keepalive?: boolean | undefined;
|
|
239
234
|
method: string;
|
|
@@ -263,6 +258,12 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
263
258
|
prefix: string | (() => string | undefined) | undefined;
|
|
264
259
|
value: string | (() => string | undefined) | undefined;
|
|
265
260
|
}) | undefined;
|
|
261
|
+
headers?: {} | {
|
|
262
|
+
[x: string]: string | undefined;
|
|
263
|
+
accept?: ((string & {}) | "application/json" | "text/plain" | "application/octet-stream") | undefined;
|
|
264
|
+
"content-type"?: ((string & {}) | "application/x-www-form-urlencoded" | "application/json" | "text/plain" | "application/octet-stream" | "multipart/form-data") | undefined;
|
|
265
|
+
authorization?: ((string & {}) | `Bearer ${string}` | `Basic ${string}`) | undefined;
|
|
266
|
+
} | undefined;
|
|
266
267
|
body?: any;
|
|
267
268
|
query?: any;
|
|
268
269
|
params?: any;
|
|
@@ -703,9 +704,14 @@ export declare function createLtAuthClient(config?: LtAuthClientConfig): {
|
|
|
703
704
|
code?: string | undefined;
|
|
704
705
|
message?: string | undefined;
|
|
705
706
|
}, FetchOptions["throw"] extends true ? true : false>>;
|
|
706
|
-
updateSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<
|
|
707
|
-
|
|
708
|
-
|
|
707
|
+
updateSession: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<Partial<{}>> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth").Prettify<import("better-auth/client").InferSessionUpdateCtx<{
|
|
708
|
+
basePath: string;
|
|
709
|
+
baseURL: any;
|
|
710
|
+
fetchOptions: {
|
|
711
|
+
customFetchImpl: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
712
|
+
};
|
|
713
|
+
plugins: any[];
|
|
714
|
+
}, FetchOptions>> | undefined, data_1?: FetchOptions | undefined) => Promise<import("better-auth/client").BetterFetchResponse<{
|
|
709
715
|
session: {
|
|
710
716
|
id: string;
|
|
711
717
|
createdAt: Date;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build-time stand-in for the OPTIONAL `@better-auth/passkey` peer dependency.
|
|
3
|
+
*
|
|
4
|
+
* `auth-client.ts` imports `passkeyClient` as a static top-level import, so a
|
|
5
|
+
* bundler has to resolve the specifier even in projects that never enable
|
|
6
|
+
* passkeys. Without a resolvable module the build dies on an unresolved
|
|
7
|
+
* optional peer, which contradicts `peerDependenciesMeta.optional: true`.
|
|
8
|
+
*
|
|
9
|
+
* The module aliases `@better-auth/passkey/client` onto this file when the real
|
|
10
|
+
* package is absent, and forces `auth.enablePasskey` to `false` in that case —
|
|
11
|
+
* so the factory below is normally never called. It stays a no-op (rather than
|
|
12
|
+
* throwing) to keep the direct `createLtAuthClient()` entry point working, whose
|
|
13
|
+
* own `enablePasskey` default is `true`.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* No-op replacement for the real `passkeyClient()` Better-Auth client plugin.
|
|
17
|
+
*
|
|
18
|
+
* Returns a plugin with a deliberately distinct `id`: claiming `'passkey'` would
|
|
19
|
+
* make Better-Auth expose passkey actions that cannot work without the package.
|
|
20
|
+
*/
|
|
21
|
+
export declare function passkeyClient(): {
|
|
22
|
+
id: "lt-passkey-unavailable";
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let warned = false;
|
|
2
|
+
export function passkeyClient() {
|
|
3
|
+
if (!warned) {
|
|
4
|
+
warned = true;
|
|
5
|
+
console.warn(
|
|
6
|
+
'[@lenne.tech/nuxt-extensions] Passkey support is unavailable: the optional peer dependency "@better-auth/passkey" is not installed. Install it to use passkeys, or pass `enablePasskey: false` to createLtAuthClient() to silence this warning.'
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
return { id: "lt-passkey-unavailable" };
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lenne.tech/nuxt-extensions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
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,6 @@
|
|
|
12
12
|
},
|
|
13
13
|
"author": "lenne.Tech <info@lenne.tech> (https://lenne.tech)",
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"packageManager": "pnpm@11.13.0",
|
|
16
15
|
"type": "module",
|
|
17
16
|
"sideEffects": false,
|
|
18
17
|
"exports": {
|
|
@@ -52,9 +51,9 @@
|
|
|
52
51
|
"prepack": "node scripts/sync-module-version.mjs && nuxt-module-build build",
|
|
53
52
|
"c": "pnpm run check",
|
|
54
53
|
"check": "node scripts/check.mjs",
|
|
55
|
-
"check:raw": "pnpm audit && pnpm run format:check && pnpm run lint && pnpm run dev:prepare && pnpm test:types && pnpm test && pnpm run build",
|
|
56
|
-
"check:fix": "pnpm install && pnpm audit --fix && pnpm run format && pnpm run lint:fix && pnpm test:types && pnpm test && pnpm run build",
|
|
57
|
-
"check:naf": "pnpm install && pnpm run format && pnpm run lint:fix && pnpm test:types && pnpm test && pnpm run build",
|
|
54
|
+
"check:raw": "pnpm install --frozen-lockfile && pnpm audit && pnpm run format:check && pnpm run lint && pnpm run version:check && pnpm run dev:prepare && pnpm test:types && pnpm test && pnpm run build && pnpm run check:manifest",
|
|
55
|
+
"check:fix": "pnpm install && pnpm audit --fix && pnpm run format && pnpm run lint:fix && pnpm run version:sync && pnpm test:types && pnpm test && pnpm run build && pnpm run check:manifest",
|
|
56
|
+
"check:naf": "pnpm install && pnpm run format && pnpm run lint:fix && pnpm run version:sync && pnpm test:types && pnpm test && pnpm run build && pnpm run check:manifest",
|
|
58
57
|
"cf": "pnpm run check:fix",
|
|
59
58
|
"cnaf": "pnpm run check:naf",
|
|
60
59
|
"dev": "pnpm dev:prepare && nuxt dev playground",
|
|
@@ -65,20 +64,24 @@
|
|
|
65
64
|
"lint:fix": "oxlint --fix --fix-suggestions src/",
|
|
66
65
|
"format": "oxfmt --write src/",
|
|
67
66
|
"format:check": "oxfmt --check src/",
|
|
67
|
+
"version:sync": "node scripts/sync-module-version.mjs",
|
|
68
|
+
"version:check": "node scripts/sync-module-version.mjs --check",
|
|
68
69
|
"test": "vitest run",
|
|
69
70
|
"test:watch": "vitest watch",
|
|
70
71
|
"test:coverage": "vitest run --coverage",
|
|
71
72
|
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
72
|
-
"release": "pnpm format:check && pnpm lint && pnpm test:types && pnpm test && pnpm prepack"
|
|
73
|
+
"release": "pnpm format:check && pnpm lint && pnpm run version:check && pnpm test:types && pnpm test && pnpm run check:consumer && pnpm prepack",
|
|
74
|
+
"check:consumer": "node scripts/check-consumer-build.mjs",
|
|
75
|
+
"check:manifest": "node scripts/check-package-manifest.mjs"
|
|
73
76
|
},
|
|
74
77
|
"dependencies": {
|
|
75
|
-
"@nuxt/kit": "4.
|
|
78
|
+
"@nuxt/kit": "^4.0.0"
|
|
76
79
|
},
|
|
77
80
|
"peerDependencies": {
|
|
78
81
|
"@better-auth/passkey": ">=1.0.0",
|
|
79
82
|
"@playwright/test": ">=1.0.0",
|
|
80
83
|
"better-auth": ">=1.0.0",
|
|
81
|
-
"nuxt": "
|
|
84
|
+
"nuxt": "^4.0.0",
|
|
82
85
|
"tus-js-client": ">=4.0.0"
|
|
83
86
|
},
|
|
84
87
|
"peerDependenciesMeta": {
|
|
@@ -96,22 +99,21 @@
|
|
|
96
99
|
}
|
|
97
100
|
},
|
|
98
101
|
"devDependencies": {
|
|
99
|
-
"@better-auth/passkey": "1.6.
|
|
100
|
-
"@nuxt/devtools": "3.2.4",
|
|
102
|
+
"@better-auth/passkey": "1.6.23",
|
|
101
103
|
"@nuxt/module-builder": "1.0.2",
|
|
102
|
-
"@nuxt/schema": "4.4.
|
|
103
|
-
"@playwright/test": "1.
|
|
104
|
-
"@types/node": "
|
|
105
|
-
"@vitest/coverage-v8": "4.1.
|
|
106
|
-
"better-auth": "1.6.
|
|
107
|
-
"happy-dom": "20.
|
|
108
|
-
"nuxt": "4.4.
|
|
109
|
-
"oxfmt": "0.
|
|
110
|
-
"oxlint": "1.
|
|
104
|
+
"@nuxt/schema": "4.4.8",
|
|
105
|
+
"@playwright/test": "1.61.1",
|
|
106
|
+
"@types/node": "26.1.1",
|
|
107
|
+
"@vitest/coverage-v8": "4.1.10",
|
|
108
|
+
"better-auth": "1.6.23",
|
|
109
|
+
"happy-dom": "20.10.6",
|
|
110
|
+
"nuxt": "4.4.8",
|
|
111
|
+
"oxfmt": "0.59.0",
|
|
112
|
+
"oxlint": "1.74.0",
|
|
111
113
|
"tus-js-client": "4.3.1",
|
|
112
114
|
"typescript": "5.9.3",
|
|
113
|
-
"vitest": "4.1.
|
|
114
|
-
"vue-tsc": "3.3.
|
|
115
|
+
"vitest": "4.1.10",
|
|
116
|
+
"vue-tsc": "3.3.7"
|
|
115
117
|
},
|
|
116
118
|
"keywords": [
|
|
117
119
|
"nuxt",
|
|
@@ -127,6 +129,7 @@
|
|
|
127
129
|
"lenne-tech"
|
|
128
130
|
],
|
|
129
131
|
"engines": {
|
|
130
|
-
"node": ">= 22"
|
|
132
|
+
"node": ">= 22",
|
|
133
|
+
"pnpm": "^11.0.0"
|
|
131
134
|
}
|
|
132
135
|
}
|