This document describes the behaviour of the JSX compiler in detail.
Options
--add-search-path path
Adds given search path to an internal list of paths used by the compiler for searching import
ed source files. It is not recommended to specify paths by using references to parent directories (i.e. ".."
) since that may cause confusion in the search logic. Repeat the option to specify more than one paths.
--run
When specified, the compiler executes the program immediately following a successfull compilation. Implies --executable node
.
--test
When specified, the compiler executes the unit tests defined in the source file. For how to write tests conforming to the interface, please refer to Unit tests for JSX.
--executable
The option specifies the way to execute (or not to execute) the program when loaded. If omitted, no function will be called when the compiled program is being loaded.
- --executable node
-
Target platform is node.js.
_Main.main(:string[]):void
of the source file (that was given to the compiler as an argument) will be called right after the program is being loaded. Command line arguments are passed to the function as the arguments. - --executable web
-
Target platform is web browsers.
_Main.main(:string[]):void
is called when the web browser issues aDOMContentLoaded
event. The argument to the function will always be an empty string array. - --executable common
-
Target platform is CommonJS. The only difference from
--executable node
is that the arguments are taken from thesystem
module of CommonJS, instead of from theprocess
module of node.js.
--release
Disables run-time type checking and debug logging, enables optimizations that are known to have performance / size benefits.
--profile
Enables the profiler. For more information please refer to Usisng the Profiler.
--minify
Minifies the generated program.
--disable-type-check
Disables run-time type checking. The option is automatically turned on when --release
is used.
--optimize cmd1,cmd2,...
Specifies the optimization subcommands to be used. Some notable subcommands are as follows.
- no-log
- ignore
log
statements (implied by--release
) - no-assert
- ignore
assert
statements (implied by--release
) - no-debug
- ignore
debug
statements (implied by--release
)
See --help
for complete list of subcommands.