Fix filename escaping issues

This commit is contained in:
mrkishi
2018-09-21 15:33:22 -03:00
parent f29e7efbd6
commit 0bd1b0b8e2
3 changed files with 20 additions and 14 deletions

View File

@@ -14,6 +14,11 @@ export function posixify(file: string) {
return file.replace(/[/\\]/g, '/');
}
export function stringify(string: string, includeQuotes: boolean = true) {
const quoted = JSON.stringify(string);
return includeQuotes ? quoted : quoted.slice(1, -1);
}
export function fudge_mtime(file: string) {
// need to fudge the mtime so that webpack doesn't go doolally
const { atime, mtime } = fs.statSync(file);