@scalar/nextjs-api-reference 0.10.19 → 0.11.0
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 +20 -0
- package/dist/index.cjs +3 -2
- package/dist/index.js +3 -2
- package/dist/index.umd.cjs +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @scalar/nextjs-api-reference
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#9422](https://github.com/scalar/scalar/pull/9422): Add a `nonce` option for Content Security Policy support.
|
|
8
|
+
|
|
9
|
+
When you pass a `nonce`, the rendered HTML stamps it onto the inline `<script>` and the CDN `<script>` tag (and Scalar's own `<style>` tags, plus a matching `<meta property="csp-nonce">`). This lets the API Reference run under a strict `script-src` with no `unsafe-inline` and no `unsafe-eval`.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
ApiReference({
|
|
13
|
+
url: '/openapi.json',
|
|
14
|
+
// Match this value in your `script-src` CSP directive.
|
|
15
|
+
nonce: 'r4nd0m',
|
|
16
|
+
})
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Note: `style-src` still needs `'unsafe-inline'`. The reference renders inline `style="…"` attributes, which a CSP nonce can never authorize (nonces only apply to `<script>`, `<style>` and `<link>` elements), so a nonce-only `style-src` is not possible. The win is a fully strict `script-src`.
|
|
20
|
+
|
|
21
|
+
## 0.10.20
|
|
22
|
+
|
|
3
23
|
## 0.10.19
|
|
4
24
|
|
|
5
25
|
## 0.10.18
|
package/dist/index.cjs
CHANGED
|
@@ -146,11 +146,12 @@ var ApiReference = (givenConfiguration) => {
|
|
|
146
146
|
...givenConfiguration
|
|
147
147
|
};
|
|
148
148
|
return () => {
|
|
149
|
-
const { cdn, pageTitle, ...config } = configuration;
|
|
149
|
+
const { cdn, pageTitle, nonce, ...config } = configuration;
|
|
150
150
|
const referenceDocument = (0, _scalar_client_side_rendering.renderApiReference)({
|
|
151
151
|
config,
|
|
152
152
|
pageTitle,
|
|
153
|
-
cdn
|
|
153
|
+
cdn,
|
|
154
|
+
nonce
|
|
154
155
|
}, customTheme);
|
|
155
156
|
return new Response(referenceDocument, {
|
|
156
157
|
status: 200,
|
package/dist/index.js
CHANGED
|
@@ -145,11 +145,12 @@ var ApiReference = (givenConfiguration) => {
|
|
|
145
145
|
...givenConfiguration
|
|
146
146
|
};
|
|
147
147
|
return () => {
|
|
148
|
-
const { cdn, pageTitle, ...config } = configuration;
|
|
148
|
+
const { cdn, pageTitle, nonce, ...config } = configuration;
|
|
149
149
|
const referenceDocument = renderApiReference({
|
|
150
150
|
config,
|
|
151
151
|
pageTitle,
|
|
152
|
-
cdn
|
|
152
|
+
cdn,
|
|
153
|
+
nonce
|
|
153
154
|
}, customTheme);
|
|
154
155
|
return new Response(referenceDocument, {
|
|
155
156
|
status: 200,
|
package/dist/index.umd.cjs
CHANGED
|
@@ -148,11 +148,12 @@
|
|
|
148
148
|
...givenConfiguration
|
|
149
149
|
};
|
|
150
150
|
return () => {
|
|
151
|
-
const { cdn, pageTitle, ...config } = configuration;
|
|
151
|
+
const { cdn, pageTitle, nonce, ...config } = configuration;
|
|
152
152
|
const referenceDocument = (0, _scalar_client_side_rendering.renderApiReference)({
|
|
153
153
|
config,
|
|
154
154
|
pageTitle,
|
|
155
|
-
cdn
|
|
155
|
+
cdn,
|
|
156
|
+
nonce
|
|
156
157
|
}, customTheme);
|
|
157
158
|
return new Response(referenceDocument, {
|
|
158
159
|
status: 200,
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"openapi",
|
|
19
19
|
"swagger"
|
|
20
20
|
],
|
|
21
|
-
"version": "0.
|
|
21
|
+
"version": "0.11.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"documentation": "https://scalar.com/products/api-references/integrations/nextjs"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@scalar/client-side-rendering": "0.
|
|
53
|
+
"@scalar/client-side-rendering": "0.2.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^24.1.0",
|