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

Commit d7f9e7b

Browse files
committed
Merge pull request #61 from purescript-contrib/topic/issue-60
Adding support for PureScript 0.9.1 and newer
2 parents 52586ec + 34f6a79 commit d7f9e7b

36 files changed

+221
-313
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
.psci
22
npm-debug.log
3-
index.js
43
node_modules/
54
bower_components/
6-
build/
75
output/

README.md

+8-21
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ Invokes the `psc` command. The following options are supported.
4444

4545
Files to compile. Glob syntax is supported.
4646

47-
###### `ffi` (String or String Array)
48-
49-
Files for code that is included with a `foreign import` in the PureScript source. Glob syntax is supported.
50-
5147
###### `noTco` (Boolean)
5248

5349
Toggles `--no-tco` that disables tail-call optimizations.
@@ -76,9 +72,13 @@ Sets `--output=<string>` the specifies the output directory, `output` by default
7672

7773
Toggles `--no-prefix` that does not include the comment header.
7874

79-
###### `requirePath` (String)
75+
###### `sourceMaps` (Boolean)
76+
77+
Toggles `--source-maps` that generates source maps.
8078

81-
Sets `--require-path=<string>` that specifies the path prefix to use for `require()` calls in the generated JavaScript.
79+
###### `jsonErrors` (Boolean)
80+
81+
Toggles `--json-errors` that prints errors to stderr as JSON.
8282

8383
### `purescript.pscBundle(options)`
8484

@@ -104,10 +104,6 @@ Toggles `--main` or sets `--main=<string>` that generates code to run the `main`
104104

105105
Sets `--namespace=<string>` that specifies the namespace that PureScript modules will be exported to when running in the browser.
106106

107-
###### `requirePath` (String)
108-
109-
Sets `--require-path=<string>` that specifies the path prefix to use for `require()` calls in the generated JavaScript. This should be set to match any value used in the `psc` task.
110-
111107
### `purescript.pscDocs(options)`
112108

113109
Invokes the `psc-docs` command. The following options are supported.
@@ -136,10 +132,6 @@ Generates a `.psci` file.
136132

137133
Files added to the `.psci` file with the `:m` command. Glob syntax is supported.
138134

139-
###### `ffi` (String or String Array)
140-
141-
Files added to the `.psci` file with the `:f` command. Glob syntax is supported.
142-
143135
## Full example
144136

145137
This example will make and bundle the code, run tests, and produce a `.psci` file and documentation for a project using the common `bower_components`/`src` file layout.
@@ -154,13 +146,8 @@ var sources = [
154146
"bower_components/purescript-*/src/**/*.purs",
155147
];
156148

157-
var foreigns = [
158-
"src/**/*.js",
159-
"bower_components/purescript-*/src/**/*.js"
160-
];
161-
162149
gulp.task("make", function () {
163-
return purescript.psc({ src: sources, ffi: foreigns });
150+
return purescript.psc({ src: sources });
164151
});
165152

