types(compiler-sfc): type annotation tweaks + move @babel/types to devDeps

This commit is contained in:
Evan You 2021-09-20 22:06:12 -04:00
parent 7915a593ea
commit a42a14d3bc
4 changed files with 11 additions and 6 deletions

View File

@ -33,7 +33,6 @@
"homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme", "homepage": "https://github.com/vuejs/vue-next/tree/master/packages/compiler-sfc#readme",
"dependencies": { "dependencies": {
"@babel/parser": "^7.15.0", "@babel/parser": "^7.15.0",
"@babel/types": "^7.15.0",
"@types/estree": "^0.0.48", "@types/estree": "^0.0.48",
"@vue/compiler-core": "3.2.12", "@vue/compiler-core": "3.2.12",
"@vue/compiler-dom": "3.2.12", "@vue/compiler-dom": "3.2.12",
@ -52,6 +51,7 @@
"source-map": "^0.6.1" "source-map": "^0.6.1"
}, },
"devDependencies": { "devDependencies": {
"@babel/types": "^7.15.0",
"@types/consolidate": "^0.14.0", "@types/consolidate": "^0.14.0",
"@types/lru-cache": "^5.1.0", "@types/lru-cache": "^5.1.0",
"pug": "^3.0.1", "pug": "^3.0.1",

View File

@ -98,7 +98,7 @@ export interface SFCScriptCompileOptions {
/** /**
* Compile the template and inline the resulting render function * Compile the template and inline the resulting render function
* directly inside setup(). * directly inside setup().
* - Only affects <script setup> * - Only affects `<script setup>`
* - This should only be used in production because it prevents the template * - This should only be used in production because it prevents the template
* from being hot-reloaded separately from component state. * from being hot-reloaded separately from component state.
*/ */

View File

@ -30,7 +30,7 @@ export interface SFCStyleCompileOptions {
postcssOptions?: any postcssOptions?: any
postcssPlugins?: any[] postcssPlugins?: any[]
/** /**
* @deprecated * @deprecated use `inMap` instead.
*/ */
map?: RawSourceMap map?: RawSourceMap
} }

View File

@ -9,7 +9,6 @@ import {
import * as CompilerDOM from '@vue/compiler-dom' import * as CompilerDOM from '@vue/compiler-dom'
import { RawSourceMap, SourceMapGenerator } from 'source-map' import { RawSourceMap, SourceMapGenerator } from 'source-map'
import { TemplateCompiler } from './compileTemplate' import { TemplateCompiler } from './compileTemplate'
import { Statement } from '@babel/types'
import { parseCssVars } from './cssVars' import { parseCssVars } from './cssVars'
import { createCache } from './cache' import { createCache } from './cache'
@ -41,8 +40,14 @@ export interface SFCScriptBlock extends SFCBlock {
type: 'script' type: 'script'
setup?: string | boolean setup?: string | boolean
bindings?: BindingMetadata bindings?: BindingMetadata
scriptAst?: Statement[] /**
scriptSetupAst?: Statement[] * import('\@babel/types').Statement
*/
scriptAst?: any[]
/**
* import('\@babel/types').Statement
*/
scriptSetupAst?: any[]
} }
export interface SFCStyleBlock extends SFCBlock { export interface SFCStyleBlock extends SFCBlock {
type: 'style' type: 'style'