Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Pass filePath to compiler.shouldCompileFile() instead of code #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/compiler-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ export default class CompilerHost {
}

let ctx = {};
let code = hashInfo.sourceCode || await pfs.readFile(filePath, 'utf8');

if (!(await compiler.shouldCompileFile(code, ctx))) {
if (!(await compiler.shouldCompileFile(filePath, ctx))) {
d(`Compiler returned false for shouldCompileFile: ${filePath}`);
return { code, mimeType: mimeTypes.lookup(filePath), dependentFiles: [] };
return { filePath, mimeType: mimeTypes.lookup(filePath), dependentFiles: [] };
}

let code = hashInfo.sourceCode || await pfs.readFile(filePath, 'utf8');
let dependentFiles = await compiler.determineDependentFiles(code, filePath, ctx);

d(`Using compiler options: ${JSON.stringify(compiler.compilerOptions)}`);
Expand Down Expand Up @@ -579,13 +579,13 @@ export default class CompilerHost {
}

let ctx = {};
let code = hashInfo.sourceCode || fs.readFileSync(filePath, 'utf8');

if (!(compiler.shouldCompileFileSync(code, ctx))) {
if (!(compiler.shouldCompileFileSync(filePath, ctx))) {
d(`Compiler returned false for shouldCompileFile: ${filePath}`);
return { code, mimeType: mimeTypes.lookup(filePath), dependentFiles: [] };
return { filePath, mimeType: mimeTypes.lookup(filePath), dependentFiles: [] };
}

let code = hashInfo.sourceCode || fs.readFileSync(filePath, 'utf8');
let dependentFiles = compiler.determineDependentFilesSync(code, filePath, ctx);

let result = compiler.compileSync(code, filePath, ctx);
Expand Down