rename for clarity

pull/4914/head
pushkine 5 years ago
parent 16da0c260c
commit 2545fe7fd3

@ -272,7 +272,7 @@ export function glob(str: string, { cwd = '.', absolute = false, filesOnly = fal
walk(matches, glob.base, path, filesOnly, dot, cwd, '.', 0); walk(matches, glob.base, path, filesOnly, dot, cwd, '.', 0);
return absolute ? matches.map((x) => resolve(cwd, x)) : matches; return absolute ? matches.map((x) => resolve(cwd, x)) : matches;
} }
export function replaceIfUpdated(config_getter, cwd) { export function replaceIfUpdated(run, cwd) {
const svelte = (function loadSvelte() { const svelte = (function loadSvelte() {
const resolved = require.resolve("../compiler.js"); const resolved = require.resolve("../compiler.js");
delete require.cache[resolved]; delete require.cache[resolved];
@ -287,8 +287,8 @@ export function replaceIfUpdated(config_getter, cwd) {
options options
); );
} }
function check_news(file, value) { function check(target, value) {
const path = `${cwd}/${dir.replace("input.svelte", file)}`; const path = `${cwd}/${dir.replace("input.svelte", target)}`;
try { try {
const previous = readFileSync(path, "utf-8"); const previous = readFileSync(path, "utf-8");
if (typeof value === "object") { if (typeof value === "object") {
@ -312,6 +312,6 @@ export function replaceIfUpdated(config_getter, cwd) {
return `${cwd}/${dir.replace("input.svelte", name)}`; return `${cwd}/${dir.replace("input.svelte", name)}`;
} }
config_getter(compile, check_news, get_relative); run(compile, check, get_relative);
}); });
} }
Loading…
Cancel
Save