; HTML5rw JavaScript Validator Library ; Compiled with js_of_ocaml for browser use (library (name htmlrw_js) (public_name html5rw.js) (libraries html5rw htmlrw_check bytesrw brr) (modes byte) ; js_of_ocaml requires bytecode (modules htmlrw_js_types htmlrw_js_dom htmlrw_js_annotate htmlrw_js_ui htmlrw_js)) ; Standalone JavaScript file for direct browser use ; This compiles the library entry point to a .js file (executable (name htmlrw_js_main) (libraries htmlrw_js) (js_of_ocaml (javascript_files)) (modes js wasm) (modules htmlrw_js_main)) ; Web Worker for background validation ; Runs validation in a separate thread to avoid blocking the UI (executable (name htmlrw_js_worker) (libraries html5rw htmlrw_check bytesrw brr) (js_of_ocaml (javascript_files)) (modes js wasm) (modules htmlrw_js_worker)) ; Test runner for browser-based regression testing ; Runs html5lib conformance tests in the browser (executable (name htmlrw_js_tests_main) (libraries html5rw bytesrw brr) (js_of_ocaml (javascript_files)) (modes js wasm) (modules htmlrw_js_tests htmlrw_js_tests_main)) ; Copy to nice filenames (JS) (rule (targets htmlrw.js) (deps htmlrw_js_main.bc.js) (action (copy %{deps} %{targets}))) (rule (targets htmlrw-worker.js) (deps htmlrw_js_worker.bc.js) (action (copy %{deps} %{targets}))) (rule (targets htmlrw-tests.js) (deps htmlrw_js_tests_main.bc.js) (action (copy %{deps} %{targets}))) ; Copy to nice filenames (WASM) ; Note: requires wasm_of_ocaml-compiler to be installed (rule (targets htmlrw.wasm.js) (deps htmlrw_js_main.bc.wasm.js) (action (copy %{deps} %{targets}))) (rule (targets htmlrw-worker.wasm.js) (deps htmlrw_js_worker.bc.wasm.js) (action (copy %{deps} %{targets}))) (rule (targets htmlrw-tests.wasm.js) (deps htmlrw_js_tests_main.bc.wasm.js) (action (copy %{deps} %{targets}))) ; Install web assets to share/html5rw-js/ for npm packaging (install (package html5rw-js) (section share) (files ; JavaScript bundles htmlrw.js htmlrw-worker.js htmlrw-tests.js ; WASM loader scripts htmlrw.wasm.js htmlrw-worker.wasm.js htmlrw-tests.wasm.js ; WASM assets (with content-hashed filenames) (glob_files_rec (htmlrw_js_main.bc.wasm.assets/* with_prefix htmlrw_js_main.bc.wasm.assets)) (glob_files_rec (htmlrw_js_worker.bc.wasm.assets/* with_prefix htmlrw_js_worker.bc.wasm.assets)) (glob_files_rec (htmlrw_js_tests_main.bc.wasm.assets/* with_prefix htmlrw_js_tests_main.bc.wasm.assets))))