gulp-purescript
raw JSON → 2.0.1 verified Fri May 01 auth: no javascript maintenance
The gulp-purescript package (v2.0.1) is a Gulp plugin that wraps the PureScript compiler (purs) to automate compilation, bundling, and documentation generation tasks. It requires the PureScript binaries to be installed separately (e.g., via the 'purescript' npm package). The plugin's API mirrors PureScript commands: compile, bundle, and docs. Breaking changes in v2.0.0 renamed psc to compile, pscBundle to bundle, and pscDocs to docs, aligning with PureScript 0.11. The package is maintained by the PureScript community under purescript-contrib. It is a legacy tool suited for projects using older Gulp workflows; alternatives include direct use of purs or Spago.
Common errors
error Error: Cannot find module 'gulp-purescript' ↓
cause Package not installed or misspelled
fix
Run npm install --save-dev gulp-purescript
error TypeError: purescript.psc is not a function ↓
cause Function renamed from psc to compile in v2.0.0
fix
Use purescript.compile() instead of purescript.psc()
error purs: command not found ↓
cause PureScript binaries not installed
fix
Install purescript npm package globally or locally: npm install purescript
error TypeError: Cannot read property 'apply' of undefined (gulp task) ↓
cause Gulp v4 expects a function that returns a stream or promise
fix
Ensure your gulp task returns the stream: return purescript.compile(...)
Warnings
breaking psc, pscBundle, pscDocs functions renamed to compile, bundle, docs ↓
fix Update your gulp tasks to use the new names: compile, bundle, docs
breaking Options updated to match PureScript 0.11 ↓
fix Review and update options passed to each function, consult PureScript 0.11 compiler docs
gotcha Requires PureScript binaries installed separately ↓
fix Install the 'purescript' npm package or binaries via purescript.org
deprecated Gulp v4+ compatibility may require using async tasks or returning streams ↓
fix Return a stream or use async/await in your gulp task
gotcha RTS flags passed via --purs-rts-flags argument to gulp ↓
fix Use gulp --purs-rts-flags +RTS -N -RTS for runtime options
Install
npm install gulp-purescript yarn add gulp-purescript pnpm add gulp-purescript Imports
- default wrong
const purescript = require('gulp-purescript')correctimport purescript from 'gulp-purescript' - compile wrong
import { psc } from 'gulp-purescript'correctimport { compile } from 'gulp-purescript' - bundle wrong
import { pscBundle } from 'gulp-purescript'correctimport { bundle } from 'gulp-purescript' - docs wrong
import { pscDocs } from 'gulp-purescript'correctimport { docs } from 'gulp-purescript'
Quickstart
import gulp from 'gulp';
import { compile, bundle, docs } from 'gulp-purescript';
const purescript = require('gulp-purescript');
gulp.task('compile', function() {
return purescript.compile({
src: ['src/**/*.purs'],
output: 'output',
comments: false
});
});
gulp.task('bundle', function() {
return purescript.bundle({
src: 'output/**/*.js',
output: 'dist/bundle.js',
module: 'Main',
main: true
});
});
gulp.task('docs', function() {
return purescript.docs({
src: 'src/**/*.purs',
format: 'markdown'
});
});