Skip to content

Overview

cem-generator generates a Custom Elements Manifest (CEM) — a machine-readable JSON file describing your custom elements. This manifest powers documentation sites, IDE autocomplete, and tooling across the web components ecosystem.

Why cem-generator?

cem-generator keeps your component source, documentation, and tooling metadata in sync without asking you to maintain the same API in multiple places. You write the component and its comments once; the generator turns that source into a validated manifest that can power documentation, editor autocomplete, and build integrations. It overlaps with CEM Analyzer and Lit Analyzer, but adds capabilities that are especially useful outside a Lit-only or annotation-driven workflow.

CapabilityWhy it makes development easier
Fast setupGo from install to a working manifest with one command. Vanilla projects need no plugin, and framework projects can select integrations interactively instead of wiring every package by hand.
One source of truthAPI discovery and inline comments produce the manifest, so routine API or documentation changes do not require a second metadata file to update.
TypeScript project awarenessUses your existing tsconfig.json, so aliases, included files, excluded files, and public types are interpreted the same way as the rest of your project.
Fits your build workflowUse the same generator programmatically, from the CLI, or through Vite, Rollup/Rolldown, and Webpack integrations instead of maintaining a separate analysis workflow.
API auto-discoveryFinds properties, methods, attributes, events, slots, CSS custom properties, shadow parts, and custom states directly from source.
CSS-only elementsDetects documented custom-element selectors in standalone CSS files, including attributes, public custom properties, @cssprop tags, and @property metadata.
Inline documentationTurns comments and standard JSDoc tags into manifest documentation next to the API they describe, keeping generated docs close to the code and reducing stale explanations.
Validation before publishingCatches broken declaration references and invalid public type exposure during generation, before bad metadata reaches documentation sites or consumers.
Complete, configurable inheritanceAutomatically includes inherited APIs across multi-level superclass chains, while JSDoc tags let you hide individual inherited members when they are not part of a component’s intended public surface.
Useful library metadataPreserves type information, inherited API provenance, external-manifest relationships, events, slots, and CSS metadata in the generated CEM.
Predictable extension pointsClear detector and annotator roles make custom behavior easier to add and safer to maintain, without forcing every plugin to understand the whole pipeline.
Framework coverage without lock-inStart with vanilla components and add only the integrations you need. The same manifest workflow works across Lit, FAST, Stencil, Preact, Vue, Solid, and Svelte.
Stable outputDeterministic sorting produces cleaner diffs and makes generated manifests easier to review in pull requests.
Modular installationCore, CLI, framework plugins, and bundler adapters are separate packages, so projects install only what they use.

Use CEM Analyzer when you want its established analyzer/plugin ecosystem, or Lit Analyzer when you need Lit-focused editor and template analysis. Choose cem-generator when you need a generated CEM that is type-aware, validated, and integrated with a broader component-library toolchain.