Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit 9812c6f

Browse files
committed
Merge pull request #28 from purescript-contrib/purescript-0.7
Add FFI option for PureScript 0.7
2 parents e446f12 + 447be13 commit 9812c6f

File tree

3 files changed

+57
-6
lines changed

3 files changed

+57
-6
lines changed

MODULE.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Module Documentation
22

3+
## Module GulpPurescript.Buffer
4+
5+
#### `Buffer`
6+
7+
``` purescript
8+
data Buffer
9+
```
10+
11+
12+
#### `mkBufferFromString`
13+
14+
``` purescript
15+
mkBufferFromString :: String -> Buffer
16+
```
17+
18+
19+
320
## Module GulpPurescript.ChildProcess
421

522
#### `ChildProcess`
@@ -60,7 +77,7 @@ mkPluginError :: String -> String -> Error
6077
#### `mkFile`
6178

6279
``` purescript
63-
mkFile :: String -> String -> File
80+
mkFile :: String -> Buffer -> File
6481
```
6582

6683

@@ -166,6 +183,13 @@ platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
166183

167184
## Module GulpPurescript.Options
168185

186+
#### `isForeignEither`
187+
188+
``` purescript
189+
instance isForeignEither :: (IsForeign a, IsForeign b) => IsForeign (Either a b)
190+
```
191+
192+
169193
#### `isForeignPsc`
170194

171195
``` purescript
@@ -201,6 +225,13 @@ pscOptions :: Foreign -> [String]
201225
```
202226

203227

228+
#### `pscOptionsNoOutput`
229+
230+
``` purescript
231+
pscOptionsNoOutput :: Foreign -> Tuple (Maybe String) [String]
232+
```
233+
234+
204235
#### `pscMakeOptions`
205236

206237
``` purescript

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Sets one or more `--module=<string>` that enables dead code elimination, removin
7878

7979
###### `codegen` (String Array)
8080

81-
Sets one or more `--codegen=<string>` that generates code and extenrs for the specified modules.
81+
Sets one or more `--codegen=<string>` that generates code and externs for the specified modules.
8282

8383
###### `output` (String)
8484

@@ -88,6 +88,10 @@ Sets the path value of the [File](https://github.com/wearefractal/vinyl) passed
8888

8989
Toggles `--no-prefix` that does not include the comment header.
9090

91+
###### `ffi` (String Array)
92+
93+
Sets one or more `--ffi=<string>` that specifies the location of files for code that is included with a `foreign import` in the PureScript source.
94+
9195
### `purescript.pscMake(options)`
9296

9397
Invokes the `psc-make` command. The following options are supported.
@@ -124,6 +128,10 @@ Sets `--output=<string>` the specifies the output directory, `output` by default
124128

125129
Toggles `--no-prefix` that does not include the comment header.
126130

131+
###### `ffi` (String Array)
132+
133+
Sets one or more `--ffi=<string>` that specifies the location of files for code that is included with a `foreign import` in the PureScript source.
134+
127135
### `purescript.pscDocs(options)`
128136

129137
Invokes the `pscDocs` command. The following options are supported.

src/Options.purs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ formatOpt = "format"
7272

7373
formatKey = formatOpt
7474

75+
ffiOpt = "ffi"
76+
77+
ffiKey = ffiOpt
78+
7579
newtype Psc
7680
= Psc { noPrelude :: NullOrUndefined Boolean
7781
, noTco :: NullOrUndefined Boolean
@@ -86,6 +90,7 @@ newtype Psc
8690
, output :: NullOrUndefined String
8791
, externs :: NullOrUndefined String
8892
, noPrefix :: NullOrUndefined Boolean
93+
, ffi :: NullOrUndefined [String]
8994
}
9095

9196
newtype PscMake
@@ -97,6 +102,7 @@ newtype PscMake
97102
, comments :: NullOrUndefined Boolean
98103
, noPrefix :: NullOrUndefined Boolean
99104
, output :: NullOrUndefined String
105+
, ffi :: NullOrUndefined [String]
100106
}
101107

102108
newtype PscDocs
@@ -110,7 +116,7 @@ instance isForeignEither :: (IsForeign a, IsForeign b) => IsForeign (Either a b)
110116

111117
instance isForeignPsc :: IsForeign Psc where
112118
read obj =
113-
(\a b c d e f g h i j k l m ->
119+
(\a b c d e f g h i j k l m o ->
114120
Psc { noPrelude: a
115121
, noTco: b
116122
, noMagicDo: c
@@ -124,6 +130,7 @@ instance isForeignPsc :: IsForeign Psc where
124130
, output: k
125131
, externs: l
126132
, noPrefix: m
133+
, ffi: o
127134
}) <$> readProp noPreludeKey obj
128135
<*> readProp noTcoKey obj
129136
<*> readProp noMagicDoKey obj
@@ -137,10 +144,11 @@ instance isForeignPsc :: IsForeign Psc where
137144
<*> readProp outputKey obj
138145
<*> readProp externsKey obj
139146
<*> readProp noPrefixKey obj
147+
<*> readProp ffiKey obj
140148

141149
instance isForeignPscMake :: IsForeign PscMake where
142150
read obj =
143-
(\a b c d e f g h ->
151+
(\a b c d e f g h i ->
144152
PscMake { output: a
145153
, noPrelude: b
146154
, noTco: c
@@ -149,6 +157,7 @@ instance isForeignPscMake :: IsForeign PscMake where
149157
, verboseErrors: f
150158
, comments: g
151159
, noPrefix: h
160+
, ffi: i
152161
}) <$> readProp outputKey obj
153162
<*> readProp noPreludeKey obj
154163
<*> readProp noTcoKey obj
@@ -157,6 +166,7 @@ instance isForeignPscMake :: IsForeign PscMake where
157166
<*> readProp verboseErrorsKey obj
158167
<*> readProp commentsKey obj
159168
<*> readProp noPrefixKey obj
169+
<*> readProp ffiKey obj
160170

161171
instance isForeignPscDocs :: IsForeign PscDocs where
162172
read obj = (\a -> PscDocs { format: a }) <$> readProp formatKey obj
@@ -204,7 +214,8 @@ foldPscOptions (Psc a) = mkBoolean noPreludeOpt a.noPrelude <>
204214
mkStringArray codegenOpt a.codegen <>
205215
mkString outputOpt a.output <>
206216
mkString externsOpt a.externs <>
207-
mkBoolean noPrefixOpt a.noPrefix
217+
mkBoolean noPrefixOpt a.noPrefix <>
218+
mkStringArray ffiOpt a.ffi
208219

209220
pscOptions :: Foreign -> [String]
210221
pscOptions opts = either (const []) foldPscOptions parsed
@@ -226,7 +237,8 @@ pscMakeOptions opts = either (const []) fold parsed
226237
mkBoolean noOptsOpt a.noOpts <>
227238
mkBoolean verboseErrorsOpt a.verboseErrors <>
228239
mkBoolean commentsOpt a.comments <>
229-
mkBoolean noPrefixOpt a.noPrefix
240+
mkBoolean noPrefixOpt a.noPrefix <>
241+
mkStringArray ffiOpt a.ffi
230242

231243
pscDocsOptions :: Foreign -> [String]
232244
pscDocsOptions opts = either (const []) fold parsed

0 commit comments

Comments
 (0)