fix: concat sources so that 'code' has them all

This commit is contained in:
Oliver Eyton-Williams
2020-05-28 17:21:26 +02:00
committed by Mrugesh Mohapatra
parent dea30c1397
commit 4de5c5fde3

View File

@ -48,10 +48,19 @@ const composeFunctions = (...fns) =>
fns.map(applyFunction).reduce((f, g) => x => f(x).then(g));
function buildSourceMap(files) {
return files.reduce((sources, file) => {
sources[file.name] = file.source || file.contents;
return sources;
}, {});
// TODO: concatenating the source/contents is a quick hack for multi-file
// editing. It is used because all the files (js, html and css) end up with
// the same name 'index'. This made the last file the only file to appear in
// sources.
// A better solution is to store and handle them separately. Perhaps never
// setting the name to 'index'.
return files.reduce(
(sources, file) => {
sources[file.name] += file.source || file.contents;
return sources;
},
{ index: '' }
);
}
function checkFilesErrors(files) {