@authup/client-web-nuxt 1.0.0-beta.64 → 1.0.0-beta.66
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 +2 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +5 -1
- package/dist/runtime/plugins/kit.js +37 -3
- package/dist/runtime/types.d.ts +4 -0
- package/package.json +7 -7
package/dist/module.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
import { HookResult } from '@nuxt/schema';
|
|
3
|
+
import * as __runtime_types from '../dist/runtime/types.js';
|
|
3
4
|
import { MiddlewareHookPayload, RuntimeOptions } from '../dist/runtime/types.js';
|
|
4
5
|
|
|
5
6
|
declare module '#app' {
|
|
@@ -15,6 +16,6 @@ declare module '@nuxt/schema' {
|
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
declare const _default: _nuxt_schema.NuxtModule<RuntimeOptions, RuntimeOptions, false>;
|
|
19
|
+
declare const _default: _nuxt_schema.NuxtModule<__runtime_types.RuntimeOptions, __runtime_types.RuntimeOptions, false>;
|
|
19
20
|
|
|
20
21
|
export { _default as default };
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -13,7 +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 =
|
|
16
|
+
const { serverApiURL, ...runtimeOptions } = options;
|
|
17
17
|
nuxt.options.runtimeConfig.public = nuxt.options.runtimeConfig.public || {};
|
|
18
18
|
if (nuxt.options.runtimeConfig.public.authup) {
|
|
19
19
|
nuxt.options.runtimeConfig.public.authup = merge(
|
|
@@ -23,6 +23,10 @@ const module$1 = defineNuxtModule({
|
|
|
23
23
|
} else {
|
|
24
24
|
nuxt.options.runtimeConfig.public.authup = runtimeOptions;
|
|
25
25
|
}
|
|
26
|
+
nuxt.options.runtimeConfig.authup = merge(
|
|
27
|
+
nuxt.options.runtimeConfig.authup || {},
|
|
28
|
+
{ serverApiURL: serverApiURL ?? "" }
|
|
29
|
+
);
|
|
26
30
|
nuxt.options.alias["#authup/nuxt"] = resolver.resolve("./runtime/exports");
|
|
27
31
|
const template = addTemplate({
|
|
28
32
|
filename: "types/authup-nuxt.d.ts",
|
|
@@ -1,12 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
COLOR_MODE_COOKIE,
|
|
3
|
+
COLOR_MODE_UNSET,
|
|
4
|
+
LOCALE_COOKIE,
|
|
5
|
+
LOCALE_UNSET,
|
|
6
|
+
install
|
|
7
|
+
} from "@authup/client-web-kit";
|
|
2
8
|
import { API_URL_DEFAULT } from "@authup/core-http-kit";
|
|
3
9
|
import { getPathValue } from "pathtrace";
|
|
10
|
+
import { computed } from "vue";
|
|
4
11
|
import {
|
|
5
12
|
defineNuxtPlugin,
|
|
6
13
|
tryUseNuxtApp,
|
|
7
14
|
useCookie,
|
|
8
15
|
useRuntimeConfig
|
|
9
16
|
} from "#imports";
|
|
17
|
+
function buildPreferenceRef(name, unset, options) {
|
|
18
|
+
const cookie = useCookie(name, {
|
|
19
|
+
path: "/",
|
|
20
|
+
maxAge: 60 * 60 * 24 * 365,
|
|
21
|
+
sameSite: "lax",
|
|
22
|
+
...options || {}
|
|
23
|
+
});
|
|
24
|
+
return computed({
|
|
25
|
+
get: () => cookie.value || unset,
|
|
26
|
+
set: (value) => {
|
|
27
|
+
cookie.value = value;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function buildPreferences(runtimeConfig) {
|
|
32
|
+
const vuecs = runtimeConfig.public.vuecs;
|
|
33
|
+
return {
|
|
34
|
+
locale: buildPreferenceRef(LOCALE_COOKIE, LOCALE_UNSET, vuecs?.localeCookie || vuecs?.cookie),
|
|
35
|
+
colorMode: buildPreferenceRef(COLOR_MODE_COOKIE, COLOR_MODE_UNSET, vuecs?.cookie)
|
|
36
|
+
};
|
|
37
|
+
}
|
|
10
38
|
function buildCookieOptions(runtimeConfig) {
|
|
11
39
|
const options = runtimeConfig.public.authup;
|
|
12
40
|
let domain;
|
|
@@ -45,8 +73,9 @@ function buildApiUrl(runtimeConfig) {
|
|
|
45
73
|
url = pathValue;
|
|
46
74
|
}
|
|
47
75
|
}
|
|
48
|
-
|
|
49
|
-
|
|
76
|
+
const serverOptions = runtimeConfig.authup;
|
|
77
|
+
if (serverOptions?.serverApiURL) {
|
|
78
|
+
url = serverOptions.serverApiURL;
|
|
50
79
|
}
|
|
51
80
|
}
|
|
52
81
|
if (!url) {
|
|
@@ -102,6 +131,11 @@ export default defineNuxtPlugin({
|
|
|
102
131
|
return null;
|
|
103
132
|
},
|
|
104
133
|
isServer: import.meta.server,
|
|
134
|
+
// Client only: a server render's cookie refs are per request and
|
|
135
|
+
// never in step with one another, so a seed there would reach
|
|
136
|
+
// nothing but a `Set-Cookie`, and the client's own resolve seeds
|
|
137
|
+
// right after hydration anyway.
|
|
138
|
+
preferences: import.meta.client ? buildPreferences(runtimeConfig) : void 0,
|
|
105
139
|
// Same bucket `useAsyncData` transports its results in, so a
|
|
106
140
|
// collection loaded during the server render is handed to the
|
|
107
141
|
// browser through the regular Nuxt payload instead of being
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export type RuntimeOptions = {
|
|
|
5
5
|
apiURL?: string;
|
|
6
6
|
/**
|
|
7
7
|
* Explicit URL of the Authup API (server-side)
|
|
8
|
+
*
|
|
9
|
+
* Kept in the private `runtimeConfig.authup`, never in the public block
|
|
10
|
+
* that is serialized into every rendered page. The runtime override is
|
|
11
|
+
* `NUXT_AUTHUP_SERVER_API_URL`, not `NUXT_PUBLIC_AUTHUP_SERVER_API_URL`.
|
|
8
12
|
*/
|
|
9
13
|
serverApiURL?: string;
|
|
10
14
|
/**
|
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.66",
|
|
5
5
|
"description": "Nuxt module for the authup ecosystem",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"node": "^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@authup/access": "^1.0.0-beta.
|
|
36
|
-
"@authup/client-web-kit": "^1.0.0-beta.
|
|
37
|
-
"@authup/core-http-kit": "^1.0.0-beta.
|
|
38
|
-
"@authup/kit": "^1.0.0-beta.
|
|
35
|
+
"@authup/access": "^1.0.0-beta.66",
|
|
36
|
+
"@authup/client-web-kit": "^1.0.0-beta.66",
|
|
37
|
+
"@authup/core-http-kit": "^1.0.0-beta.66",
|
|
38
|
+
"@authup/kit": "^1.0.0-beta.66",
|
|
39
39
|
"@nuxt/kit": "^4.0.0",
|
|
40
40
|
"pathtrace": "^2.2.0",
|
|
41
41
|
"smob": "^1.6.1"
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"rollup-plugin-dts": "^6.5.1",
|
|
53
53
|
"strip-literal": "^4.0.0",
|
|
54
54
|
"vitest": "^4.0.14",
|
|
55
|
-
"vue": "^3.5.
|
|
56
|
-
"vue-router": "^5.3.
|
|
55
|
+
"vue": "^3.5.43",
|
|
56
|
+
"vue-router": "^5.3.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@pinia/nuxt": "*",
|