@luckystack/docs-ui 0.10.2 → 0.12.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/AGENTS.md +5 -0
- package/CHANGELOG.md +12 -1
- package/README.md +2 -87
- package/dist/{chunk-5CJZTAA5.js → chunk-AFSFBNYK.js} +2 -2
- package/dist/{chunk-5CJZTAA5.js.map → chunk-AFSFBNYK.js.map} +1 -1
- package/dist/docsHtml.d.ts +14 -0
- package/dist/index.d.ts +6 -9
- package/dist/index.js +1 -1
- package/dist/register.d.ts +1 -2
- package/dist/register.js +1 -1
- package/docs/extension-fields.md +3 -167
- package/docs/html-generation.md +2 -191
- package/docs/mounting.md +2 -223
- package/docs/theming.md +3 -170
- package/package.json +5 -5
- package/CLAUDE.md +0 -55
package/CLAUDE.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# @luckystack/docs-ui
|
|
2
|
-
|
|
3
|
-
> AI summary + function INDEX. For deep specs see `docs/` next to this file.
|
|
4
|
-
|
|
5
|
-
## What this package does
|
|
6
|
-
|
|
7
|
-
Dev-only API docs browser for LuckyStack. Mounts a single page (default `/_docs`) that fetches the framework's generated `apiDocs.generated.json` and renders every API endpoint grouped by page, with HTTP method, auth, rate limit, input shape, and output shape. Sync events appear alongside APIs when the type-map emitter has produced metadata for them. Ships a `customRoutes` handler — composable with `createLuckyStackServer`'s `customRoutes` option without taking ownership of the request pipeline.
|
|
8
|
-
|
|
9
|
-
## When to USE this package
|
|
10
|
-
|
|
11
|
-
- Local development: developer wants a Swagger-style overview of every route in the project without leaving the browser.
|
|
12
|
-
- Internal developer-portal: opt-in production rendering via `enabledInProd: true` for an authenticated team-only deploy.
|
|
13
|
-
- Custom branded API docs: replace the default template via the `template: DocsTemplateBuilder` option to render in a sidebar/tabs/marketing layout while reusing the JSON endpoint.
|
|
14
|
-
- Inline request runner: enable `enableTryItOut` so each endpoint gets a textarea + Send button that posts against the live server using the browser session cookie.
|
|
15
|
-
|
|
16
|
-
## When to NOT suggest this (yet)
|
|
17
|
-
|
|
18
|
-
- Public production surface where API discoverability is sensitive — keep the default `enabledInProd: false` and don't mount in prod.
|
|
19
|
-
- Replacement for `apiDocs.generated.json` itself — this package only reads/renders that file; regenerate via `@luckystack/devkit`'s type-map emitter (`npm run generateArtifacts`).
|
|
20
|
-
- A non-HTTP transport — the handler is bound to `IncomingMessage` / `ServerResponse`; do not wire it directly into Socket.io handlers.
|
|
21
|
-
- React-tree integration — the docs UI is a single self-contained HTML document with no React/Tailwind dependency on the client; do not import `renderDocsHtml` into the app bundle.
|
|
22
|
-
|
|
23
|
-
## Function Index
|
|
24
|
-
|
|
25
|
-
| Function / Export | 1-regel | Deep doc |
|
|
26
|
-
|---|---|---|
|
|
27
|
-
| `mountDocsUi(options?)` | Returns a `DocsRouteHandler` for `customRoutes`; serves HTML + JSON | → docs/mounting.md |
|
|
28
|
-
| `renderDocsHtml(jsonPath, pageTitle, options?)` | Builds the self-contained docs HTML document | → docs/html-generation.md |
|
|
29
|
-
| Type: `DocsRouteHandler` | `(req, res) => Promise<boolean>`; returns `true` when route handled | → docs/mounting.md |
|
|
30
|
-
| Type: `DocsTemplateBuilder` | Custom HTML builder hook: `({ jsonPath, pageTitle, branding }) => string` | → docs/html-generation.md |
|
|
31
|
-
| Type: `MountDocsUiOptions` | All mount inputs (routePath, enabledInProd, branding, template, enableTryItOut, ...) | → docs/mounting.md |
|
|
32
|
-
| Type: `DocsBranding` | `{ logoUrl?, brandColor?, fontFamily? }` applied by default template | → docs/theming.md |
|
|
33
|
-
| Type: `RenderDocsHtmlOptions` | `{ branding?, enableTryItOut? }` passed to `renderDocsHtml` | → docs/html-generation.md |
|
|
34
|
-
| Extension field: `meta.stream` | Per-endpoint stream shape rendered in expanded detail panel | → docs/extension-fields.md |
|
|
35
|
-
| Extension field: `meta.owner` | Owner string rendered in expanded detail panel | → docs/extension-fields.md |
|
|
36
|
-
| Extension field: `meta.tags` | Tag badges rendered in expanded detail panel | → docs/extension-fields.md |
|
|
37
|
-
| Extension field: `meta.deprecated` | Deprecation note (red) rendered in expanded detail panel | → docs/extension-fields.md |
|
|
38
|
-
|
|
39
|
-
## Config keys (env vars + registerProjectConfig slots)
|
|
40
|
-
|
|
41
|
-
- `NODE_ENV` (env) — when `'production'`, the route returns `404` unless `enabledInProd: true` is set.
|
|
42
|
-
- `ProjectConfig.paths.generatedApiDocs` (config, resolved via `getGeneratedApiDocsPath()` from `@luckystack/core`) — default JSON file path; override per-mount via `options.apiDocsPath`.
|
|
43
|
-
- No package-private env vars. All behavior is controlled via `MountDocsUiOptions`.
|
|
44
|
-
|
|
45
|
-
## Peer dependencies
|
|
46
|
-
|
|
47
|
-
- **Required**: `@luckystack/core` (provides `getGeneratedApiDocsPath` + `tryCatch`).
|
|
48
|
-
- **Required (runtime composition)**: `@luckystack/server` — the handler is intended to be passed to `createLuckyStackServer({ customRoutes })` / `bootstrapLuckyStack({ customRoutes })`. The package itself does not import `@luckystack/server`; the dependency is on the consumer side.
|
|
49
|
-
- **Required (data source)**: `@luckystack/devkit` (build-time) — emits `apiDocs.generated.json`. Without it the JSON endpoint returns a 404 with a hint to run `npm run generateArtifacts`.
|
|
50
|
-
|
|
51
|
-
## Related
|
|
52
|
-
|
|
53
|
-
- Architecture deep-dives: `/docs/ARCHITECTURE_API.md` (lifecycle of documented endpoints), `/docs/ARCHITECTURE_PACKAGING.md` (how the JSON artifact is produced).
|
|
54
|
-
- README (consumer quickstart): `./README.md`.
|
|
55
|
-
- Source: `./src/index.ts` (mount + route handling), `./src/docsHtml.ts` (embedded HTML renderer).
|