Skip to main content

Module utils

Module utils 

Source

Structs§

CollectionReport
Per-collection summary: record count and output path.
EngineError
One non-fatal compile failure (read fail, schema reject, …). The build continues unless EngineConfig.strict is set.
EngineReport
Build outcome: per-collection summaries plus non-fatal errors.

Functions§

build_schema_ctx
dmc_schema::Ctx from a compiled doc. What schema transform/refine predicates see (HTML, MDX body, TOC, plain text, path, …).
build_velite_record
Pack one compiled doc into a velite-shaped JSON record: { ...frontmatter, code, raw, slug, permalink, path, ...optional html }.
is_js_ident
True when s is a bare JS identifier (safe to emit unquoted).
minify_js
Best-effort JS minifier: strips comments, collapses whitespace, drops blank lines. Not a full parser; corner cases (regex literals, multi-line strings) are skipped over.
pascal_case
kebab-case / snake_case / space case -> PascalCase. Empty input -> "Doc" so the caller can always concatenate a suffix.
relative_from
POSIX-style relative path from from_dir to target. Canonicalises when possible; always emits forward slashes (TS/ESM specifier shape).
wrap_mdx_module
Wrap the raw MDX body in an ES-module shell, hoisting frontmatter imports above the function. Consumers import the default export.