@scalar/server-side-rendering 0.1.52 → 0.1.54
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 +8 -0
- package/dist/ssr.d.ts.map +1 -1
- package/dist/ssr.js +2 -13
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @scalar/server-side-rendering
|
|
2
2
|
|
|
3
|
+
## 0.1.54
|
|
4
|
+
|
|
5
|
+
## 0.1.53
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- [#10344](https://github.com/scalar/scalar/pull/10344): Share JSON and property-name escaping for inline scripts between client-side and server-side rendering.
|
|
10
|
+
|
|
3
11
|
## 0.1.52
|
|
4
12
|
|
|
5
13
|
## 0.1.51
|
package/dist/ssr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AA+B/E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,4BAA4B,GAAG,MAAM,CAkBtF;AAqFD;;;;;;;GAOG;AACH,wBAAsB,0BAA0B,CAAC,aAAa,EAAE,4BAA4B,GAAG,OAAO,CAAC,MAAM,CAAC,CAG7G;AAcD;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,MAAM,CA2BnC;AAyHD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CA2B3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,uCAAuC;IACvC,MAAM,EAAE,4BAA4B,CAAA;IACpC,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iCAAiC;IACjC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAA;CACb,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BlB"}
|
package/dist/ssr.js
CHANGED
|
@@ -2,6 +2,8 @@ import { existsSync, readFileSync } from 'node:fs';
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { dirname, resolve } from 'node:path';
|
|
4
4
|
import { ApiReference } from '@scalar/api-reference';
|
|
5
|
+
import { escapeJsonForInlineScript } from '@scalar/helpers/json/escape-json-for-inline-script';
|
|
6
|
+
import { serializePropertyKey } from '@scalar/helpers/json/serialize-property-key';
|
|
5
7
|
import { useServerSeoMeta } from '@unhead/vue';
|
|
6
8
|
import { createHead, renderSSRHead } from '@unhead/vue/server';
|
|
7
9
|
import { createSSRApp, h } from 'vue';
|
|
@@ -173,18 +175,6 @@ function escapeHtml(str) {
|
|
|
173
175
|
function escapeHtmlAttribute(str) {
|
|
174
176
|
return escapeHtml(str).replace(/"/g, '"').replace(/'/g, ''');
|
|
175
177
|
}
|
|
176
|
-
/**
|
|
177
|
-
* Escape a JSON string so it is safe to embed inside an inline script tag.
|
|
178
|
-
* This prevents user content from closing the script tag.
|
|
179
|
-
*/
|
|
180
|
-
function escapeJsonForInlineScript(json) {
|
|
181
|
-
return json
|
|
182
|
-
.replace(/</g, '\\u003c')
|
|
183
|
-
.replace(/>/g, '\\u003e')
|
|
184
|
-
.replace(/&/g, '\\u0026')
|
|
185
|
-
.replace(/\u2028/g, '\\u2028')
|
|
186
|
-
.replace(/\u2029/g, '\\u2029');
|
|
187
|
-
}
|
|
188
178
|
/**
|
|
189
179
|
* Escape a function's source code so it is safe to embed inside an inline script tag.
|
|
190
180
|
*
|
|
@@ -250,7 +240,6 @@ const assertNoNestedFunctions = (value, path) => {
|
|
|
250
240
|
};
|
|
251
241
|
const serializeJsonValue = (value) => escapeJsonForInlineScript(JSON.stringify(value));
|
|
252
242
|
const serializeJsonObject = (value) => escapeJsonForInlineScript(JSON.stringify(value));
|
|
253
|
-
const serializePropertyKey = (key) => escapeJsonForInlineScript(JSON.stringify(key));
|
|
254
243
|
const serializeArrayWithFunctions = (value, path) => {
|
|
255
244
|
return `[${value
|
|
256
245
|
.map((item, index) => {
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directory": "packages/server-side-rendering"
|
|
12
12
|
},
|
|
13
13
|
"keywords": [],
|
|
14
|
-
"version": "0.1.
|
|
14
|
+
"version": "0.1.54",
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=22"
|
|
17
17
|
},
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
"CHANGELOG.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@scalar/api-reference": "1.72.
|
|
32
|
-
"@scalar/
|
|
31
|
+
"@scalar/api-reference": "1.72.2",
|
|
32
|
+
"@scalar/helpers": "0.16.0",
|
|
33
|
+
"@scalar/types": "0.22.2",
|
|
33
34
|
"@unhead/vue": "^2.1.12",
|
|
34
35
|
"vue": "^3.5.40"
|
|
35
36
|
},
|