aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/to-javascript.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/to-javascript.js')
-rw-r--r--src/to-javascript.js23
1 files changed, 13 insertions, 10 deletions
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