@authup/client-web-nuxt 1.0.0-beta.63 → 1.0.0-beta.65

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 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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@authup/client-web-nuxt",
3
3
  "configKey": "authup",
4
- "version": "1.0.0-beta.63",
4
+ "version": "1.0.0-beta.65",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.3",
7
7
  "unbuild": "3.6.1"
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 { serverApiURL, ...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(
@@ -30,6 +23,10 @@ const module$1 = defineNuxtModule({
30
23
  } else {
31
24
  nuxt.options.runtimeConfig.public.authup = runtimeOptions;
32
25
  }
26
+ nuxt.options.runtimeConfig.authup = merge(
27
+ nuxt.options.runtimeConfig.authup || {},
28
+ { serverApiURL: serverApiURL ?? "" }
29
+ );
33
30
  nuxt.options.alias["#authup/nuxt"] = resolver.resolve("./runtime/exports");
34
31
  const template = addTemplate({
35
32
  filename: "types/authup-nuxt.d.ts",
@@ -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;
@@ -38,8 +45,9 @@ function buildApiUrl(runtimeConfig) {
38
45
  url = pathValue;
39
46
  }
40
47
  }
41
- if (options.serverApiURL) {
42
- url = options.serverApiURL;
48
+ const serverOptions = runtimeConfig.authup;
49
+ if (serverOptions?.serverApiURL) {
50
+ url = serverOptions.serverApiURL;
43
51
  }
44
52
  }
45
53
  if (!url) {
@@ -62,13 +70,14 @@ export default defineNuxtPlugin({
62
70
  const runtimeConfig = useRuntimeConfig();
63
71
  const baseURL = buildApiUrl(runtimeConfig);
64
72
  const cookieOptions = buildCookieOptions(runtimeConfig);
73
+ const cookieName = buildCookieName(runtimeConfig);
65
74
  install(ctx.vueApp, {
66
75
  pinia: ctx.$pinia,
67
76
  baseURL,
68
77
  cookieSet: (key, value, options) => {
69
78
  const app = tryUseNuxtApp();
70
79
  if (app) {
71
- const cookie = useCookie(key, {
80
+ const cookie = useCookie(cookieName(key), {
72
81
  ...cookieOptions,
73
82
  ...options || {}
74
83
  });
@@ -78,7 +87,7 @@ export default defineNuxtPlugin({
78
87
  cookieUnset: (key, options) => {
79
88
  const app = tryUseNuxtApp();
80
89
  if (app) {
81
- const cookie = useCookie(key, {
90
+ const cookie = useCookie(cookieName(key), {
82
91
  ...cookieOptions,
83
92
  ...options || {}
84
93
  });
@@ -88,7 +97,7 @@ export default defineNuxtPlugin({
88
97
  cookieGet: (key) => {
89
98
  const app = tryUseNuxtApp();
90
99
  if (app) {
91
- const cookie = useCookie(key);
100
+ const cookie = useCookie(cookieName(key));
92
101
  return cookie.value;
93
102
  }
94
103
  return null;
@@ -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
  /**
@@ -22,6 +26,21 @@ export type RuntimeOptions = {
22
26
  * (client-side & server-side)
23
27
  */
24
28
  cookieDomainRuntimeKey?: string;
29
+ /**
30
+ * Prefix prepended to every session cookie name
31
+ * (client-side & server-side)
32
+ *
33
+ * The session cookies are written under fixed names (`access_token`,
34
+ * `refresh_token`, ...). Widening `cookieDomain` delivers those names to
35
+ * every host under that domain, so any other authup client there writes
36
+ * the same names and the browser ends up holding two records under one.
37
+ * A prefix keeps them apart.
38
+ *
39
+ * Prepended verbatim, so `flame_` writes `flame_access_token`. Use cookie
40
+ * name characters only: letters, digits, `_`, `-`, `.`, never `:` or a
41
+ * space.
42
+ */
43
+ cookiePrefix?: string;
25
44
  /**
26
45
  * Path of the home route
27
46
  * 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.63",
4
+ "version": "1.0.0-beta.65",
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.63",
35
- "@authup/client-web-kit": "^1.0.0-beta.63",
36
- "@authup/core-http-kit": "^1.0.0-beta.63",
37
- "@authup/kit": "^1.0.0-beta.63",
35
+ "@authup/access": "^1.0.0-beta.65",
36
+ "@authup/client-web-kit": "^1.0.0-beta.65",
37
+ "@authup/core-http-kit": "^1.0.0-beta.65",
38
+ "@authup/kit": "^1.0.0-beta.65",
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.1",
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.2",
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.41",
55
- "vue-router": "^5.0.7"
55
+ "vue": "^3.5.42",
56
+ "vue-router": "^5.3.1"
56
57
  },
57
58
  "peerDependencies": {
58
59
  "@pinia/nuxt": "*",
59
- "pinia": "^4.0.2"
60
+ "pinia": "^4.0.3"
60
61
  },
61
62
  "keywords": [
62
63
  "auth",