import MagicString from 'magic-string' import { BindingMetadata } from '@vue/compiler-core' import { SFCDescriptor, SFCScriptBlock } from './parse' import { parse as _parse, ParserOptions, ParserPlugin } from '@babel/parser' import { babelParserDefaultPlugins, generateCodeFrame } from '@vue/shared' import { Node, Declaration, ObjectPattern, ObjectExpression, ArrayPattern, Identifier, ExportSpecifier, Function as FunctionNode, TSType, TSTypeLiteral, TSFunctionType, TSDeclareFunction, ObjectProperty, ArrayExpression, Statement, Expression, LabeledStatement } from '@babel/types' import { walk } from 'estree-walker' import { RawSourceMap } from 'source-map' import { genCssVarsCode, injectCssVarsCalls } from './genCssVars' import { compileTemplate, SFCTemplateCompileOptions } from './compileTemplate' const CTX_FN_NAME = 'defineContext' export interface SFCScriptCompileOptions { /** * https://babeljs.io/docs/en/babel-parser#plugins */ babelParserPlugins?: ParserPlugin[] /** * Enable ref: label sugar * https://github.com/vuejs/rfcs/pull/228 * @default true */ refSugar?: boolean /** * Compile the template and inline the resulting render function * directly inside setup(). * - Only affects