Scroll to navigation

JS_OF_OCAML(1) Js_of_ocaml Manual JS_OF_OCAML(1)

NAME

js_of_ocaml - Js_of_ocaml compiler

SYNOPSIS

js_of_ocaml COMMAND ...

DESCRIPTION

Js_of_ocaml is a compiler from OCaml bytecode to Javascript. It makes it possible to run pure OCaml programs in JavaScript environments like web browsers and Node.js.

OPTIONS (TOPLEVEL)

--export=VAL
File containing the list of unit to export in a toplevel.
--nocmis, --no-cmis
Do not include cmis when compiling toplevel.
--toplevel
Compile a toplevel.

OPTIONS (FILESYSTEM)

--extern-fs
Configure pseudo-filesystem to allow registering files from outside. (default)
--file=FILE
Register [FILE] to the pseudo filesystem.
-I DIR
Add [DIR] to the list of include directories.
--no-extern-fs
Configure pseudo-filesystem to NOT allow registering files from outside.
--ofs=FILE
Output the filesystem to [FILE].

COMMANDS

build-fs
Js_of_ocaml pseudo filesystem utility
build-runtime
Build standalone runtime. Used for separate compilation.
compile
Js_of_ocaml compiler
link
Js_of_ocaml linker
print-standard-runtime
Print standard runtime to stdout

ARGUMENTS

JS_FILES
Link JavaScript files [JS_FILES]. One can refer to path relative to Findlib packages with the syntax '+pkg_name/file.js'
PROGRAM (required)
Compile the bytecode program [PROGRAM]. Use '-' to read from the standard input instead.

OPTIONS

--custom-header=VAL
Provide a custom header for the generated JavaScript file, useful for making the script an executable file with #!/usr/bin/env node
--debug=SECTION
enable debug [SECTION].
--debuginfo, --debug-info
Output debug information.
--disable=OPT
Disable optimization [OPT].
--dynlink
Enable dynlink.
--enable=OPT
Enable optimization [OPT].
--help[=FMT] (default=auto)
Show this help in format FMT. The value FMT must be one of `auto', `pager', `groff' or `plain'. With `auto', the format is `pager` or `plain' whenever the TERM env var is `dumb' or undefined.
--keep-unit-names
Keep unit name
--linkall
Link all primitives.
--no-sourcemap, --no-source-map
Don't generate source map. All other source map related flags will be be ignored.
--noinline, --no-inline
Disable inlining.
--noruntime, --no-runtime
Do not include the standard runtime.
-o FILE
Set output file name to [FILE].
--opt=NUM
Set optimization profile : [NUM].
--pretty
Pretty print the output.
-q, --quiet
suppress non-error messages.
--runtime-only
[DEPRECATED: use js_of_ocaml build-runtime instead]. Generate a JavaScript file containing/exporting the runtime only.
--set=PARAM=VALUE
Set compiler options.
--setenv=PARAM=VALUE
Set environment variable statically.
--source-map-inline
Inline sourcemap in the generated JavaScript.
--source-map-no-source
Do not inline sources in source map.
--source-map-root=VAL
root dir for source map.
--sourcemap, --source-map
Generate source map.
--version
Show version information.
--wrap-with-fun=VAL
Wrap the generated JavaScript code inside a function that needs to be applied with the global object.

BUGS

Bugs are tracked on github at https://github.com/ocsigen/js_of_ocaml/issues.

SEE ALSO

ocaml(1)

AUTHORS

Jerome Vouillon, Hugo Heuzard.

LICENSE

Copyright (C) 2010-2020.

js_of_ocaml is free software, you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, with linking exception; either version 2.1 of the License, or (at your option) any later version.

Js_of_ocaml 3.6.0