diff --git a/packages/compiler-sfc/src/compileScript.ts b/packages/compiler-sfc/src/compileScript.ts index 48907773..e2589dc5 100644 --- a/packages/compiler-sfc/src/compileScript.ts +++ b/packages/compiler-sfc/src/compileScript.ts @@ -57,7 +57,7 @@ const isBuiltInDir = makeMap( `once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is` ) -export interface SFCScriptCompileOptions { +export interface ScriptCompileOptions { /** * Production mode. Used to determine whether to generate hashed CSS variables */ @@ -87,7 +87,7 @@ export interface ImportBinding { */ export function compileScript( sfc: SFCDescriptor, - options: SFCScriptCompileOptions = {} + options: ScriptCompileOptions = {} ): SFCScriptBlock { let { filename, script, scriptSetup, source } = sfc const isProd = !!options.isProd diff --git a/packages/compiler-sfc/src/index.ts b/packages/compiler-sfc/src/index.ts index b8dee976..d1348430 100644 --- a/packages/compiler-sfc/src/index.ts +++ b/packages/compiler-sfc/src/index.ts @@ -2,6 +2,7 @@ export { parse } from './parse' export { compileTemplate } from './compileTemplate' export { compileStyle, compileStyleAsync } from './compileStyle' +export { compileScript } from './compileScript' // types export { SFCBlock, SFCCustomBlock, SFCDescriptor } from './parseComponent' @@ -10,3 +11,4 @@ export { TemplateCompileResult } from './compileTemplate' export { StyleCompileOptions, StyleCompileResults } from './compileStyle' +export { ScriptCompileOptions } from './compileScript' diff --git a/packages/compiler-sfc/test/compileScript.spec.ts b/packages/compiler-sfc/test/compileScript.spec.ts index 54afae2e..8365756d 100644 --- a/packages/compiler-sfc/test/compileScript.spec.ts +++ b/packages/compiler-sfc/test/compileScript.spec.ts @@ -1,11 +1,11 @@ import { BindingTypes } from '../src/types' import { parse, ParseOptions } from '../src/parse' import { parse as babelParse } from '@babel/parser' -import { compileScript, SFCScriptCompileOptions } from '../src/compileScript' +import { compileScript, ScriptCompileOptions } from '../src/compileScript' function compile( source: string, - options?: Partial, + options?: Partial, parseOptions?: Partial ) { const sfc = parse({ diff --git a/src/v3/apiSetup.ts b/src/v3/apiSetup.ts index 619987fd..29ef7e48 100644 --- a/src/v3/apiSetup.ts +++ b/src/v3/apiSetup.ts @@ -83,7 +83,10 @@ function createSetupContext(vm: Component) { get slots() { return initSlotsProxy(vm) }, - emit: bind(vm.$emit, vm) as any + emit: bind(vm.$emit, vm) as any, + expose() { + // TODO + } } }