@rapidoc/prerender 0.0.0-stage → 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/LICENSE.txt +22 -0
- package/README.md +27 -2
- package/dist/index.js +15146 -0
- package/package.json +57 -4
- package/src/index.d.ts +200 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Mrinmoy Majumdar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @rapidoc/prerender
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Renders RapiDoc API documentation to HTML at build time, in Node, Bun or any framework's build (Astro, Next.js, Nuxt, 11ty, VitePress):
|
|
4
|
+
|
|
5
|
+
- **`renderRapiDoc({ spec, ...options })`**: a pre-rendered `<rapi-doc>`, as Declarative Shadow DOM (the element hydrates over it) or as plain light-DOM HTML. Also `renderEndpoint` and `renderSchema` for single pieces.
|
|
6
|
+
- **`getNavBarHtml(spec, options)`**, **`getNavCss()`**, **`getThemeTokensCss()`**: a static sidebar to place beside a headless `<rapi-doc>`, as `@rapidoc/portal` does.
|
|
7
|
+
- **`renderArazzoWorkflow(arazzo, options)`** and **`getFlowCss()`**: an Arazzo workflow as an SVG diagram.
|
|
8
|
+
- **`methodPathSlug`**, **`operationAnchorSource`**, **`toKebabCase`**: the anchors `<rapi-doc>` uses, for links into it.
|
|
9
|
+
|
|
10
|
+
It renders the same templates as the `rapidoc` web component, so the HTML matches what the element shows.
|
|
11
|
+
|
|
12
|
+
## Use
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @rapidoc/prerender
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```javascript
|
|
19
|
+
import { renderRapiDoc } from "@rapidoc/prerender";
|
|
20
|
+
|
|
21
|
+
const html = await renderRapiDoc({ spec: "./openapi.yaml", outputMode: "dsd" });
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Load `rapidoc` in the page for the interactive element. Types are in `src/index.d.ts`. The guide: [rapidocui.com/guides/prerender](https://rapidocui.com/guides/prerender/).
|
|
25
|
+
|
|
26
|
+
## Development
|
|
27
|
+
|
|
28
|
+
The renderer is in `src/` (its contract: `src/README.md`); the templates, components and styles it renders are in `packages/rapidoc/src`. `npm run build` bundles both into `dist/index.js`, with the third-party packages left external.
|