@vue-jsx-vapor/macros
Version: 
Macros for Vue JSX Vapor
46 lines (45 loc) • 1.69 kB
TypeScript
import { OptionsResolved } from "./options-K4yleEdU.js";
import { CodeTransform, MagicStringAST } from "@vue-macros/common";
import { ArrowFunctionExpression, CallExpression, FunctionDeclaration, FunctionExpression, LVal, Node, VoidPattern } from "@babel/types";
//#region src/core/utils.d.ts
type FunctionalNode = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
declare function isFunctionalNode(node?: Node | null): node is FunctionalNode;
//#endregion
//#region src/core/restructure.d.ts
type Options = {
  withDefaultsFrom?: string;
  skipDefaultProps?: boolean;
  generateRestProps?: (restPropsName: string, index: number, list: Prop[]) => string | undefined;
};
type Prop = {
  path: string;
  name: string;
  value: string;
  defaultValue?: string;
  isRest?: boolean;
};
declare function restructure(s: MagicStringAST, node: FunctionalNode, options?: Options): Prop[];
//#endregion
//#region src/core/index.d.ts
type DefineStyle = {
  expression: CallExpression;
  isCssModules: boolean;
  lang: string;
};
type Macros = {
  defineComponent?: CallExpression;
  defineModel?: {
    expression: CallExpression;
    isRequired: boolean;
  }[];
  defineSlots?: {
    expression: CallExpression;
    id?: VoidPattern | LVal;
  };
  defineExpose?: CallExpression;
  defineStyle?: DefineStyle[];
};
declare function transformJsxMacros(code: string, id: string, importMap: Map<string, string>, options: OptionsResolved): CodeTransform | undefined;
declare function getMacroExpression(node: Node, options: OptionsResolved): CallExpression | undefined;
//#endregion
export { DefineStyle, Macros, getMacroExpression, isFunctionalNode, restructure, transformJsxMacros };