@scalar/express-api-reference 0.2.74 → 0.3.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/README.md CHANGED
@@ -69,3 +69,21 @@ app.use(
69
69
  }),
70
70
  )
71
71
  ```
72
+
73
+ ### Custom CDN
74
+
75
+ You can use a custom CDN ,default is `https://cdn.jsdelivr.net/npm/@scalar/api-reference`.
76
+
77
+ ```ts
78
+ import { apiReference } from '@scalar/nestjs-api-reference'
79
+
80
+ app.use(
81
+ '/reference',
82
+ apiReference({
83
+ cdn: 'https://cdn.jsdelivr.net/npm/@scalar/api-reference',
84
+ spec: {
85
+ content: OpenApiSpecification,
86
+ },
87
+ }),
88
+ )
89
+ ```
package/dist/index.cjs CHANGED
@@ -131,7 +131,7 @@ var ApiReference = (options) => {
131
131
  id="api-reference"
132
132
  type="application/json"
133
133
  data-configuration="${JSON.stringify(options).split('"').join("&quot;")}">${options.spec?.content ? typeof options.spec?.content === "function" ? JSON.stringify(options.spec?.content()) : JSON.stringify(options.spec?.content) : ""}</script>
134
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
134
+ <script src="${options.cdn || "https://cdn.jsdelivr.net/npm/@scalar/api-reference"}"></script>
135
135
  `;
136
136
  };
137
137
  function apiReference(options) {
package/dist/index.d.cts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { ReferenceConfiguration } from '@scalar/api-reference';
2
2
  import { Request, Response } from 'express';
3
3
 
4
- type ApiReferenceOptions = ReferenceConfiguration;
4
+ type ApiReferenceOptions = ReferenceConfiguration & {
5
+ cdn?: string;
6
+ };
5
7
  /**
6
8
  * The custom theme CSS for the API Reference.
7
9
  */
@@ -13,6 +15,6 @@ declare const ApiReference: (options: ApiReferenceOptions) => string;
13
15
  /**
14
16
  * The HTML template to render the API Reference.
15
17
  */
16
- declare function apiReference(options: ReferenceConfiguration): (req: Request, res: Response) => void;
18
+ declare function apiReference(options: ApiReferenceOptions): (req: Request, res: Response) => void;
17
19
 
18
20
  export { ApiReference, type ApiReferenceOptions, apiReference, customThemeCSS };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { ReferenceConfiguration } from '@scalar/api-reference';
2
2
  import { Request, Response } from 'express';
3
3
 
4
- type ApiReferenceOptions = ReferenceConfiguration;
4
+ type ApiReferenceOptions = ReferenceConfiguration & {
5
+ cdn?: string;
6
+ };
5
7
  /**
6
8
  * The custom theme CSS for the API Reference.
7
9
  */
@@ -13,6 +15,6 @@ declare const ApiReference: (options: ApiReferenceOptions) => string;
13
15
  /**
14
16
  * The HTML template to render the API Reference.
15
17
  */
16
- declare function apiReference(options: ReferenceConfiguration): (req: Request, res: Response) => void;
18
+ declare function apiReference(options: ApiReferenceOptions): (req: Request, res: Response) => void;
17
19
 
18
20
  export { ApiReference, type ApiReferenceOptions, apiReference, customThemeCSS };
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ var ApiReference = (options) => {
103
103
  id="api-reference"
104
104
  type="application/json"
105
105
  data-configuration="${JSON.stringify(options).split('"').join("&quot;")}">${options.spec?.content ? typeof options.spec?.content === "function" ? JSON.stringify(options.spec?.content()) : JSON.stringify(options.spec?.content) : ""}</script>
106
- <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
106
+ <script src="${options.cdn || "https://cdn.jsdelivr.net/npm/@scalar/api-reference"}"></script>
107
107
  `;
108
108
  };
109
109
  function apiReference(options) {
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "author": "Scalar (https://github.com/scalar)",
6
6
  "homepage": "https://github.com/scalar/scalar",
7
7
  "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
- "version": "0.2.74",
8
+ "version": "0.3.1",
9
9
  "engines": {
10
10
  "node": ">=18"
11
11
  },
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "express": "^4.18.2",
38
- "@scalar/api-reference": "1.18.6"
38
+ "@scalar/api-reference": "1.19.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/express": "^4.17.21",