import { rewriteDefault } from './rewriteDefault'
import { createCache } from './cache'
import {
- shouldTransform,
- transformAST as transformWithRefSugar
+ shouldTransform as shouldTransformRef,
+ transformAST as transformRefAST
} from '@vue/ref-transform'
// Special compiler macros
*/
babelParserPlugins?: ParserPlugin[]
/**
- * Introduce a compiler-based syntax sugar for using refs without `.value`
+ * (Experimental) Enable syntax transform for using refs without `.value`
* https://github.com/vuejs/rfcs/discussions/369
* @default true
*/
+ refTransform?: boolean
+ /**
+ * @deprecated use `refTransform` instead.
+ */
refSugar?: boolean
/**
* Compile the template and inline the resulting render function
): SFCScriptBlock {
let { script, scriptSetup, source, filename } = sfc
// feature flags
- const enableRefSugar = !!options.refSugar
+ const enableRefTransform = !!options.refSugar || !!options.refTransform
let refBindings: string[] | undefined
// for backwards compat
}
// 3. Apply ref sugar transform
- if (enableRefSugar && shouldTransform(source)) {
+ if (enableRefTransform && shouldTransformRef(source)) {
warnExperimental(
`ref sugar`,
`https://github.com/vuejs/rfcs/discussions/369`
)
- const { rootVars, importedHelpers } = transformWithRefSugar(
+ const { rootVars, importedHelpers } = transformRefAST(
scriptSetupAst,
s,
startOffset
export { compileStyle, compileStyleAsync } from './compileStyle'
export { compileScript } from './compileScript'
export { rewriteDefault } from './rewriteDefault'
-export { generateCodeFrame, walkIdentifiers } from '@vue/compiler-core'
+export { generateCodeFrame } from '@vue/compiler-core'
export {
+ shouldTransform as shouldTransformRef,
transform as transformRef,
transformAST as transformRefAST
} from '@vue/ref-transform'