OCaml HTML5 parser/serialiser based on Python's JustHTML
at main 2.5 kB view raw
1; HTML5rw JavaScript Validator Library 2; Compiled with js_of_ocaml for browser use 3 4(library 5 (name htmlrw_js) 6 (public_name html5rw.js) 7 (libraries 8 html5rw 9 htmlrw_check 10 bytesrw 11 brr) 12 (modes byte) ; js_of_ocaml requires bytecode 13 (modules 14 htmlrw_js_types 15 htmlrw_js_dom 16 htmlrw_js_annotate 17 htmlrw_js_ui 18 htmlrw_js)) 19 20; Standalone JavaScript file for direct browser use 21; This compiles the library entry point to a .js file 22(executable 23 (name htmlrw_js_main) 24 (libraries htmlrw_js) 25 (js_of_ocaml 26 (javascript_files)) 27 (modes js wasm) 28 (modules htmlrw_js_main)) 29 30; Web Worker for background validation 31; Runs validation in a separate thread to avoid blocking the UI 32(executable 33 (name htmlrw_js_worker) 34 (libraries html5rw htmlrw_check bytesrw brr) 35 (js_of_ocaml 36 (javascript_files)) 37 (modes js wasm) 38 (modules htmlrw_js_worker)) 39 40; Test runner for browser-based regression testing 41; Runs html5lib conformance tests in the browser 42(executable 43 (name htmlrw_js_tests_main) 44 (libraries html5rw bytesrw brr) 45 (js_of_ocaml 46 (javascript_files)) 47 (modes js wasm) 48 (modules htmlrw_js_tests htmlrw_js_tests_main)) 49 50; Copy to nice filenames (JS) 51(rule 52 (targets htmlrw.js) 53 (deps htmlrw_js_main.bc.js) 54 (action (copy %{deps} %{targets}))) 55 56(rule 57 (targets htmlrw-worker.js) 58 (deps htmlrw_js_worker.bc.js) 59 (action (copy %{deps} %{targets}))) 60 61(rule 62 (targets htmlrw-tests.js) 63 (deps htmlrw_js_tests_main.bc.js) 64 (action (copy %{deps} %{targets}))) 65 66; Copy to nice filenames (WASM) 67; Note: requires wasm_of_ocaml-compiler to be installed 68(rule 69 (targets htmlrw.wasm.js) 70 (deps htmlrw_js_main.bc.wasm.js) 71 (action (copy %{deps} %{targets}))) 72 73(rule 74 (targets htmlrw-worker.wasm.js) 75 (deps htmlrw_js_worker.bc.wasm.js) 76 (action (copy %{deps} %{targets}))) 77 78(rule 79 (targets htmlrw-tests.wasm.js) 80 (deps htmlrw_js_tests_main.bc.wasm.js) 81 (action (copy %{deps} %{targets}))) 82 83; Install web assets to share/html5rw-js/ for npm packaging 84(install 85 (package html5rw-js) 86 (section share) 87 (files 88 ; JavaScript bundles 89 htmlrw.js 90 htmlrw-worker.js 91 htmlrw-tests.js 92 ; WASM loader scripts 93 htmlrw.wasm.js 94 htmlrw-worker.wasm.js 95 htmlrw-tests.wasm.js 96 ; WASM assets (with content-hashed filenames) 97 (glob_files_rec (htmlrw_js_main.bc.wasm.assets/* with_prefix htmlrw_js_main.bc.wasm.assets)) 98 (glob_files_rec (htmlrw_js_worker.bc.wasm.assets/* with_prefix htmlrw_js_worker.bc.wasm.assets)) 99 (glob_files_rec (htmlrw_js_tests_main.bc.wasm.assets/* with_prefix htmlrw_js_tests_main.bc.wasm.assets))))