mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-02 03:57:36 +08:00
wip: expose compileScript
This commit is contained in:
parent
53a5ac9638
commit
2bb3659c05
@ -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
|
||||
|
@ -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'
|
||||
|
@ -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<SFCScriptCompileOptions>,
|
||||
options?: Partial<ScriptCompileOptions>,
|
||||
parseOptions?: Partial<ParseOptions>
|
||||
) {
|
||||
const sfc = parse({
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user