@gluonjs/vue-migration-analyzer
@gluonjs/vue-migration-analyzer / packages/vue-migration-analyzer/src / VueMigrationReport
Interface: VueMigrationReport
Properties
analyzer
readonlyanalyzer:Readonly<{name:"@gluonjs/vue-migration-analyzer";version:string; }>
components
readonlycomponents: readonlyComponentInventory[]
files
readonlyfiles: readonlyAnalyzedFile[]
findings
readonlyfindings: readonlyMigrationFinding[]
input
readonlyinput:Readonly<{bytesRead:number;entriesVisited:number;filesAnalyzed:number;filesVisited:number;limits: typeofANALYZER_LIMITS;packageManager:Readonly<{kind:"npm"|"yarn"|"pnpm"|"other"|"none";lockfile:string|null; }>;vue:Readonly<{declaredRange:string|null;resolvedVersion:string|null;versionSource:"exact-manifest"|"package-lock-v2"|"package-lock-v3"|"unresolved"; }>; }>
inventory
readonlyinventory: readonlyInventoryItem[]
root
readonlyroot:"."
schemaVersion
readonlyschemaVersion:"1.0.0"
summary
readonlysummary:Readonly<{components:number;confidences:Readonly<Record<Confidence,number>>;fileKinds:Readonly<Record<FileKind,number>>;files:number;inventory:Readonly<Record<InventoryCategory,number>>;severities:Readonly<Record<Severity,number>>;stages:Readonly<Record<MigrationStage,number>>;supportState:SupportState; }>
Example
Consume the versioned, deterministic analysis contract containing inputs, files, components, inventory, findings, and aggregate support summary:
import {
ANALYZER_LIMITS,
VueMigrationAnalyzerError,
analyzeVueMigration,
formatVueMigrationReport,
type AnalyzedFile,
type AnalyzerOptions,
type BlockKind,
type ComponentInventory,
type Confidence,
type FileKind,
type InventoryCategory,
type InventoryItem,
type InventoryKind,
type MigrationFinding,
type MigrationStage,
type ParseStatus,
type ScriptMode,
type Severity,
type SfcBlock,
type SourceLocation,
type SourcePoint,
type SupportState,
type VueMigrationReport,
} from '@gluonjs/vue-migration-analyzer';
const options = { root: '.' } satisfies AnalyzerOptions;
try {
const report: VueMigrationReport = await analyzeVueMigration(options);
const file: AnalyzedFile | undefined = report.files[0];
const component: ComponentInventory | undefined = report.components[0];
const block: SfcBlock | undefined = component?.blocks[0];
const item: InventoryItem | undefined = report.inventory[0];
const finding: MigrationFinding | undefined = report.findings[0];
const location: SourceLocation | null | undefined = finding?.location;
const point: SourcePoint | undefined = location?.start;
const severity: Severity = finding?.severity ?? 'info';
const confidence: Confidence = finding?.confidence ?? 'indeterminate';
const stage: MigrationStage = finding?.migrationStage ?? 'baseline';
const support: SupportState = report.summary.supportState;
const fileKind: FileKind = file?.kind ?? 'other';
const status: ParseStatus = file?.parseStatus ?? 'skipped';
const scriptMode: ScriptMode = component?.scriptMode ?? 'none';
const blockKind: BlockKind = block?.kind ?? 'custom';
const category: InventoryCategory = item?.category ?? 'remaining-vue';
const inventoryKind: InventoryKind = item?.kind ?? 'vue-dependency';
console.log(formatVueMigrationReport(report, 'human'));
console.log(ANALYZER_LIMITS.analyzedFiles, point, severity, confidence, stage, support, fileKind, status, scriptMode, blockKind, category, inventoryKind);
} catch (error) {
if (error instanceof VueMigrationAnalyzerError) console.error(error.exitCode, error.message);
else throw error;
}