166153
gulp.task("bundle", ["make"], function () {
@@ -178,7 +165,7 @@ gulp.task("docs", function () {
178165
});
179166

180167
gulp.task("dotpsci", function () {
181-
return purescript.psci({ src: sources, ffi: foreigns })
168+
return purescript.psci({ src: sources })
182169
.pipe(gulp.dest("."));
183170
});
184171

bower.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "gulp-purescript",
33
"private": true,
4-
"devDependencies": {
5-
"purescript-aff": "~0.13.0",
6-
"purescript-foreign": "~0.7.0"
4+
"dependencies": {
5+
"purescript-aff": "~0.17.0",
6+
"purescript-foreign": "~1.0.0"
77
}
88
}

entry.js renamed to index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var gulpPurescript = require('GulpPurescript.Plugin');
3+
var gulpPurescript = require('./output/GulpPurescript.Plugin');
44

55
function psc(options) {
66
return gulpPurescript.psc(options)();

package.json

+18-26
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,34 @@
1212
"node": ">=0.10.0"
1313
},
1414
"files": [
15-
"index.js"
15+
"LICENSE",
16+
"index.js",
17+
"output"
1618
],
1719
"scripts": {
18-
"test:run": "node test.js | tap-spec",
19-
"test": "npm run-script build && npm run-script test:run",
20-
"build": "npm run-script build:compile && npm run-script build:docs && npm run-script build:package",
21-
"build:compile": "./node_modules/.bin/pulp build -o build",
22-
"build:docs": "./node_modules/.bin/pulp docs",
23-
"build:package": "./node_modules/.bin/webpack --progress --colors --profile --bail",
24-
"build:json": "./node_modules/.bin/webpack --progress --colors --profile --bail --json > index.json",
25-
"prepublish": "npm run-script build"
20+
"psc": "psc 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
21+
"test": "npm run psc && (node test/test.js | tap-spec)",
22+
"prepublish": "rm -r output && npm run psc"
2623
},
2724
"keywords": [
2825
"gulpplugin",
2926
"purescript"
3027
],
3128
"dependencies": {
32-
"async": "^1.3.0",
33-
"camelcase": "^1.1.0",
34-
"cross-spawn": "^0.4.0",
35-
"glob": "^5.0.5",
36-
"gulp-util": "^3.0.4",
29+
"async": "^2.0.0-rc.5",
30+
"camelcase": "^3.0.0",
31+
"cross-spawn": "^4.0.0",
32+
"glob": "^7.0.3",
33+
"gulp-util": "^3.0.7",
3734
"logalot": "^2.1.0",
38-
"resolve-bin": "^0.3.0",
39-
"which": "^1.0.9"
35+
"resolve-bin": "^0.4.0",
36+
"which": "^1.2.9"
4037
},
4138
"devDependencies": {
42-
"del": "^1.1.1",
43-
"gulp": "^3.8.11",
44-
"gulp-plumber": "^1.0.0",
45-
"json-loader": "^0.5.1",
46-
"pulp": "^4.3.0",
47-
"run-sequence": "^1.0.2",
48-
"tap-spec": "^2.2.2",
49-
"tape": "^3.5.0",
50-
"through2": "^0.6.3",
51-
"webpack": "^1.8.9"
39+
"gulp": "^3.9.1",
40+
"purescript": "^0.9.1-rc.1",
41+
"tap-spec": "^4.1.1",
42+
"tape": "^4.5.1",
43+
"through2": "^2.0.1"
5244
}
5345
}

src/GulpPurescript/Buffer.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.Buffer
4-
53
function mkBufferFromString(str) {
64
return new Buffer(str);
75
}

src/GulpPurescript/Buffer.purs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module GulpPurescript.Buffer
2-
( Buffer()
2+
( Buffer
33
, mkBufferFromString
44
) where
55

src/GulpPurescript/ChildProcess.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.ChildProcess
4-
53
var child_process = require('cross-spawn');
64

75
function spawnFn(command, args, errback, callback) {

src/GulpPurescript/ChildProcess.purs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
module GulpPurescript.ChildProcess
2-
( ChildProcess()
2+
( ChildProcess
33
, spawn
44
) where
55

66
import Prelude
77

8-
import Control.Monad.Aff (Aff(), makeAff)
9-
import Control.Monad.Eff (Eff())
10-
import Control.Monad.Eff.Exception (Error())
8+
import Control.Monad.Aff (Aff, makeAff)
9+
import Control.Monad.Eff (Eff)
10+
import Control.Monad.Eff.Exception (Error)
1111

12-
import Data.Function
12+
import Data.Function.Uncurried (Fn4, runFn4)
1313

1414
foreign import data ChildProcess :: !
1515

src/GulpPurescript/Glob.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.Glob
4-
53
var glob = require('glob');
64

75
var async = require('async');

src/GulpPurescript/Glob.purs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module GulpPurescript.Glob
2-
( Glob()
2+
( Glob
33
, glob
44
, globAll
55
) where
66

7-
import Prelude
7+
import Prelude (Unit, ($))
88

9-
import Control.Monad.Aff (Aff(), makeAff)
10-
import Control.Monad.Eff (Eff())
11-
import Control.Monad.Eff.Exception (Error())
9+
import Control.Monad.Aff (Aff, makeAff)
10+
import Control.Monad.Eff (Eff)
11+
import Control.Monad.Eff.Exception (Error)
1212

13-
import Data.Function
13+
import Data.Function.Uncurried (Fn3, runFn3)
1414

1515
foreign import data Glob :: !
1616

src/GulpPurescript/GulpUtil.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.GulpUtil
4-
53
var gutil = require('gulp-util');
64

75
function mkPluginErrorFn(name, message) {

src/GulpPurescript/GulpUtil.purs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
module GulpPurescript.GulpUtil
2-
( File()
2+
( File
33
, mkPluginError
44
, mkFile
55
) where
66

7-
import Control.Monad.Eff.Exception (Error())
7+
import Control.Monad.Eff.Exception (Error)
88

9-
import Data.Function
9+
import Data.Function.Uncurried (Fn2, runFn2)
1010

11-
import GulpPurescript.Buffer (Buffer())
11+
import GulpPurescript.Buffer (Buffer)
1212

1313
data File
1414

src/GulpPurescript/Logalot.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.Logalot
4-
53
var logalot = require('logalot');
64

75
function info(message) {

src/GulpPurescript/Logalot.purs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module GulpPurescript.Logalot
2-
( Logalot()
2+
( Logalot
33
, info
44
) where
55

6-
import Prelude
6+
import Prelude (Unit)
77

8-
import Control.Monad.Eff (Eff())
8+
import Control.Monad.Eff (Eff)
99

1010
foreign import data Logalot :: !
1111

src/GulpPurescript/OS.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.OS
4-
53
var os = require('os');
64

75
function platformFn() {

src/GulpPurescript/OS.purs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
module GulpPurescript.OS
2-
( OS()
2+
( OS
33
, Platform(..)
44
, platform
55
) where
66

7-
import Prelude
7+
import Prelude (class Show, (<$>), (<>), const)
88

9-
import Control.Monad.Eff (Eff())
9+
import Control.Monad.Eff (Eff)
10+
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)
1011

1112
import Data.Either (either)
12-
import Data.Foreign (Foreign())
13-
import Data.Foreign.Class (IsForeign, read)
13+
import Data.Foreign (Foreign)
14+
import Data.Foreign.Class (class IsForeign, read)
1415
import Data.Maybe (Maybe(..))
1516

1617
foreign import data OS :: !
@@ -27,7 +28,8 @@ instance isForeignPlatform :: IsForeign Platform where
2728
read a = (\a -> case a of
2829
"darwin" -> Darwin
2930
"linux" -> Linux
30-
"win32" -> Win32) <$> read a
31+
"win32" -> Win32
32+
_ -> unsafeThrow ("Unhandled platform: " <> a)) <$> read a
3133

3234
platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
3335
platform = either (const Nothing) Just <$> read <$> platformFn

src/GulpPurescript/Options.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
'use strict';
22

3-
// module GulpPurescript.Options
4-
53
var glob = require('glob');
64

75
var camelcase = require('camelcase');

0 commit comments

Comments
 (0)