Experimental tree shaking tool for PureScript.
# compile your project (or use `pulp build -- -g corefn`) purs compile -g corefn bower_components/purescript-*/src/**/*.purs src/**/*.purs # run `zephyr` zephyr -f Main.main # bundle your code webpack
or you can bundle with
pulp browserify --skip-compile -o dce-output -t app.js
You can also specify modules as entry points, which is the same as specifying all exported identifiers.
# include all identifiers from Data.Eq module zephyr Data.Eq # as above zephyr module:Data.Eq # include Data.Eq.Eq identifier of Data.Eq module zephyr ident:Data.Eq.Eq # include Data.Eq.eq identifier (not the lower case of the identifier!) zpehyr Data.Eq.eq
zephyr reads corefn json representation from
output directory, removes non
transitive dependencies of entry points and dumps common js modules (or corefn
Zephyr can evaluate some literal expressions.
import Config (isProduction) a = if isProduction then "api/prod/" else "api/dev/"
will be transformed to
a = "api/prod/"
true. This allows you to have different
development and production environment while still ship a minified code in your
production environment. You may define
isProduction in a module under
src-prod directory and include it when compiling production code with
pulp build -I src-prod and to have another copy for your development environment
isProduction is set to
Build & Test
To build just run
stack build (or with
stack --nix build). If you
want to run test
stack --nix test is the prefered method,
stack test will
also work, unless you don't have one of the dependencies:
-f switch is not 100% safe. When on
zephyr will remove exports from
foreign modules that seems to be not used: are not used in purescript code and
seem not to be used in the foreign module. If you simply assign to
exports[var] in a dynamic way (i.e. var is a true variable rather
than a string literal) then
zephyr might remove code that shouldn't be
It is good to run