purescript-0.12.0: PureScript Programming Language Compiler

Safe HaskellNone
LanguageHaskell2010

Language.PureScript.Bundle

Description

Bundles compiled PureScript modules for the browser.

This module takes as input the individual generated modules from Make and performs dead code elimination, filters empty modules, and generates the final JavaScript bundle.

Synopsis

Documentation

bundle Source #

Arguments

:: MonadError ErrorMessage m 
=> [(ModuleIdentifier, String)]

The input modules. Each module should be javascript rendered from the compiler.

-> [ModuleIdentifier]

Entry points. These module identifiers are used as the roots for dead-code elimination

-> Maybe String

An optional main module.

-> String

The namespace (e.g. PS).

-> m String 

The bundling function. This function performs dead code elimination, filters empty modules and generates and prints the final JavaScript bundle.

bundleSM Source #

Arguments

:: MonadError ErrorMessage m 
=> [(ModuleIdentifier, Maybe FilePath, String)]

The input modules. Each module should be javascript rendered from the compiler.

-> [ModuleIdentifier]

Entry points. These module identifiers are used as the roots for dead-code elimination

-> Maybe String

An optional main module.

-> String

The namespace (e.g. PS).

-> Maybe FilePath

The output file name (if there is one - in which case generate source map)

-> m (Maybe SourceMapping, String) 

The bundling function. This function performs dead code elimination, filters empty modules and generates and prints the final JavaScript bundle.

guessModuleIdentifier :: MonadError ErrorMessage m => FilePath -> m ModuleIdentifier Source #

Given a filename, assuming it is in the correct place on disk, infer a ModuleIdentifier.

data ModuleType Source #

Modules are either "regular modules" (i.e. those generated by the PureScript compiler) or foreign modules.

Constructors

Regular 
Foreign 

data ErrorMessage Source #

The type of error messages. We separate generation and rendering of errors using a data type, in case we need to match on error types later.

printErrorMessage :: ErrorMessage -> [String] Source #

Prepare an error message for consumption by humans.