diff options
Diffstat (limited to 'src/compile.js')
-rw-r--r-- | src/compile.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/compile.js b/src/compile.js index 8b5d87f..707605c 100644 --- a/src/compile.js +++ b/src/compile.js | |||
@@ -4,17 +4,17 @@ const Promise = require('bluebird'); | |||
4 | 4 | ||
5 | const spawn = require('cross-spawn'); | 5 | const spawn = require('cross-spawn'); |
6 | 6 | ||
7 | const debug = require('debug')('purs-loader'); | 7 | const debug_ = require('debug'); |
8 | |||
9 | const debug = debug_('purs-loader'); | ||
10 | |||
11 | const debugVerbose = debug_('purs-loader:verbose'); | ||
8 | 12 | ||
9 | const dargs = require('./dargs'); | 13 | const dargs = require('./dargs'); |
10 | 14 | ||
11 | module.exports = function compile(psModule) { | 15 | module.exports = function compile(psModule) { |
12 | const options = psModule.options | 16 | const options = psModule.options |
13 | 17 | ||
14 | const cache = psModule.cache | ||
15 | |||
16 | const stderr = [] | ||
17 | |||
18 | const compileCommand = options.psc || 'purs'; | 18 | const compileCommand = options.psc || 'purs'; |
19 | 19 | ||
20 | const compileArgs = (options.psc ? [] : [ 'compile' ]).concat(dargs(Object.assign({ | 20 | const compileArgs = (options.psc ? [] : [ 'compile' ]).concat(dargs(Object.assign({ |
@@ -22,7 +22,9 @@ module.exports = function compile(psModule) { | |||
22 | output: options.output, | 22 | output: options.output, |
23 | }, options.pscArgs))) | 23 | }, options.pscArgs))) |
24 | 24 | ||
25 | debug('spawning compiler %s %o', compileCommand, compileArgs) | 25 | const stderr = []; |
26 | |||
27 | debug('compile %s %o', compileCommand, compileArgs) | ||
26 | 28 | ||
27 | return new Promise((resolve, reject) => { | 29 | return new Promise((resolve, reject) => { |
28 | debug('compiling PureScript...') | 30 | debug('compiling PureScript...') |
@@ -33,8 +35,13 @@ module.exports = function compile(psModule) { | |||
33 | stderr.push(data.toString()); | 35 | stderr.push(data.toString()); |
34 | }); | 36 | }); |
35 | 37 | ||
38 | compilation.stdout.on('data', data => { | ||
39 | debugVerbose(data.toString()); | ||
40 | }); | ||
41 | |||
36 | compilation.on('close', code => { | 42 | compilation.on('close', code => { |
37 | debug('finished compiling PureScript.') | 43 | debug('finished compiling PureScript.') |
44 | |||
38 | if (code !== 0) { | 45 | if (code !== 0) { |
39 | const errorMessage = stderr.join(''); | 46 | const errorMessage = stderr.join(''); |
40 | if (errorMessage.length) { | 47 | if (errorMessage.length) { |