@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 { openMetaProject } from "@verter/component-meta";
const project = await openMetaProject({
root: ".",
tsconfig: "./tsconfig.json",
});
try {
const meta = await project.getComponentMeta("./src/MyButton.vue");
console.log(meta.props);
console.log(meta.events);
console.log(meta.slots);
console.log(meta._verter?.styles);
} finally {
project.close();
}Root exports
openMetaProject(config)MetaProjectevictMetaProject(config)shutdownMetaRuntime()
MetaProject
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.dispose();
}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