@scalar/server-side-rendering 0.1.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 ADDED
@@ -0,0 +1,12 @@
1
+ # @scalar/server-side-rendering
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#8431](https://github.com/scalar/scalar/pull/8431): feat: init :)
8
+
9
+ ### Patch Changes
10
+
11
+ - [#8758](https://github.com/scalar/scalar/pull/8758): feat: default to dark-mode for non-js users
12
+ - [#8758](https://github.com/scalar/scalar/pull/8758): fix(server-side-rendering): respect dark mode config for initial body class
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Scalar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Scalar Server-Side Rendering
2
+
3
+ [![Version](https://img.shields.io/npm/v/%40scalar/server-side-rendering)](https://www.npmjs.com/package/@scalar/server-side-rendering)
4
+ [![Downloads](https://img.shields.io/npm/dm/%40scalar/server-side-rendering)](https://www.npmjs.com/package/@scalar/server-side-rendering)
5
+ [![License](https://img.shields.io/npm/l/%40scalar%2Fserver-side-rendering)](https://www.npmjs.com/package/@scalar/server-side-rendering)
6
+ [![Discord](https://img.shields.io/discord/1135330207960678410?style=flat&color=5865F2)](https://discord.gg/scalar)
7
+
8
+ Server-side render the Scalar API Reference with client-side hydration. Pre-renders HTML on the server for instant content, then hydrates with the standalone bundle for full interactivity.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @scalar/server-side-rendering
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ Render the HTML and JS once at startup, then serve from memory.
19
+
20
+ ```ts
21
+ import { renderApiReference, getJsAsset } from '@scalar/server-side-rendering'
22
+
23
+ // Render once at startup
24
+ const html = await renderApiReference({
25
+ config: {
26
+ url: 'https://registry.scalar.com/@scalar/apis/galaxy?format=json',
27
+ },
28
+ pageTitle: 'My API Reference',
29
+ })
30
+
31
+ const js = getJsAsset()
32
+
33
+ // Serve the JS bundle for client-side hydration
34
+ app.get('/scalar/scalar.js', (c) => {
35
+ return c.body(js, {
36
+ headers: { 'content-type': 'application/javascript' },
37
+ })
38
+ })
39
+
40
+ // Serve the pre-rendered HTML
41
+ app.get('/scalar', (c) => c.html(html))
42
+ ```
43
+
44
+ ## Community
45
+
46
+ We are API nerds. You too? Let's chat on Discord: <https://discord.gg/scalar>
47
+
48
+ ## License
49
+
50
+ The source code in this repository is licensed under [MIT](https://github.com/scalar/scalar/blob/main/LICENSE).
@@ -0,0 +1,10 @@
1
+ import { __commonJSMin } from "./_rolldown/runtime.js";
2
+ //#region __vite-browser-external
3
+ var require___vite_browser_external = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ module.exports = {};
5
+ }));
6
+ //#endregion
7
+ export default require___vite_browser_external();
8
+ export { require___vite_browser_external };
9
+
10
+ //# sourceMappingURL=__vite-browser-external.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__vite-browser-external.js","names":[],"sources":["../../__vite-browser-external"],"sourcesContent":["module.exports = {}"],"mappings":";;;AAAA,QAAO,UAAU,EAAA"}
@@ -0,0 +1,4 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
3
+ //#endregion
4
+ export { __commonJSMin };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import { generateBodyScript, getJsAsset, renderApiReference, renderApiReferenceToString } from "./ssr.js";
2
+ export { generateBodyScript, getJsAsset, renderApiReference, renderApiReferenceToString };
package/dist/ssr.js ADDED
@@ -0,0 +1,149 @@
1
+ import { require___vite_browser_external } from "./_virtual/__vite-browser-external.js";
2
+ import { ApiReference } from "@scalar/api-reference";
3
+ import { createSSRApp, h } from "vue";
4
+ import { renderToString } from "vue/server-renderer";
5
+ //#region src/ssr.ts
6
+ var import___vite_browser_external = require___vite_browser_external();
7
+ var require = (0, import___vite_browser_external.createRequire)(import.meta.url);
8
+ /**
9
+ * Unwrap the configuration from an array if needed, since AnyApiReferenceConfiguration
10
+ * can be a single config or an array of configs.
11
+ */
12
+ function unwrapConfig(configuration) {
13
+ return (Array.isArray(configuration) ? configuration[0] : configuration) ?? {};
14
+ }
15
+ /**
16
+ * Generate an inline script that detects the user's color mode preference
17
+ * and applies the correct class to <body> before content paints.
18
+ *
19
+ * Place this script before the app container in your HTML so it runs before
20
+ * the first paint without interfering with Vue hydration.
21
+ *
22
+ * Priority:
23
+ * 1. forceDarkModeState → always wins (no runtime detection)
24
+ * 2. localStorage 'colorMode' → user's saved preference
25
+ * 3. matchMedia system preference
26
+ * 4. darkMode config → explicit default
27
+ * 5. Fallback → light-mode
28
+ */
29
+ function generateBodyScript(configuration) {
30
+ const config = unwrapConfig(configuration);
31
+ const forced = config.forceDarkModeState ?? null;
32
+ const darkMode = config.darkMode ?? null;
33
+ /** When forceDarkModeState is set, we do not need runtime detection at all. */
34
+ if (forced) return `<script>(function(){var cl=document.body.classList;cl.remove('dark-mode','light-mode');cl.add('${forced === "dark" ? "dark-mode" : "light-mode"}')})()<\/script>`;
35
+ return `<script>(function(){var cl=document.body.classList;function set(d){cl.remove('dark-mode','light-mode');cl.add(d?'dark-mode':'light-mode')}try{var s=localStorage.getItem('colorMode');if(s==='dark'||s==='light'){set(s==='dark');return}}catch(e){}${darkMode === null ? `set(window.matchMedia('(prefers-color-scheme:dark)').matches)` : `set(${darkMode})`}})()<\/script>`;
36
+ }
37
+ /**
38
+ * Derive the initial SSR class for <body> from config.
39
+ *
40
+ * Priority:
41
+ * 1. forceDarkModeState
42
+ * 2. darkMode
43
+ * 3. fallback to dark-mode (then runtime script can refine from localStorage/matchMedia)
44
+ */
45
+ function getInitialBodyClass(configuration) {
46
+ const config = unwrapConfig(configuration);
47
+ const forced = config.forceDarkModeState ?? null;
48
+ const darkMode = config.darkMode ?? null;
49
+ if (forced) return forced === "dark" ? "dark-mode" : "light-mode";
50
+ if (darkMode !== null) return darkMode ? "dark-mode" : "light-mode";
51
+ return "dark-mode";
52
+ }
53
+ /**
54
+ * Render the Scalar API Reference to an HTML string for server-side rendering.
55
+ * Use createApiReference on the client to hydrate the server-rendered output.
56
+ *
57
+ * Returns only the Vue-rendered HTML. Use generateBodyScript separately to get
58
+ * the dark/light mode script — place it outside the app container so it does not
59
+ * interfere with Vue hydration.
60
+ */
61
+ async function renderApiReferenceToString(configuration) {
62
+ const normalizedConfiguration = unwrapConfig(configuration);
63
+ const app = createSSRApp(() => h(ApiReference, { configuration: normalizedConfiguration }));
64
+ app.config.idPrefix = "scalar-refs";
65
+ return await renderToString(app);
66
+ }
67
+ var _cachedCss;
68
+ var _cachedJs;
69
+ /** Read the built style.css from the @scalar/api-reference package. */
70
+ function getDefaultCss() {
71
+ if (_cachedCss === void 0) _cachedCss = (0, import___vite_browser_external.readFileSync)(require.resolve("@scalar/api-reference/style.css"), "utf-8");
72
+ return _cachedCss;
73
+ }
74
+ /**
75
+ * Get the standalone JavaScript bundle as a string.
76
+ *
77
+ * Serve this at a route (e.g. `/scalar/scalar.js`) and pass the same path
78
+ * as the `cdn` option to `renderApiReference`. The bundle handles client-side
79
+ * hydration of the server-rendered HTML.
80
+ */
81
+ function getJsAsset() {
82
+ if (_cachedJs === void 0) _cachedJs = (0, import___vite_browser_external.readFileSync)(require.resolve("@scalar/api-reference/browser/standalone.js"), "utf-8");
83
+ return _cachedJs;
84
+ }
85
+ /** Escape HTML special characters in user-provided strings. */
86
+ function escapeHtml(str) {
87
+ return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
88
+ }
89
+ /** Escape user-provided strings before inserting into HTML attributes. */
90
+ function escapeHtmlAttribute(str) {
91
+ return escapeHtml(str).replace(/"/g, "&quot;").replace(/'/g, "&#39;");
92
+ }
93
+ /** Serialize an array that may contain functions. */
94
+ function serializeArrayWithFunctions(arr) {
95
+ return `[${arr.map((item) => typeof item === "function" ? item.toString() : JSON.stringify(item)).join(", ")}]`;
96
+ }
97
+ /**
98
+ * Serialize a configuration object to a JavaScript expression string,
99
+ * preserving function values (which JSON.stringify would silently drop).
100
+ */
101
+ function serializeConfigToJs(config) {
102
+ const jsonProps = {};
103
+ const functionProps = [];
104
+ for (const [key, value] of Object.entries(config)) if (typeof value === "function") functionProps.push(`"${key}": ${value.toString()}`);
105
+ else if (Array.isArray(value) && value.some((item) => typeof item === "function")) functionProps.push(`"${key}": ${serializeArrayWithFunctions(value)}`);
106
+ else jsonProps[key] = value;
107
+ const jsonString = JSON.stringify(jsonProps);
108
+ if (functionProps.length === 0) return jsonString;
109
+ return `{${[jsonString === "{}" ? "" : jsonString.slice(1, -1), functionProps.join(", ")].filter(Boolean).join(", ")}}`;
110
+ }
111
+ /**
112
+ * Render the Scalar API Reference as a complete HTML document with client-side
113
+ * hydration.
114
+ *
115
+ * Returns a full `<!doctype html>` page with:
116
+ * - Inline CSS in `<head>` (prevents flash of unstyled content)
117
+ * - Color-mode detection script (runs before first paint)
118
+ * - Pre-rendered Vue HTML (immediate content, no blank page)
119
+ * - Script tags to load the standalone bundle and hydrate
120
+ *
121
+ * Serve the standalone JS bundle via `getJsAsset()` at the route matching
122
+ * the `cdn` option (defaults to `/scalar/scalar.js`).
123
+ */
124
+ async function renderApiReference(options) {
125
+ const title = escapeHtml(options.pageTitle ?? "Scalar API Reference");
126
+ const css = options.css ?? getDefaultCss();
127
+ const cdn = escapeHtmlAttribute(options.cdn ?? "/scalar/scalar.js");
128
+ const html = await renderApiReferenceToString(options.config);
129
+ const bodyScript = generateBodyScript(options.config);
130
+ return `<!doctype html>
131
+ <html lang="en">
132
+ <head>
133
+ <meta charset="UTF-8" />
134
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
135
+ <title>${title}</title>
136
+ <style>${css}</style>
137
+ </head>
138
+ <body class="${getInitialBodyClass(options.config)}">
139
+ ${bodyScript}
140
+ <div id="app">${html}</div>
141
+ <script src="${cdn}"><\/script>
142
+ <script>Scalar.createApiReference('#app', ${serializeConfigToJs(unwrapConfig(options.config))})<\/script>
143
+ </body>
144
+ </html>`;
145
+ }
146
+ //#endregion
147
+ export { generateBodyScript, getJsAsset, renderApiReference, renderApiReferenceToString };
148
+
149
+ //# sourceMappingURL=ssr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ssr.js","names":[],"sources":["../src/ssr.ts"],"sourcesContent":["import { readFileSync } from 'node:fs'\nimport { createRequire } from 'node:module'\n\nimport { ApiReference } from '@scalar/api-reference'\nimport type { AnyApiReferenceConfiguration } from '@scalar/types/api-reference'\nimport { createSSRApp, h } from 'vue'\nimport { renderToString } from 'vue/server-renderer'\n\nconst require = createRequire(import.meta.url)\n\n/**\n * Unwrap the configuration from an array if needed, since AnyApiReferenceConfiguration\n * can be a single config or an array of configs.\n */\nfunction unwrapConfig(configuration: AnyApiReferenceConfiguration): Record<string, unknown> {\n const config = Array.isArray(configuration) ? configuration[0] : configuration\n return (config ?? {}) as Record<string, unknown>\n}\n\n/**\n * Generate an inline script that detects the user's color mode preference\n * and applies the correct class to <body> before content paints.\n *\n * Place this script before the app container in your HTML so it runs before\n * the first paint without interfering with Vue hydration.\n *\n * Priority:\n * 1. forceDarkModeState → always wins (no runtime detection)\n * 2. localStorage 'colorMode' → user's saved preference\n * 3. matchMedia system preference\n * 4. darkMode config → explicit default\n * 5. Fallback → light-mode\n */\nexport function generateBodyScript(configuration: AnyApiReferenceConfiguration): string {\n const config = unwrapConfig(configuration)\n const forced = (config.forceDarkModeState as string | undefined) ?? null\n const darkMode = (config.darkMode as boolean | undefined) ?? null\n\n /** When forceDarkModeState is set, we do not need runtime detection at all. */\n if (forced) {\n return `<script>(function(){var cl=document.body.classList;cl.remove('dark-mode','light-mode');cl.add('${forced === 'dark' ? 'dark-mode' : 'light-mode'}')})()</script>`\n }\n\n /**\n * Runtime detection script: checks localStorage first, then system preference,\n * then falls back to the darkMode config value.\n */\n const fallback =\n darkMode === null ? `set(window.matchMedia('(prefers-color-scheme:dark)').matches)` : `set(${darkMode})`\n\n return `<script>(function(){var cl=document.body.classList;function set(d){cl.remove('dark-mode','light-mode');cl.add(d?'dark-mode':'light-mode')}try{var s=localStorage.getItem('colorMode');if(s==='dark'||s==='light'){set(s==='dark');return}}catch(e){}${fallback}})()</script>`\n}\n\n/**\n * Derive the initial SSR class for <body> from config.\n *\n * Priority:\n * 1. forceDarkModeState\n * 2. darkMode\n * 3. fallback to dark-mode (then runtime script can refine from localStorage/matchMedia)\n */\nfunction getInitialBodyClass(configuration: AnyApiReferenceConfiguration): 'dark-mode' | 'light-mode' {\n const config = unwrapConfig(configuration)\n const forced = (config.forceDarkModeState as string | undefined) ?? null\n const darkMode = (config.darkMode as boolean | undefined) ?? null\n\n if (forced) {\n return forced === 'dark' ? 'dark-mode' : 'light-mode'\n }\n\n if (darkMode !== null) {\n return darkMode ? 'dark-mode' : 'light-mode'\n }\n\n return 'dark-mode'\n}\n\n/**\n * Render the Scalar API Reference to an HTML string for server-side rendering.\n * Use createApiReference on the client to hydrate the server-rendered output.\n *\n * Returns only the Vue-rendered HTML. Use generateBodyScript separately to get\n * the dark/light mode script — place it outside the app container so it does not\n * interfere with Vue hydration.\n */\nexport async function renderApiReferenceToString(configuration: AnyApiReferenceConfiguration): Promise<string> {\n const normalizedConfiguration = unwrapConfig(configuration)\n const app = createSSRApp(() => h(ApiReference, { configuration: normalizedConfiguration }))\n app.config.idPrefix = 'scalar-refs'\n\n return await renderToString(app)\n}\n\nlet _cachedCss: string | undefined\nlet _cachedJs: string | undefined\n\n/** Read the built style.css from the @scalar/api-reference package. */\nfunction getDefaultCss(): string {\n if (_cachedCss === undefined) {\n const cssPath = require.resolve('@scalar/api-reference/style.css')\n _cachedCss = readFileSync(cssPath, 'utf-8')\n }\n return _cachedCss\n}\n\n/**\n * Get the standalone JavaScript bundle as a string.\n *\n * Serve this at a route (e.g. `/scalar/scalar.js`) and pass the same path\n * as the `cdn` option to `renderApiReference`. The bundle handles client-side\n * hydration of the server-rendered HTML.\n */\nexport function getJsAsset(): string {\n if (_cachedJs === undefined) {\n const jsPath = require.resolve('@scalar/api-reference/browser/standalone.js')\n _cachedJs = readFileSync(jsPath, 'utf-8')\n }\n return _cachedJs\n}\n\n/** Escape HTML special characters in user-provided strings. */\nfunction escapeHtml(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n}\n\n/** Escape user-provided strings before inserting into HTML attributes. */\nfunction escapeHtmlAttribute(str: string): string {\n return escapeHtml(str).replace(/\"/g, '&quot;').replace(/'/g, '&#39;')\n}\n\n/** Serialize an array that may contain functions. */\nfunction serializeArrayWithFunctions(arr: unknown[]): string {\n return `[${arr.map((item) => (typeof item === 'function' ? item.toString() : JSON.stringify(item))).join(', ')}]`\n}\n\n/**\n * Serialize a configuration object to a JavaScript expression string,\n * preserving function values (which JSON.stringify would silently drop).\n */\nfunction serializeConfigToJs(config: Record<string, unknown>): string {\n const jsonProps: Record<string, unknown> = {}\n const functionProps: string[] = []\n\n for (const [key, value] of Object.entries(config)) {\n if (typeof value === 'function') {\n functionProps.push(`\"${key}\": ${value.toString()}`)\n } else if (Array.isArray(value) && value.some((item) => typeof item === 'function')) {\n functionProps.push(`\"${key}\": ${serializeArrayWithFunctions(value)}`)\n } else {\n jsonProps[key] = value\n }\n }\n\n const jsonString = JSON.stringify(jsonProps)\n\n if (functionProps.length === 0) {\n return jsonString\n }\n\n const jsonEntries = jsonString === '{}' ? '' : jsonString.slice(1, -1)\n const functionEntries = functionProps.join(', ')\n\n return `{${[jsonEntries, functionEntries].filter(Boolean).join(', ')}}`\n}\n\n/**\n * Render the Scalar API Reference as a complete HTML document with client-side\n * hydration.\n *\n * Returns a full `<!doctype html>` page with:\n * - Inline CSS in `<head>` (prevents flash of unstyled content)\n * - Color-mode detection script (runs before first paint)\n * - Pre-rendered Vue HTML (immediate content, no blank page)\n * - Script tags to load the standalone bundle and hydrate\n *\n * Serve the standalone JS bundle via `getJsAsset()` at the route matching\n * the `cdn` option (defaults to `/scalar/scalar.js`).\n */\nexport async function renderApiReference(options: {\n /** The API reference configuration. */\n config: AnyApiReferenceConfiguration\n /** Page title. Defaults to \"Scalar API Reference\". */\n pageTitle?: string\n /** Override the built-in CSS. */\n css?: string\n /** URL path to the standalone JS bundle. Defaults to \"/scalar/scalar.js\". */\n cdn?: string\n}): Promise<string> {\n const title = escapeHtml(options.pageTitle ?? 'Scalar API Reference')\n const css = options.css ?? getDefaultCss()\n const cdn = escapeHtmlAttribute(options.cdn ?? '/scalar/scalar.js')\n const html = await renderApiReferenceToString(options.config)\n const bodyScript = generateBodyScript(options.config)\n const initialBodyClass = getInitialBodyClass(options.config)\n const configJs = serializeConfigToJs(unwrapConfig(options.config))\n\n return `<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>${title}</title>\n <style>${css}</style>\n </head>\n <body class=\"${initialBodyClass}\">\n ${bodyScript}\n <div id=\"app\">${html}</div>\n <script src=\"${cdn}\"></script>\n <script>Scalar.createApiReference('#app', ${configJs})</script>\n </body>\n</html>`\n}\n"],"mappings":";;;;;;AAQA,IAAM,WAAA,GAAA,+BAAA,eAAwB,OAAO,KAAK,IAAI;;;;;AAM9C,SAAS,aAAa,eAAsE;AAE1F,SADe,MAAM,QAAQ,cAAc,GAAG,cAAc,KAAK,kBAC/C,EAAE;;;;;;;;;;;;;;;;AAiBtB,SAAgB,mBAAmB,eAAqD;CACtF,MAAM,SAAS,aAAa,cAAc;CAC1C,MAAM,SAAU,OAAO,sBAA6C;CACpE,MAAM,WAAY,OAAO,YAAoC;;AAG7D,KAAI,OACF,QAAO,kGAAkG,WAAW,SAAS,cAAc,aAAa;AAU1J,QAAO,uPAFL,aAAa,OAAO,kEAAkE,OAAO,SAAS,GAE+J;;;;;;;;;;AAWzQ,SAAS,oBAAoB,eAAyE;CACpG,MAAM,SAAS,aAAa,cAAc;CAC1C,MAAM,SAAU,OAAO,sBAA6C;CACpE,MAAM,WAAY,OAAO,YAAoC;AAE7D,KAAI,OACF,QAAO,WAAW,SAAS,cAAc;AAG3C,KAAI,aAAa,KACf,QAAO,WAAW,cAAc;AAGlC,QAAO;;;;;;;;;;AAWT,eAAsB,2BAA2B,eAA8D;CAC7G,MAAM,0BAA0B,aAAa,cAAc;CAC3D,MAAM,MAAM,mBAAmB,EAAE,cAAc,EAAE,eAAe,yBAAyB,CAAC,CAAC;AAC3F,KAAI,OAAO,WAAW;AAEtB,QAAO,MAAM,eAAe,IAAI;;AAGlC,IAAI;AACJ,IAAI;;AAGJ,SAAS,gBAAwB;AAC/B,KAAI,eAAe,KAAA,EAEjB,eAAA,GAAA,+BAAA,cADgB,QAAQ,QAAQ,kCAAkC,EAC/B,QAAQ;AAE7C,QAAO;;;;;;;;;AAUT,SAAgB,aAAqB;AACnC,KAAI,cAAc,KAAA,EAEhB,cAAA,GAAA,+BAAA,cADe,QAAQ,QAAQ,8CAA8C,EAC5C,QAAQ;AAE3C,QAAO;;;AAIT,SAAS,WAAW,KAAqB;AACvC,QAAO,IAAI,QAAQ,MAAM,QAAQ,CAAC,QAAQ,MAAM,OAAO,CAAC,QAAQ,MAAM,OAAO;;;AAI/E,SAAS,oBAAoB,KAAqB;AAChD,QAAO,WAAW,IAAI,CAAC,QAAQ,MAAM,SAAS,CAAC,QAAQ,MAAM,QAAQ;;;AAIvE,SAAS,4BAA4B,KAAwB;AAC3D,QAAO,IAAI,IAAI,KAAK,SAAU,OAAO,SAAS,aAAa,KAAK,UAAU,GAAG,KAAK,UAAU,KAAK,CAAE,CAAC,KAAK,KAAK,CAAC;;;;;;AAOjH,SAAS,oBAAoB,QAAyC;CACpE,MAAM,YAAqC,EAAE;CAC7C,MAAM,gBAA0B,EAAE;AAElC,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,CAC/C,KAAI,OAAO,UAAU,WACnB,eAAc,KAAK,IAAI,IAAI,KAAK,MAAM,UAAU,GAAG;UAC1C,MAAM,QAAQ,MAAM,IAAI,MAAM,MAAM,SAAS,OAAO,SAAS,WAAW,CACjF,eAAc,KAAK,IAAI,IAAI,KAAK,4BAA4B,MAAM,GAAG;KAErE,WAAU,OAAO;CAIrB,MAAM,aAAa,KAAK,UAAU,UAAU;AAE5C,KAAI,cAAc,WAAW,EAC3B,QAAO;AAMT,QAAO,IAAI,CAHS,eAAe,OAAO,KAAK,WAAW,MAAM,GAAG,GAAG,EAC9C,cAAc,KAAK,KAAK,CAEP,CAAC,OAAO,QAAQ,CAAC,KAAK,KAAK,CAAC;;;;;;;;;;;;;;;AAgBvE,eAAsB,mBAAmB,SASrB;CAClB,MAAM,QAAQ,WAAW,QAAQ,aAAa,uBAAuB;CACrE,MAAM,MAAM,QAAQ,OAAO,eAAe;CAC1C,MAAM,MAAM,oBAAoB,QAAQ,OAAO,oBAAoB;CACnE,MAAM,OAAO,MAAM,2BAA2B,QAAQ,OAAO;CAC7D,MAAM,aAAa,mBAAmB,QAAQ,OAAO;AAIrD,QAAO;;;;;aAKI,MAAM;aACN,IAAI;;iBATU,oBAAoB,QAAQ,OAAO,CAW5B;MAC5B,WAAW;oBACG,KAAK;mBACN,IAAI;gDAbJ,oBAAoB,aAAa,QAAQ,OAAO,CAAC,CAcX"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@scalar/server-side-rendering",
3
+ "description": "Server-side rendering for the Scalar API Reference using bundled JS",
4
+ "license": "MIT",
5
+ "author": "Scalar (https://github.com/scalar)",
6
+ "homepage": "https://github.com/scalar/scalar",
7
+ "bugs": "https://github.com/scalar/scalar/issues/new/choose",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/scalar/scalar.git",
11
+ "directory": "packages/server-side-rendering"
12
+ },
13
+ "keywords": [],
14
+ "version": "0.1.0",
15
+ "engines": {
16
+ "node": ">=22"
17
+ },
18
+ "type": "module",
19
+ "exports": {
20
+ ".": {
21
+ "import": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "default": "./dist/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "CHANGELOG.md"
29
+ ],
30
+ "dependencies": {
31
+ "vue": "^3.5.30",
32
+ "@scalar/types": "0.8.0",
33
+ "@scalar/api-reference": "1.52.0"
34
+ },
35
+ "devDependencies": {
36
+ "@hono/node-server": "^1.19.10",
37
+ "@vitejs/plugin-vue": "^6.0.3",
38
+ "hono": "^4.12.7",
39
+ "tsx": "4.19.4",
40
+ "vite": "8.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "vite build",
44
+ "dev": "tsx playground/server.ts",
45
+ "test": "vitest",
46
+ "types:check": "tsc --noEmit"
47
+ }
48
+ }