@verter/component-meta
@verter/component-meta exposes native-backed Vue component metadata. It does not support the removed JS extractor pipeline.
Supported public surfaces:
@verter/component-meta: pooled project/session API@verter/component-meta/compat:vue-component-meta-compatible checker API@verter/component-meta/browser: browser-safe entrypoint for shared types and Type IR helpers
Install
npm install @verter/component-meta
# or
pnpm add @verter/component-meta@verter/native is required for Node.js usage. @verter/wasm is optional for browser-only consumers.
Project API
Use the root package for first-class metadata access.
import { openComponentMetaSession } from "@verter/component-meta";
const session = await openComponentMetaSession({
root: ".",
tsconfig: "./tsconfig.json",
});
try {
const meta = await session.getComponentMeta("./src/MyButton.vue");
console.log(meta.props);
console.log(meta.events);
console.log(meta.slots);
console.log(meta._verter?.styles);
} finally {
session.close();
}Project configuration
A session opened with tsconfig is a configured TypeScript project: the native workspace loader reads the tsconfig itself (its extends chain, compiler options including paths/baseUrl, and its files / include / exclude membership, enumerating include matches from disk). The membership is the program's root files in their authored order, which decides the order of declarations merged across files (global interfaces and namespaces, declare global, module augmentations); files those roots import or reference join the program just ahead of the root that pulls them in. The tsconfig's paths also govern imported and referenced dependencies outside files / include. An unreachable component outside that closure still publishes, but resolves only relative and package imports. The pooled engine identity fingerprints the tsconfig and its extends chain, including package configuration resolution. JSONC comments, URLs, alias globs and trailing commas are supported. Changes to root order or inherited configuration select a fresh engine for both project sessions and compat checkers.
A session opened with an inline config object has no tsconfig file and is an unconfigured project: it applies the object's paths/baseUrl to every file under root (match-all), and its include only filters discovery. Use a tsconfig file when the program's file order matters.
Root exports
openComponentMetaSession(config)ComponentMetaSessionevictComponentMetaSession(config)shutdownMetaRuntime()
ComponentMetaSession
getComponentMeta(filePath)getExportNames(filePath)updateFile(filePath, source)deleteFile(filePath)reload()clearCaches()close()
getComponentMeta() returns Volar-shaped top-level metadata and attaches the full Verter-native metadata object on _verter.
Compat API
Use the compat entrypoint only when you need vue-component-meta API compatibility.
import { createChecker } from "@verter/component-meta/compat";
const checker = await createChecker("./tsconfig.json");
try {
const meta = await checker.getComponentMeta("./src/MyButton.vue");
console.log(meta.props);
console.log(meta._verter?.components);
} finally {
checker.close();
}Compat exports
createChecker(tsconfigPath, options?)createCheckerByJson(root, config, options?)ComponentMetaCheckertypeDescriptorToSchema(type, options?, registry?)typeDescriptorToString(type)
The compat path is the only compatibility surface this package supports.
Compat schema notes:
schema: truekeeps the default consumer-facing behavior.schema: { literalBooleanSchema: true }enables parity-focusedtrue | falseenum schema expansion without changing native types or compat display strings.
Native Vs Compat Contract
The official Verter metadata payload is the semantic source of truth. The compat checker is a projection for vue-component-meta interoperability, not a separate semantic engine.
- Native
_vertermetadata may include more information than Volar, includingmodels,publicInstance,acceptedProps,acceptedEvents,acceptedSurfaceCompleteness,rootReachability, andfallthroughSurface. - Native type descriptors preserve TypeScript meaning. For example, native
booleanstaysboolean; Volar-specific display or schema normalization should not rewrite the native payload. - Benchmark comparisons against
vue-component-metashould compare equivalent surfaces only. Native-only_verterfields are additional Verter metadata, not parity regressions by themselves. - Current parity totals explicitly exclude native-only
modelsbecausevue-component-metadoes not expose an equivalent surface.
Root And Attrs Metadata
Verter's native metadata already models root fallthrough and root-bound attrs/listeners beyond what vue-component-meta exposes.
acceptedPropsincludes both declared props and inherited root attrs. Usekind: "declaredProp" | "attr"to tell them apart.acceptedEventsincludes both declared emits and inherited root listeners. Usekind: "declaredEmit" | "listener"to tell them apart.rootReachabilitytells you whether the template has no fallthrough surface, a single root, or conditional root branches.rootReachability.branches[].targetandfallthroughSurface.branches[].rootChaindescribe the root target type: native element, component root, or unresolved root.rootReachability.branches[].consumed.attrs/.listenersrecord which names are consumed on the root and therefore should not fall through.- Native/public API generation already uses this root information to type
$attrsfor native roots.
Current limitation:
- The public component-meta API does not yet expose arbitrary SFC
<template ...>block attributes as first-class metadata. The host currently tracks templatelang/srcfor parsing and invalidation, but not a full exported template-block attribute record.
Returned Metadata
Both metadata surfaces return Volar-shaped top-level fields:
propseventsslotsexposed
Compat exposed keeps the analysis defineExpose / Options API expose semantics. The native ref-accessible runtime surface is exposed separately on _verter.publicInstance.
The _verter extension carries the full native metadata payload:
propseventsslotsmodelsexposedpublicInstancetypeRegistryacceptedPropsacceptedEventsacceptedSurfaceCompletenessrootInforootReachabilityfallthroughSurfacecomponentstemplateRefsimportsbindingsvueApiCallsstylesflags
components preserves call-site detail from template analysis, including prop expressions, referenced bindings, spread markers, and structured vModelEntries alongside the existing summary fields.
typeRegistry preserves both the expanded native type descriptor and the resolved declaration provenance when available, including the pre-expansion rawType text and declaration.canonicalSource.
rootInfo is the coarse root summary for consumers that do not want to reconstruct it from the full branch graph. It reports kind: "none" | "single" | "conditional" | "multiple" and includes direct root targets when those targets are known.
Type IR And Adapters
The package also exports:
TypeDescriptortypes and constructors from./type-ir- adapter transforms for Storybook, Histoire, Zod, and JSON Schema
These operate on native metadata results. They do not add a second parsing or type-evaluation pipeline.
Browser Entry
@verter/component-meta/browser exposes shared types and Type IR helpers without the Node.js runtime/session API.
Removed Public Surfaces
The following legacy public APIs are removed and unsupported:
extractComponentMetasnapshotToMetaparseTyperuntimeTypeToDescriptorcreateAdaptercreateNapiAdaptercreateWasmAdapterwrapNapiHostwrapWasmHost