From a72c8af19a72186069465c139b72df9c353fd3d1 Mon Sep 17 00:00:00 2001 From: eric thul Date: Thu, 14 May 2015 22:13:59 -0400 Subject: 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 --- src/Loader.purs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Loader.purs') 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) import PursLoader.LoaderRef (LoaderRef(), Loader(), async, cacheable, clearDependencies, addDependency, query, resourcePath) import PursLoader.LoaderUtil (getRemainingRequest, parseQuery) import PursLoader.OS (eol) -import PursLoader.Options (pscMakeOptions, pscMakeDefaultOutput, pscMakeOutputOption) +import PursLoader.Options (loaderSrcOption, pscMakeOptions, pscMakeDefaultOutput, pscMakeOutputOption) import PursLoader.Path (dirname, join, relative, resolve) foreign import cwd "var cwd = process.cwd();" :: String @@ -43,8 +43,8 @@ indexFilename = "index.js" (!!!) = flip (!!) -pursPattern :: String -> String -pursPattern root = join [ "{" ++ joinWith "," [ bowerPattern, root ] ++ "}" +pursPattern :: [String] -> String +pursPattern srcs = join [ "{" ++ joinWith "," ([ bowerPattern ] <> srcs) ++ "}" , "**" , "*.purs" ] @@ -86,10 +86,10 @@ loader' ref source = do liftEff $ cacheable ref let request = getRemainingRequest ref - root = dirname $ relative cwd request parsed = parseQuery $ query ref + srcs = loaderSrcOption parsed opts = pscMakeOptions parsed - pattern = pursPattern root + pattern = pursPattern $ fromMaybe [] srcs key = match moduleRegex source >>= (!!!) 1 files <- glob pattern -- cgit v1.2.3