aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.js')
-rw-r--r--src/index.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js
index 4c5abd2..f90a218 100644
--- a/src/index.js
+++ b/src/index.js
@@ -22,6 +22,8 @@ const ide = require('./ide');
22 22
23const toJavaScript = require('./to-javascript'); 23const toJavaScript = require('./to-javascript');
24 24
25const sourceMaps = require('./source-maps');
26
25const dargs = require('./dargs'); 27const dargs = require('./dargs');
26 28
27const spawn = require('cross-spawn').sync 29const spawn = require('cross-spawn').sync
@@ -168,9 +170,11 @@ module.exports = function purescriptLoader(source, map) {
168 170
169 const psModule = { 171 const psModule = {
170 name: psModuleName, 172 name: psModuleName,
171 load: js => callback(null, js), 173 source: source,
174 load: ({js, map}) => callback(null, js, map),
172 reject: error => callback(error), 175 reject: error => callback(error),
173 srcPath: this.resourcePath, 176 srcPath: this.resourcePath,
177 remainingRequest: loaderUtils.getRemainingRequest(this),
174 srcDir: path.dirname(this.resourcePath), 178 srcDir: path.dirname(this.resourcePath),
175 jsPath: path.resolve(path.join(options.output, psModuleName, 'index.js')), 179 jsPath: path.resolve(path.join(options.output, psModuleName, 'index.js')),
176 options: options, 180 options: options,
@@ -226,6 +230,7 @@ module.exports = function purescriptLoader(source, map) {
226 ide.rebuild(psModule) 230 ide.rebuild(psModule)
227 .then(() => 231 .then(() =>
228 toJavaScript(psModule) 232 toJavaScript(psModule)
233 .then(js => sourceMaps(psModule, js))
229 .then(psModule.load) 234 .then(psModule.load)
230 .catch(psModule.reject) 235 .catch(psModule.reject)
231 ) 236 )
@@ -255,6 +260,7 @@ module.exports = function purescriptLoader(source, map) {
255 Promise.map(cache.deferred, psModule => 260 Promise.map(cache.deferred, psModule =>
256 ide.load(psModule) 261 ide.load(psModule)
257 .then(() => toJavaScript(psModule)) 262 .then(() => toJavaScript(psModule))
263 .then(js => sourceMaps(psModule, js))
258 .then(psModule.load) 264 .then(psModule.load)
259 ) 265 )
260 ) 266 )
@@ -287,6 +293,7 @@ module.exports = function purescriptLoader(source, map) {
287 debugVerbose('compilation is already finished, loading module %s', psModule.name); 293 debugVerbose('compilation is already finished, loading module %s', psModule.name);
288 294
289 toJavaScript(psModule) 295 toJavaScript(psModule)
296 .then(js => sourceMaps(psModule, js))
290 .then(psModule.load) 297 .then(psModule.load)
291 .catch(psModule.reject); 298 .catch(psModule.reject);
292 } 299 }
@@ -320,6 +327,7 @@ module.exports = function purescriptLoader(source, map) {
320 .then(() => 327 .then(() =>
321 Promise.map(cache.deferred, psModule => 328 Promise.map(cache.deferred, psModule =>
322 toJavaScript(psModule) 329 toJavaScript(psModule)
330 .then(js => sourceMaps(psModule, js))
323 .then(psModule.load) 331 .then(psModule.load)
324 ) 332 )
325 ) 333 )