Skip to content

Home > vue-metamorph

vue-metamorph package

Functions

Function

Description

createVueMetamorphCli(options)

Creates a CLI runner that globs files and runs codemod/manual-migration plugins against them.

Parses process.argv for --files <glob>, --plugins <glob...>, and --list-plugins options. Returns an object with run(), abort(), and opts() methods.

findManualMigrations(code, filename, plugins, opts)

Runs manual migration plugins against source code and returns reports identifying nodes that require human attention. Does not modify the code.

transform(code, filename, plugins, opts)

Parses source code into ASTs, runs codemod plugins against them, and returns the transformed source code. This is the core function of vue-metamorph.

The filename determines how code is parsed: - .vue — Parsed as a Vue SFC (template + scripts + styles) - .js, .jsx, .ts, .tsx — Parsed as JavaScript/TypeScript - .css, .scss, .sass, .less, .styl — Parsed as CSS

Interfaces

Interface

Description

CreateVueMetamorphCliOptions

vue-metamorph CLI Options

Namespaces

Namespace

Description

AST

astHelpers

Variables

Variable

Description

builders

Combined AST node builders for both script (ESTree/Babel) and template (Vue SFC) nodes.

Script builders create JavaScript/TypeScript AST nodes (e.g. builders.identifier(), builders.callExpression()). Template builders create Vue template AST nodes (e.g. builders.vElement(), builders.vDirective()).

Type Aliases

Type Alias

Description

Builders

CodemodPlugin

A plugin that updates source code

CodemodPluginContext

ErrorReport

An error that was encountered during parsing or plugin execution

ManualMigrationPlugin

A plugin for finding nodes that cannot be migrated automatically

ManualMigrationPluginContext

ManualMigrationReport

An object containing a manual migration that a ManualMigrationPlugin reported

Plugin

Union of plugin types

ProgressCallback

Function signature for the onProgress function passed to createVueMetamorphCli

TransformResult

Return type of the transform function, containing new source code and codemod stats

VueProgram

ESTree Program type, with an additional property isScriptSetup that denotes whether the program represents the contents of a <script setup> block in a Vue SFC