aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.js
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-01-14 22:18:13 -0500
committereric thul <thul.eric@gmail.com>2015-01-14 22:18:13 -0500
commita6986505b0be81ddca5bd7d63bb98f2926ee47e8 (patch)
tree39ef2c6c05c84b637e61450442cb61debcc34401 /index.js
parentebf06d39692b92058df757b2ec0009f0935d4563 (diff)
downloadpurs-loader-a6986505b0be81ddca5bd7d63bb98f2926ee47e8.tar.gz
purs-loader-a6986505b0be81ddca5bd7d63bb98f2926ee47e8.tar.zst
purs-loader-a6986505b0be81ddca5bd7d63bb98f2926ee47e8.zip
Adding bower path
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));