Skip to content

Latest commit

 

History

History

compiler-tsx

Compiler TSX

A custom compiler to convert .vue to a TSX representation for type checking and IDE support.

Usage

npm add @vuedx/compiler-tsx

API

More info

Signature:

export declare function compile(
  source: string,
  options: CompileOptions,
): Omit<CompileOutput, 'map'> & {
  map: RawSourceMap
}
Parameter Type Description
source string -
options CompileOptions -

More info

Signature:

export declare function compileWithDecodedSourceMap(
  source: string,
  options: CompileOptions,
): CompileOutput
Parameter Type Description
source string -
options CompileOptions -

Types

export interface CompileOptions extends TransformOptions {}

export interface CompileOutput extends TransformedCode {
  descriptor: SFCDescriptor
  errors: Array<CompilerError | SyntaxError>
  template?: RootNode
}

export interface CustomAttributeNode extends AttributeNode {
  nameLoc: SourceLocation
}

export interface CustomBaseElementNode extends BaseElementNode {
  endTagLoc?: SourceLocation
  hoists?: CompoundExpressionNode[]
  startTagLoc: SourceLocation
  tagLoc: SourceLocation
}

export interface CustomNode extends Node {
  scope: Scope
}

Support

This package is part of VueDX project, maintained by Rahul Kadyan. You can 💖 sponsor him for continued development of this package and other VueDX tools.