@auth/sveltekit
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,7 +5,7 @@ import { setEnvDefaults as coreSetEnvDefaults } from "@auth/core"; | ||
export function setEnvDefaults(envObject, config) { | ||
config.trustHost ??= dev; | ||
config.basePath = `${base}/auth`; | ||
if (building) | ||
return; | ||
coreSetEnvDefaults(envObject, config); | ||
config.trustHost ??= dev; | ||
config.basePath = `${base}/auth`; | ||
} |
@@ -271,2 +271,4 @@ /** | ||
* | ||
* - If you build your SvelteKit application with `prerender` enabled, pages which have an anchor tag to the default signin page (i.e. `<a href="/auth/signin" ...`) will have trouble building. Please use the [builtin functions or components](https://authjs.dev/getting-started/session-management/login?framework=sveltekit) to sign in or out instead. | ||
* | ||
* :::info | ||
@@ -276,6 +278,2 @@ * Learn more about `@auth/sveltekit` [here](https://vercel.com/blog/announcing-sveltekit-auth). | ||
* | ||
* :::info | ||
* PRs to improve this documentation are welcome! See [this file](https://github.com/nextauthjs/next-auth/blob/main/packages/frameworks-sveltekit/src/lib/index.ts). | ||
* ::: | ||
* | ||
* @module @auth/sveltekit | ||
@@ -282,0 +280,0 @@ */ |
@@ -271,2 +271,4 @@ /** | ||
* | ||
* - If you build your SvelteKit application with `prerender` enabled, pages which have an anchor tag to the default signin page (i.e. `<a href="/auth/signin" ...`) will have trouble building. Please use the [builtin functions or components](https://authjs.dev/getting-started/session-management/login?framework=sveltekit) to sign in or out instead. | ||
* | ||
* :::info | ||
@@ -276,6 +278,2 @@ * Learn more about `@auth/sveltekit` [here](https://vercel.com/blog/announcing-sveltekit-auth). | ||
* | ||
* :::info | ||
* PRs to improve this documentation are welcome! See [this file](https://github.com/nextauthjs/next-auth/blob/main/packages/frameworks-sveltekit/src/lib/index.ts). | ||
* ::: | ||
* | ||
* @module @auth/sveltekit | ||
@@ -287,2 +285,3 @@ */ | ||
import { Auth, isAuthAction } from "@auth/core"; | ||
import { building } from "$app/environment"; | ||
export { AuthError, CredentialsSignin } from "@auth/core/errors"; | ||
@@ -297,2 +296,4 @@ const authorizationParamsPrefix = "authorizationParams-"; | ||
signIn: async (event) => { | ||
if (building) | ||
return; | ||
const { request } = event; | ||
@@ -318,2 +319,4 @@ const _config = typeof config === "object" ? config : await config(event); | ||
signOut: async (event) => { | ||
if (building) | ||
return; | ||
const _config = typeof config === "object" ? config : await config(event); | ||
@@ -325,2 +328,7 @@ setEnvDefaults(env, _config); | ||
async handle({ event, resolve }) { | ||
if (building) { | ||
event.locals.auth ??= async () => null; | ||
event.locals.getSession ??= event.locals.auth; | ||
return resolve(event); | ||
} | ||
const _config = typeof config === "object" ? config : await config(event); | ||
@@ -327,0 +335,0 @@ setEnvDefaults(env, _config); |
{ | ||
"name": "@auth/sveltekit", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Authentication for SvelteKit.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -10,6 +10,6 @@ import { setEnvDefaults as coreSetEnvDefaults } from "@auth/core" | ||
) { | ||
config.trustHost ??= dev | ||
config.basePath = `${base}/auth` | ||
if (building) return | ||
coreSetEnvDefaults(envObject, config) | ||
config.trustHost ??= dev | ||
config.basePath = `${base}/auth` | ||
} |
@@ -271,2 +271,4 @@ /** | ||
* | ||
* - If you build your SvelteKit application with `prerender` enabled, pages which have an anchor tag to the default signin page (i.e. `<a href="/auth/signin" ...`) will have trouble building. Please use the [builtin functions or components](https://authjs.dev/getting-started/session-management/login?framework=sveltekit) to sign in or out instead. | ||
* | ||
* :::info | ||
@@ -276,6 +278,2 @@ * Learn more about `@auth/sveltekit` [here](https://vercel.com/blog/announcing-sveltekit-auth). | ||
* | ||
* :::info | ||
* PRs to improve this documentation are welcome! See [this file](https://github.com/nextauthjs/next-auth/blob/main/packages/frameworks-sveltekit/src/lib/index.ts). | ||
* ::: | ||
* | ||
* @module @auth/sveltekit | ||
@@ -292,2 +290,3 @@ */ | ||
import { Auth, isAuthAction } from "@auth/core" | ||
import { building } from "$app/environment" | ||
@@ -323,2 +322,4 @@ export { AuthError, CredentialsSignin } from "@auth/core/errors" | ||
signIn: async (event) => { | ||
if (building) return | ||
const { request } = event | ||
@@ -349,2 +350,4 @@ const _config = typeof config === "object" ? config : await config(event) | ||
signOut: async (event) => { | ||
if (building) return | ||
const _config = typeof config === "object" ? config : await config(event) | ||
@@ -356,2 +359,8 @@ setEnvDefaults(env, _config) | ||
async handle({ event, resolve }) { | ||
if (building) { | ||
event.locals.auth ??= async () => null | ||
event.locals.getSession ??= event.locals.auth | ||
return resolve(event) | ||
} | ||
const _config = typeof config === "object" ? config : await config(event) | ||
@@ -358,0 +367,0 @@ setEnvDefaults(env, _config) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
118874
1990