UNPKG

vue-jsx-vapor

Version:
27 lines (25 loc) 733 B
import { transformSync } from "@babel/core"; import babelTypescript from "@babel/plugin-transform-typescript"; import jsx from "@vue-jsx-vapor/babel"; //#region src/core/index.ts function transformVueJsxVapor(code, id, options, needSourceMap = false) { const params = new URLSearchParams(id); const vapor = params.get("vapor"); return transformSync(code, { plugins: [[jsx, { compile: options?.compile, interop: vapor ? false : options?.interop }], ...id.endsWith(".tsx") ? [[babelTypescript, { isTSX: true, allowExtensions: true }]] : []], filename: id, sourceMaps: needSourceMap, sourceFileName: id, babelrc: false, configFile: false, ast: true }); } //#endregion export { transformVueJsxVapor };