JS_OF_OCAML-BUILD-RUNTIME(1)

πŸ“¦
version 6.2.0 Β· 4 versions
, in ubuntu resolute

✨ JS_OF_OCAML-BUILD-RUNTIME ✨

okay bestie, welcome to the js_of_ocaml-build-runtime page from the Js_of_ocaml Manual πŸ’… this one's all about building the standalone runtime β€” it's the whole point when you're doing separate compilation. sit down, grab a strawberry πŸ“, let's go.


🌸 NAME 🌸

js_of_ocaml-build-runtime β€” build the standalone runtime. it's used for separate compilation, no cap.


πŸ¦‹ SYNOPSIS πŸ¦‹

js_of_ocaml build-runtime [OPTION]… [JS_FILES]…

πŸ’– DESCRIPTION πŸ’–

Js_of_ocaml is a compiler that takes OCaml bytecode and turns it into JavaScript. it's giving translator, it's giving glow-up 🧚 and the way it works means you can literally run pure OCaml programs inside JavaScript environments β€” think web browsers, think Node.js. iconic behavior honestly.


πŸŽ€ OPTIONS (TOPLEVEL) πŸŽ€

  • --nocmis, --no-cmis β€” do not include cmis when compiling toplevel. that's it, that's the whole vibe.
  • --toplevel β€” compile a toplevel and embed the necessary cmis (unless you passed --no-cmis, in which case, no cmis, we respect it). you can configure which exported compilation units go in with --export. heads up though: you'll also need to link against js_of_ocaml-toplevel 🫢

🌈 OPTIONS (FILESYSTEM) 🌈

  • --extern-fs β€” configure the pseudo-filesystem so it allows registering files from outside. this is the default, bestie, it's already on ✨
  • --file=FILE β€” register [FILE] into the pseudo-filesystem.
  • -I DIR β€” add [DIR] to the list of include directories.
  • --no-extern-fs β€” configure the pseudo-filesystem to NOT allow registering files from outside. the opposite vibe entirely.
  • --ofs=FILE β€” output the filesystem to [FILE].

πŸ’œ ARGUMENTS πŸ’œ

  • JS_FILES β€” link JavaScript files [JS_FILES]. and here's a lil trick you're gonna love: you can refer to a path relative to Findlib packages using the syntax '+pkg_name/file.js' 😌 iykyk.

⭐ OPTIONS ⭐

  • --custom-header=VAL β€” give the generated JavaScript file a custom header. super useful if you want to make the script an executable file with #!/usr/bin/env node πŸ‘‘
  • --debug=SECTION β€” enable debug for [SECTION].
  • --debuginfo, --debug-info β€” output debug information.
  • --disable=OPT β€” disable optimization [OPT].
  • --effects=KIND β€” pick an implementation of effect handlers. [KIND] has to be one of cps, double-translation, or disabled (which is the default). and fr fr: effects will not be supported if you leave this unspecified 🫠
  • --empty-sourcemap, --empty-source-map β€” always generate empty source maps.
  • --enable=OPT β€” enable optimization [OPT].
  • --no-sourcemap, --no-source-map β€” don't generate a source map. and just so you know: every other source-map-related flag gets ignored once you use this one. it's giving main character, it overrides everything πŸ’…
  • --noinline, --no-inline β€” disable inlining.
  • --noruntime, --no-runtime β€” do not include the standard runtime.
  • -o FILE (required) β€” set the output file name to [FILE]. it's required bestie, you can't skip it 😭
  • --pretty β€” pretty print the output. aesthetic ✨
  • -q, --quiet β€” suppress non-error messages. silence, but make it chic.
  • --set=PARAM=VALUE β€” set compiler options.
  • --setenv=PARAM=VALUE β€” set an environment variable statically.
  • --source-map-inline β€” inline the sourcemap in the generated JavaScript.
  • --source-map-no-source β€” do not inline sources in the source map.
  • --source-map-root=VAL β€” root dir for the source map.
  • --sourcemap, --source-map β€” generate a source map.
  • --target-env={isomorphic,browser,nodejs} (absent=isomorphic) β€” the runtime compile target. defaults to isomorphic if you don't say anything.
  • -w WARN β€” enable or disable the warnings specified by the argument [WARN].
  • --Werror β€” turn all warnings into errors. dramatic? yes. effective? also yes πŸ’€
  • --wrap-with-fun=VAL (absent=<Immediately Invoked Function Expression>) β€” wrap the generated JavaScript code inside a function that needs to be applied with the global object.

🧚 COMMON OPTIONS 🧚

  • --help[=FMT] (default=auto) β€” show this help in format FMT. the value of 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.
  • --version β€” show version information.

πŸ’€ EXIT STATUS πŸ’€

js_of_ocaml build-runtime exits with:

  • 0 β€” on success πŸŽ‰
  • 123 β€” on indiscriminate errors reported on standard error.
  • 124 β€” on command line parsing errors.
  • 125 β€” on unexpected internal errors (bugs). not the cute kind of bug, the bad kind πŸ™ˆ

πŸ› BUGS πŸ›

bugs are tracked on github at https://github.com/ocsigen/js_of_ocaml/issues. go tell them, they'll handle it 🫢


πŸ‘€ SEE ALSO πŸ‘€


πŸ‘‘ AUTHORS πŸ‘‘

Jerome Vouillon, Hugo Heuzard. absolute legends, we stan 🌟


πŸ“œ 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.


and that's the whole page, bestie πŸŽ€ this was Js_of_ocaml version 6.2.0, section JS_OF_OCAML-BUILD-RUNTIME(1) β€” slay, go build that runtime, you got this πŸ’–βœ¨

πŸ“¦ where this page comes from