How to use the @vue/compiler-core.transform function in @vue/compiler-core

To help you get started, we’ve selected a few @vue/compiler-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vOn.spec.ts View on Github external
function parseWithVOn(template: string, options: CompilerOptions = {}) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformExpression, transformElement],
    directiveTransforms: {
      on: transformOn
    },
    ...options
  })
  return {
    root: ast,
    props: (((ast.children[0] as ElementNode).codegenNode as CallExpression)
      .arguments[1] as ObjectExpression).properties
  }
}
github vuejs / vue-next / packages / compiler-sfc / __tests__ / templateTransformSrcset.spec.ts View on Github external
function compileWithSrcset(template: string) {
  const ast = baseParse(template)
  transform(ast, {
    nodeTransforms: [transformSrcset, transformElement],
    directiveTransforms: {
      bind: transformBind
    }
  })
  return generate(ast, { mode: 'module' })
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vShow.spec.ts View on Github external
function transformWithShow(template: string, options: CompilerOptions = {}) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformElement],
    directiveTransforms: {
      show: transformShow
    },
    ...options
  })
  return ast
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / transformStyle.spec.ts View on Github external
function transformWithStyleTransform(
  template: string,
  options: CompilerOptions = {}
) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformStyle],
    ...options
  })
  return {
    root: ast,
    node: ast.children[0] as ElementNode
  }
}
github vuejs / vue-next / packages / compiler-sfc / __tests__ / templateTransformAssetUrl.spec.ts View on Github external
function compileWithAssetUrls(template: string) {
  const ast = baseParse(template)
  transform(ast, {
    nodeTransforms: [transformAssetUrl, transformElement],
    directiveTransforms: {
      bind: transformBind
    }
  })
  return generate(ast, { mode: 'module' })
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vText.spec.ts View on Github external
function transformWithVText(template: string, options: CompilerOptions = {}) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformElement],
    directiveTransforms: {
      text: transformVText
    },
    ...options
  })
  return ast
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vHtml.spec.ts View on Github external
function transformWithVHtml(template: string, options: CompilerOptions = {}) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformElement],
    directiveTransforms: {
      html: transformVHtml
    },
    ...options
  })
  return ast
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vModel.spec.ts View on Github external
function transformWithModel(template: string, options: CompilerOptions = {}) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformElement],
    directiveTransforms: {
      model: transformModel
    },
    ...options
  })
  return ast
}
github vuejs / vue-next / packages / compiler-dom / __tests__ / transforms / vCloak.spec.ts View on Github external
function transformWithCloak(template: string) {
  const ast = parse(template)
  transform(ast, {
    nodeTransforms: [transformElement],
    directiveTransforms: {
      cloak: transformCloak
    }
  })
  return ast.children[0] as ElementNode
}