chore: type updates

fix import

chore: more docs update
This commit is contained in:
Balázs Orbán
2022-12-19 04:03:03 +01:00
parent e699ff14b8
commit f7275c7527
13 changed files with 125 additions and 77 deletions

View File

@@ -48,6 +48,12 @@ module.exports = {
"jsdoc/tag-lines": "off",
},
},
{
files: ["packages/core/src/adapters.ts"],
rules: {
"@typescript-eslint/method-signature-style": "off",
},
},
],
plugins: ["jest"],
ignorePatterns: [

View File

@@ -44,13 +44,15 @@ module.exports = {
position: "left",
},
{
to: "/guides",
to: "/guides/overview",
activeBasePath: "/guides",
label: "Guides",
position: "left",
},
{
to: "/reference",
to: "/reference/core/modules/main",
// TODO: change to this when the overview page looks better.
// to: "/reference",
activeBasePath: "/reference",
label: "Reference",
position: "left",
@@ -149,6 +151,11 @@ module.exports = {
colorMode: {
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
autoCollapseCategories: true,
},
},
},
presets: [
[
@@ -194,6 +201,7 @@ module.exports = {
"../packages/core/src/providers/email.ts",
"../packages/core/src/providers/credentials.ts",
"../packages/core/src/jwt/index.ts",
"../packages/core/src/lib/types.ts",
],
tsconfig: "../packages/core/tsconfig.json",
out: "reference/03-core",

View File

@@ -4,7 +4,7 @@
"name": "docs",
"scripts": {
"start": "TYPEDOC_WATCH=true docusaurus start --no-open --port 8000",
"dev": "pnpm start",
"dev": "pnpm providers && pnpm snippets && pnpm start",
"build": "pnpm providers && docusaurus build",
"docusaurus": "docusaurus",
"swizzle": "docusaurus swizzle",

View File

@@ -20,7 +20,7 @@ module.exports = {
label: "@auth/core",
link: {
type: "doc",
id: "reference/core/modules/index",
id: "reference/core/modules/main",
},
items: [
// See: https://github.com/facebook/docusaurus/issues/5689
@@ -33,6 +33,23 @@ module.exports = {
"reference/core/modules/jwt",
"reference/core/modules/providers",
"reference/core/modules/providers_github",
"reference/core/modules/types",
{
type: "category",
label: "Reflections",
collapsed: true,
className: "reflection-category", // See src/index.css
items: [
{
type: "autogenerated",
dirName: "reference/03-core/functions",
},
{
type: "autogenerated",
dirName: "reference/03-core/interfaces",
},
],
},
],
},
{

View File

@@ -0,0 +1,45 @@
Add $1 login to your page.
## Example
@example
```js
import Auth from "@auth/core"
import { $1 } from "@auth/core/providers/$2"
const request = new Request("https://example.com")
const resposne = await AuthHandler(request, {
providers: [
$1({clientId: "", clientSecret: ""})
]
})
```
---
## Resources
@see [Link 1](https://example.com)
---
## Notes
By default, Auth.js assumes that the $1 provider is
based on the [OAuth 2](https://www.rfc-editor.org/rfc/rfc6749.html) specification.
:::tip
The $1 provider comes with a [default configuration](https://github.com/nextauthjs/next-auth/blob/main/packages/core/src/providers/$2.ts).
To override the defaults for your use case, check out [customizing a built-in OAuth provider](https://authjs.dev/guides/providers/custom-provider#override-default-options).
:::
:::info **Disclaimer**
If you think you found a bug in the default configuration, you can [open an issue](https://authjs.dev/new/provider-issue).
Auth.js strictly adheres to the specification and it cannot take responsibility for any deviation from
the spec by the provider. You can open an issue, but if the problem is non-compliance with the spec,
we might not pursue a resolution. You can ask for more help in [Discussions](https://authjs.dev/new/github-discussions).
:::

View File

@@ -273,3 +273,15 @@ html[data-theme="dark"] #carbonads .carbon-poweredby {
color: #aaa;
background: #1e2021;
}
/*
This is a hack to hide the "Reflection" category from the sidebar.
This is because otherwise opening any page under the "Reflection" category
would hide the entire sidebar.
See sidebars.js
*/
.reflection-category {
display: none;
}

View File

@@ -66,9 +66,6 @@
"pnpm": {
"overrides": {
"undici": "5.11.0"
},
"patchedDependencies": {
"typedoc-plugin-markdown@3.14.0": "patches/typedoc-plugin-markdown@3.14.0.patch"
}
}
}

View File

@@ -40,6 +40,9 @@
"./providers/*": {
"types": "./providers/*.d.ts",
"import": "./providers/*.js"
},
"./types": {
"types": "./lib/types.d.ts"
}
},
"license": "ISC",
@@ -60,7 +63,7 @@
}
},
"scripts": {
"build": "pnpm clean && tsc && pnpm css",
"build": "pnpm clean && pnpm css && tsc",
"clean": "rm -rf adapters.* index.* jwt lib providers",
"css": "node ./scripts/generate-css.js",
"lint": "eslint src",

View File

@@ -1,13 +1,29 @@
/**
*
* `@auth/core` is the main entry point for the Auth.js library.
*
* Based on the {@link https://developer.mozilla.org/en-US/docs/Web/API/Request Request}
* and {@link https://developer.mozilla.org/en-US/docs/Web/API/Response Response} Web standard APIs.
*
* ```ts
* import { Auth } from "@auth/core"
*
* const request = new Request("https://example.com"
* const response = await Auth(request, {...})
*
* console.log(response instanceof Response) // true
* ```
*
* Primarily used to implement [framework](https://authjs.dev/concepts/frameworks)-specific packages,
* but it can also be used directly.
*
* ## Installation
*
* ```bash npm2yarn2pnpm
* npm install @auth/core
* ```
*
* ## Usage
*
* @module index
* @module main
*/
import { init } from "./lib/init.js"

View File

@@ -1,3 +1,10 @@
/**
*
* The `@auth/core/types` module contains all public types and interfaces of the core package.
*
* @module types
*/
import type { CookieSerializeOptions } from "cookie"
import type { Adapter, AdapterUser } from "../adapters.js"
import type {

View File

@@ -1,5 +1,5 @@
import type { CommonProviderOptions } from "./index.js"
import type { Awaitable, RequestInternal, User } from "../index.js"
import type { Awaitable, RequestInternal, User } from "../lib/types.js"
export interface CredentialInput {
label?: string

View File

@@ -1,57 +0,0 @@
diff --git a/dist/theme.js b/dist/theme.js
index 1483a4b4ec69583aa3086eac83b2b31ae8bb6777..6b90b17261e14b8a49e52d0885038dbff4b6b503 100644
--- a/dist/theme.js
+++ b/dist/theme.js
@@ -209,52 +209,6 @@ class MarkdownTheme extends typedoc_1.Theme {
directory: 'modules',
template: this.getReflectionTemplate(),
},
- {
- kind: [typedoc_1.ReflectionKind.Namespace],
- isLeaf: false,
- directory: 'modules',
- template: this.getReflectionTemplate(),
- },
- {
- kind: [typedoc_1.ReflectionKind.Enum],
- isLeaf: false,
- directory: 'enums',
- template: this.getReflectionTemplate(),
- },
- {
- kind: [typedoc_1.ReflectionKind.Class],
- isLeaf: false,
- directory: 'classes',
- template: this.getReflectionTemplate(),
- },
- {
- kind: [typedoc_1.ReflectionKind.Interface],
- isLeaf: false,
- directory: 'interfaces',
- template: this.getReflectionTemplate(),
- },
- ...(this.allReflectionsHaveOwnDocument
- ? [
- {
- kind: [typedoc_1.ReflectionKind.TypeAlias],
- isLeaf: true,
- directory: 'types',
- template: this.getReflectionMemberTemplate(),
- },
- {
- kind: [typedoc_1.ReflectionKind.Variable],
- isLeaf: true,
- directory: 'variables',
- template: this.getReflectionMemberTemplate(),
- },
- {
- kind: [typedoc_1.ReflectionKind.Function],
- isLeaf: true,
- directory: 'functions',
- template: this.getReflectionMemberTemplate(),
- },
- ]
- : []),
];
}
onBeginRenderer(event) {

10
pnpm-lock.yaml generated
View File

@@ -3,11 +3,6 @@ lockfileVersion: 5.4
overrides:
undici: 5.11.0
patchedDependencies:
typedoc-plugin-markdown@3.14.0:
hash: 7c3svfnvqamb7naqau6rcwpxme
path: patches/typedoc-plugin-markdown@3.14.0.patch
importers:
.:
@@ -59,7 +54,7 @@ importers:
ts-node: 10.5.0_ksn4eycaeggbrckn3ykh37hwf4
turbo: 1.3.1
typedoc: 0.23.22_typescript@4.8.4
typedoc-plugin-markdown: 3.14.0_7c3svfnvqamb7naqau6rcwpxme_typedoc@0.23.22
typedoc-plugin-markdown: 3.14.0_typedoc@0.23.22
typescript: 4.8.4
apps/dev:
@@ -27478,7 +27473,7 @@ packages:
dependencies:
is-typedarray: 1.0.0
/typedoc-plugin-markdown/3.14.0_7c3svfnvqamb7naqau6rcwpxme_typedoc@0.23.22:
/typedoc-plugin-markdown/3.14.0_typedoc@0.23.22:
resolution: {integrity: sha512-UyQLkLRkfTFhLdhSf3RRpA3nNInGn+k6sll2vRXjflaMNwQAAiB61SYbisNZTg16t4K1dt1bPQMMGLrxS0GZ0Q==}
peerDependencies:
typedoc: '>=0.23.0'
@@ -27486,7 +27481,6 @@ packages:
handlebars: 4.7.7
typedoc: 0.23.22_typescript@4.8.4
dev: true
patched: true
/typedoc/0.23.22_typescript@4.8.4:
resolution: {integrity: sha512-5sJkjK60xp8A7YpcYniu3+Wf0QcgojEnhzHuCN+CkdpQkKRhOspon/9+sGTkGI8kjVkZs3KHrhltpQyVhRMVfw==}