build vendored JavaScriptCore artifacts (Linux/Windows only):
# linux
./build.sh --configuration release
# windows
build.bat --configuration release
- Uses
WebKit/Tools/Scripts/build-jscunder the vendoredWebKitcheckout. - Linux builds with
--gtkand copieslibjavascriptcoregtk-4.1.so*to this folder. - Windows builds with
--winand copiesJavaScriptCore.dll+JavaScriptCore.libto this folder. build_static.sh/build_static.batare aliases to the same shared-library build flow.
run demo:
odin run examples -- examples/script.js
generate module bindings:
odin run scripts/bindgen.odin -file -- ./path/to/module
- Emits:
jsc_bindings.generated.odin(shared helpers + public register proc)${source}_jsc.generated.odinper source filejsc_bindings.generated.d.ts(TypeScript declarations)
- Runtime JS surface is namespaced under
globalThis.<namespace_root>.<module_alias>.- Default
<namespace_root>is derived from the module parent folder name. - Default
<module_alias>is the module folder name. target_renameinjsc_bindgen.specoverrides<module_alias>.- Example: bindgen for
./rt/driftregisters symbols underglobalThis.rt.drift.*.
- Default
optional jsc_bindgen.spec (per-module):
- Put the file at
<module>/jsc_bindgen.spec. - Empty lines and lines starting with
#or//are ignored. - Directive syntax:
exclude <symbol>rename <symbol> <js_name>specialize <symbol> <js_name> <bindings>
<bindings>is comma-separatedname=valuepairs for compile-time params.
example:
# hide symbol from JS
exclude _internal_only
# rename generated JS function name
rename fps get_fps
# expose a concrete generic specialization
specialize transform transform_vec2 T=vec2
specialize transform transform_vec3 T=vec3