feat(cli): support locales

This commit is contained in:
陈嘉涵
2019-12-06 15:51:20 +08:00
parent 6bd858fac5
commit dc6cc6c5af
16 changed files with 336 additions and 135 deletions
+10 -6
View File
@@ -67,12 +67,8 @@ type CompileSfcOptions = {
skipStyle?: boolean;
};
export async function compileSfc(
filePath: string,
options: CompileSfcOptions = {}
): Promise<any> {
export function parseSfc(filePath: string) {
const source = readFileSync(filePath, 'utf-8');
const jsFilePath = replaceExt(filePath, '.js');
const descriptor = compileUtils.parse({
source,
@@ -80,9 +76,17 @@ export async function compileSfc(
needMap: false
} as any);
const { template, styles } = descriptor;
return descriptor;
}
export async function compileSfc(
filePath: string,
options: CompileSfcOptions = {}
): Promise<any> {
const tasks = [remove(filePath)];
const jsFilePath = replaceExt(filePath, '.js');
const descriptor = parseSfc(filePath);
const { template, styles } = descriptor;
// compile js part
if (descriptor.script) {