@scalar/nextjs-api-reference 0.1.0 → 0.1.3
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/CHANGELOG.md +28 -0
- package/README.md +17 -15
- package/dist/index.cjs +37 -943
- package/dist/index.d.ts +5 -7
- package/dist/index.js +37 -943
- package/dist/index.umd.cjs +39 -943
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @scalar/nextjs-api-reference
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8ffea2ae]
|
|
8
|
+
- Updated dependencies [e073b015]
|
|
9
|
+
- @scalar/api-reference@1.13.17
|
|
10
|
+
|
|
11
|
+
## 0.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [fcb2b75b]
|
|
16
|
+
- Updated dependencies [8e7fcfa0]
|
|
17
|
+
- @scalar/api-reference@1.13.16
|
|
18
|
+
|
|
19
|
+
## 0.1.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- ac9e9326: fix: moved next.js adapter to an api route
|
|
24
|
+
- 1963d803: chore: allow Next.js 14
|
|
25
|
+
- Updated dependencies [706b29f2]
|
|
26
|
+
- Updated dependencies [d8fc0544]
|
|
27
|
+
- Updated dependencies [55e74b08]
|
|
28
|
+
- Updated dependencies [8573da8d]
|
|
29
|
+
- @scalar/api-reference@1.13.15
|
|
30
|
+
|
|
3
31
|
## 0.1.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
# Scalar Next.js API Reference
|
|
1
|
+
# Scalar Next.js API Reference Handler
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
|
|
4
4
|
[](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
|
|
5
|
-
[](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
|
|
6
6
|
[](https://discord.gg/8HeZcRGPFS)
|
|
7
7
|
|
|
8
|
-
This plugin provides an easy way to render a beautiful API reference based on
|
|
8
|
+
This plugin provides an easy way to render a beautiful API reference based on an OpenAPI/Swagger file with Next.js.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
<picture>
|
|
11
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/scalar/scalar/assets/2039539/5837adad-a605-4edb-90ec-b929ff2b803b">
|
|
12
|
+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/scalar/scalar/assets/2039539/4f58202d-f40f-47b3-aeaa-44681b424a45">
|
|
13
|
+
<img alt="Screenshot of an API Reference" src="https://github.com/scalar/scalar/assets/2039539/4f58202d-f40f-47b3-aeaa-44681b424a45">
|
|
14
|
+
</picture>
|
|
11
15
|
|
|
12
16
|
## Installation
|
|
13
17
|
|
|
@@ -17,21 +21,19 @@ npm install @scalar/nextjs-api-reference
|
|
|
17
21
|
|
|
18
22
|
## Usage
|
|
19
23
|
|
|
20
|
-
If you have a OpenAPI/Swagger file already, you can pass
|
|
24
|
+
If you have a OpenAPI/Swagger file already, you can pass a URL to the plugin in an API [Route](https://nextjs.org/docs/app/building-your-application/routing/route-handlers):
|
|
21
25
|
|
|
22
26
|
```ts
|
|
27
|
+
// app/reference/route.ts
|
|
23
28
|
import { ApiReference } from '@scalar/nextjs-api-reference'
|
|
24
29
|
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return <ApiReference config={config} />
|
|
30
|
+
const config = {
|
|
31
|
+
spec: {
|
|
32
|
+
url: '/swagger.json',
|
|
33
|
+
},
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
|
|
36
|
+
export const GET = ApiReference(config)
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
Or, if you just have a static OpenAPI spec, you can directly pass it as well:
|
|
@@ -44,7 +46,7 @@ const config = {
|
|
|
44
46
|
}
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
The Next.js
|
|
49
|
+
The Next.js handler takes our universal configuration object, [read more about configuration](https://github.com/scalar/scalar/tree/main/packages/api-reference#configuration) in the core package README.
|
|
48
50
|
|
|
49
51
|
## Themes
|
|
50
52
|
|