Skip to content

Commit 457fe6d

Browse files
committed
types: align compiler-sfc type exports with v3
1 parent b3432ff commit 457fe6d

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

Diff for: packages/compiler-sfc/src/compileScript.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const isBuiltInDir = makeMap(
5757
`once,memo,if,for,else,else-if,slot,text,html,on,bind,model,show,cloak,is`
5858
)
5959

60-
export interface ScriptCompileOptions {
60+
export interface SFCScriptCompileOptions {
6161
/**
6262
* Production mode. Used to determine whether to generate hashed CSS variables
6363
*/
@@ -87,7 +87,7 @@ export interface ImportBinding {
8787
*/
8888
export function compileScript(
8989
sfc: SFCDescriptor,
90-
options: ScriptCompileOptions = {}
90+
options: SFCScriptCompileOptions = {}
9191
): SFCScriptBlock {
9292
let { filename, script, scriptSetup, source } = sfc
9393
const isProd = !!options.isProd

Diff for: packages/compiler-sfc/src/compileStyle.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
StylePreprocessorResults
99
} from './stylePreprocessors'
1010

11-
export interface StyleCompileOptions {
11+
export interface SFCStyleCompileOptions {
1212
source: string
1313
filename: string
1414
id: string
@@ -21,32 +21,32 @@ export interface StyleCompileOptions {
2121
postcssPlugins?: any[]
2222
}
2323

24-
export interface AsyncStyleCompileOptions extends StyleCompileOptions {
24+
export interface SFCAsyncStyleCompileOptions extends SFCStyleCompileOptions {
2525
isAsync?: boolean
2626
}
2727

28-
export interface StyleCompileResults {
28+
export interface SFCStyleCompileResults {
2929
code: string
3030
map: any | void
3131
rawResult: LazyResult | void
3232
errors: string[]
3333
}
3434

3535
export function compileStyle(
36-
options: StyleCompileOptions
37-
): StyleCompileResults {
36+
options: SFCStyleCompileOptions
37+
): SFCStyleCompileResults {
3838
return doCompileStyle({ ...options, isAsync: false })
3939
}
4040

4141
export function compileStyleAsync(
42-
options: StyleCompileOptions
43-
): Promise<StyleCompileResults> {
42+
options: SFCStyleCompileOptions
43+
): Promise<SFCStyleCompileResults> {
4444
return Promise.resolve(doCompileStyle({ ...options, isAsync: true }))
4545
}
4646

4747
export function doCompileStyle(
48-
options: AsyncStyleCompileOptions
49-
): StyleCompileResults {
48+
options: SFCAsyncStyleCompileOptions
49+
): SFCStyleCompileResults {
5050
const {
5151
filename,
5252
id,
@@ -94,15 +94,15 @@ export function doCompileStyle(
9494
if (options.isAsync) {
9595
return result
9696
.then(
97-
(result: LazyResult): StyleCompileResults => ({
97+
(result: LazyResult): SFCStyleCompileResults => ({
9898
code: result.css || '',
9999
map: result.map && result.map.toJSON(),
100100
errors,
101101
rawResult: result
102102
})
103103
)
104104
.catch(
105-
(error: Error): StyleCompileResults => ({
105+
(error: Error): SFCStyleCompileResults => ({
106106
code: '',
107107
map: undefined,
108108
errors: [...errors, error.message],
@@ -127,7 +127,7 @@ export function doCompileStyle(
127127
}
128128

129129
function preprocess(
130-
options: StyleCompileOptions,
130+
options: SFCStyleCompileOptions,
131131
preprocessor: StylePreprocessor
132132
): StylePreprocessorResults {
133133
return preprocessor(

Diff for: packages/compiler-sfc/src/compileTemplate.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as _compiler from 'web/entry-compiler'
1313
import { prefixIdentifiers } from './prefixIdentifiers'
1414
import { WarningMessage } from 'types/compiler'
1515

16-
export interface TemplateCompileOptions {
16+
export interface SFCTemplateCompileOptions {
1717
source: string
1818
filename: string
1919
compiler?: VueTemplateCompiler
@@ -31,7 +31,7 @@ export interface TemplateCompileOptions {
3131
bindings?: BindingMetadata
3232
}
3333

34-
export interface TemplateCompileResult {
34+
export interface SFCTemplateCompileResult {
3535
ast: Object | undefined
3636
code: string
3737
source: string
@@ -40,8 +40,8 @@ export interface TemplateCompileResult {
4040
}
4141

4242
export function compileTemplate(
43-
options: TemplateCompileOptions
44-
): TemplateCompileResult {
43+
options: SFCTemplateCompileOptions
44+
): SFCTemplateCompileResult {
4545
const { preprocessLang } = options
4646
const preprocessor = preprocessLang && consolidate[preprocessLang]
4747
if (preprocessor) {
@@ -68,7 +68,7 @@ export function compileTemplate(
6868
}
6969

7070
function preprocess(
71-
options: TemplateCompileOptions,
71+
options: SFCTemplateCompileOptions,
7272
preprocessor: any
7373
): string {
7474
const { source, filename, preprocessOptions } = options
@@ -99,8 +99,8 @@ function preprocess(
9999
}
100100

101101
function actuallyCompile(
102-
options: TemplateCompileOptions
103-
): TemplateCompileResult {
102+
options: SFCTemplateCompileOptions
103+
): SFCTemplateCompileResult {
104104
const {
105105
source,
106106
compiler = _compiler,

Diff for: packages/compiler-sfc/src/index.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export { generateCodeFrame } from 'compiler/codeframe'
88
// types
99
export { SFCBlock, SFCCustomBlock, SFCDescriptor } from './parseComponent'
1010
export {
11-
TemplateCompileOptions,
12-
TemplateCompileResult
11+
SFCTemplateCompileOptions,
12+
SFCTemplateCompileResult
1313
} from './compileTemplate'
14-
export { StyleCompileOptions, StyleCompileResults } from './compileStyle'
15-
export { ScriptCompileOptions } from './compileScript'
14+
export { SFCStyleCompileOptions, SFCStyleCompileResults } from './compileStyle'
15+
export { SFCScriptCompileOptions } from './compileScript'

0 commit comments

Comments
 (0)