@authup/client-web-nuxt 1.0.0-beta.63 → 1.0.0-beta.64
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 +1 -1
- package/dist/module.mjs +1 -8
- package/dist/runtime/plugins/kit.js +11 -3
- package/dist/runtime/types.d.ts +15 -0
- package/package.json +11 -10
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,14 +13,7 @@ const module$1 = defineNuxtModule({
|
|
|
13
13
|
const runtimeDir = fileURLToPath(new URL("./runtime", import.meta.url));
|
|
14
14
|
nuxt.options.build.transpile.push(runtimeDir);
|
|
15
15
|
const resolver = createResolver(import.meta.url);
|
|
16
|
-
const runtimeOptions = {
|
|
17
|
-
apiURL: options.apiURL,
|
|
18
|
-
apiURLRuntimeKey: options.apiURLRuntimeKey,
|
|
19
|
-
cookieDomain: options.cookieDomain,
|
|
20
|
-
cookieDomainRuntimeKey: options.cookieDomainRuntimeKey,
|
|
21
|
-
homeRoute: options.homeRoute,
|
|
22
|
-
loginRoute: options.loginRoute
|
|
23
|
-
};
|
|
16
|
+
const runtimeOptions = { ...options };
|
|
24
17
|
nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};
|
|
25
18
|
if (nuxt.options.runtimeConfig.public.authup) {
|
|
26
19
|
nuxt.options.runtimeConfig.public.authup = merge(
|
|
@@ -28,6 +28,13 @@ function buildCookieOptions(runtimeConfig) {
|
|
|
28
28
|
}
|
|
29
29
|
return cookieOptions;
|
|
30
30
|
}
|
|
31
|
+
function buildCookieName(runtimeConfig) {
|
|
32
|
+
const options = runtimeConfig.public.authup;
|
|
33
|
+
if (!options.cookiePrefix) {
|
|
34
|
+
return (key) => key;
|
|
35
|
+
}
|
|
36
|
+
return (key) => `${options.cookiePrefix}${key}`;
|
|
37
|
+
}
|
|
31
38
|
function buildApiUrl(runtimeConfig) {
|
|
32
39
|
const options = runtimeConfig.public.authup;
|
|
33
40
|
let url;
|
|
@@ -62,13 +69,14 @@ export default defineNuxtPlugin({
|
|
|
62
69
|
const runtimeConfig = useRuntimeConfig();
|
|
63
70
|
const baseURL = buildApiUrl(runtimeConfig);
|
|
64
71
|
const cookieOptions = buildCookieOptions(runtimeConfig);
|
|
72
|
+
const cookieName = buildCookieName(runtimeConfig);
|
|
65
73
|
install(ctx.vueApp, {
|
|
66
74
|
pinia: ctx.$pinia,
|
|
67
75
|
baseURL,
|
|
68
76
|
cookieSet: (key, value, options) => {
|
|
69
77
|
const app = tryUseNuxtApp();
|
|
70
78
|
if (app) {
|
|
71
|
-
const cookie = useCookie(key, {
|
|
79
|
+
const cookie = useCookie(cookieName(key), {
|
|
72
80
|
...cookieOptions,
|
|
73
81
|
...options || {}
|
|
74
82
|
});
|
|
@@ -78,7 +86,7 @@ export default defineNuxtPlugin({
|
|
|
78
86
|
cookieUnset: (key, options) => {
|
|
79
87
|
const app = tryUseNuxtApp();
|
|
80
88
|
if (app) {
|
|
81
|
-
const cookie = useCookie(key, {
|
|
89
|
+
const cookie = useCookie(cookieName(key), {
|
|
82
90
|
...cookieOptions,
|
|
83
91
|
...options || {}
|
|
84
92
|
});
|
|
@@ -88,7 +96,7 @@ export default defineNuxtPlugin({
|
|
|
88
96
|
cookieGet: (key) => {
|
|
89
97
|
const app = tryUseNuxtApp();
|
|
90
98
|
if (app) {
|
|
91
|
-
const cookie = useCookie(key);
|
|
99
|
+
const cookie = useCookie(cookieName(key));
|
|
92
100
|
return cookie.value;
|
|
93
101
|
}
|
|
94
102
|
return null;
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -22,6 +22,21 @@ export type RuntimeOptions = {
|
|
|
22
22
|
* (client-side & server-side)
|
|
23
23
|
*/
|
|
24
24
|
cookieDomainRuntimeKey?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Prefix prepended to every session cookie name
|
|
27
|
+
* (client-side & server-side)
|
|
28
|
+
*
|
|
29
|
+
* The session cookies are written under fixed names (`access_token`,
|
|
30
|
+
* `refresh_token`, ...). Widening `cookieDomain` delivers those names to
|
|
31
|
+
* every host under that domain, so any other authup client there writes
|
|
32
|
+
* the same names and the browser ends up holding two records under one.
|
|
33
|
+
* A prefix keeps them apart.
|
|
34
|
+
*
|
|
35
|
+
* Prepended verbatim, so `flame_` writes `flame_access_token`. Use cookie
|
|
36
|
+
* name characters only: letters, digits, `_`, `-`, `.`, never `:` or a
|
|
37
|
+
* space.
|
|
38
|
+
*/
|
|
39
|
+
cookiePrefix?: string;
|
|
25
40
|
/**
|
|
26
41
|
* Path of the home route
|
|
27
42
|
* Default: /
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authup/client-web-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.64",
|
|
5
5
|
"description": "Nuxt module for the authup ecosystem",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"build": "nuxt-module-build prepare && nuxt-module-build build",
|
|
25
25
|
"prepack": "nuxt-module-build prepare && nuxt-module-build build",
|
|
26
26
|
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
27
|
+
"check:types": "nuxt-module-build prepare && vue-tsc -p tsconfig.test.json",
|
|
27
28
|
"lint": "eslint .",
|
|
28
29
|
"test": "nuxt-module-build prepare && cross-env NODE_ENV=test vitest run --config test/vitest.config.ts"
|
|
29
30
|
},
|
|
@@ -31,10 +32,10 @@
|
|
|
31
32
|
"node": "^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"@authup/access": "^1.0.0-beta.
|
|
35
|
-
"@authup/client-web-kit": "^1.0.0-beta.
|
|
36
|
-
"@authup/core-http-kit": "^1.0.0-beta.
|
|
37
|
-
"@authup/kit": "^1.0.0-beta.
|
|
35
|
+
"@authup/access": "^1.0.0-beta.64",
|
|
36
|
+
"@authup/client-web-kit": "^1.0.0-beta.64",
|
|
37
|
+
"@authup/core-http-kit": "^1.0.0-beta.64",
|
|
38
|
+
"@authup/kit": "^1.0.0-beta.64",
|
|
38
39
|
"@nuxt/kit": "^4.0.0",
|
|
39
40
|
"pathtrace": "^2.2.0",
|
|
40
41
|
"smob": "^1.6.1"
|
|
@@ -42,21 +43,21 @@
|
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@nuxt/module-builder": "^1.0.3",
|
|
44
45
|
"@nuxt/schema": "^4.0.0",
|
|
45
|
-
"@pinia/nuxt": "^1.0.
|
|
46
|
+
"@pinia/nuxt": "^1.0.2",
|
|
46
47
|
"cross-env": "^10.1.0",
|
|
47
48
|
"fix-dts-default-cjs-exports": "^1.0.1",
|
|
48
49
|
"mkdist": "^2.3.0",
|
|
49
50
|
"nuxt": "^4.5.2",
|
|
50
|
-
"pinia": "^4.0.
|
|
51
|
+
"pinia": "^4.0.3",
|
|
51
52
|
"rollup-plugin-dts": "^6.5.1",
|
|
52
53
|
"strip-literal": "^4.0.0",
|
|
53
54
|
"vitest": "^4.0.14",
|
|
54
|
-
"vue": "^3.5.
|
|
55
|
-
"vue-router": "^5.0
|
|
55
|
+
"vue": "^3.5.42",
|
|
56
|
+
"vue-router": "^5.3.0"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"@pinia/nuxt": "*",
|
|
59
|
-
"pinia": "^4.0.
|
|
60
|
+
"pinia": "^4.0.3"
|
|
60
61
|
},
|
|
61
62
|
"keywords": [
|
|
62
63
|
"auth",
|