diff options
Diffstat (limited to 'src/index.js')
-rw-r--r-- | src/index.js | 10 |
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 | ||
23 | const toJavaScript = require('./to-javascript'); | 23 | const toJavaScript = require('./to-javascript'); |
24 | 24 | ||
25 | const sourceMaps = require('./source-maps'); | ||
26 | |||
25 | const dargs = require('./dargs'); | 27 | const dargs = require('./dargs'); |
26 | 28 | ||
27 | const spawn = require('cross-spawn').sync | 29 | const 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 | ) |