aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Loader.purs
diff options
context:
space:
mode:
authoreric thul <thul.eric@gmail.com>2015-05-14 22:13:59 -0400
committereric thul <thul.eric@gmail.com>2015-05-14 22:13:59 -0400
commita72c8af19a72186069465c139b72df9c353fd3d1 (patch)
treeecb69055fe7b668b99d49153c12c729938ed08dc /src/Loader.purs
parenta8b2571ee98ccd640a39873f8a9d67c707f336fe (diff)
downloadpurs-loader-a72c8af19a72186069465c139b72df9c353fd3d1.tar.gz
purs-loader-a72c8af19a72186069465c139b72df9c353fd3d1.tar.zst
purs-loader-a72c8af19a72186069465c139b72df9c353fd3d1.zip
Additional loader options
Adds the `psc-make` options `comments` and `no-prefix`. Also, an internal option `src` has been added that is used to specify the source paths of `PureScript` files that will be globbed for compilation. By default the `bower_components` path is globbed, but the loader requires that the source paths be provided for the user's code. Resolves #12
Diffstat (limited to 'src/Loader.purs')
-rw-r--r--src/Loader.purs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Loader.purs b/src/Loader.purs
index aae51c0..fedc424 100644
--- a/src/Loader.purs
+++ b/src/Loader.purs
@@ -26,7 +26,7 @@ import PursLoader.Glob (Glob(), glob)
26import PursLoader.LoaderRef (LoaderRef(), Loader(), async, cacheable, clearDependencies, addDependency, query, resourcePath) 26import PursLoader.LoaderRef (LoaderRef(), Loader(), async, cacheable, clearDependencies, addDependency, query, resourcePath)
27import PursLoader.LoaderUtil (getRemainingRequest, parseQuery) 27import PursLoader.LoaderUtil (getRemainingRequest, parseQuery)
28import PursLoader.OS (eol) 28import PursLoader.OS (eol)
29import PursLoader.Options (pscMakeOptions, pscMakeDefaultOutput, pscMakeOutputOption) 29import PursLoader.Options (loaderSrcOption, pscMakeOptions, pscMakeDefaultOutput, pscMakeOutputOption)
30import PursLoader.Path (dirname, join, relative, resolve) 30import PursLoader.Path (dirname, join, relative, resolve)
31 31
32foreign import cwd "var cwd = process.cwd();" :: String 32foreign import cwd "var cwd = process.cwd();" :: String
@@ -43,8 +43,8 @@ indexFilename = "index.js"
43 43
44(!!!) = flip (!!) 44(!!!) = flip (!!)
45 45
46pursPattern :: String -> String 46pursPattern :: [String] -> String
47pursPattern root = join [ "{" ++ joinWith "," [ bowerPattern, root ] ++ "}" 47pursPattern srcs = join [ "{" ++ joinWith "," ([ bowerPattern ] <> srcs) ++ "}"
48 , "**" 48 , "**"
49 , "*.purs" 49 , "*.purs"
50 ] 50 ]
@@ -86,10 +86,10 @@ loader' ref source = do
86 liftEff $ cacheable ref 86 liftEff $ cacheable ref
87 87
88 let request = getRemainingRequest ref 88 let request = getRemainingRequest ref
89 root = dirname $ relative cwd request
90 parsed = parseQuery $ query ref 89 parsed = parseQuery $ query ref
90 srcs = loaderSrcOption parsed
91 opts = pscMakeOptions parsed 91 opts = pscMakeOptions parsed
92 pattern = pursPattern root 92 pattern = pursPattern $ fromMaybe [] srcs
93 key = match moduleRegex source >>= (!!!) 1 93 key = match moduleRegex source >>= (!!!) 1
94 94
95 files <- glob pattern 95 files <- glob pattern