@scalar/nextjs-api-reference 0.4.91 → 0.4.93

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,18 @@
1
1
  # @scalar/nextjs-api-reference
2
2
 
3
+ ## 0.4.93
4
+
5
+ ### Patch Changes
6
+
7
+ - 95351fe: feat: pin cdn version in integrations
8
+
9
+ ## 0.4.92
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [9dc2ab7]
14
+ - @scalar/types@0.0.13
15
+
3
16
  ## 0.4.91
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -84,3 +84,25 @@ export default function References() {
84
84
  )
85
85
  }
86
86
  ```
87
+
88
+ ### Specific CDN version
89
+
90
+ By default, this integration will use the latest version of the `@scalar/api-reference`.
91
+
92
+ You can also pin the CDN to a specific version by specifying it in the CDN string like `https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.28`
93
+
94
+ You can find all available CDN versions [here](https://www.jsdelivr.com/package/npm/@scalar/api-reference?tab=files)
95
+
96
+ ```ts
97
+ // app/reference/route.ts
98
+ import { ApiReference } from '@scalar/nextjs-api-reference'
99
+
100
+ const config = {
101
+ spec: {
102
+ url: '/openapi.json',
103
+ },
104
+ cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest',
105
+ }
106
+
107
+ export const GET = ApiReference(config)
108
+ ```
package/dist/index.cjs CHANGED
@@ -139,6 +139,7 @@ const ApiReference = (config) => {
139
139
  if (!(config == null ? void 0 : config.customCss) && !(config == null ? void 0 : config.theme)) {
140
140
  config.customCss = nextjsThemeCss;
141
141
  }
142
+ const cdnString = (config == null ? void 0 : config.cdn) ? config.cdn : "https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest";
142
143
  const configString = JSON.stringify(config ?? {}).split('"').join(""");
143
144
  return async () => {
144
145
  return new Response(
@@ -157,7 +158,7 @@ const ApiReference = (config) => {
157
158
  data-configuration="${configString}">
158
159
  ${documentString}
159
160
  <\/script>
160
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"><\/script>
161
+ <script src="${cdnString}"><\/script>
161
162
  </body>
162
163
  </html>
163
164
  `,
package/dist/index.d.ts CHANGED
@@ -8,6 +8,10 @@ import { ReferenceConfiguration } from '@scalar/types/legacy';
8
8
  * @params config - the Api Reference config object
9
9
  * @params options - reserved for future use to add customization to the response
10
10
  */
11
- export declare const ApiReference: (config: ReferenceConfiguration) => () => Promise<Response>;
11
+ export declare const ApiReference: (config: ApiReferenceOptions) => () => Promise<Response>;
12
+
13
+ export declare type ApiReferenceOptions = ReferenceConfiguration & {
14
+ cdn?: string;
15
+ };
12
16
 
13
17
  export { }
package/dist/index.js CHANGED
@@ -137,6 +137,7 @@ const ApiReference = (config) => {
137
137
  if (!(config == null ? void 0 : config.customCss) && !(config == null ? void 0 : config.theme)) {
138
138
  config.customCss = nextjsThemeCss;
139
139
  }
140
+ const cdnString = (config == null ? void 0 : config.cdn) ? config.cdn : "https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest";
140
141
  const configString = JSON.stringify(config ?? {}).split('"').join("&quot;");
141
142
  return async () => {
142
143
  return new Response(
@@ -155,7 +156,7 @@ const ApiReference = (config) => {
155
156
  data-configuration="${configString}">
156
157
  ${documentString}
157
158
  <\/script>
158
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"><\/script>
159
+ <script src="${cdnString}"><\/script>
159
160
  </body>
160
161
  </html>
161
162
  `,
@@ -141,6 +141,7 @@
141
141
  if (!(config == null ? void 0 : config.customCss) && !(config == null ? void 0 : config.theme)) {
142
142
  config.customCss = nextjsThemeCss;
143
143
  }
144
+ const cdnString = (config == null ? void 0 : config.cdn) ? config.cdn : "https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest";
144
145
  const configString = JSON.stringify(config ?? {}).split('"').join("&quot;");
145
146
  return async () => {
146
147
  return new Response(
@@ -159,7 +160,7 @@
159
160
  data-configuration="${configString}">
160
161
  ${documentString}
161
162
  <\/script>
162
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"><\/script>
163
+ <script src="${cdnString}"><\/script>
163
164
  </body>
164
165
  </html>
165
166
  `,
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "openapi",
19
19
  "swagger"
20
20
  ],
21
- "version": "0.4.91",
21
+ "version": "0.4.93",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "module": "./dist/index.js",
37
37
  "dependencies": {
38
- "@scalar/types": "0.0.12"
38
+ "@scalar/types": "0.0.13"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/node": "^20.14.10",
@@ -46,7 +46,7 @@
46
46
  "react-dom": "^18.3.1",
47
47
  "vite": "^5.2.10",
48
48
  "vite-plugin-dts": "^3.6.3",
49
- "@scalar/api-reference": "1.25.26"
49
+ "@scalar/api-reference": "1.25.30"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^18.0.0",