Skip to content

Home > vue-metamorph > astHelpers

astHelpers namespace

Functions

Function

Description

createDefaultImport(ast, moduleSpecifier, importName)

Inserts a default import at the top of a script, or inserts a default import on an existing import declaration for the moduleSpecifier

createNamedImport(ast, moduleSpecifier, importName, localName)

Inserts a named import at the top of a script, or inserts a named import on an existing import declaration for the moduleSpecifier

createNamespaceImport(ast, moduleSpecifier, namespaceName)

Inserts a namespaced import at the top of a script

findAll(ast, matcher)

Finds all nodes in an AST that match a partial node

findFirst(ast, matcher)

Finds the first node in an AST that matches a partial node

findImportDeclaration(ast, moduleSpecifier)

Finds an existing import declaration for a module

findVueComponentOptions(ast, isSfc)

Finds the Options API objects passed to Vue.extend(), Vue.component(), Vue.mixin(), defineComponent(), or new Vue()