properly coerce input code to string - fixes #1432

This commit is contained in:
Sebastian McKenzie 2015-05-04 15:08:18 +01:00
parent 9e0cf84505
commit e6326332b6
2 changed files with 3 additions and 1 deletions

View File

@ -53,7 +53,7 @@ export function transformFile(filename: string, opts?: Object, callback: Functio
export function transformFileSync(filename: string, opts?: Object = {}) { export function transformFileSync(filename: string, opts?: Object = {}) {
opts.filename = filename; opts.filename = filename;
return transform(fs.readFileSync(filename), opts); return transform(fs.readFileSync(filename, "utf8"), opts);
} }
export function parse(code, opts = {}) { export function parse(code, opts = {}) {

View File

@ -480,6 +480,8 @@ export default class File {
} }
wrap(code, callback) { wrap(code, callback) {
code = code + "";
try { try {
if (this.shouldIgnore()) { if (this.shouldIgnore()) {
return { return {