@scalar/nextjs-api-reference 0.1.0 → 0.1.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @scalar/nextjs-api-reference
2
2
 
3
+ ## 0.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - ac9e9326: fix: moved next.js adapter to an api route
8
+ - 1963d803: chore: allow Next.js 14
9
+ - Updated dependencies [706b29f2]
10
+ - Updated dependencies [d8fc0544]
11
+ - Updated dependencies [55e74b08]
12
+ - Updated dependencies [8573da8d]
13
+ - @scalar/api-reference@1.13.15
14
+
3
15
  ## 0.1.0
4
16
 
5
17
  ### Minor Changes
package/README.md CHANGED
@@ -1,13 +1,17 @@
1
- # Scalar Next.js API Reference Component
1
+ # Scalar Next.js API Reference Handler
2
2
 
3
3
  [![Version](https://img.shields.io/npm/v/%40scalar/nextjs-api-reference)](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
4
4
  [![Downloads](https://img.shields.io/npm/dm/%40scalar/nextjs-api-reference)](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
5
- [![License](https://img.shields.io/npm/l/%40scalar%nextjs-api-reference)](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
5
+ [![License](https://img.shields.io/npm/l/%40scalar%2fnextjs-api-reference)](https://www.npmjs.com/package/@scalar/nextjs-api-reference)
6
6
  [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/8HeZcRGPFS)
7
7
 
8
- This plugin provides an easy way to render a beautiful API reference based on a OpenAPI/Swagger file with Next.JS.
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
- [![Screenshot of an API Reference](https://github.com/scalar/scalar/assets/6201407/d8beb5e1-bf64-4589-8cb0-992ba79215a8)](https://docs.scalar.com/swagger-editor)
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 an URL to the plugin:
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 Page = () => {
26
- const config = {
27
- spec: {
28
- url: '/swagger.json'
29
- }
30
- }
31
-
32
- return <ApiReference config={config} />
30
+ const config = {
31
+ spec: {
32
+ url: '/swagger.json',
33
+ },
33
34
  }
34
- export default Page
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 component 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.
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