import MagicString from 'magic-string' import { BindingMetadata, BindingTypes, UNREF } 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, ObjectProperty, ArrayExpression, Statement, Expression, LabeledStatement, TSUnionType, CallExpression } from '@babel/types' import { walk } from 'estree-walker' import { RawSourceMap } from 'source-map' import { CSS_VARS_HELPER, genCssVarsCode, injectCssVarsCalls } from './cssVars' import { compileTemplate, SFCTemplateCompileOptions } from './compileTemplate' import { warnOnce } from './warn' const DEFINE_OPTIONS = 'defineOptions' export interface SFCScriptCompileOptions { /** * Scope ID for prefixing injected CSS varialbes. * This must be consistent with the `id` passed to `compileStyle`. */ id: string /** * Production mode. Used to determine whether to generate hashed CSS variables */ isProd?: boolean /** * 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