aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/index.js14
-rw-r--r--src/to-javascript.js23
2 files changed, 13 insertions, 24 deletions
diff --git a/src/index.js b/src/index.js
index f90a218..eeabc4b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -250,13 +250,6 @@ module.exports = function purescriptLoader(source, map) {
250 cache.compilationFinished = true; 250 cache.compilationFinished = true;
251 }) 251 })
252 .then(() => 252 .then(() =>
253 PsModuleMap.makeMap(options.src).then(map => {
254 debug('rebuilt module map after unknown module forced a recompilation');
255
256 cache.psModuleMap = map;
257 })
258 )
259 .then(() =>
260 Promise.map(cache.deferred, psModule => 253 Promise.map(cache.deferred, psModule =>
261 ide.load(psModule) 254 ide.load(psModule)
262 .then(() => toJavaScript(psModule)) 255 .then(() => toJavaScript(psModule))
@@ -318,13 +311,6 @@ module.exports = function purescriptLoader(source, map) {
318 } 311 }
319 }) 312 })
320 .then(() => 313 .then(() =>
321 PsModuleMap.makeMap(options.src).then(map => {
322 debug('rebuilt module map after compilation');
323
324 cache.psModuleMap = map;
325 })
326 )
327 .then(() =>
328 Promise.map(cache.deferred, psModule => 314 Promise.map(cache.deferred, psModule =>
329 toJavaScript(psModule) 315 toJavaScript(psModule)
330 .then(js => sourceMaps(psModule, js)) 316 .then(js => sourceMaps(psModule, js))
diff --git a/src/to-javascript.js b/src/to-javascript.js
index b3e3051..3cc9698 100644
--- a/src/to-javascript.js
+++ b/src/to-javascript.js
@@ -26,21 +26,24 @@ function updatePsModuleMap(psModule) {
26 const filePurs = psModule.srcPath; 26 const filePurs = psModule.srcPath;
27 27
28 if (!cache.psModuleMap) { 28 if (!cache.psModuleMap) {
29 debug('module mapping does not exist'); 29 debugVerbose('module mapping does not exist - making a new module map');
30 30
31 return PsModuleMap.makeMap(options.src).then(map => { 31 cache.psModuleMap = PsModuleMap.makeMap(options.src);
32 cache.psModuleMap = map; 32
33 return cache.psModuleMap; 33 return cache.psModuleMap;
34 });
35 } 34 }
36 else { 35 else {
37 return PsModuleMap.makeMapEntry(filePurs).then(result => { 36 debugVerbose('module mapping exists - updating module map for %s', filePurs);
38 const map = Object.assign(cache.psModuleMap, result); 37
38 cache.psModuleMap = cache.psModuleMap.then(psModuleMap =>
39 PsModuleMap.makeMapEntry(filePurs).then(result => {
40 const map = Object.assign(psModuleMap, result);
39 41
40 cache.psModuleMap = map; 42 return map;
43 })
44 );
41 45
42 return cache.psModuleMap; 46 return cache.psModuleMap;
43 });
44 } 47 }
45} 48}
46 49