aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'index.js')
-rw-r--r--index.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/index.js b/index.js
index 07988a2..ff2936f 100644
--- a/index.js
+++ b/index.js
@@ -6,6 +6,7 @@ var cp = require('child_process')
6 , chalk = require('chalk') 6 , chalk = require('chalk')
7 , lu = require('loader-utils') 7 , lu = require('loader-utils')
8 , cwd = process.cwd() 8 , cwd = process.cwd()
9 , BOWER_PATTERN = path.join('bower_components', 'purescript-*', 'src')
9 , PSC_MAKE = 'psc-make' 10 , PSC_MAKE = 'psc-make'
10 , OUTPUT = 'output' 11 , OUTPUT = 'output'
11 , OPTIONS = { 12 , OPTIONS = {
@@ -18,6 +19,11 @@ var cp = require('child_process')
18 } 19 }
19; 20;
20 21
22function pattern(root) {
23 var as = [ BOWER_PATTERN, root ];
24 return path.join('{' + as.join(',') + '}', '**', '*.purs');
25}
26
21module.exports = function(source){ 27module.exports = function(source){
22 var callback = this.async() 28 var callback = this.async()
23 , request = lu.getRemainingRequest(this) 29 , request = lu.getRemainingRequest(this)
@@ -29,7 +35,7 @@ module.exports = function(source){
29 else return h(OPTIONS[k]); 35 else return h(OPTIONS[k]);
30 }, []) 36 }, [])
31 ; 37 ;
32 glob(path.join(root, '**', '*.purs'), function(e, files){ 38 glob(pattern(root), function(e, files){
33 if (e !== null) callback(e); 39 if (e !== null) callback(e);
34 else { 40 else {
35 var cmd = cp.spawn(PSC_MAKE, opts.concat(files)); 41 var cmd = cp.spawn(PSC_MAKE, opts.concat(files));