Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- bundle :: MonadError ErrorMessage m => [(ModuleIdentifier, String)] -> [ModuleIdentifier] -> Maybe String -> String -> m String
- bundleSM :: MonadError ErrorMessage m => [(ModuleIdentifier, Maybe FilePath, String)] -> [ModuleIdentifier] -> Maybe String -> String -> Maybe FilePath -> m (Maybe SourceMapping, String)
- guessModuleIdentifier :: MonadError ErrorMessage m => FilePath -> m ModuleIdentifier
- data ModuleIdentifier = ModuleIdentifier String ModuleType
- moduleName :: ModuleIdentifier -> String
- data ModuleType
- data ErrorMessage
- printErrorMessage :: ErrorMessage -> [String]
- getExportedIdentifiers :: MonadError ErrorMessage m => String -> JSAST -> m [String]
Documentation
:: 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.
:: 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 ModuleIdentifier Source #
A module is identified by its module name and its type.
moduleName :: ModuleIdentifier -> String Source #
data ModuleType Source #
Modules are either "regular modules" (i.e. those generated by the PureScript compiler) or foreign modules.
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.
getExportedIdentifiers :: MonadError ErrorMessage m => String -> JSAST -> m [String] Source #