.\" Pipe this output to groff -m man -K utf8 -T utf8 | less -R .\" .mso an.tmac .TH "JS_OF_OCAML" 1 "" "Js_of_ocaml 5.6.0" "Js_of_ocaml Manual" .\" Disable hyphenation and ragged-right .nh .ad l .SH NAME .P js_of_ocaml \N'45' Js_of_ocaml compiler .SH SYNOPSIS .P \fBjs_of_ocaml\fR [\fICOMMAND\fR] … .SH DESCRIPTION .P Js_of_ocaml is a compiler from OCaml bytecode to Javascript\N'46' It makes it possible to run pure OCaml programs in JavaScript environments like web browsers and Node\N'46'js\N'46' .SH OPTIONS (TOPLEVEL) .TP 4 \fB\N'45'\N'45'export\fR=\fIVAL\fR File containing the list of unit to export in a toplevel, with Dynlink or with \N'45'\N'45'linkall\N'46' If absent, all units will be exported\N'46' .TP 4 \fB\N'45'\N'45'nocmis\fR, \fB\N'45'\N'45'no\N'45'cmis\fR Do not include cmis when compiling toplevel\N'46' .TP 4 \fB\N'45'\N'45'toplevel\fR Compile a toplevel and embed necessary cmis (unless \N'39'\N'45'\N'45'no\N'45'cmis\N'39' is provided)\N'46' Exported compilation units can be configured with \N'39'\N'45'\N'45'export\N'39'\N'46' Note you you\N'39'll also need to link against js_of_ocaml\N'45'toplevel\N'46' .SH OPTIONS (FILESYSTEM) .TP 4 \fB\N'45'\N'45'extern\N'45'fs\fR Configure pseudo\N'45'filesystem to allow registering files from outside\N'46' (default) .TP 4 \fB\N'45'\N'45'file\fR=\fIFILE\fR Register [\fIFILE\fR] to the pseudo filesystem\N'46' .TP 4 \fB\N'45'I\fR \fIDIR\fR Add [\fIDIR\fR] to the list of include directories\N'46' .TP 4 \fB\N'45'\N'45'no\N'45'extern\N'45'fs\fR Configure pseudo\N'45'filesystem to NOT allow registering files from outside\N'46' .TP 4 \fB\N'45'\N'45'ofs\fR=\fIFILE\fR Output the filesystem to [\fIFILE\fR]\N'46' .SH COMMANDS .TP 4 \fBbuild\N'45'fs\fR [\fB\N'45'I\fR \fIDIR\fR] [\fB\N'45'o\fR \fIFILE\fR] [\fIOPTION\fR]… [\fIFILES\fR]… Js_of_ocaml pseudo filesystem utility .TP 4 \fBbuild\N'45'runtime\fR [\fIOPTION\fR]… [\fIJS_FILES\fR]… Build standalone runtime\N'46' Used for separate compilation\N'46' .TP 4 \fBcheck\N'45'runtime\fR [\fB\N'45'\N'45'target\N'45'env\fR=\fI{isomorphic,browser,nodejs}\fR] [\fIOPTION\fR]… [\fIFILES\fR]… Check runtime .TP 4 \fBcompile\fR [\fIOPTION\fR]… [\fIJS_FILES\fR]… \fIPROGRAM\fR Js_of_ocaml compiler .TP 4 \fBlink\fR [\fIOPTION\fR]… [\fIJS_FILES\fR]… Js_of_ocaml linker .TP 4 \fBprint\N'45'standard\N'45'runtime\fR [\fIOPTION\fR]… Print standard runtime to stdout .SH ARGUMENTS .TP 4 \fIJS_FILES\fR Link JavaScript files [\fIJS_FILES\fR]\N'46' One can refer to path relative to Findlib packages with the syntax \N'39'+pkg_name/file\N'46'js\N'39' .TP 4 \fIPROGRAM\fR (required) Compile the bytecode program [\fIPROGRAM\fR]\N'46' Use \N'39'\N'45'\N'39' to read from the standard input instead\N'46' .SH OPTIONS .TP 4 \fB\N'45'\N'45'custom\N'45'header\fR=\fIVAL\fR Provide a custom header for the generated JavaScript file, useful for making the script an executable file with #!/usr/bin/env node .TP 4 \fB\N'45'\N'45'debug\fR=\fISECTION\fR enable debug [\fISECTION\fR]\N'46' .TP 4 \fB\N'45'\N'45'debuginfo\fR, \fB\N'45'\N'45'debug\N'45'info\fR Output debug information\N'46' .TP 4 \fB\N'45'\N'45'disable\fR=\fIOPT\fR Disable optimization [\fIOPT\fR]\N'46' .TP 4 \fB\N'45'\N'45'dynlink\fR Enable dynlink of bytecode files\N'46' Use this if you want to be able to use the Dynlink module\N'46' Note that you\N'39'll also need to link with \N'39'js_of_ocaml\N'45'compiler\N'46'dynlink\N'39'\N'46' .TP 4 \fB\N'45'\N'45'enable\fR=\fIOPT\fR Enable optimization [\fIOPT\fR]\N'46' .TP 4 \fB\N'45'\N'45'keep\N'45'unit\N'45'names\fR Keep unit name .TP 4 \fB\N'45'\N'45'linkall\fR Link all primitives and compilation units\N'46' Exported compilation units can be configured with \N'39'\N'45'\N'45'export\N'39'\N'46' .TP 4 \fB\N'45'\N'45'no\N'45'sourcemap\fR, \fB\N'45'\N'45'no\N'45'source\N'45'map\fR Don\N'39't generate source map\N'46' All other source map related flags will be be ignored\N'46' .TP 4 \fB\N'45'\N'45'noinline\fR, \fB\N'45'\N'45'no\N'45'inline\fR Disable inlining\N'46' .TP 4 \fB\N'45'\N'45'noruntime\fR, \fB\N'45'\N'45'no\N'45'runtime\fR Do not include the standard runtime\N'46' .TP 4 \fB\N'45'o\fR \fIFILE\fR Set output file name to [\fIFILE\fR]\N'46' .TP 4 \fB\N'45'\N'45'opt\fR=\fINUM\fR Set optimization profile : [\fINUM\fR]\N'46' .TP 4 \fB\N'45'\N'45'pretty\fR Pretty print the output\N'46' .TP 4 \fB\N'45'q\fR, \fB\N'45'\N'45'quiet\fR suppress non\N'45'error messages\N'46' .TP 4 \fB\N'45'\N'45'runtime\N'45'only\fR [DEPRECATED: use js_of_ocaml build\N'45'runtime instead]\N'46' Generate a JavaScript file containing/exporting the runtime only\N'46' .TP 4 \fB\N'45'\N'45'set\fR=\fIPARAM=VALUE\fR Set compiler options\N'46' .TP 4 \fB\N'45'\N'45'setenv\fR=\fIPARAM=VALUE\fR Set environment variable statically\N'46' .TP 4 \fB\N'45'\N'45'source\N'45'map\N'45'inline\fR Inline sourcemap in the generated JavaScript\N'46' .TP 4 \fB\N'45'\N'45'source\N'45'map\N'45'no\N'45'source\fR Do not inline sources in source map\N'46' .TP 4 \fB\N'45'\N'45'source\N'45'map\N'45'root\fR=\fIVAL\fR root dir for source map\N'46' .TP 4 \fB\N'45'\N'45'sourcemap\fR, \fB\N'45'\N'45'source\N'45'map\fR Generate source map\N'46' .TP 4 \fB\N'45'\N'45'target\N'45'env\fR=\fI{isomorphic,browser,nodejs}\fR (absent=\fBisomorphic\fR) Runtime compile target\N'46' .TP 4 \fB\N'45'\N'45'Werror\fR turn all warnings into errors\N'46' .TP 4 \fB\N'45'\N'45'wrap\N'45'with\N'45'fun\fR=\fIVAL\fR (absent=\fB\fR) Wrap the generated JavaScript code inside a function that needs to be applied with the global object\N'46' .SH COMMON OPTIONS .TP 4 \fB\N'45'\N'45'help\fR[=\fIFMT\fR] (default=\fBauto\fR) Show this help in format \fIFMT\fR\N'46' The value \fIFMT\fR must be one of \fBauto\fR, \fBpager\fR, \fBgroff\fR or \fBplain\fR\N'46' With \fBauto\fR, the format is \fBpager\fR or \fBplain\fR whenever the \fBTERM\fR env var is \fBdumb\fR or undefined\N'46' .TP 4 \fB\N'45'\N'45'version\fR Show version information\N'46' .SH EXIT STATUS .P \fBjs_of_ocaml\fR exits with: .TP 4 0 on success\N'46' .TP 4 123 on indiscriminate errors reported on standard error\N'46' .TP 4 124 on command line parsing errors\N'46' .TP 4 125 on unexpected internal errors (bugs)\N'46' .SH BUGS .P Bugs are tracked on github at \fIhttps://github\N'46'com/ocsigen/js_of_ocaml/issues\fR\N'46' .SH SEE ALSO .P ocaml(1) .SH AUTHORS .P Jerome Vouillon, Hugo Heuzard\N'46' .SH LICENSE .P Copyright (C) 2010\N'45'2020\N'46' .P 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\N'46'1 of the License, or (at your option) any later version\N'46'