@scalar/server-side-rendering 0.1.66 → 0.1.67

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,11 @@
1
1
  # @scalar/server-side-rendering
2
2
 
3
+ ## 0.1.67
4
+
5
+ ### Patch Changes
6
+
7
+ - [#10845](https://github.com/scalar/scalar/pull/10845): Prevent custom CSS and themes from closing style elements in generated HTML.
8
+
3
9
  ## 0.1.66
4
10
 
5
11
  ## 0.1.65
package/dist/ssr.d.ts.map CHANGED
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"ssr.d.ts","sourceRoot":"","sources":["../src/ssr.ts"],"names":[],"mappings":"AAQA,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,7 @@ 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 { escapeCssForStyleTag } from '@scalar/helpers/dom/escape-css-for-style-tag';
5
6
  import { escapeJsonForInlineScript } from '@scalar/helpers/json/escape-json-for-inline-script';
6
7
  import { serializePropertyKey } from '@scalar/helpers/json/serialize-property-key';
7
8
  import { useServerSeoMeta } from '@unhead/vue';
@@ -134,11 +135,11 @@ export async function renderApiReferenceToString(configuration) {
134
135
  }
135
136
  let _cachedCss;
136
137
  let _cachedJs;
137
- /** Read the built style.css from the @scalar/api-reference package. */
138
+ /** Cache the built stylesheet escaped for embedding in an HTML style element. */
138
139
  function getDefaultCss() {
139
140
  if (_cachedCss === undefined) {
140
141
  const cssPath = require.resolve('@scalar/api-reference/style.css');
141
- _cachedCss = readFileSync(cssPath, 'utf-8');
142
+ _cachedCss = escapeCssForStyleTag(readFileSync(cssPath, 'utf-8'));
142
143
  }
143
144
  return _cachedCss;
144
145
  }
@@ -304,7 +305,7 @@ export function serializeConfigToJs(config) {
304
305
  */
305
306
  export async function renderApiReference(options) {
306
307
  const title = options.pageTitle ?? 'Scalar API Reference';
307
- const css = options.css ?? getDefaultCss();
308
+ const css = options.css == null ? getDefaultCss() : escapeCssForStyleTag(options.css);
308
309
  const cdn = escapeHtmlAttribute(options.cdn ?? '/scalar/scalar.js');
309
310
  const { html, head } = await renderApiReferenceApp({
310
311
  configuration: options.config,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "directory": "packages/server-side-rendering"
12
12
  },
13
13
  "keywords": [],
14
- "version": "0.1.66",
14
+ "version": "0.1.67",
15
15
  "engines": {
16
16
  "node": ">=22"
17
17
  },
@@ -28,9 +28,9 @@
28
28
  "CHANGELOG.md"
29
29
  ],
30
30
  "dependencies": {
31
- "@scalar/api-reference": "1.76.4",
32
- "@scalar/helpers": "0.16.4",
33
- "@scalar/types": "0.26.0",
31
+ "@scalar/api-reference": "1.77.0",
32
+ "@scalar/helpers": "0.17.0",
33
+ "@scalar/types": "0.27.0",
34
34
  "@unhead/vue": "^3.4.3",
35
35
  "vue": "^3.5.44"
36
36
  },