Files
dev/docs/source.config.mjs
6f0dfd20c5 docs: complete tooling story (pb2zap + zap2pb), zip server, ZAP-only production case (#1)
* docs: tools section (pb2zap, zap2pb), zip server page, ZAP-only production story

- content/docs/tools/: new Tooling nav group — the complete pb<->ZAP
  interop boundary. pb2zap (go/ast codemod off protobuf), zap2pb
  (the one sanctioned protobuf import: Marshal/Unmarshal/Equal/
  AppendMessage, v0.2.0), and the migration path over the existing
  schema/codegen pages.
- content/docs/zip.mdx: the ZAP-native application server — one
  Listen verb (ZAP primary, HTTP secondary), typed handlers with
  REST/OpenAPI/MCP projections, Mount composition, and the
  hanzoai/cloud case: sub-1,000-line compose root hosting ~75K LOC
  of subsystems (76:1).
- why-zap: scrub the unmeasured benchmark tables (per the
  benchmarks-page policy), replace with mechanism arguments and the
  ZAP-only-in-production account: zero gRPC, protobuf confined to
  the four-function zap2pb boundary at the OTLP edge.
- ecosystem: add zip/pb2zap/zap2pb rows; quick-start + index: link
  the new pages, drop the unmeasured 5-20x claim.

* fix(build): alias MDX collections to regenerated docs/, drop frozen .docs snapshot

next.config.mjs and tsconfig.json pointed @hanzo/docs-mdx:collections/*
at .docs/ — a snapshot frozen on Jun 1 — while the MDX plugin
regenerates docs/ on every build. Result: no page added since the
snapshot (schema, codegen, rpc, capabilities, and this PR%27s tools/zip)
was ever emitted; the site silently served 37 routes instead of 45.
Alias both resolvers at docs/ and remove .docs.

---------

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-07 17:58:42 -07:00

288 lines
7.0 KiB
JavaScript

// source.config.ts
import {
defineConfig,
defineDocs,
frontmatterSchema,
metaSchema
} from "@hanzo/docs-mdx/config";
// lib/zap.tmLanguage.json
var zap_tmLanguage_default = {
$schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
name: "zap",
displayName: "ZAP",
aliases: ["zaps"],
scopeName: "source.zap",
fileTypes: ["zap", "zaps"],
patterns: [
{ include: "#comments" },
{ include: "#annotations" },
{ include: "#keywords" },
{ include: "#types" },
{ include: "#strings" },
{ include: "#numbers" },
{ include: "#constants" },
{ include: "#identifiers" },
{ include: "#operators" },
{ include: "#punctuation" }
],
repository: {
comments: {
patterns: [
{
name: "comment.line.number-sign.zap",
match: "#.*$"
},
{
name: "comment.line.double-slash.zap",
match: "//.*$"
},
{
name: "comment.block.zap",
begin: "/\\*",
end: "\\*/",
patterns: [
{
name: "comment.block.zap",
match: "."
}
]
}
]
},
annotations: {
patterns: [
{
name: "entity.name.function.decorator.zap",
match: "@[a-zA-Z_][a-zA-Z0-9_]*"
},
{
name: "constant.numeric.field-id.zap",
match: "@[0-9]+"
},
{
name: "keyword.other.unique-id.zap",
match: "@0x[0-9a-fA-F]+"
}
]
},
keywords: {
patterns: [
{
name: "keyword.control.zap",
match: "\\b(struct|enum|interface|union|group|service|rpc|method)\\b"
},
{
name: "keyword.other.zap",
match: "\\b(import|using|const|annotation|extends|implements|returns|throws|stream)\\b"
},
{
name: "keyword.modifier.zap",
match: "\\b(inline|packed|aligned|deprecated|optional|required|repeated)\\b"
},
{
name: "keyword.control.flow.zap",
match: "\\b(in|of|on|as|with|from|to|for)\\b"
}
]
},
types: {
patterns: [
{
name: "storage.type.primitive.zap",
match: "\\b(Void|Bool|Int8|Int16|Int32|Int64|UInt8|UInt16|UInt32|UInt64|Float32|Float64)\\b"
},
{
name: "storage.type.primitive.alias.zap",
match: "\\b(i8|i16|i32|i64|u8|u16|u32|u64|f32|f64|bool|void)\\b"
},
{
name: "storage.type.composite.zap",
match: "\\b(Text|Data|Bytes|String|List|Map|Set|Option|Result|AnyPointer|AnyStruct|Capability)\\b"
},
{
name: "storage.type.generic.zap",
match: "\\b[A-Z][a-zA-Z0-9_]*\\b(?=\\s*[<\\(\\{]|\\s*@|\\s*:)"
},
{
name: "entity.name.type.zap",
match: "\\b[A-Z][a-zA-Z0-9_]*\\b"
}
]
},
strings: {
patterns: [
{
name: "string.quoted.double.zap",
begin: '"',
end: '"',
patterns: [
{
name: "constant.character.escape.zap",
match: `\\\\(?:[0-7]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[abfnrtv\\\\"'])`
}
]
},
{
name: "string.quoted.single.zap",
begin: "'",
end: "'",
patterns: [
{
name: "constant.character.escape.zap",
match: "\\\\."
}
]
},
{
name: "string.quoted.raw.zap",
begin: "`",
end: "`"
}
]
},
numbers: {
patterns: [
{
name: "constant.numeric.hex.zap",
match: "\\b0[xX][0-9a-fA-F_]+\\b"
},
{
name: "constant.numeric.binary.zap",
match: "\\b0[bB][01_]+\\b"
},
{
name: "constant.numeric.octal.zap",
match: "\\b0[oO][0-7_]+\\b"
},
{
name: "constant.numeric.float.zap",
match: "\\b[0-9][0-9_]*\\.[0-9_]+([eE][+-]?[0-9_]+)?\\b"
},
{
name: "constant.numeric.float.exponent.zap",
match: "\\b[0-9][0-9_]*[eE][+-]?[0-9_]+\\b"
},
{
name: "constant.numeric.integer.zap",
match: "\\b[0-9][0-9_]*\\b"
}
]
},
constants: {
patterns: [
{
name: "constant.language.boolean.zap",
match: "\\b(true|false)\\b"
},
{
name: "constant.language.null.zap",
match: "\\b(null|nil|void)\\b"
},
{
name: "constant.language.infinity.zap",
match: "\\b(inf|nan)\\b"
}
]
},
identifiers: {
patterns: [
{
name: "variable.other.field.zap",
match: "\\b[a-z_][a-zA-Z0-9_]*\\b(?=\\s*@)"
},
{
name: "variable.other.zap",
match: "\\b[a-z_][a-zA-Z0-9_]*\\b"
}
]
},
operators: {
patterns: [
{
name: "keyword.operator.assignment.zap",
match: "="
},
{
name: "keyword.operator.arrow.zap",
match: "->"
},
{
name: "keyword.operator.type.zap",
match: ":"
}
]
},
punctuation: {
patterns: [
{
name: "punctuation.definition.block.begin.zap",
match: "\\{"
},
{
name: "punctuation.definition.block.end.zap",
match: "\\}"
},
{
name: "punctuation.definition.parameters.begin.zap",
match: "\\("
},
{
name: "punctuation.definition.parameters.end.zap",
match: "\\)"
},
{
name: "punctuation.definition.generic.begin.zap",
match: "<"
},
{
name: "punctuation.definition.generic.end.zap",
match: ">"
},
{
name: "punctuation.definition.array.begin.zap",
match: "\\["
},
{
name: "punctuation.definition.array.end.zap",
match: "\\]"
},
{
name: "punctuation.separator.zap",
match: "[,;]"
}
]
}
}
};
// source.config.ts
var docs = defineDocs({
dir: "content/docs",
docs: {
schema: frontmatterSchema,
postprocess: {
includeProcessedMarkdown: true
}
},
meta: {
schema: metaSchema
}
});
var source_config_default = defineConfig({
mdxOptions: {
// Register ZAP's TextMate grammar so ```zap fences highlight instead of
// throwing ShikiError. Grammar vendored from luxfi zap/syntax (source.zap).
// Only `langs` is overridden; themes/engine/transformers stay on the docs
// preset defaults, which the runtime merges in (its type demands a full
// options object, so this partial override is asserted).
rehypeCodeOptions: {
langs: [zap_tmLanguage_default]
}
}
});
export {
source_config_default as default,
docs
};