From 55e234816ee31891b755d4a28ceb5aca6f396eb6 Mon Sep 17 00:00:00 2001 From: Pocho <13343460801@163.com> Date: Tue, 10 Dec 2019 03:19:39 +0800 Subject: [PATCH] types(compiler-sfc): use specific preprocessLang instead of string (#528) --- packages/compiler-sfc/src/compileStyle.ts | 5 +++-- packages/compiler-sfc/src/stylePreprocessors.ts | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/compiler-sfc/src/compileStyle.ts b/packages/compiler-sfc/src/compileStyle.ts index b61c46f36b..25b8d419c0 100644 --- a/packages/compiler-sfc/src/compileStyle.ts +++ b/packages/compiler-sfc/src/compileStyle.ts @@ -5,7 +5,8 @@ import scopedPlugin from './stylePluginScoped' import { processors, StylePreprocessor, - StylePreprocessorResults + StylePreprocessorResults, + PreprocessLang } from './stylePreprocessors' export interface StyleCompileOptions { @@ -15,7 +16,7 @@ export interface StyleCompileOptions { map?: object scoped?: boolean trim?: boolean - preprocessLang?: string + preprocessLang?: PreprocessLang preprocessOptions?: any postcssOptions?: any postcssPlugins?: any[] diff --git a/packages/compiler-sfc/src/stylePreprocessors.ts b/packages/compiler-sfc/src/stylePreprocessors.ts index e391c6b7dc..2c7b370282 100644 --- a/packages/compiler-sfc/src/stylePreprocessors.ts +++ b/packages/compiler-sfc/src/stylePreprocessors.ts @@ -104,7 +104,9 @@ const styl: StylePreprocessor = { } } -export const processors: Record = { +export type PreprocessLang = 'less' | 'sass' | 'scss' | 'styl' | 'stylus' + +export const processors: Record = { less, sass, scss, -- 2.47.3