diff --git a/MODULE.md b/MODULE.md index 54ebb47..b4e0ec0 100644 --- a/MODULE.md +++ b/MODULE.md @@ -1,5 +1,22 @@ # Module Documentation +## Module GulpPurescript.Buffer + +#### `Buffer` + +``` purescript +data Buffer +``` + + +#### `mkBufferFromString` + +``` purescript +mkBufferFromString :: String -> Buffer +``` + + + ## Module GulpPurescript.ChildProcess #### `ChildProcess` @@ -60,7 +77,7 @@ mkPluginError :: String -> String -> Error #### `mkFile` ``` purescript -mkFile :: String -> String -> File +mkFile :: String -> Buffer -> File ``` @@ -166,6 +183,13 @@ platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform) ## Module GulpPurescript.Options +#### `isForeignEither` + +``` purescript +instance isForeignEither :: (IsForeign a, IsForeign b) => IsForeign (Either a b) +``` + + #### `isForeignPsc` ``` purescript @@ -201,6 +225,13 @@ pscOptions :: Foreign -> [String] ``` +#### `pscOptionsNoOutput` + +``` purescript +pscOptionsNoOutput :: Foreign -> Tuple (Maybe String) [String] +``` + + #### `pscMakeOptions` ``` purescript diff --git a/README.md b/README.md index 8291d01..6320f4d 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Sets one or more `--module=` that enables dead code elimination, removin ###### `codegen` (String Array) -Sets one or more `--codegen=` that generates code and extenrs for the specified modules. +Sets one or more `--codegen=` that generates code and externs for the specified modules. ###### `output` (String) @@ -88,6 +88,10 @@ Sets the path value of the [File](https://github.com/wearefractal/vinyl) passed Toggles `--no-prefix` that does not include the comment header. +###### `ffi` (String Array) + +Sets one or more `--ffi=` that specifies the location of files for code that is included with a `foreign import` in the PureScript source. + ### `purescript.pscMake(options)` Invokes the `psc-make` command. The following options are supported. @@ -124,6 +128,10 @@ Sets `--output=` the specifies the output directory, `output` by default Toggles `--no-prefix` that does not include the comment header. +###### `ffi` (String Array) + +Sets one or more `--ffi=` that specifies the location of files for code that is included with a `foreign import` in the PureScript source. + ### `purescript.pscDocs(options)` Invokes the `pscDocs` command. The following options are supported. diff --git a/src/Options.purs b/src/Options.purs index 989ea44..323866c 100644 --- a/src/Options.purs +++ b/src/Options.purs @@ -72,6 +72,10 @@ formatOpt = "format" formatKey = formatOpt +ffiOpt = "ffi" + +ffiKey = ffiOpt + newtype Psc = Psc { noPrelude :: NullOrUndefined Boolean , noTco :: NullOrUndefined Boolean @@ -86,6 +90,7 @@ newtype Psc , output :: NullOrUndefined String , externs :: NullOrUndefined String , noPrefix :: NullOrUndefined Boolean + , ffi :: NullOrUndefined [String] } newtype PscMake @@ -97,6 +102,7 @@ newtype PscMake , comments :: NullOrUndefined Boolean , noPrefix :: NullOrUndefined Boolean , output :: NullOrUndefined String + , ffi :: NullOrUndefined [String] } newtype PscDocs @@ -110,7 +116,7 @@ instance isForeignEither :: (IsForeign a, IsForeign b) => IsForeign (Either a b) instance isForeignPsc :: IsForeign Psc where read obj = - (\a b c d e f g h i j k l m -> + (\a b c d e f g h i j k l m o -> Psc { noPrelude: a , noTco: b , noMagicDo: c @@ -124,6 +130,7 @@ instance isForeignPsc :: IsForeign Psc where , output: k , externs: l , noPrefix: m + , ffi: o }) <$> readProp noPreludeKey obj <*> readProp noTcoKey obj <*> readProp noMagicDoKey obj @@ -137,10 +144,11 @@ instance isForeignPsc :: IsForeign Psc where <*> readProp outputKey obj <*> readProp externsKey obj <*> readProp noPrefixKey obj + <*> readProp ffiKey obj instance isForeignPscMake :: IsForeign PscMake where read obj = - (\a b c d e f g h -> + (\a b c d e f g h i -> PscMake { output: a , noPrelude: b , noTco: c @@ -149,6 +157,7 @@ instance isForeignPscMake :: IsForeign PscMake where , verboseErrors: f , comments: g , noPrefix: h + , ffi: i }) <$> readProp outputKey obj <*> readProp noPreludeKey obj <*> readProp noTcoKey obj @@ -157,6 +166,7 @@ instance isForeignPscMake :: IsForeign PscMake where <*> readProp verboseErrorsKey obj <*> readProp commentsKey obj <*> readProp noPrefixKey obj + <*> readProp ffiKey obj instance isForeignPscDocs :: IsForeign PscDocs where read obj = (\a -> PscDocs { format: a }) <$> readProp formatKey obj @@ -204,7 +214,8 @@ foldPscOptions (Psc a) = mkBoolean noPreludeOpt a.noPrelude <> mkStringArray codegenOpt a.codegen <> mkString outputOpt a.output <> mkString externsOpt a.externs <> - mkBoolean noPrefixOpt a.noPrefix + mkBoolean noPrefixOpt a.noPrefix <> + mkStringArray ffiOpt a.ffi pscOptions :: Foreign -> [String] pscOptions opts = either (const []) foldPscOptions parsed @@ -226,7 +237,8 @@ pscMakeOptions opts = either (const []) fold parsed mkBoolean noOptsOpt a.noOpts <> mkBoolean verboseErrorsOpt a.verboseErrors <> mkBoolean commentsOpt a.comments <> - mkBoolean noPrefixOpt a.noPrefix + mkBoolean noPrefixOpt a.noPrefix <> + mkStringArray ffiOpt a.ffi pscDocsOptions :: Foreign -> [String] pscDocsOptions opts = either (const []) fold parsed