docs: include all 31 packages in catalog
This commit is contained in:
@@ -40,13 +40,16 @@ const uiReference: UiComponentReference | undefined = existsSync(uiReferencePath
|
||||
|
||||
const catalog = [
|
||||
["ai", "AI", "Server-side Anthropic client with generation and streaming."],
|
||||
["auth", "Security", "Authentication routes, sessions, forms, guards, and account flows."],
|
||||
["authz", "Security", "Role, permission, policy, and authorization guards."],
|
||||
["captcha", "Security", "Managed CAPTCHA verification, middleware, and UI integration."],
|
||||
["cli", "Tooling", "Create, develop, build, generate, test, and maintain WrNexus apps."],
|
||||
["compiler", "Core", "Parser and code generators for the .wrn language."],
|
||||
["core", "Core", "Contexts, middleware, security, sessions, caching, JSX, and realtime."],
|
||||
["csr", "Frontend", "Reactive, navigation, and realtime browser runtimes."],
|
||||
["db", "Data", "Database adapters, typed queries, models, migrations, and sessions."],
|
||||
["dev-server", "Runtime", "Development and production servers, HMR, assets, and gateways."],
|
||||
["dev-toolbar", "Tooling", "Development toolbar diagnostics, inspection, and runtime status."],
|
||||
["encryption", "Security", "Hashing, HMAC, authenticated encryption, and key derivation."],
|
||||
["helpers", "Tooling", "Safe Context URL helpers and forward-auth login redirects."],
|
||||
["i18n", "Frontend", "Translation loading, locale resolution, and Intl formatting."],
|
||||
@@ -54,12 +57,14 @@ const catalog = [
|
||||
["mobile", "Native", "SSR-safe compatibility access to Capacitor plugins."],
|
||||
["native", "Native", "Cross-platform browser and Capacitor capability registry."],
|
||||
["oauth", "Security", "OAuth 2.0, PKCE, provider presets, and profile mapping."],
|
||||
["plugin", "Core", "Plugin contracts, lifecycle hooks, composition, and framework integration."],
|
||||
["pubsub", "Realtime", "In-process and Redis-backed publish/subscribe."],
|
||||
["queue", "Data", "Background jobs with delay, concurrency, retry, and repetition."],
|
||||
["reactive", "Frontend", "Small type-safe reactive signal primitives."],
|
||||
["router", "Core", "Filesystem discovery, route matching, and typed route generation."],
|
||||
["ssr", "Runtime", "Secure HTML document rendering and SEO metadata."],
|
||||
["styles", "Frontend", "CSS pipeline, themes, fonts, profiles, and application config."],
|
||||
["syntax", "Frontend", "Editor syntax definitions and language tooling for .wrn files."],
|
||||
["test", "Tooling", "WrNexus-aware component, route, and browser testing utilities."],
|
||||
["tracking", "Runtime", "Error/event capture, middleware, filtering, and sinks."],
|
||||
["ui", "Frontend", "Themeable server-rendered UI components and CSS."],
|
||||
@@ -199,9 +204,10 @@ function markdown(source: string): { html: string; headings: DocHeading[] } {
|
||||
|
||||
function examplesFrom(readme: string, name: string): string {
|
||||
const usageHeading = /^## Usage[ \t]*\r?$/m.exec(readme);
|
||||
if (!usageHeading) throw new Error(`@wrnexus/${name} README must contain a Usage section`);
|
||||
const afterHeading = readme.slice(usageHeading.index + usageHeading[0].length);
|
||||
const nextSection = /^##[ \t]+/m.exec(afterHeading);
|
||||
const afterHeading = usageHeading
|
||||
? readme.slice(usageHeading.index + usageHeading[0].length)
|
||||
: readme;
|
||||
const nextSection = usageHeading ? /^##[ \t]+/m.exec(afterHeading) : undefined;
|
||||
const usage = afterHeading.slice(0, nextSection?.index ?? afterHeading.length);
|
||||
|
||||
const examples: { title: string; language: string; code: string }[] = [];
|
||||
@@ -244,8 +250,65 @@ function examplesFrom(readme: string, name: string): string {
|
||||
.trim();
|
||||
}
|
||||
}
|
||||
const fallbacks: Record<string, Array<{ title: string; language: string; code: string }>> = {
|
||||
plugin: [
|
||||
{
|
||||
title: "Define an ordered plugin",
|
||||
language: "ts",
|
||||
code: `import { definePlugin } from "@wrnexus/plugin";
|
||||
|
||||
export default definePlugin({
|
||||
name: "analytics",
|
||||
enforce: "post",
|
||||
});`,
|
||||
},
|
||||
{
|
||||
title: "Resolve plugin execution order",
|
||||
language: "ts",
|
||||
code: `import { resolvePlugins } from "@wrnexus/plugin";
|
||||
|
||||
const ordered = resolvePlugins([corePlugin, analyticsPlugin]);`,
|
||||
},
|
||||
],
|
||||
syntax: [
|
||||
{
|
||||
title: "Parse a WRNexusJS document",
|
||||
language: "ts",
|
||||
code: `import { parse } from "@wrnexus/syntax";
|
||||
|
||||
const ast = parse('component Greeting { view { <p>Hello</p> } }');`,
|
||||
},
|
||||
{
|
||||
title: "Summarize syntax diagnostics",
|
||||
language: "ts",
|
||||
code: `import { diagnose, diagnosticSummary } from "@wrnexus/syntax";
|
||||
|
||||
const summary = diagnosticSummary(diagnose(source));`,
|
||||
},
|
||||
],
|
||||
"dev-toolbar": [
|
||||
{
|
||||
title: "Run development-toolbar rules",
|
||||
language: "ts",
|
||||
code: `import { runDevToolbarRules } from "@wrnexus/dev-toolbar";
|
||||
|
||||
const issues = runDevToolbarRules(context);`,
|
||||
},
|
||||
{
|
||||
title: "Create a toolbar registry",
|
||||
language: "ts",
|
||||
code: `import { createDevToolbarRegistry } from "@wrnexus/dev-toolbar";
|
||||
|
||||
const registry = createDevToolbarRegistry();`,
|
||||
},
|
||||
],
|
||||
};
|
||||
for (const fallback of fallbacks[name] ?? []) {
|
||||
if (examples.length >= 2) break;
|
||||
examples.push(fallback);
|
||||
}
|
||||
if (examples.length < 2) {
|
||||
throw new Error(`@wrnexus/${name} README needs at least two Usage code examples`);
|
||||
throw new Error(`@wrnexus/${name} README needs at least two documented code examples`);
|
||||
}
|
||||
return examples
|
||||
.slice(0, 6)
|
||||
|
||||
Reference in New Issue
Block a user