Skip to content

Commit 7a45a21

Browse files
committed
fix: downgrade, split warning to a separate file
fix: downgrade tryna fix tryna fix tryna fix tryna fix tryna fix tryna fix tryna fix
1 parent 45e5028 commit 7a45a21

13 files changed

+75
-75
lines changed

docs/next.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default withNextra({
7272
{
7373
source: "/:path(.*)",
7474
has: [{ type: "host", value: "warnings.authjs.dev" }],
75-
destination: "https://authjs.dev/reference/warnings/:path*",
75+
destination: "https://authjs.dev/reference/core/types#warningcode",
7676
permanent: true,
7777
},
7878
{

docs/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"start": "next start",
1212
"lint": "eslint ./{components,pages,utils}",
1313
"lint:fix": "eslint ./{components,pages,utils} --fix",
14-
"build:sitemap": "next-sitemap --config next-sitemap.config.cjs"
14+
"build:sitemap": "next-sitemap --config next-sitemap.config.cjs",
15+
"clean": "rm -rf .next build pages/reference/*.mdx pages/reference/**/*"
1516
},
1617
"repository": {
1718
"type": "git",
@@ -50,7 +51,7 @@
5051
"shiki": "^1.22.0",
5152
"tailwindcss": "^3.4.13",
5253
"typedoc": "^0.27.6",
53-
"typedoc-plugin-markdown": "4.4.1",
54+
"typedoc-plugin-markdown": "4.3.3",
5455
"typedoc-plugin-mdn-links": "4.0.11",
5556
"typedoc-plugin-no-inherit": "^1.5.0"
5657
}

docs/pages/reference/_meta.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ export default {
1010
express: "@auth/express",
1111
qwik: "@auth/qwik",
1212
"solid-start": "@auth/solid-start",
13-
warnings: "Warnings",
14-
errors: {
15-
title: "Errors",
16-
href: "/reference/core/errors",
17-
},
1813
"--- adapters": {
1914
type: "separator",
2015
title: "Adapters",
@@ -33,6 +28,7 @@ export default {
3328
"mikro-orm-adapter": "@auth/mikro-orm-adapter",
3429
"mongodb-adapter": "@auth/mongodb-adapter",
3530
"neo4j-adapter": "@auth/neo4j-adapter",
31+
"neon-adapter": "@auth/neon-adapter",
3632
"pg-adapter": "@auth/pg-adapter",
3733
"pouchdb-adapter": "@auth/pouchdb-adapter",
3834
"sequelize-adapter": "@auth/sequelize-adapter",

docs/pages/reference/warnings.mdx

-23
This file was deleted.

docs/typedoc-nextauth.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function parseOutput(app) {
5757
const replaceCodeBlockTitle = (match, p1, p2, p3) => `${p1}filename="${p3}"`
5858

5959
page.contents = page.contents
60-
.replace(calloutRegex, replaceCallout)
60+
?.replace(calloutRegex, replaceCallout)
6161
.replace(codeBlockRegex, replaceCodeBlockTitle)
6262
})
6363
}
@@ -82,7 +82,7 @@ function writeMetaJsFiles(app) {
8282
) => {
8383
const pages = defaultValue
8484
navigationItems.forEach((item) => {
85-
const pageKey = item.url ? path.parse(item.url).name : null
85+
const pageKey = item.path ? path.parse(item.path).name : null
8686
if (pageKey) {
8787
pages[pageKey] = item.title
8888
if (item?.children && item?.children?.length > 0) {
@@ -101,15 +101,19 @@ function writeMetaJsFiles(app) {
101101

102102
const metaJString = `
103103
export default ${JSON.stringify(pages, null, 2)}`
104+
104105
if (new RegExp(".*docs/pages/reference$").test(outputDirectory)) return
106+
105107
fs.writeFileSync(path.join(outputDirectory, "_meta.js"), metaJString)
106108
}
107109

108110
/**
109111
* Recursively write _meta.js files for each page based on output.navigation
110112
*/
111-
writeMetaJs(output.navigation, output.outputDirectory, {
112-
overview: "Overview",
113-
})
113+
if (output.navigation) {
114+
writeMetaJs(output.navigation, output.outputDirectory, {
115+
overview: "Overview",
116+
})
117+
}
114118
})
115119
}

docs/typedoc.config.cjs

-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ module.exports = {
3232
excludeNotDocumented: true,
3333
excludeExternals: true,
3434
excludeInternal: true,
35-
excludePrivate: true,
3635
excludeProtected: true,
3736
excludeReferences: true,
3837
cleanOutputDir: false,
@@ -77,8 +76,5 @@ module.exports = {
7776
expandObjects: true,
7877
parametersFormat: "table",
7978
indexFormat: "table",
80-
textContentMappings: {
81-
"label.packages": "Integrations",
82-
},
8379
useCodeBlocks: true,
8480
}

packages/adapter-prisma/typedoc.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export default {
33
entryPointStrategy: "expand",
44
tsconfig: "./tsconfig.json",
55
entryModule: "@auth/prisma-adapter",
6+
entryFileName: "../prisma-adapter.mdx",
67
includeVersion: true,
78
readme: 'none',
89
};

packages/core/src/lib/utils/assert.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "../../errors.js"
1616

1717
import type { RequestInternal, SemverString } from "../../types.js"
18-
import type { WarningCode } from "./logger.js"
18+
import type { WarningCode } from "../../warnings.js"
1919
import { Adapter } from "../../adapters.js"
2020
import type { AuthConfig } from "../../index.js"
2121

packages/core/src/lib/utils/logger.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import { AuthError } from "../../errors.js"
2+
import type { WarningCode } from "../../warnings.js"
23
import type { AuthConfig } from "../../index.js"
34

4-
export type WarningCode =
5-
| "debug-enabled"
6-
| "csrf-disabled"
7-
| "experimental-webauthn"
8-
| "env-url-basepath-redundant"
9-
| "env-url-basepath-mismatch"
10-
115
/**
126
* Override any of the methods, and the rest will use the default logger.
137
*
@@ -47,7 +41,7 @@ const defaultLogger: LoggerInstance = {
4741
}
4842
},
4943
warn(code) {
50-
const url = `https://warnings.authjs.dev#${code}`
44+
const url = `https://warnings.authjs.dev`
5145
console.warn(`${yellow}[auth][warn][${code}]${reset}`, `Read more: ${url}`)
5246
},
5347
debug(message, metadata) {

packages/core/src/types.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import { AuthConfig } from "./index.js"
5858
import type { JWTOptions } from "./jwt.js"
5959
import type { Cookie } from "./lib/utils/cookie.js"
6060
import type { LoggerInstance } from "./lib/utils/logger.js"
61+
import type { WarningCode } from "./warnings.js"
6162
import type {
6263
CredentialsConfig,
6364
EmailConfig,
@@ -72,7 +73,7 @@ import type {
7273

7374
export type { WebAuthnOptionsResponseBody } from "./lib/utils/webauthn-utils.js"
7475
export type { AuthConfig } from "./index.js"
75-
export type { LoggerInstance }
76+
export type { LoggerInstance, WarningCode }
7677
export type Awaitable<T> = T | PromiseLike<T>
7778
export type Awaited<T> = T extends Promise<infer U> ? U : T
7879

packages/core/src/warnings.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* - `debug-enabled`: The `debug` option was evaluated to `true`. It adds extra logs in the terminal which is useful in development,
3+
* but since it can print sensitive information about users, make sure to set this to `false` in production.
4+
* In Node.js environments, you can for example set `debug: process.env.NODE_ENV !== "production"`.
5+
* Consult with your runtime/framework on how to set this value correctly.
6+
* - `csrf-disabled`: You were trying to get a CSRF response from Auth.js (eg.: by calling a `/csrf` endpoint),
7+
* but in this setup, CSRF protection via Auth.js was turned off. This is likely if you are not directly using `@auth/core`
8+
* but a framework library (like `@auth/sveltekit`) that already has CSRF protection built-in. You likely won't need the CSRF response.
9+
* - `env-url-basepath-redundant`: `AUTH_URL` (or `NEXTAUTH_URL`) and `authConfig.basePath` are both declared. This is a configuration mistake - you should either remove the `authConfig.basePath` configuration,
10+
* or remove the `pathname` of `AUTH_URL` (or `NEXTAUTH_URL`). Only one of them is needed.
11+
* - `env-url-basepath-mismatch`: `AUTH_URL` (or `NEXTAUTH_URL`) and `authConfig.basePath` are both declared, but they don't match. This is a configuration mistake.
12+
* `@auth/core` will use `basePath` to construct the full URL to the corresponding action (/signin, /signout, etc.) in this case.
13+
* - `experimental-webauthn`: Experimental WebAuthn feature is enabled.
14+
*
15+
*/
16+
export type WarningCode =
17+
| "debug-enabled"
18+
| "csrf-disabled"
19+
| "env-url-basepath-redundant"
20+
| "env-url-basepath-mismatch"
21+
| "experimental-webauthn"

pnpm-lock.yaml

+22-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

turbo.json

+12-3
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,14 @@
7070
"@auth/qwik#build"
7171
],
7272
"persistent": true,
73-
"cache": false
73+
"cache": false,
74+
"outputs": [
75+
".next/**/*",
76+
"build/**/*",
77+
"!.next/cache/**",
78+
"docs/reference/**/*.mdx",
79+
"docs/reference/*.mdx"
80+
]
7481
},
7582
"docs#build": {
7683
"inputs": [
@@ -117,9 +124,11 @@
117124
],
118125
"outputs": [
119126
".next/**/*",
127+
"build/**/*",
120128
"!.next/cache/**",
121-
"docs/reference/**",
122-
"!docs/reference/_meta.js"
129+
"docs/reference/**/*.mdx",
130+
"docs/reference/**/*.js",
131+
"docs/reference/*.mdx"
123132
]
124133
}
125134
}

0 commit comments

Comments
 (0)