diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d01bd49b8d..5600289ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -316,15 +316,13 @@ jobs: run: opam exec -- make test-syntax - name: Build runtime/stdlib - if: runner.os != 'Windows' - run: | - opam exec -- node ./scripts/ninja.js config - opam exec -- node ./scripts/ninja.js build + run: ./scripts/buildRuntime.sh + shell: bash - name: Check for changes in lib folder run: git diff --exit-code lib/js lib/es6 - - name: Populate lib/ocaml + - name: Version Check run: ./scripts/prebuilt.js - name: Run tests diff --git a/CHANGELOG.md b/CHANGELOG.md index cb04f07a3c..3aedb09947 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ #### :house: Internal - Remove uncurried flag from bsb. https://github.com/rescript-lang/rescript-compiler/pull/7049 +- Build runtime/stdlib files with rescript/bsb instead of ninja.js. https://github.com/rescript-lang/rescript-compiler/pull/7063 # 12.0.0-alpha.3 diff --git a/Makefile b/Makefile index 8fe4aa627d..16e5cdd169 100644 --- a/Makefile +++ b/Makefile @@ -51,8 +51,7 @@ reanalyze: reanalyze.exe -set-exit-code -all-cmt _build/default/jscomp -suppress jscomp/syntax/testrunner -exclude-paths jscomp/outcome_printer,jscomp/ounit_tests,jscomp/ml,jscomp/js_parser,jscomp/frontend,jscomp/ext,jscomp/depends,jscomp/core,jscomp/common,jscomp/cmij,jscomp/bsb_helper,jscomp/bsb lib: build node_modules/.bin/semver - node scripts/ninja.js config - node scripts/ninja.js build + ./scripts/buildRuntime.sh ./scripts/prebuilt.js artifacts: lib @@ -86,8 +85,8 @@ clean-rewatch: cargo clean --manifest-path rewatch/Cargo.toml && rm -f rewatch/rewatch clean: + (cd runtime && ../rescript clean) dune clean - ./scripts/ninja.js clean && rm -f ninja/ninja clean-all: clean clean-gentype clean-rewatch diff --git a/jscomp/others/Design.md b/jscomp/others/Design.md deleted file mode 100644 index 0447c3e6c9..0000000000 --- a/jscomp/others/Design.md +++ /dev/null @@ -1,54 +0,0 @@ - - - - -hierachy - -# set -## bs_internalAVLset (basic module with rotation) - - methods in this moudle could be shared by (at least 2 of them) - - fuctional set, functional specialized set - mutable set, mutable specialized set. - - for example, [mem0] could be shared by functional/mutable poly set - - -## bs_Set - functional poly set (depends on bs_internalAVLset) - -## intenral_set.cppo.ml -## bs_intenralSetInt -## bs_internalSetString - - methods could be shared by funcitional/imperative specialized set. - This intermediate module is created since we want to share methods - like [findOpt], [cmp] - -## set.cppo.ml -## bs_SetInt -## bs_SetString - - - -## setm.cpp.ml -## bs_SetIntM -## bs_SetStringM - -# map -## bs_internalAVLtree (basic module with rotation) - -## bs_Map - -## internal_map.cpp.ml -## bs_internalMapInt -## bs_internalMapString - -## map.cppo.ml -## bs_MapInt -## bs_MapString - -## mapm.cppo.ml -## bs_MapIntM -## bs_MapStringM \ No newline at end of file diff --git a/jscomp/others/README.md b/jscomp/others/README.md deleted file mode 100644 index cb5a854451..0000000000 --- a/jscomp/others/README.md +++ /dev/null @@ -1,32 +0,0 @@ -Belt is a data structures and utilities library that ships with ReScript and bsb-native, optimized for the web. - -```ocaml -let a = Belt.Array.make 10 0 -let b = Belt.Array.map a (fun x -> x + 1) - -module Comparator = Belt.Id.MakeComparable(struct - type t = int - let cmp = Pervasives.compare -end) - -let c = Belt.Map.make ~id:(module Comparator) - -let d = Belt.Map.set c 10 "Hello" -let e = Belt.Map.set d 11 "World!" - -let _ = - match Belt.Map.get e 11 with - | None -> print_endline "Not possible, I'm pretty sure!" - | Some world -> print_endline ("Hello " ^ world) - -let _ = - match Belt.Map.get d 11 with - | None -> print_endline "Maps are immutable" - | _ -> print_endline "I will never print!" -``` - -## Contributing - -You'll need to build `bspp.exe` that is inside `../lib` by simply running `make -C ../lib bspp.exe`. - -Then you can recompile all of belt to JS by running `make all`. diff --git a/jscomp/others/intro.txt b/jscomp/others/intro.txt deleted file mode 100644 index 768a12b072..0000000000 --- a/jscomp/others/intro.txt +++ /dev/null @@ -1,37 +0,0 @@ -{!indexlist} - -{1 Libraries shipped with ReScript} - -ReScript is mostly a compiler, but it does ship some libraries for users' convenience - -{2 4 libraries} - -{!Js} - -This library are mostly {i bindings} to JS, it should work with both NodeJS and Browser. -It is strongly recommended to use qualified name instead of flatten module name. -For example -{[ - [| 1; 2 ; 3 |] - |> Js.Array.map (fun x -> x + 1 ) - |> Js.log -]} - -{!Belt} - -The ReScript standard library ({b beta}). - -ReScript also ships the vanilla OCaml standard library. -@see OCaml standard library - -{!Node} - -This library contains bindings to NodeJS, it is still work in progress, use it with care, -and we may break API backward compatiblity in the future. - -{!Dom} - -This library are for DOM API, currently it only defines some -types for diferent packages to talk to each other - - diff --git a/jscomp/others/release.ninja b/jscomp/others/release.ninja deleted file mode 100644 index d3779d3f25..0000000000 --- a/jscomp/others/release.ninja +++ /dev/null @@ -1,147 +0,0 @@ - -bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -unsafe -w +50 -warn-error A -I runtime - -rule cc - command = $bsc -bs-cmi -bs-cmj $bsc_flags -I others $in - description = $in -> $out -rule cc_cmi - command = $bsc -bs-read-cmi -bs-cmi -bs-cmj $bsc_flags -I others $in - description = $in -> $out - -o others/belt.cmj others/belt.cmi : cc others/belt.res | $bsc runtime -o others/js.cmi others/js.cmj : cc others/js.res | others/js_array.cmj others/js_array2.cmj others/js_bigint.cmj others/js_blob.cmj others/js_console.cmj others/js_date.cmj others/js_dict.cmj others/js_exn.cmj others/js_file.cmj others/js_float.cmj others/js_global.cmj others/js_int.cmj others/js_json.cmj others/js_map.cmj others/js_math.cmj others/js_null.cmj others/js_null_undefined.cmj others/js_obj.cmj others/js_option.cmj others/js_promise.cmj others/js_promise2.cmj others/js_re.cmj others/js_result.cmj others/js_set.cmj others/js_string.cmj others/js_string2.cmj others/js_typed_array.cmj others/js_typed_array2.cmj others/js_types.cmj others/js_undefined.cmj others/js_weakmap.cmj others/js_weakset.cmj $bsc runtime -o others/js_OO.cmi others/js_OO.cmj : cc others/js_OO.res | $bsc runtime -o others/js_array.cmi others/js_array.cmj : cc others/js_array.res | others/js_array2.cmj $bsc runtime -o others/js_array2.cmi others/js_array2.cmj : cc others/js_array2.res | $bsc runtime -o others/js_bigint.cmi others/js_bigint.cmj : cc others/js_bigint.res | $bsc runtime -o others/js_blob.cmi others/js_blob.cmj : cc others/js_blob.res | $bsc runtime -o others/js_cast.cmj : cc_cmi others/js_cast.res | others/js_cast.cmi $bsc runtime -o others/js_cast.cmi : cc others/js_cast.resi | $bsc runtime -o others/js_console.cmi others/js_console.cmj : cc others/js_console.res | $bsc runtime -o others/js_date.cmi others/js_date.cmj : cc others/js_date.res | $bsc runtime -o others/js_dict.cmj : cc_cmi others/js_dict.res | others/js_array2.cmj others/js_dict.cmi $bsc runtime -o others/js_dict.cmi : cc others/js_dict.resi | $bsc runtime -o others/js_exn.cmj : cc_cmi others/js_exn.res | others/js_exn.cmi $bsc runtime -o others/js_exn.cmi : cc others/js_exn.resi | $bsc runtime -o others/js_extern.cmi others/js_extern.cmj : cc others/js_extern.res | $bsc runtime -o others/js_file.cmi others/js_file.cmj : cc others/js_file.res | $bsc runtime -o others/js_float.cmi others/js_float.cmj : cc others/js_float.res | $bsc runtime -o others/js_global.cmi others/js_global.cmj : cc others/js_global.res | $bsc runtime -o others/js_int.cmi others/js_int.cmj : cc others/js_int.res | $bsc runtime -o others/js_json.cmj : cc_cmi others/js_json.res | others/js_array2.cmj others/js_dict.cmj others/js_extern.cmj others/js_json.cmi others/js_null.cmj others/js_string.cmj others/js_types.cmj $bsc runtime -o others/js_json.cmi : cc others/js_json.resi | others/js_dict.cmi others/js_null.cmi others/js_string.cmj others/js_types.cmi $bsc runtime -o others/js_map.cmi others/js_map.cmj : cc others/js_map.res | $bsc runtime -o others/js_math.cmi others/js_math.cmj : cc others/js_math.res | others/js_int.cmj $bsc runtime -o others/js_null.cmj : cc_cmi others/js_null.res | others/js_exn.cmj others/js_extern.cmj others/js_null.cmi $bsc runtime -o others/js_null.cmi : cc others/js_null.resi | $bsc runtime -o others/js_null_undefined.cmj : cc_cmi others/js_null_undefined.res | others/js_null_undefined.cmi $bsc runtime -o others/js_null_undefined.cmi : cc others/js_null_undefined.resi | $bsc runtime -o others/js_obj.cmi others/js_obj.cmj : cc others/js_obj.res | $bsc runtime -o others/js_option.cmj : cc_cmi others/js_option.res | others/js_exn.cmj others/js_option.cmi $bsc runtime -o others/js_option.cmi : cc others/js_option.resi | $bsc runtime -o others/js_promise.cmi others/js_promise.cmj : cc others/js_promise.res | others/js_promise2.cmj $bsc runtime -o others/js_promise2.cmi others/js_promise2.cmj : cc others/js_promise2.res | $bsc runtime -o others/js_re.cmi others/js_re.cmj : cc others/js_re.res | others/js_null_undefined.cmj $bsc runtime -o others/js_result.cmj : cc_cmi others/js_result.res | others/js_result.cmi $bsc runtime -o others/js_result.cmi : cc others/js_result.resi | $bsc runtime -o others/js_set.cmi others/js_set.cmj : cc others/js_set.res | $bsc runtime -o others/js_string.cmi others/js_string.cmj : cc others/js_string.res | others/js_array2.cmj others/js_re.cmj $bsc runtime -o others/js_string2.cmi others/js_string2.cmj : cc others/js_string2.res | others/js_array2.cmj others/js_re.cmj $bsc runtime -o others/js_typed_array.cmi others/js_typed_array.cmj : cc others/js_typed_array.res | others/js_typed_array2.cmj $bsc runtime -o others/js_typed_array2.cmi others/js_typed_array2.cmj : cc others/js_typed_array2.res | others/js_undefined.cmj $bsc runtime -o others/js_types.cmj : cc_cmi others/js_types.res | others/js_extern.cmj others/js_null.cmj others/js_types.cmi $bsc runtime -o others/js_types.cmi : cc others/js_types.resi | $bsc runtime -o others/js_undefined.cmj : cc_cmi others/js_undefined.res | others/js_exn.cmj others/js_undefined.cmi $bsc runtime -o others/js_undefined.cmi : cc others/js_undefined.resi | $bsc runtime -o others/js_weakmap.cmi others/js_weakmap.cmj : cc others/js_weakmap.res | $bsc runtime -o others/js_weakset.cmi others/js_weakset.cmj : cc others/js_weakset.res | $bsc runtime -o others/jsx.cmi others/jsx.cmj : cc others/jsx.res | $bsc runtime -o others/jsxDOM.cmi others/jsxDOM.cmj : cc others/jsxDOM.res | others/jsx.cmj others/jsxDOMStyle.cmj others/jsxEvent.cmj $bsc runtime -o others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj : cc others/jsxDOMStyle.res | $bsc runtime -o others/jsxEvent.cmi others/jsxEvent.cmj : cc others/jsxEvent.res | $bsc runtime -o others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj : cc others/jsxPPXReactSupport.res | others/jsx.cmj $bsc runtime -o js_pkg : phony others/js.cmi others/js.cmj others/js_OO.cmi others/js_OO.cmj others/js_array.cmi others/js_array.cmj others/js_array2.cmi others/js_array2.cmj others/js_bigint.cmi others/js_bigint.cmj others/js_blob.cmi others/js_blob.cmj others/js_cast.cmi others/js_cast.cmj others/js_console.cmi others/js_console.cmj others/js_date.cmi others/js_date.cmj others/js_dict.cmi others/js_dict.cmj others/js_exn.cmi others/js_exn.cmj others/js_extern.cmi others/js_extern.cmj others/js_file.cmi others/js_file.cmj others/js_float.cmi others/js_float.cmj others/js_global.cmi others/js_global.cmj others/js_int.cmi others/js_int.cmj others/js_json.cmi others/js_json.cmj others/js_map.cmi others/js_map.cmj others/js_math.cmi others/js_math.cmj others/js_null.cmi others/js_null.cmj others/js_null_undefined.cmi others/js_null_undefined.cmj others/js_obj.cmi others/js_obj.cmj others/js_option.cmi others/js_option.cmj others/js_promise.cmi others/js_promise.cmj others/js_promise2.cmi others/js_promise2.cmj others/js_re.cmi others/js_re.cmj others/js_result.cmi others/js_result.cmj others/js_set.cmi others/js_set.cmj others/js_string.cmi others/js_string.cmj others/js_string2.cmi others/js_string2.cmj others/js_typed_array.cmi others/js_typed_array.cmj others/js_typed_array2.cmi others/js_typed_array2.cmj others/js_types.cmi others/js_types.cmj others/js_undefined.cmi others/js_undefined.cmj others/js_weakmap.cmi others/js_weakmap.cmj others/js_weakset.cmi others/js_weakset.cmj others/jsx.cmi others/jsx.cmj others/jsxDOM.cmi others/jsxDOM.cmj others/jsxDOMStyle.cmi others/jsxDOMStyle.cmj others/jsxEvent.cmi others/jsxEvent.cmj others/jsxPPXReactSupport.cmi others/jsxPPXReactSupport.cmj -o others/belt_Array.cmj : cc_cmi others/belt_Array.res | others/belt.cmi others/belt_Array.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Array.cmi : cc others/belt_Array.resi | others/js.cmi $bsc runtime -o others/belt_Float.cmj : cc_cmi others/belt_Float.res | others/belt.cmi others/belt_Float.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Float.cmi : cc others/belt_Float.resi | others/js.cmi $bsc runtime -o others/belt_HashMap.cmj : cc_cmi others/belt_HashMap.res | others/belt.cmi others/belt_Array.cmj others/belt_HashMap.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmj others/belt_Id.cmj others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashMap.cmi : cc others/belt_HashMap.resi | others/belt.cmi others/belt_HashMapInt.cmi others/belt_HashMapString.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_HashMapInt.cmj : cc_cmi others/belt_HashMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_HashMapInt.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashMapInt.cmi : cc others/belt_HashMapInt.resi | others/js.cmi $bsc runtime -o others/belt_HashMapString.cmj : cc_cmi others/belt_HashMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_HashMapString.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashMapString.cmi : cc others/belt_HashMapString.resi | others/js.cmi $bsc runtime -o others/belt_HashSet.cmj : cc_cmi others/belt_HashSet.res | others/belt.cmi others/belt_Array.cmj others/belt_HashSet.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmj others/belt_Id.cmj others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashSet.cmi : cc others/belt_HashSet.resi | others/belt.cmi others/belt_HashSetInt.cmi others/belt_HashSetString.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_HashSetInt.cmj : cc_cmi others/belt_HashSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_HashSetInt.cmi others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashSetInt.cmi : cc others/belt_HashSetInt.resi | others/js.cmi $bsc runtime -o others/belt_HashSetString.cmj : cc_cmi others/belt_HashSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_HashSetString.cmi others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_HashSetString.cmi : cc others/belt_HashSetString.resi | others/js.cmi $bsc runtime -o others/belt_Id.cmj : cc_cmi others/belt_Id.res | others/belt.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Id.cmi : cc others/belt_Id.resi | others/js.cmi $bsc runtime -o others/belt_Int.cmj : cc_cmi others/belt_Int.res | others/belt.cmi others/belt_Int.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Int.cmi : cc others/belt_Int.resi | others/js.cmi $bsc runtime -o others/belt_List.cmj : cc_cmi others/belt_List.res | others/belt.cmi others/belt_Array.cmj others/belt_List.cmi others/belt_SortArray.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_List.cmi : cc others/belt_List.resi | others/js.cmi $bsc runtime -o others/belt_Map.cmj : cc_cmi others/belt_Map.res | others/belt.cmi others/belt_Id.cmj others/belt_Map.cmi others/belt_MapDict.cmj others/belt_MapInt.cmj others/belt_MapString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_Map.cmi : cc others/belt_Map.resi | others/belt.cmi others/belt_Id.cmi others/belt_MapDict.cmi others/belt_MapInt.cmi others/belt_MapString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MapDict.cmj : cc_cmi others/belt_MapDict.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MapDict.cmi others/belt_internalAVLtree.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MapDict.cmi : cc others/belt_MapDict.resi | others/belt.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MapInt.cmj : cc_cmi others/belt_MapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MapInt.cmi others/belt_internalAVLtree.cmj others/belt_internalMapInt.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MapInt.cmi : cc others/belt_MapInt.resi | others/js.cmi $bsc runtime -o others/belt_MapString.cmj : cc_cmi others/belt_MapString.res | others/belt.cmi others/belt_Array.cmj others/belt_MapString.cmi others/belt_internalAVLtree.cmj others/belt_internalMapString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MapString.cmi : cc others/belt_MapString.resi | others/js.cmi $bsc runtime -o others/belt_MutableMap.cmj : cc_cmi others/belt_MutableMap.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MutableMap.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmj others/belt_internalAVLtree.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableMap.cmi : cc others/belt_MutableMap.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableMapInt.cmi others/belt_MutableMapString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MutableMapInt.cmj : cc_cmi others/belt_MutableMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableMapInt.cmi others/belt_internalAVLtree.cmj others/belt_internalMapInt.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableMapInt.cmi : cc others/belt_MutableMapInt.resi | others/js.cmi $bsc runtime -o others/belt_MutableMapString.cmj : cc_cmi others/belt_MutableMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableMapString.cmi others/belt_internalAVLtree.cmj others/belt_internalMapString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableMapString.cmi : cc others/belt_MutableMapString.resi | others/js.cmi $bsc runtime -o others/belt_MutableQueue.cmj : cc_cmi others/belt_MutableQueue.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableQueue.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MutableQueue.cmi : cc others/belt_MutableQueue.resi | others/js.cmi $bsc runtime -o others/belt_MutableSet.cmj : cc_cmi others/belt_MutableSet.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_MutableSet.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmj others/belt_SortArray.cmj others/belt_internalAVLset.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableSet.cmi : cc others/belt_MutableSet.resi | others/belt.cmi others/belt_Id.cmi others/belt_MutableSetInt.cmi others/belt_MutableSetString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MutableSetInt.cmj : cc_cmi others/belt_MutableSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableSetInt.cmi others/belt_SortArrayInt.cmj others/belt_internalAVLset.cmj others/belt_internalSetInt.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableSetInt.cmi : cc others/belt_MutableSetInt.resi | others/js.cmi $bsc runtime -o others/belt_MutableSetString.cmj : cc_cmi others/belt_MutableSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_MutableSetString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmj others/belt_internalSetString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_MutableSetString.cmi : cc others/belt_MutableSetString.resi | others/js.cmi $bsc runtime -o others/belt_MutableStack.cmj : cc_cmi others/belt_MutableStack.res | others/belt.cmi others/belt_MutableStack.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_MutableStack.cmi : cc others/belt_MutableStack.resi | others/js.cmi $bsc runtime -o others/belt_Option.cmj : cc_cmi others/belt_Option.res | others/belt.cmi others/belt_Option.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Option.cmi : cc others/belt_Option.resi | others/js.cmi $bsc runtime -o others/belt_Range.cmj : cc_cmi others/belt_Range.res | others/belt.cmi others/belt_Range.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Range.cmi : cc others/belt_Range.resi | others/js.cmi $bsc runtime -o others/belt_Result.cmj : cc_cmi others/belt_Result.res | others/belt.cmi others/belt_Result.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_Result.cmi : cc others/belt_Result.resi | others/js.cmi $bsc runtime -o others/belt_Set.cmj : cc_cmi others/belt_Set.res | others/belt.cmi others/belt_Id.cmj others/belt_Set.cmi others/belt_SetDict.cmj others/belt_SetInt.cmj others/belt_SetString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_Set.cmi : cc others/belt_Set.resi | others/belt.cmi others/belt_Id.cmi others/belt_SetDict.cmi others/belt_SetInt.cmi others/belt_SetString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_SetDict.cmj : cc_cmi others/belt_SetDict.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SetDict.cmi others/belt_internalAVLset.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_SetDict.cmi : cc others/belt_SetDict.resi | others/belt.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_SetInt.cmj : cc_cmi others/belt_SetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SetInt.cmi others/belt_internalAVLset.cmj others/belt_internalSetInt.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_SetInt.cmi : cc others/belt_SetInt.resi | others/js.cmi $bsc runtime -o others/belt_SetString.cmj : cc_cmi others/belt_SetString.res | others/belt.cmi others/belt_Array.cmj others/belt_SetString.cmi others/belt_internalAVLset.cmj others/belt_internalSetString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_SetString.cmi : cc others/belt_SetString.resi | others/js.cmi $bsc runtime -o others/belt_SortArray.cmj : cc_cmi others/belt_SortArray.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_SortArray.cmi : cc others/belt_SortArray.resi | others/belt.cmi others/belt_SortArrayInt.cmi others/belt_SortArrayString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_SortArrayInt.cmj : cc_cmi others/belt_SortArrayInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayInt.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_SortArrayInt.cmi : cc others/belt_SortArrayInt.resi | others/js.cmi $bsc runtime -o others/belt_SortArrayString.cmj : cc_cmi others/belt_SortArrayString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayString.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_SortArrayString.cmi : cc others/belt_SortArrayString.resi | others/js.cmi $bsc runtime -o others/belt_internalAVLset.cmj : cc_cmi others/belt_internalAVLset.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLset.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalAVLset.cmi : cc others/belt_internalAVLset.resi | others/belt.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalAVLtree.cmj : cc_cmi others/belt_internalAVLtree.res | others/belt.cmi others/belt_Array.cmj others/belt_Id.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalAVLtree.cmi : cc others/belt_internalAVLtree.resi | others/belt.cmi others/belt_Id.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalBuckets.cmj : cc_cmi others/belt_internalBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBuckets.cmi others/belt_internalBucketsType.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_internalBuckets.cmi : cc others/belt_internalBuckets.resi | others/belt.cmi others/belt_internalBucketsType.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalBucketsType.cmj : cc_cmi others/belt_internalBucketsType.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalBucketsType.cmi : cc others/belt_internalBucketsType.resi | others/js.cmi $bsc runtime -o others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj : cc others/belt_internalMapInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_internalMapString.cmi others/belt_internalMapString.cmj : cc others/belt_internalMapString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArray.cmj others/belt_internalAVLtree.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_internalSetBuckets.cmj : cc_cmi others/belt_internalSetBuckets.res | others/belt.cmi others/belt_Array.cmj others/belt_internalBucketsType.cmj others/belt_internalSetBuckets.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalSetBuckets.cmi : cc others/belt_internalSetBuckets.resi | others/belt.cmi others/belt_internalBucketsType.cmi others/js.cmi $bsc js_pkg runtime -o others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj : cc others/belt_internalSetInt.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayInt.cmj others/belt_internalAVLset.cmj others/js.cmi $bsc js_pkg runtime -o others/belt_internalSetString.cmi others/belt_internalSetString.cmj : cc others/belt_internalSetString.res | others/belt.cmi others/belt_Array.cmj others/belt_SortArrayString.cmj others/belt_internalAVLset.cmj others/js.cmi $bsc js_pkg runtime -o others/dom.cmi others/dom.cmj : cc others/dom.res | others/dom_storage.cmj others/dom_storage2.cmj others/js.cmi $bsc js_pkg runtime -o others/dom_storage.cmi others/dom_storage.cmj : cc others/dom_storage.res | others/dom_storage2.cmj others/js.cmi $bsc js_pkg runtime -o others/dom_storage2.cmi others/dom_storage2.cmj : cc others/dom_storage2.res | others/js.cmi $bsc runtime -o others : phony others/belt_Array.cmi others/belt_Array.cmj others/belt_Float.cmi others/belt_Float.cmj others/belt_HashMap.cmi others/belt_HashMap.cmj others/belt_HashMapInt.cmi others/belt_HashMapInt.cmj others/belt_HashMapString.cmi others/belt_HashMapString.cmj others/belt_HashSet.cmi others/belt_HashSet.cmj others/belt_HashSetInt.cmi others/belt_HashSetInt.cmj others/belt_HashSetString.cmi others/belt_HashSetString.cmj others/belt_Id.cmi others/belt_Id.cmj others/belt_Int.cmi others/belt_Int.cmj others/belt_List.cmi others/belt_List.cmj others/belt_Map.cmi others/belt_Map.cmj others/belt_MapDict.cmi others/belt_MapDict.cmj others/belt_MapInt.cmi others/belt_MapInt.cmj others/belt_MapString.cmi others/belt_MapString.cmj others/belt_MutableMap.cmi others/belt_MutableMap.cmj others/belt_MutableMapInt.cmi others/belt_MutableMapInt.cmj others/belt_MutableMapString.cmi others/belt_MutableMapString.cmj others/belt_MutableQueue.cmi others/belt_MutableQueue.cmj others/belt_MutableSet.cmi others/belt_MutableSet.cmj others/belt_MutableSetInt.cmi others/belt_MutableSetInt.cmj others/belt_MutableSetString.cmi others/belt_MutableSetString.cmj others/belt_MutableStack.cmi others/belt_MutableStack.cmj others/belt_Option.cmi others/belt_Option.cmj others/belt_Range.cmi others/belt_Range.cmj others/belt_Result.cmi others/belt_Result.cmj others/belt_Set.cmi others/belt_Set.cmj others/belt_SetDict.cmi others/belt_SetDict.cmj others/belt_SetInt.cmi others/belt_SetInt.cmj others/belt_SetString.cmi others/belt_SetString.cmj others/belt_SortArray.cmi others/belt_SortArray.cmj others/belt_SortArrayInt.cmi others/belt_SortArrayInt.cmj others/belt_SortArrayString.cmi others/belt_SortArrayString.cmj others/belt_internalAVLset.cmi others/belt_internalAVLset.cmj others/belt_internalAVLtree.cmi others/belt_internalAVLtree.cmj others/belt_internalBuckets.cmi others/belt_internalBuckets.cmj others/belt_internalBucketsType.cmi others/belt_internalBucketsType.cmj others/belt_internalMapInt.cmi others/belt_internalMapInt.cmj others/belt_internalMapString.cmi others/belt_internalMapString.cmj others/belt_internalSetBuckets.cmi others/belt_internalSetBuckets.cmj others/belt_internalSetInt.cmi others/belt_internalSetInt.cmj others/belt_internalSetString.cmi others/belt_internalSetString.cmj others/dom.cmi others/dom.cmj others/dom_storage.cmi others/dom_storage.cmj others/dom_storage2.cmi others/dom_storage2.cmj diff --git a/jscomp/runtime/Readme.md b/jscomp/runtime/Readme.md deleted file mode 100644 index 243d075026..0000000000 --- a/jscomp/runtime/Readme.md +++ /dev/null @@ -1,3 +0,0 @@ -# Runtime support - -The build deps are manually maintained. \ No newline at end of file diff --git a/jscomp/runtime/release.ninja b/jscomp/runtime/release.ninja deleted file mode 100644 index b3ecd1eb7c..0000000000 --- a/jscomp/runtime/release.ninja +++ /dev/null @@ -1,58 +0,0 @@ - -bsc_flags = -no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib -bs-cross-module-opt -make-runtime -unsafe -w -3+50 -warn-error A - -rule cc - command = $bsc -bs-cmi -bs-cmj $bsc_flags -I runtime $in - description = $in -> $out -rule cc_cmi - command = $bsc -bs-read-cmi -bs-cmi -bs-cmj $bsc_flags -I runtime $in - description = $in -> $out - -o runtime/pervasives.cmj runtime/pervasives.cmi : cc runtime/pervasives.res - bsc_flags = $bsc_flags -nopervasives -o runtime/array.cmj : cc_cmi runtime/array.res | runtime/array.cmi runtime/list.cmj runtime/primitive_array.cmj runtime/primitive_exceptions.cmj -o runtime/array.cmi : cc runtime/array.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/char.cmj : cc_cmi runtime/char.res | runtime/char.cmi runtime/primitive_array_extern.cmj -o runtime/char.cmi : cc runtime/char.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/hashtbl.cmj : cc_cmi runtime/hashtbl.res | runtime/hashtbl.cmi runtime/primitive_hash.cmj -o runtime/hashtbl.cmi : cc runtime/hashtbl.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/lazy.cmj : cc_cmi runtime/lazy.res | runtime/lazy.cmi runtime/primitive_lazy.cmj -o runtime/lazy.cmi : cc runtime/lazy.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/list.cmj : cc_cmi runtime/list.res | runtime/list.cmi runtime/pervasives.cmj runtime/primitive_option.cmj -o runtime/list.cmi : cc runtime/list.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_curry.cmj : cc_cmi runtime/primitive_curry.res | runtime/array.cmj runtime/obj.cmj runtime/primitive_array_extern.cmj runtime/primitive_curry.cmi runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmj -o runtime/primitive_curry.cmi : cc runtime/primitive_curry.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_exceptions.cmj : cc_cmi runtime/primitive_exceptions.res | runtime/obj.cmj runtime/primitive_exceptions.cmi runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmj -o runtime/primitive_exceptions.cmi : cc runtime/primitive_exceptions.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_hash.cmj : cc_cmi runtime/primitive_hash.res | runtime/obj.cmj runtime/primitive_float_extern.cmj runtime/primitive_hash.cmi runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmj runtime/primitive_string_extern.cmj runtime/string.cmj -o runtime/primitive_hash.cmi : cc runtime/primitive_hash.resi | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_object.cmi -o runtime/primitive_lazy.cmj : cc_cmi runtime/primitive_lazy.res | runtime/primitive_exceptions.cmj runtime/primitive_lazy.cmi -o runtime/primitive_lazy.cmi : cc runtime/primitive_lazy.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_module.cmj : cc_cmi runtime/primitive_module.res | runtime/array.cmj runtime/lazy.cmj runtime/obj.cmj runtime/primitive_array_extern.cmj runtime/primitive_module.cmi runtime/primitive_object_extern.cmj -o runtime/primitive_module.cmi : cc runtime/primitive_module.resi | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_object.cmi -o runtime/primitive_object.cmj : cc_cmi runtime/primitive_object.res | runtime/array.cmj runtime/primitive_array_extern.cmj runtime/primitive_bool.cmj runtime/primitive_float.cmj runtime/primitive_int.cmj runtime/primitive_js_extern.cmj runtime/primitive_object.cmi runtime/primitive_object_extern.cmj runtime/primitive_option.cmj runtime/primitive_string.cmj -o runtime/primitive_object.cmi : cc runtime/primitive_object.resi | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_object_extern.cmj -o runtime/primitive_option.cmj : cc_cmi runtime/primitive_option.res | runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmj runtime/primitive_option.cmi -o runtime/primitive_option.cmi : cc runtime/primitive_option.resi | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmj -o runtime/string.cmj : cc_cmi runtime/string.res | runtime/array.cmj runtime/char.cmj runtime/primitive_exceptions.cmj runtime/primitive_string_extern.cmj runtime/string.cmi -o runtime/string.cmi : cc runtime/string.resi | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/map.cmi runtime/map.cmj : cc runtime/map.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/obj.cmi runtime/obj.cmj : cc runtime/obj.res | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_object_extern.cmj -o runtime/primitive_array.cmi runtime/primitive_array.cmj : cc runtime/primitive_array.res | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_array_extern.cmj -o runtime/primitive_array_extern.cmi runtime/primitive_array_extern.cmj : cc runtime/primitive_array_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_bigint.cmi runtime/primitive_bigint.cmj : cc runtime/primitive_bigint.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_bool.cmi runtime/primitive_bool.cmj : cc runtime/primitive_bool.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_char_extern.cmi runtime/primitive_char_extern.cmj : cc runtime/primitive_char_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_dict.cmi runtime/primitive_dict.cmj : cc runtime/primitive_dict.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_float.cmi runtime/primitive_float.cmj : cc runtime/primitive_float.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_float_extern.cmi runtime/primitive_float_extern.cmj : cc runtime/primitive_float_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_int.cmi runtime/primitive_int.cmj : cc runtime/primitive_int.res | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_int_extern.cmj -o runtime/primitive_int_extern.cmi runtime/primitive_int_extern.cmj : cc runtime/primitive_int_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_js_extern.cmi runtime/primitive_js_extern.cmj : cc runtime/primitive_js_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_object_extern.cmi runtime/primitive_object_extern.cmj : cc runtime/primitive_object_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_promise.cmi runtime/primitive_promise.cmj : cc runtime/primitive_promise.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_string.cmi runtime/primitive_string.cmj : cc runtime/primitive_string.res | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_string_extern.cmj -o runtime/primitive_string_extern.cmi runtime/primitive_string_extern.cmj : cc runtime/primitive_string_extern.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime/primitive_util.cmi runtime/primitive_util.cmj : cc runtime/primitive_util.res | runtime/pervasives.cmi runtime/pervasives.cmj runtime/primitive_js_extern.cmj -o runtime/set.cmi runtime/set.cmj : cc runtime/set.res | runtime/pervasives.cmi runtime/pervasives.cmj -o runtime : phony runtime/pervasives.cmj runtime/pervasives.cmi runtime/array.cmi runtime/array.cmj runtime/char.cmi runtime/char.cmj runtime/hashtbl.cmi runtime/hashtbl.cmj runtime/lazy.cmi runtime/lazy.cmj runtime/list.cmi runtime/list.cmj runtime/primitive_curry.cmi runtime/primitive_curry.cmj runtime/primitive_exceptions.cmi runtime/primitive_exceptions.cmj runtime/primitive_hash.cmi runtime/primitive_hash.cmj runtime/primitive_lazy.cmi runtime/primitive_lazy.cmj runtime/primitive_module.cmi runtime/primitive_module.cmj runtime/primitive_object.cmi runtime/primitive_object.cmj runtime/primitive_option.cmi runtime/primitive_option.cmj runtime/string.cmi runtime/string.cmj runtime/map.cmi runtime/map.cmj runtime/obj.cmi runtime/obj.cmj runtime/primitive_array.cmi runtime/primitive_array.cmj runtime/primitive_array_extern.cmi runtime/primitive_array_extern.cmj runtime/primitive_bigint.cmi runtime/primitive_bigint.cmj runtime/primitive_bool.cmi runtime/primitive_bool.cmj runtime/primitive_char_extern.cmi runtime/primitive_char_extern.cmj runtime/primitive_dict.cmi runtime/primitive_dict.cmj runtime/primitive_float.cmi runtime/primitive_float.cmj runtime/primitive_float_extern.cmi runtime/primitive_float_extern.cmj runtime/primitive_int.cmi runtime/primitive_int.cmj runtime/primitive_int_extern.cmi runtime/primitive_int_extern.cmj runtime/primitive_js_extern.cmi runtime/primitive_js_extern.cmj runtime/primitive_object_extern.cmi runtime/primitive_object_extern.cmj runtime/primitive_promise.cmi runtime/primitive_promise.cmj runtime/primitive_string.cmi runtime/primitive_string.cmj runtime/primitive_string_extern.cmi runtime/primitive_string_extern.cmj runtime/primitive_util.cmi runtime/primitive_util.cmj runtime/set.cmi runtime/set.cmj diff --git a/runtime/.gitignore b/runtime/.gitignore new file mode 100644 index 0000000000..c3af857904 --- /dev/null +++ b/runtime/.gitignore @@ -0,0 +1 @@ +lib/ diff --git a/jscomp/runtime/array.res b/runtime/array.res similarity index 100% rename from jscomp/runtime/array.res rename to runtime/array.res diff --git a/jscomp/runtime/array.resi b/runtime/array.resi similarity index 100% rename from jscomp/runtime/array.resi rename to runtime/array.resi diff --git a/jscomp/others/belt.res b/runtime/belt.res similarity index 100% rename from jscomp/others/belt.res rename to runtime/belt.res diff --git a/jscomp/others/belt_Array.res b/runtime/belt_Array.res similarity index 100% rename from jscomp/others/belt_Array.res rename to runtime/belt_Array.res diff --git a/jscomp/others/belt_Array.resi b/runtime/belt_Array.resi similarity index 100% rename from jscomp/others/belt_Array.resi rename to runtime/belt_Array.resi diff --git a/jscomp/others/belt_Float.res b/runtime/belt_Float.res similarity index 100% rename from jscomp/others/belt_Float.res rename to runtime/belt_Float.res diff --git a/jscomp/others/belt_Float.resi b/runtime/belt_Float.resi similarity index 100% rename from jscomp/others/belt_Float.resi rename to runtime/belt_Float.resi diff --git a/jscomp/others/belt_HashMap.res b/runtime/belt_HashMap.res similarity index 100% rename from jscomp/others/belt_HashMap.res rename to runtime/belt_HashMap.res diff --git a/jscomp/others/belt_HashMap.resi b/runtime/belt_HashMap.resi similarity index 100% rename from jscomp/others/belt_HashMap.resi rename to runtime/belt_HashMap.resi diff --git a/jscomp/others/belt_HashMapInt.res b/runtime/belt_HashMapInt.res similarity index 100% rename from jscomp/others/belt_HashMapInt.res rename to runtime/belt_HashMapInt.res diff --git a/jscomp/others/belt_HashMapInt.resi b/runtime/belt_HashMapInt.resi similarity index 100% rename from jscomp/others/belt_HashMapInt.resi rename to runtime/belt_HashMapInt.resi diff --git a/jscomp/others/belt_HashMapString.res b/runtime/belt_HashMapString.res similarity index 100% rename from jscomp/others/belt_HashMapString.res rename to runtime/belt_HashMapString.res diff --git a/jscomp/others/belt_HashMapString.resi b/runtime/belt_HashMapString.resi similarity index 100% rename from jscomp/others/belt_HashMapString.resi rename to runtime/belt_HashMapString.resi diff --git a/jscomp/others/belt_HashSet.res b/runtime/belt_HashSet.res similarity index 100% rename from jscomp/others/belt_HashSet.res rename to runtime/belt_HashSet.res diff --git a/jscomp/others/belt_HashSet.resi b/runtime/belt_HashSet.resi similarity index 100% rename from jscomp/others/belt_HashSet.resi rename to runtime/belt_HashSet.resi diff --git a/jscomp/others/belt_HashSetInt.res b/runtime/belt_HashSetInt.res similarity index 100% rename from jscomp/others/belt_HashSetInt.res rename to runtime/belt_HashSetInt.res diff --git a/jscomp/others/belt_HashSetInt.resi b/runtime/belt_HashSetInt.resi similarity index 100% rename from jscomp/others/belt_HashSetInt.resi rename to runtime/belt_HashSetInt.resi diff --git a/jscomp/others/belt_HashSetString.res b/runtime/belt_HashSetString.res similarity index 100% rename from jscomp/others/belt_HashSetString.res rename to runtime/belt_HashSetString.res diff --git a/jscomp/others/belt_HashSetString.resi b/runtime/belt_HashSetString.resi similarity index 100% rename from jscomp/others/belt_HashSetString.resi rename to runtime/belt_HashSetString.resi diff --git a/jscomp/others/belt_Id.res b/runtime/belt_Id.res similarity index 100% rename from jscomp/others/belt_Id.res rename to runtime/belt_Id.res diff --git a/jscomp/others/belt_Id.resi b/runtime/belt_Id.resi similarity index 100% rename from jscomp/others/belt_Id.resi rename to runtime/belt_Id.resi diff --git a/jscomp/others/belt_Int.res b/runtime/belt_Int.res similarity index 100% rename from jscomp/others/belt_Int.res rename to runtime/belt_Int.res diff --git a/jscomp/others/belt_Int.resi b/runtime/belt_Int.resi similarity index 100% rename from jscomp/others/belt_Int.resi rename to runtime/belt_Int.resi diff --git a/jscomp/others/belt_List.res b/runtime/belt_List.res similarity index 100% rename from jscomp/others/belt_List.res rename to runtime/belt_List.res diff --git a/jscomp/others/belt_List.resi b/runtime/belt_List.resi similarity index 100% rename from jscomp/others/belt_List.resi rename to runtime/belt_List.resi diff --git a/jscomp/others/belt_Map.res b/runtime/belt_Map.res similarity index 100% rename from jscomp/others/belt_Map.res rename to runtime/belt_Map.res diff --git a/jscomp/others/belt_Map.resi b/runtime/belt_Map.resi similarity index 100% rename from jscomp/others/belt_Map.resi rename to runtime/belt_Map.resi diff --git a/jscomp/others/belt_MapDict.res b/runtime/belt_MapDict.res similarity index 100% rename from jscomp/others/belt_MapDict.res rename to runtime/belt_MapDict.res diff --git a/jscomp/others/belt_MapDict.resi b/runtime/belt_MapDict.resi similarity index 100% rename from jscomp/others/belt_MapDict.resi rename to runtime/belt_MapDict.resi diff --git a/jscomp/others/belt_MapInt.res b/runtime/belt_MapInt.res similarity index 100% rename from jscomp/others/belt_MapInt.res rename to runtime/belt_MapInt.res diff --git a/jscomp/others/belt_MapInt.resi b/runtime/belt_MapInt.resi similarity index 100% rename from jscomp/others/belt_MapInt.resi rename to runtime/belt_MapInt.resi diff --git a/jscomp/others/belt_MapString.res b/runtime/belt_MapString.res similarity index 100% rename from jscomp/others/belt_MapString.res rename to runtime/belt_MapString.res diff --git a/jscomp/others/belt_MapString.resi b/runtime/belt_MapString.resi similarity index 100% rename from jscomp/others/belt_MapString.resi rename to runtime/belt_MapString.resi diff --git a/jscomp/others/belt_MutableMap.res b/runtime/belt_MutableMap.res similarity index 100% rename from jscomp/others/belt_MutableMap.res rename to runtime/belt_MutableMap.res diff --git a/jscomp/others/belt_MutableMap.resi b/runtime/belt_MutableMap.resi similarity index 100% rename from jscomp/others/belt_MutableMap.resi rename to runtime/belt_MutableMap.resi diff --git a/jscomp/others/belt_MutableMapInt.res b/runtime/belt_MutableMapInt.res similarity index 100% rename from jscomp/others/belt_MutableMapInt.res rename to runtime/belt_MutableMapInt.res diff --git a/jscomp/others/belt_MutableMapInt.resi b/runtime/belt_MutableMapInt.resi similarity index 100% rename from jscomp/others/belt_MutableMapInt.resi rename to runtime/belt_MutableMapInt.resi diff --git a/jscomp/others/belt_MutableMapString.res b/runtime/belt_MutableMapString.res similarity index 100% rename from jscomp/others/belt_MutableMapString.res rename to runtime/belt_MutableMapString.res diff --git a/jscomp/others/belt_MutableMapString.resi b/runtime/belt_MutableMapString.resi similarity index 100% rename from jscomp/others/belt_MutableMapString.resi rename to runtime/belt_MutableMapString.resi diff --git a/jscomp/others/belt_MutableQueue.res b/runtime/belt_MutableQueue.res similarity index 100% rename from jscomp/others/belt_MutableQueue.res rename to runtime/belt_MutableQueue.res diff --git a/jscomp/others/belt_MutableQueue.resi b/runtime/belt_MutableQueue.resi similarity index 100% rename from jscomp/others/belt_MutableQueue.resi rename to runtime/belt_MutableQueue.resi diff --git a/jscomp/others/belt_MutableSet.res b/runtime/belt_MutableSet.res similarity index 100% rename from jscomp/others/belt_MutableSet.res rename to runtime/belt_MutableSet.res diff --git a/jscomp/others/belt_MutableSet.resi b/runtime/belt_MutableSet.resi similarity index 100% rename from jscomp/others/belt_MutableSet.resi rename to runtime/belt_MutableSet.resi diff --git a/jscomp/others/belt_MutableSetInt.res b/runtime/belt_MutableSetInt.res similarity index 100% rename from jscomp/others/belt_MutableSetInt.res rename to runtime/belt_MutableSetInt.res diff --git a/jscomp/others/belt_MutableSetInt.resi b/runtime/belt_MutableSetInt.resi similarity index 100% rename from jscomp/others/belt_MutableSetInt.resi rename to runtime/belt_MutableSetInt.resi diff --git a/jscomp/others/belt_MutableSetString.res b/runtime/belt_MutableSetString.res similarity index 100% rename from jscomp/others/belt_MutableSetString.res rename to runtime/belt_MutableSetString.res diff --git a/jscomp/others/belt_MutableSetString.resi b/runtime/belt_MutableSetString.resi similarity index 100% rename from jscomp/others/belt_MutableSetString.resi rename to runtime/belt_MutableSetString.resi diff --git a/jscomp/others/belt_MutableStack.res b/runtime/belt_MutableStack.res similarity index 100% rename from jscomp/others/belt_MutableStack.res rename to runtime/belt_MutableStack.res diff --git a/jscomp/others/belt_MutableStack.resi b/runtime/belt_MutableStack.resi similarity index 100% rename from jscomp/others/belt_MutableStack.resi rename to runtime/belt_MutableStack.resi diff --git a/jscomp/others/belt_Option.res b/runtime/belt_Option.res similarity index 100% rename from jscomp/others/belt_Option.res rename to runtime/belt_Option.res diff --git a/jscomp/others/belt_Option.resi b/runtime/belt_Option.resi similarity index 100% rename from jscomp/others/belt_Option.resi rename to runtime/belt_Option.resi diff --git a/jscomp/others/belt_Range.res b/runtime/belt_Range.res similarity index 100% rename from jscomp/others/belt_Range.res rename to runtime/belt_Range.res diff --git a/jscomp/others/belt_Range.resi b/runtime/belt_Range.resi similarity index 100% rename from jscomp/others/belt_Range.resi rename to runtime/belt_Range.resi diff --git a/jscomp/others/belt_Result.res b/runtime/belt_Result.res similarity index 100% rename from jscomp/others/belt_Result.res rename to runtime/belt_Result.res diff --git a/jscomp/others/belt_Result.resi b/runtime/belt_Result.resi similarity index 100% rename from jscomp/others/belt_Result.resi rename to runtime/belt_Result.resi diff --git a/jscomp/others/belt_Set.res b/runtime/belt_Set.res similarity index 100% rename from jscomp/others/belt_Set.res rename to runtime/belt_Set.res diff --git a/jscomp/others/belt_Set.resi b/runtime/belt_Set.resi similarity index 100% rename from jscomp/others/belt_Set.resi rename to runtime/belt_Set.resi diff --git a/jscomp/others/belt_SetDict.res b/runtime/belt_SetDict.res similarity index 100% rename from jscomp/others/belt_SetDict.res rename to runtime/belt_SetDict.res diff --git a/jscomp/others/belt_SetDict.resi b/runtime/belt_SetDict.resi similarity index 100% rename from jscomp/others/belt_SetDict.resi rename to runtime/belt_SetDict.resi diff --git a/jscomp/others/belt_SetInt.res b/runtime/belt_SetInt.res similarity index 100% rename from jscomp/others/belt_SetInt.res rename to runtime/belt_SetInt.res diff --git a/jscomp/others/belt_SetInt.resi b/runtime/belt_SetInt.resi similarity index 100% rename from jscomp/others/belt_SetInt.resi rename to runtime/belt_SetInt.resi diff --git a/jscomp/others/belt_SetString.res b/runtime/belt_SetString.res similarity index 100% rename from jscomp/others/belt_SetString.res rename to runtime/belt_SetString.res diff --git a/jscomp/others/belt_SetString.resi b/runtime/belt_SetString.resi similarity index 100% rename from jscomp/others/belt_SetString.resi rename to runtime/belt_SetString.resi diff --git a/jscomp/others/belt_SortArray.res b/runtime/belt_SortArray.res similarity index 100% rename from jscomp/others/belt_SortArray.res rename to runtime/belt_SortArray.res diff --git a/jscomp/others/belt_SortArray.resi b/runtime/belt_SortArray.resi similarity index 100% rename from jscomp/others/belt_SortArray.resi rename to runtime/belt_SortArray.resi diff --git a/jscomp/others/belt_SortArrayInt.res b/runtime/belt_SortArrayInt.res similarity index 100% rename from jscomp/others/belt_SortArrayInt.res rename to runtime/belt_SortArrayInt.res diff --git a/jscomp/others/belt_SortArrayInt.resi b/runtime/belt_SortArrayInt.resi similarity index 100% rename from jscomp/others/belt_SortArrayInt.resi rename to runtime/belt_SortArrayInt.resi diff --git a/jscomp/others/belt_SortArrayString.res b/runtime/belt_SortArrayString.res similarity index 100% rename from jscomp/others/belt_SortArrayString.res rename to runtime/belt_SortArrayString.res diff --git a/jscomp/others/belt_SortArrayString.resi b/runtime/belt_SortArrayString.resi similarity index 100% rename from jscomp/others/belt_SortArrayString.resi rename to runtime/belt_SortArrayString.resi diff --git a/jscomp/others/belt_internalAVLset.res b/runtime/belt_internalAVLset.res similarity index 100% rename from jscomp/others/belt_internalAVLset.res rename to runtime/belt_internalAVLset.res diff --git a/jscomp/others/belt_internalAVLset.resi b/runtime/belt_internalAVLset.resi similarity index 100% rename from jscomp/others/belt_internalAVLset.resi rename to runtime/belt_internalAVLset.resi diff --git a/jscomp/others/belt_internalAVLtree.res b/runtime/belt_internalAVLtree.res similarity index 100% rename from jscomp/others/belt_internalAVLtree.res rename to runtime/belt_internalAVLtree.res diff --git a/jscomp/others/belt_internalAVLtree.resi b/runtime/belt_internalAVLtree.resi similarity index 100% rename from jscomp/others/belt_internalAVLtree.resi rename to runtime/belt_internalAVLtree.resi diff --git a/jscomp/others/belt_internalBuckets.res b/runtime/belt_internalBuckets.res similarity index 100% rename from jscomp/others/belt_internalBuckets.res rename to runtime/belt_internalBuckets.res diff --git a/jscomp/others/belt_internalBuckets.resi b/runtime/belt_internalBuckets.resi similarity index 100% rename from jscomp/others/belt_internalBuckets.resi rename to runtime/belt_internalBuckets.resi diff --git a/jscomp/others/belt_internalBucketsType.res b/runtime/belt_internalBucketsType.res similarity index 100% rename from jscomp/others/belt_internalBucketsType.res rename to runtime/belt_internalBucketsType.res diff --git a/jscomp/others/belt_internalBucketsType.resi b/runtime/belt_internalBucketsType.resi similarity index 100% rename from jscomp/others/belt_internalBucketsType.resi rename to runtime/belt_internalBucketsType.resi diff --git a/jscomp/others/belt_internalMapInt.res b/runtime/belt_internalMapInt.res similarity index 100% rename from jscomp/others/belt_internalMapInt.res rename to runtime/belt_internalMapInt.res diff --git a/jscomp/others/belt_internalMapString.res b/runtime/belt_internalMapString.res similarity index 100% rename from jscomp/others/belt_internalMapString.res rename to runtime/belt_internalMapString.res diff --git a/jscomp/others/belt_internalSetBuckets.res b/runtime/belt_internalSetBuckets.res similarity index 100% rename from jscomp/others/belt_internalSetBuckets.res rename to runtime/belt_internalSetBuckets.res diff --git a/jscomp/others/belt_internalSetBuckets.resi b/runtime/belt_internalSetBuckets.resi similarity index 100% rename from jscomp/others/belt_internalSetBuckets.resi rename to runtime/belt_internalSetBuckets.resi diff --git a/jscomp/others/belt_internalSetInt.res b/runtime/belt_internalSetInt.res similarity index 100% rename from jscomp/others/belt_internalSetInt.res rename to runtime/belt_internalSetInt.res diff --git a/jscomp/others/belt_internalSetString.res b/runtime/belt_internalSetString.res similarity index 100% rename from jscomp/others/belt_internalSetString.res rename to runtime/belt_internalSetString.res diff --git a/jscomp/runtime/char.res b/runtime/char.res similarity index 100% rename from jscomp/runtime/char.res rename to runtime/char.res diff --git a/jscomp/runtime/char.resi b/runtime/char.resi similarity index 100% rename from jscomp/runtime/char.resi rename to runtime/char.resi diff --git a/jscomp/others/dom.res b/runtime/dom.res similarity index 100% rename from jscomp/others/dom.res rename to runtime/dom.res diff --git a/jscomp/others/dom_storage.res b/runtime/dom_storage.res similarity index 100% rename from jscomp/others/dom_storage.res rename to runtime/dom_storage.res diff --git a/jscomp/others/dom_storage2.res b/runtime/dom_storage2.res similarity index 100% rename from jscomp/others/dom_storage2.res rename to runtime/dom_storage2.res diff --git a/jscomp/runtime/hashtbl.res b/runtime/hashtbl.res similarity index 100% rename from jscomp/runtime/hashtbl.res rename to runtime/hashtbl.res diff --git a/jscomp/runtime/hashtbl.resi b/runtime/hashtbl.resi similarity index 100% rename from jscomp/runtime/hashtbl.resi rename to runtime/hashtbl.resi diff --git a/jscomp/others/js.res b/runtime/js.res similarity index 100% rename from jscomp/others/js.res rename to runtime/js.res diff --git a/jscomp/others/js_OO.res b/runtime/js_OO.res similarity index 100% rename from jscomp/others/js_OO.res rename to runtime/js_OO.res diff --git a/jscomp/others/js_array.res b/runtime/js_array.res similarity index 100% rename from jscomp/others/js_array.res rename to runtime/js_array.res diff --git a/jscomp/others/js_array2.res b/runtime/js_array2.res similarity index 100% rename from jscomp/others/js_array2.res rename to runtime/js_array2.res diff --git a/jscomp/others/js_bigint.res b/runtime/js_bigint.res similarity index 100% rename from jscomp/others/js_bigint.res rename to runtime/js_bigint.res diff --git a/jscomp/others/js_blob.res b/runtime/js_blob.res similarity index 100% rename from jscomp/others/js_blob.res rename to runtime/js_blob.res diff --git a/jscomp/others/js_cast.res b/runtime/js_cast.res similarity index 100% rename from jscomp/others/js_cast.res rename to runtime/js_cast.res diff --git a/jscomp/others/js_cast.resi b/runtime/js_cast.resi similarity index 100% rename from jscomp/others/js_cast.resi rename to runtime/js_cast.resi diff --git a/jscomp/others/js_console.res b/runtime/js_console.res similarity index 100% rename from jscomp/others/js_console.res rename to runtime/js_console.res diff --git a/jscomp/others/js_date.res b/runtime/js_date.res similarity index 100% rename from jscomp/others/js_date.res rename to runtime/js_date.res diff --git a/jscomp/others/js_dict.res b/runtime/js_dict.res similarity index 100% rename from jscomp/others/js_dict.res rename to runtime/js_dict.res diff --git a/jscomp/others/js_dict.resi b/runtime/js_dict.resi similarity index 100% rename from jscomp/others/js_dict.resi rename to runtime/js_dict.resi diff --git a/jscomp/others/js_exn.res b/runtime/js_exn.res similarity index 100% rename from jscomp/others/js_exn.res rename to runtime/js_exn.res diff --git a/jscomp/others/js_exn.resi b/runtime/js_exn.resi similarity index 100% rename from jscomp/others/js_exn.resi rename to runtime/js_exn.resi diff --git a/jscomp/others/js_extern.res b/runtime/js_extern.res similarity index 100% rename from jscomp/others/js_extern.res rename to runtime/js_extern.res diff --git a/jscomp/others/js_file.res b/runtime/js_file.res similarity index 100% rename from jscomp/others/js_file.res rename to runtime/js_file.res diff --git a/jscomp/others/js_float.res b/runtime/js_float.res similarity index 100% rename from jscomp/others/js_float.res rename to runtime/js_float.res diff --git a/jscomp/others/js_global.res b/runtime/js_global.res similarity index 100% rename from jscomp/others/js_global.res rename to runtime/js_global.res diff --git a/jscomp/others/js_int.res b/runtime/js_int.res similarity index 100% rename from jscomp/others/js_int.res rename to runtime/js_int.res diff --git a/jscomp/others/js_json.res b/runtime/js_json.res similarity index 100% rename from jscomp/others/js_json.res rename to runtime/js_json.res diff --git a/jscomp/others/js_json.resi b/runtime/js_json.resi similarity index 100% rename from jscomp/others/js_json.resi rename to runtime/js_json.resi diff --git a/jscomp/others/js_map.res b/runtime/js_map.res similarity index 100% rename from jscomp/others/js_map.res rename to runtime/js_map.res diff --git a/jscomp/others/js_math.res b/runtime/js_math.res similarity index 100% rename from jscomp/others/js_math.res rename to runtime/js_math.res diff --git a/jscomp/others/js_null.res b/runtime/js_null.res similarity index 100% rename from jscomp/others/js_null.res rename to runtime/js_null.res diff --git a/jscomp/others/js_null.resi b/runtime/js_null.resi similarity index 100% rename from jscomp/others/js_null.resi rename to runtime/js_null.resi diff --git a/jscomp/others/js_null_undefined.res b/runtime/js_null_undefined.res similarity index 100% rename from jscomp/others/js_null_undefined.res rename to runtime/js_null_undefined.res diff --git a/jscomp/others/js_null_undefined.resi b/runtime/js_null_undefined.resi similarity index 100% rename from jscomp/others/js_null_undefined.resi rename to runtime/js_null_undefined.resi diff --git a/jscomp/others/js_obj.res b/runtime/js_obj.res similarity index 100% rename from jscomp/others/js_obj.res rename to runtime/js_obj.res diff --git a/jscomp/others/js_option.res b/runtime/js_option.res similarity index 100% rename from jscomp/others/js_option.res rename to runtime/js_option.res diff --git a/jscomp/others/js_option.resi b/runtime/js_option.resi similarity index 100% rename from jscomp/others/js_option.resi rename to runtime/js_option.resi diff --git a/jscomp/others/js_promise.res b/runtime/js_promise.res similarity index 100% rename from jscomp/others/js_promise.res rename to runtime/js_promise.res diff --git a/jscomp/others/js_promise2.res b/runtime/js_promise2.res similarity index 100% rename from jscomp/others/js_promise2.res rename to runtime/js_promise2.res diff --git a/jscomp/others/js_re.res b/runtime/js_re.res similarity index 100% rename from jscomp/others/js_re.res rename to runtime/js_re.res diff --git a/jscomp/others/js_result.res b/runtime/js_result.res similarity index 100% rename from jscomp/others/js_result.res rename to runtime/js_result.res diff --git a/jscomp/others/js_result.resi b/runtime/js_result.resi similarity index 100% rename from jscomp/others/js_result.resi rename to runtime/js_result.resi diff --git a/jscomp/others/js_set.res b/runtime/js_set.res similarity index 100% rename from jscomp/others/js_set.res rename to runtime/js_set.res diff --git a/jscomp/others/js_string.res b/runtime/js_string.res similarity index 100% rename from jscomp/others/js_string.res rename to runtime/js_string.res diff --git a/jscomp/others/js_string2.res b/runtime/js_string2.res similarity index 100% rename from jscomp/others/js_string2.res rename to runtime/js_string2.res diff --git a/jscomp/others/js_typed_array.res b/runtime/js_typed_array.res similarity index 100% rename from jscomp/others/js_typed_array.res rename to runtime/js_typed_array.res diff --git a/jscomp/others/js_typed_array2.res b/runtime/js_typed_array2.res similarity index 100% rename from jscomp/others/js_typed_array2.res rename to runtime/js_typed_array2.res diff --git a/jscomp/others/js_types.res b/runtime/js_types.res similarity index 100% rename from jscomp/others/js_types.res rename to runtime/js_types.res diff --git a/jscomp/others/js_types.resi b/runtime/js_types.resi similarity index 100% rename from jscomp/others/js_types.resi rename to runtime/js_types.resi diff --git a/jscomp/others/js_undefined.res b/runtime/js_undefined.res similarity index 100% rename from jscomp/others/js_undefined.res rename to runtime/js_undefined.res diff --git a/jscomp/others/js_undefined.resi b/runtime/js_undefined.resi similarity index 100% rename from jscomp/others/js_undefined.resi rename to runtime/js_undefined.resi diff --git a/jscomp/others/js_weakmap.res b/runtime/js_weakmap.res similarity index 100% rename from jscomp/others/js_weakmap.res rename to runtime/js_weakmap.res diff --git a/jscomp/others/js_weakset.res b/runtime/js_weakset.res similarity index 100% rename from jscomp/others/js_weakset.res rename to runtime/js_weakset.res diff --git a/jscomp/others/jsx.res b/runtime/jsx.res similarity index 100% rename from jscomp/others/jsx.res rename to runtime/jsx.res diff --git a/jscomp/others/jsxDOM.res b/runtime/jsxDOM.res similarity index 100% rename from jscomp/others/jsxDOM.res rename to runtime/jsxDOM.res diff --git a/jscomp/others/jsxDOMStyle.res b/runtime/jsxDOMStyle.res similarity index 100% rename from jscomp/others/jsxDOMStyle.res rename to runtime/jsxDOMStyle.res diff --git a/jscomp/others/jsxEvent.res b/runtime/jsxEvent.res similarity index 100% rename from jscomp/others/jsxEvent.res rename to runtime/jsxEvent.res diff --git a/jscomp/others/jsxPPXReactSupport.res b/runtime/jsxPPXReactSupport.res similarity index 100% rename from jscomp/others/jsxPPXReactSupport.res rename to runtime/jsxPPXReactSupport.res diff --git a/jscomp/runtime/lazy.res b/runtime/lazy.res similarity index 100% rename from jscomp/runtime/lazy.res rename to runtime/lazy.res diff --git a/jscomp/runtime/lazy.resi b/runtime/lazy.resi similarity index 100% rename from jscomp/runtime/lazy.resi rename to runtime/lazy.resi diff --git a/jscomp/runtime/list.res b/runtime/list.res similarity index 100% rename from jscomp/runtime/list.res rename to runtime/list.res diff --git a/jscomp/runtime/list.resi b/runtime/list.resi similarity index 100% rename from jscomp/runtime/list.resi rename to runtime/list.resi diff --git a/jscomp/runtime/map.res b/runtime/map.res similarity index 100% rename from jscomp/runtime/map.res rename to runtime/map.res diff --git a/jscomp/runtime/obj.res b/runtime/obj.res similarity index 100% rename from jscomp/runtime/obj.res rename to runtime/obj.res diff --git a/jscomp/others_cppo/belt_Set.cppo.res b/runtime/others_cppo/belt_Set.cppo.res similarity index 100% rename from jscomp/others_cppo/belt_Set.cppo.res rename to runtime/others_cppo/belt_Set.cppo.res diff --git a/jscomp/others_cppo/belt_Set.cppo.resi b/runtime/others_cppo/belt_Set.cppo.resi similarity index 100% rename from jscomp/others_cppo/belt_Set.cppo.resi rename to runtime/others_cppo/belt_Set.cppo.resi diff --git a/jscomp/others_cppo/hashmap.cppo.res b/runtime/others_cppo/hashmap.cppo.res similarity index 100% rename from jscomp/others_cppo/hashmap.cppo.res rename to runtime/others_cppo/hashmap.cppo.res diff --git a/jscomp/others_cppo/hashmap.cppo.resi b/runtime/others_cppo/hashmap.cppo.resi similarity index 100% rename from jscomp/others_cppo/hashmap.cppo.resi rename to runtime/others_cppo/hashmap.cppo.resi diff --git a/jscomp/others_cppo/hashset.cppo.res b/runtime/others_cppo/hashset.cppo.res similarity index 100% rename from jscomp/others_cppo/hashset.cppo.res rename to runtime/others_cppo/hashset.cppo.res diff --git a/jscomp/others_cppo/hashset.cppo.resi b/runtime/others_cppo/hashset.cppo.resi similarity index 100% rename from jscomp/others_cppo/hashset.cppo.resi rename to runtime/others_cppo/hashset.cppo.resi diff --git a/jscomp/others_cppo/internal_map.cppo.res b/runtime/others_cppo/internal_map.cppo.res similarity index 100% rename from jscomp/others_cppo/internal_map.cppo.res rename to runtime/others_cppo/internal_map.cppo.res diff --git a/jscomp/others_cppo/internal_set.cppo.res b/runtime/others_cppo/internal_set.cppo.res similarity index 100% rename from jscomp/others_cppo/internal_set.cppo.res rename to runtime/others_cppo/internal_set.cppo.res diff --git a/jscomp/others_cppo/map.cppo.res b/runtime/others_cppo/map.cppo.res similarity index 100% rename from jscomp/others_cppo/map.cppo.res rename to runtime/others_cppo/map.cppo.res diff --git a/jscomp/others_cppo/map.cppo.resi b/runtime/others_cppo/map.cppo.resi similarity index 100% rename from jscomp/others_cppo/map.cppo.resi rename to runtime/others_cppo/map.cppo.resi diff --git a/jscomp/others_cppo/mapm.cppo.res b/runtime/others_cppo/mapm.cppo.res similarity index 100% rename from jscomp/others_cppo/mapm.cppo.res rename to runtime/others_cppo/mapm.cppo.res diff --git a/jscomp/others_cppo/mapm.cppo.resi b/runtime/others_cppo/mapm.cppo.resi similarity index 100% rename from jscomp/others_cppo/mapm.cppo.resi rename to runtime/others_cppo/mapm.cppo.resi diff --git a/jscomp/others_cppo/setm.cppo.res b/runtime/others_cppo/setm.cppo.res similarity index 100% rename from jscomp/others_cppo/setm.cppo.res rename to runtime/others_cppo/setm.cppo.res diff --git a/jscomp/others_cppo/setm.cppo.resi b/runtime/others_cppo/setm.cppo.resi similarity index 100% rename from jscomp/others_cppo/setm.cppo.resi rename to runtime/others_cppo/setm.cppo.resi diff --git a/jscomp/others_cppo/sort.cppo.res b/runtime/others_cppo/sort.cppo.res similarity index 100% rename from jscomp/others_cppo/sort.cppo.res rename to runtime/others_cppo/sort.cppo.res diff --git a/jscomp/others_cppo/sort.cppo.resi b/runtime/others_cppo/sort.cppo.resi similarity index 100% rename from jscomp/others_cppo/sort.cppo.resi rename to runtime/others_cppo/sort.cppo.resi diff --git a/runtime/package.json b/runtime/package.json new file mode 100644 index 0000000000..431e023703 --- /dev/null +++ b/runtime/package.json @@ -0,0 +1,5 @@ +{ + "name": "rescript-runtime", + "version": "0.0.0", + "private": true +} \ No newline at end of file diff --git a/jscomp/runtime/pervasives.res b/runtime/pervasives.res similarity index 100% rename from jscomp/runtime/pervasives.res rename to runtime/pervasives.res diff --git a/jscomp/runtime/primitive_array.res b/runtime/primitive_array.res similarity index 100% rename from jscomp/runtime/primitive_array.res rename to runtime/primitive_array.res diff --git a/jscomp/runtime/primitive_array_extern.res b/runtime/primitive_array_extern.res similarity index 100% rename from jscomp/runtime/primitive_array_extern.res rename to runtime/primitive_array_extern.res diff --git a/jscomp/runtime/primitive_bigint.res b/runtime/primitive_bigint.res similarity index 100% rename from jscomp/runtime/primitive_bigint.res rename to runtime/primitive_bigint.res diff --git a/jscomp/runtime/primitive_bool.res b/runtime/primitive_bool.res similarity index 100% rename from jscomp/runtime/primitive_bool.res rename to runtime/primitive_bool.res diff --git a/jscomp/runtime/primitive_char_extern.res b/runtime/primitive_char_extern.res similarity index 100% rename from jscomp/runtime/primitive_char_extern.res rename to runtime/primitive_char_extern.res diff --git a/jscomp/runtime/primitive_curry.res b/runtime/primitive_curry.res similarity index 100% rename from jscomp/runtime/primitive_curry.res rename to runtime/primitive_curry.res diff --git a/jscomp/runtime/primitive_curry.resi b/runtime/primitive_curry.resi similarity index 100% rename from jscomp/runtime/primitive_curry.resi rename to runtime/primitive_curry.resi diff --git a/jscomp/runtime/primitive_dict.res b/runtime/primitive_dict.res similarity index 100% rename from jscomp/runtime/primitive_dict.res rename to runtime/primitive_dict.res diff --git a/jscomp/runtime/primitive_exceptions.res b/runtime/primitive_exceptions.res similarity index 100% rename from jscomp/runtime/primitive_exceptions.res rename to runtime/primitive_exceptions.res diff --git a/jscomp/runtime/primitive_exceptions.resi b/runtime/primitive_exceptions.resi similarity index 100% rename from jscomp/runtime/primitive_exceptions.resi rename to runtime/primitive_exceptions.resi diff --git a/jscomp/runtime/primitive_float.res b/runtime/primitive_float.res similarity index 100% rename from jscomp/runtime/primitive_float.res rename to runtime/primitive_float.res diff --git a/jscomp/runtime/primitive_float_extern.res b/runtime/primitive_float_extern.res similarity index 100% rename from jscomp/runtime/primitive_float_extern.res rename to runtime/primitive_float_extern.res diff --git a/jscomp/runtime/primitive_hash.res b/runtime/primitive_hash.res similarity index 100% rename from jscomp/runtime/primitive_hash.res rename to runtime/primitive_hash.res diff --git a/jscomp/runtime/primitive_hash.resi b/runtime/primitive_hash.resi similarity index 100% rename from jscomp/runtime/primitive_hash.resi rename to runtime/primitive_hash.resi diff --git a/jscomp/runtime/primitive_int.res b/runtime/primitive_int.res similarity index 100% rename from jscomp/runtime/primitive_int.res rename to runtime/primitive_int.res diff --git a/jscomp/runtime/primitive_int_extern.res b/runtime/primitive_int_extern.res similarity index 100% rename from jscomp/runtime/primitive_int_extern.res rename to runtime/primitive_int_extern.res diff --git a/jscomp/runtime/primitive_js_extern.res b/runtime/primitive_js_extern.res similarity index 100% rename from jscomp/runtime/primitive_js_extern.res rename to runtime/primitive_js_extern.res diff --git a/jscomp/runtime/primitive_lazy.res b/runtime/primitive_lazy.res similarity index 100% rename from jscomp/runtime/primitive_lazy.res rename to runtime/primitive_lazy.res diff --git a/jscomp/runtime/primitive_lazy.resi b/runtime/primitive_lazy.resi similarity index 100% rename from jscomp/runtime/primitive_lazy.resi rename to runtime/primitive_lazy.resi diff --git a/jscomp/runtime/primitive_module.res b/runtime/primitive_module.res similarity index 100% rename from jscomp/runtime/primitive_module.res rename to runtime/primitive_module.res diff --git a/jscomp/runtime/primitive_module.resi b/runtime/primitive_module.resi similarity index 100% rename from jscomp/runtime/primitive_module.resi rename to runtime/primitive_module.resi diff --git a/jscomp/runtime/primitive_object.res b/runtime/primitive_object.res similarity index 100% rename from jscomp/runtime/primitive_object.res rename to runtime/primitive_object.res diff --git a/jscomp/runtime/primitive_object.resi b/runtime/primitive_object.resi similarity index 100% rename from jscomp/runtime/primitive_object.resi rename to runtime/primitive_object.resi diff --git a/jscomp/runtime/primitive_object_extern.res b/runtime/primitive_object_extern.res similarity index 100% rename from jscomp/runtime/primitive_object_extern.res rename to runtime/primitive_object_extern.res diff --git a/jscomp/runtime/primitive_option.res b/runtime/primitive_option.res similarity index 100% rename from jscomp/runtime/primitive_option.res rename to runtime/primitive_option.res diff --git a/jscomp/runtime/primitive_option.resi b/runtime/primitive_option.resi similarity index 100% rename from jscomp/runtime/primitive_option.resi rename to runtime/primitive_option.resi diff --git a/jscomp/runtime/primitive_promise.res b/runtime/primitive_promise.res similarity index 100% rename from jscomp/runtime/primitive_promise.res rename to runtime/primitive_promise.res diff --git a/jscomp/runtime/primitive_string.res b/runtime/primitive_string.res similarity index 100% rename from jscomp/runtime/primitive_string.res rename to runtime/primitive_string.res diff --git a/jscomp/runtime/primitive_string_extern.res b/runtime/primitive_string_extern.res similarity index 100% rename from jscomp/runtime/primitive_string_extern.res rename to runtime/primitive_string_extern.res diff --git a/jscomp/runtime/primitive_util.res b/runtime/primitive_util.res similarity index 100% rename from jscomp/runtime/primitive_util.res rename to runtime/primitive_util.res diff --git a/runtime/rescript.json b/runtime/rescript.json new file mode 100644 index 0000000000..2ec055d9db --- /dev/null +++ b/runtime/rescript.json @@ -0,0 +1,22 @@ +{ + "name": "rescript-runtime", + "sources": [ + { + "dir": "." + } + ], + "bsc-flags": [ + "-make-runtime", + "-nostdlib", + "-nopervasives", + "-open Pervasives", + "-no-keep-locs", + "-no-alias-deps", + "-bs-no-version-header", + "-bs-no-check-div-by-zero", + "-bs-cross-module-opt", + "-unsafe", + "-w -3+50", + "-warn-error A" + ] +} \ No newline at end of file diff --git a/jscomp/runtime/set.res b/runtime/set.res similarity index 100% rename from jscomp/runtime/set.res rename to runtime/set.res diff --git a/jscomp/runtime/string.res b/runtime/string.res similarity index 100% rename from jscomp/runtime/string.res rename to runtime/string.res diff --git a/jscomp/runtime/string.resi b/runtime/string.resi similarity index 100% rename from jscomp/runtime/string.resi rename to runtime/string.resi diff --git a/scripts/buildRuntime.sh b/scripts/buildRuntime.sh new file mode 100755 index 0000000000..5bfd26c291 --- /dev/null +++ b/scripts/buildRuntime.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e +shopt -s extglob + +rm -f lib/es6/*.js lib/js/*.js lib/ocaml/* +mkdir -p lib/es6 lib/js lib/ocaml +mkdir -p runtime/lib/es6 runtime/lib/js + +(cd runtime && ../rescript build) + +cp runtime/lib/es6/*.js lib/es6 +cp runtime/lib/js/*.js lib/js +cp runtime/lib/bs/!(belt_internal*).cmi lib/ocaml/ +cp runtime/lib/bs/*.@(cmj|cmt|cmti) lib/ocaml/ +cp runtime/*.@(res|resi) lib/ocaml/ diff --git a/scripts/ninja.js b/scripts/ninja.js deleted file mode 100755 index dabd32c55d..0000000000 --- a/scripts/ninja.js +++ /dev/null @@ -1,1181 +0,0 @@ -#!/usr/bin/env node -//@ts-check - -var os = require("os"); -var fs = require("fs"); -var path = require("path"); -var cp = require("child_process"); -var semver = require("semver"); - -var jscompDir = path.join(__dirname, "..", "jscomp"); -var runtimeDir = path.join(jscompDir, "runtime"); -var othersDir = path.join(jscompDir, "others"); -var testDir = path.join(jscompDir, "test"); - -var jsDir = path.join(__dirname, "..", "lib", "js"); - -var runtimeFiles = fs.readdirSync(runtimeDir, "ascii"); -var runtimeMlFiles = runtimeFiles.filter( - x => !x.startsWith("pervasives") && x.endsWith(".res"), -); -var runtimeMliFiles = runtimeFiles.filter( - x => !x.startsWith("pervasives") && x.endsWith(".resi"), -); -var runtimeSourceFiles = runtimeMlFiles.concat(runtimeMliFiles); -var runtimeJsFiles = [...new Set(runtimeSourceFiles.map(baseName))]; - -var commonBsFlags = `-no-keep-locs -no-alias-deps -bs-no-version-header -bs-no-check-div-by-zero -nostdlib `; -var js_package = pseudoTarget("js_pkg"); -var runtimeTarget = pseudoTarget("runtime"); -var othersTarget = pseudoTarget("others"); -var { - absolutePath: my_target, - bsc_exe, - ninja_exe: vendorNinjaPath, -} = require("#cli/bin_path"); - -// Let's enforce a Node version >= 16 to make sure M1 users don't trip up on -// cryptic issues caused by mismatching assembly architectures Node 16 ships -// with a native arm64 binary, and will set process.arch to "arm64" (instead of -// Rosetta emulated "x86") -if (semver.lt(process.version, "16.0.0")) { - console.error("Requires node version 16 or above... Abort."); - process.exit(1); -} - -exports.vendorNinjaPath = vendorNinjaPath; -/** - * By default we use vendored, - * we produce two ninja files which won't overlap - * one is build.ninja which use vendored config - * the other is env.ninja which use binaries from environment - * - * In dev mode, files generated for vendor config - * - * build.ninja - * runtime/build.ninja - * others/build.ninja - * test/build.ninja - * - * files generated for env config - * - * env.ninja - * compilerEnv.ninja (no snapshot since env can not provide snapshot) - * runtime/env.ninja - * others/env.ninja - * test/env.ninja - * - * In release mode: - * - * release.ninja - * runtime/release.ninja - * others/release.ninja - * - * Like that our snapshot is so robust that - * we don't do snapshot in CI, we don't - * need do test build in CI either - * - */ - -/** - * @type {string} - */ -var versionString = undefined; - -/** - * - * @returns {string} - */ -var getVersionString = () => { - if (versionString === undefined) { - var searcher = "version"; - try { - var output = cp.execSync(`ocamldep.opt -version`, { - encoding: "ascii", - }); - versionString = output - .substring(output.indexOf(searcher) + searcher.length) - .trim(); - } catch (err) { - console.error(`This error probably came from that you don't have OCaml installed. -Make sure you have the OCaml compiler available in your path.`); - console.error(err.message); - process.exit(err.status); - } - } - return versionString; -}; - -/** - * - * @param {string} ninjaCwd - */ -function ruleCC(ninjaCwd) { - return ` -rule cc - command = $bsc -bs-cmi -bs-cmj $bsc_flags -I ${ninjaCwd} $in - description = $in -> $out -rule cc_cmi - command = $bsc -bs-read-cmi -bs-cmi -bs-cmj $bsc_flags -I ${ninjaCwd} $in - description = $in -> $out -`; -} -/** - * - * @param {string} name - * @param {string} content - */ -function writeFileAscii(name, content) { - fs.writeFile(name, content, "ascii", throwIfError); -} - -/** - * - * @param {string} name - * @param {string} content - */ -function writeFileSync(name, content) { - return fs.writeFileSync(name, content, "ascii"); -} -/** - * - * @param {NodeJS.ErrnoException} err - */ -function throwIfError(err) { - if (err !== null) { - throw err; - } -} -/** - * - * @typedef { {kind : "file" , name : string} | {kind : "pseudo" , name : string}} Target - * @typedef {{key : string, value : string}} Override - * @typedef { Target[]} Targets - * @typedef {Map} DepsMap - */ - -class TargetSet { - /** - * - * @param {Targets} xs - */ - constructor(xs = []) { - this.data = xs; - } - /** - * - * @param {Target} x - */ - add(x) { - var data = this.data; - var found = false; - for (var i = 0; i < data.length; ++i) { - var cur = data[i]; - if (cur.kind === x.kind && cur.name === x.name) { - found = true; - break; - } - } - if (!found) { - this.data.push(x); - } - return this; - } - /** - * @returns {Targets} a copy - * - */ - toSortedArray() { - var newData = this.data.concat(); - newData.sort((x, y) => { - var kindx = x.kind; - var kindy = y.kind; - if (kindx > kindy) { - return 1; - } else if (kindx < kindy) { - return -1; - } else { - if (x.name > y.name) { - return 1; - } else if (x.name < y.name) { - return -1; - } else { - return 0; - } - } - }); - return newData; - } - /** - * - * @param {(item:Target)=>void} callback - */ - forEach(callback) { - this.data.forEach(callback); - } -} - -/** - * - * @param {string} target - * @param {string} dependency - * @param {DepsMap} depsMap - */ -function updateDepsKVByFile(target, dependency, depsMap) { - var singleTon = fileTarget(dependency); - if (depsMap.has(target)) { - depsMap.get(target).add(singleTon); - } else { - depsMap.set(target, new TargetSet([singleTon])); - } -} - -/** - * - * @param {string} s - */ -function uncapitalize(s) { - if (s.length === 0) { - return s; - } - return s[0].toLowerCase() + s.slice(1); -} -/** - * - * @param {string} target - * @param {string[]} dependencies - * @param {DepsMap} depsMap - */ -function updateDepsKVsByFile(target, dependencies, depsMap) { - var targets = fileTargets(dependencies); - if (depsMap.has(target)) { - var s = depsMap.get(target); - for (var i = 0; i < targets.length; ++i) { - s.add(targets[i]); - } - } else { - depsMap.set(target, new TargetSet(targets)); - } -} - -/** - * - * @param {string} target - * @param {string[]} modules - * @param {DepsMap} depsMap - */ -function updateDepsKVsByModule(target, modules, depsMap) { - if (depsMap.has(target)) { - let s = depsMap.get(target); - for (let module of modules) { - let filename = uncapitalize(module); - let filenameAsCmi = filename + ".cmi"; - let filenameAsCmj = filename + ".cmj"; - if (target.endsWith(".cmi")) { - if (depsMap.has(filenameAsCmi) || depsMap.has(filenameAsCmj)) { - s.add(fileTarget(filenameAsCmi)); - } - } else if (target.endsWith(".cmj")) { - if (depsMap.has(filenameAsCmj)) { - s.add(fileTarget(filenameAsCmj)); - } else if (depsMap.has(filenameAsCmi)) { - s.add(fileTarget(filenameAsCmi)); - } - } - } - } -} -/** - * - * @param {string[]}sources - * @return {DepsMap} - */ -function createDepsMapWithTargets(sources) { - /** - * @type {DepsMap} - */ - let depsMap = new Map(); - for (let source of sources) { - let target = sourceToTarget(source); - depsMap.set(target, new TargetSet([])); - } - depsMap.forEach((set, name) => { - let cmiFile; - if ( - name.endsWith(".cmj") && - depsMap.has((cmiFile = replaceExt(name, ".cmi"))) - ) { - set.add(fileTarget(cmiFile)); - } - }); - return depsMap; -} - -/** - * - * @param {Target} file - * @param {string} cwd - */ -function targetToString(file, cwd) { - switch (file.kind) { - case "file": - return path.join(cwd, file.name); - case "pseudo": - return file.name; - default: - throw Error; - } -} -/** - * - * @param {Targets} files - * @param {string} cwd - * - * @returns {string} return a string separated with whitespace - */ -function targetsToString(files, cwd) { - return files.map(x => targetToString(x, cwd)).join(" "); -} -/** - * - * @param {Targets} outputs - * @param {Targets} inputs - * @param {Targets} deps - * @param {Override[]} overrides - * @param {string} rule - * @param {string} cwd - * @return {string} - */ -function ninjaBuild(outputs, inputs, rule, deps, cwd, overrides) { - var fileOutputs = targetsToString(outputs, cwd); - var fileInputs = targetsToString(inputs, cwd); - var stmt = `o ${fileOutputs} : ${rule} ${fileInputs}`; - // deps.push(pseudoTarget('../lib/bsc')) - if (deps.length > 0) { - var fileDeps = targetsToString(deps, cwd); - stmt += ` | ${fileDeps}`; - } - if (overrides.length > 0) { - stmt += - `\n` + - overrides - .map(x => { - return ` ${x.key} = ${x.value}`; - }) - .join("\n"); - } - return stmt; -} - -/** - * - * @param {Target} outputs - * @param {Targets} inputs - * @param {string} cwd - */ -function phony(outputs, inputs, cwd) { - return ninjaBuild([outputs], inputs, "phony", [], cwd, []); -} - -/** - * - * @param {string | string[]} outputs - * @param {string | string[]} inputs - * @param {string | string[]} fileDeps - * @param {string} rule - * @param {string} cwd - * @param {[string,string][]} overrides - * @param {Target | Targets} extraDeps - */ -function ninjaQuickBuild( - outputs, - inputs, - rule, - cwd, - overrides, - fileDeps, - extraDeps, -) { - var os = Array.isArray(outputs) - ? fileTargets(outputs) - : [fileTarget(outputs)]; - var is = Array.isArray(inputs) ? fileTargets(inputs) : [fileTarget(inputs)]; - var ds = Array.isArray(fileDeps) - ? fileTargets(fileDeps) - : [fileTarget(fileDeps)]; - var dds = Array.isArray(extraDeps) ? extraDeps : [extraDeps]; - - return ninjaBuild( - os, - is, - rule, - ds.concat(dds), - cwd, - overrides.map(x => { - return { key: x[0], value: x[1] }; - }), - ); -} - -/** - * @typedef { (string | string []) } Strings - * @typedef { [string,string]} KV - * @typedef { [Strings, Strings, string, string, KV[], Strings, (Target|Targets)] } BuildList - * @param {BuildList[]} xs - * @returns {string} - */ -function ninjaQuickBuildList(xs) { - return xs - .map(x => ninjaQuickBuild(x[0], x[1], x[2], x[3], x[4], x[5], x[6])) - .join("\n"); -} - -/** - * - * @param {string} name - * @returns {Target} - */ -function fileTarget(name) { - return { kind: "file", name }; -} - -/** - * - * @param {string} name - * @returns {Target} - */ -function pseudoTarget(name) { - return { kind: "pseudo", name }; -} - -/** - * - * @param {string[]} args - * @returns {Targets} - */ -function fileTargets(args) { - return args.map(name => fileTarget(name)); -} - -/** - * - * @param {string[]} outputs - * @param {string[]} inputs - * @param {DepsMap} depsMap - * @param {Override[]} overrides - * @param {Targets} extraDeps - * @param {string} rule - * @param {string} cwd - */ -function buildStmt(outputs, inputs, rule, depsMap, cwd, overrides, extraDeps) { - var os = outputs.map(fileTarget); - var is = inputs.map(fileTarget); - var deps = new TargetSet(); - for (var i = 0; i < outputs.length; ++i) { - var curDeps = depsMap.get(outputs[i]); - if (curDeps !== undefined) { - curDeps.forEach(x => deps.add(x)); - } - } - extraDeps.forEach(x => deps.add(x)); - return ninjaBuild(os, is, rule, deps.toSortedArray(), cwd, overrides); -} - -/** - * - * @param {string} x - */ -function replaceCmj(x) { - return x.trim().replace("cmx", "cmj"); -} - -/** - * - * @param {string} y - */ -function sourceToTarget(y) { - if (y.endsWith(".res")) { - return replaceExt(y, ".cmj"); - } else if (y.endsWith(".resi")) { - return replaceExt(y, ".cmi"); - } - return y; -} -/** - * - * @param {string[]} files - * @param {string} dir - * @param {DepsMap} depsMap - * @return {Promise} - * Note `bsdep.exe` does not need post processing and -one-line flag - * By default `ocamldep.opt` only list dependencies in its args - */ -function ocamlDepForBscAsync(files, dir, depsMap) { - return new Promise((resolve, reject) => { - var tmpdir = null; - const mlfiles = []; // convert .res files to temporary .ml files in tmpdir - files.forEach(f => { - const { name, ext } = path.parse(f); - if (ext === ".res" || ext === ".resi") { - const mlname = ext === ".resi" ? name + ".mli" : name + ".ml"; - if (tmpdir == null) { - tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), "resToMl")); - } - try { - const mlfile = path.join(tmpdir, mlname); - cp.execSync( - `${bsc_exe} -dsource -only-parse -bs-no-builtin-ppx ${f} 2>${mlfile}`, - { - cwd: dir, - encoding: "ascii", - }, - ); - mlfiles.push(mlfile); - } catch (err) { - console.log(err); - } - } - }); - const minusI = tmpdir == null ? "" : `-I ${tmpdir}`; - cp.exec( - `ocamldep.opt -allow-approx -one-line ${minusI} -native ${files.join( - " ", - )} ${mlfiles.join(" ")}`, - { - cwd: dir, - encoding: "ascii", - }, - function (error, stdout, stderr) { - if (tmpdir != null) { - fs.rmSync(tmpdir, { recursive: true, force: true }); - } - if (error !== null) { - return reject(error); - } else { - const pairs = stdout.split("\n").map(x => x.split(":")); - pairs.forEach(x => { - var deps; - let source = replaceCmj(path.basename(x[0])); - if (x[1] !== undefined && (deps = x[1].trim())) { - deps = deps.split(" "); - updateDepsKVsByFile( - source, - deps.map(x => replaceCmj(path.basename(x))), - depsMap, - ); - } - }); - return resolve(); - } - }, - ); - }); -} - -/** - * - * @param {string[]} files - * @param {string} dir - * @param {DepsMap} depsMap - * @return { Promise []} - * Note `bsdep.exe` does not need post processing and -one-line flag - * By default `ocamldep.opt` only list dependencies in its args - */ -function depModulesForBscAsync(files, dir, depsMap) { - let resFiles = files.filter(x => x.endsWith(".res") || x.endsWith(".resi")); - /** - * - * @param {(value:void) =>void} resolve - * @param {(value:any)=>void} reject - */ - let cb = (resolve, reject) => { - /** - * @param {any} error - * @param {string} stdout - * @param {string} stderr - */ - let fn = function (error, stdout, stderr) { - if (error !== null) { - return reject(error); - } else { - var pairs = stdout.split("\n").map(x => x.split(":")); - pairs.forEach(x => { - var modules; - let source = sourceToTarget(x[0].trim()); - if (x[1] !== undefined && (modules = x[1].trim())) { - modules = modules.split(" "); - updateDepsKVsByModule(source, modules, depsMap); - } - }); - return resolve(); - } - }; - return fn; - }; - let config = { - cwd: dir, - encoding: "ascii", - }; - return [ - new Promise((resolve, reject) => { - cp.exec( - `${bsc_exe} -modules -bs-syntax-only ${resFiles.join(" ")}`, - config, - cb(resolve, reject), - ); - }), - ]; -} - -/** - * @typedef {('HAS_RES' | 'HAS_RESI' | 'HAS_BOTH_RES')} FileInfo - * @param {string[]} sourceFiles - * @returns {Map} - * We make a set to ensure that `sourceFiles` are not duplicated - */ -function collectTarget(sourceFiles) { - /** - * @type {Map} - */ - var allTargets = new Map(); - sourceFiles.forEach(x => { - var { ext, name } = path.parse(x); - var existExt = allTargets.get(name); - if (existExt === undefined) { - if (ext === ".res") { - allTargets.set(name, "HAS_RES"); - } else if (ext === ".resi") { - allTargets.set(name, "HAS_RESI"); - } - } else { - switch (existExt) { - case "HAS_RES": - if (ext === ".resi") { - allTargets.set(name, "HAS_BOTH_RES"); - } - break; - case "HAS_RESI": - if (ext === ".res") { - allTargets.set(name, "HAS_BOTH_RES"); - } - break; - case "HAS_BOTH_RES": - break; - } - } - }); - return allTargets; -} - -/** - * - * @param {Map} allTargets - * @param {string[]} collIn - * @returns {string[]} A new copy which is - * - */ -function scanFileTargets(allTargets, collIn) { - var coll = collIn.concat(); - allTargets.forEach((ext, mod) => { - switch (ext) { - case "HAS_RESI": - coll.push(`${mod}.cmi`); - break; - case "HAS_BOTH_RES": - coll.push(`${mod}.cmi`, `${mod}.cmj`); - break; - case "HAS_RES": - coll.push(`${mod}.cmi`, `${mod}.cmj`); - break; - } - }); - return coll; -} - -/** - * - * @param {DepsMap} depsMap - * @param {Map} allTargets - * @param {string} cwd - * @param {Targets} extraDeps - * @return {string[]} - */ -function generateNinja(depsMap, allTargets, cwd, extraDeps = []) { - /** - * @type {string[]} - */ - var build_stmts = []; - allTargets.forEach((x, mod) => { - let ouptput_cmj = mod + ".cmj"; - let output_cmi = mod + ".cmi"; - let input_res = mod + ".res"; - let input_resi = mod + ".resi"; - /** - * @type {Override[]} - */ - var overrides = []; - // if (mod.endsWith("Labels")) { - // overrides.push({ key: "bsc_flags", value: "$bsc_flags -nolabels" }); - // } - - /** - * - * @param {string[]} outputs - * @param {string[]} inputs - * - */ - let mk = (outputs, inputs, rule = "cc") => { - return build_stmts.push( - buildStmt(outputs, inputs, rule, depsMap, cwd, overrides, extraDeps), - ); - }; - switch (x) { - case "HAS_BOTH_RES": - mk([ouptput_cmj], [input_res], "cc_cmi"); - mk([output_cmi], [input_resi]); - break; - case "HAS_RES": - mk([output_cmi, ouptput_cmj], [input_res]); - break; - case "HAS_RESI": - mk([output_cmi], [input_resi]); - break; - } - }); - return build_stmts; -} - -var COMPILIER = bsc_exe; -var BSC_COMPILER = `bsc = ${COMPILIER}`; - -async function runtimeNinja(devmode = true) { - var ninjaCwd = "runtime"; - var compilerTarget = pseudoTarget("$bsc"); - var externalDeps = devmode ? [compilerTarget] : []; - var ninjaOutput = devmode ? "build.ninja" : "release.ninja"; - var bsc_flags = "bsc_flags"; - /** - * @type [string,string][] - */ - var templateRuntimeRules = ` -${bsc_flags} = ${commonBsFlags} -bs-cross-module-opt -make-runtime -unsafe -w -3+50 -warn-error A -${ruleCC(ninjaCwd)} -${ninjaQuickBuildList([ - // we make it still depends on external - // to enjoy free ride on dev config for compiler-deps - - [ - ["pervasives.cmj", "pervasives.cmi"], - "pervasives.res", - "cc", - ninjaCwd, - [[bsc_flags, `$${bsc_flags} -nopervasives`]], - [], - externalDeps, - ], -])} -`; - /** - * @type {DepsMap} - */ - var depsMap = new Map(); - var allTargets = collectTarget([...runtimeMliFiles, ...runtimeMlFiles]); - var manualDeps = ["pervasives.cmj", "pervasives.cmi"]; - var allFileTargetsInRuntime = scanFileTargets(allTargets, manualDeps); - allTargets.forEach((ext, mod) => { - switch (ext) { - case "HAS_RESI": - case "HAS_BOTH_RES": - updateDepsKVsByFile(mod + ".cmi", manualDeps, depsMap); - break; - case "HAS_RES": - updateDepsKVsByFile(mod + ".cmj", manualDeps, depsMap); - break; - } - }); - // FIXME: in dev mode, it should not rely on reading js file - // since it may cause a bootstrapping issues - try { - await Promise.all([ - runJSCheckAsync(depsMap), - ocamlDepForBscAsync(runtimeSourceFiles, runtimeDir, depsMap), - ]); - var stmts = generateNinja(depsMap, allTargets, ninjaCwd, externalDeps); - stmts.push( - phony(runtimeTarget, fileTargets(allFileTargetsInRuntime), ninjaCwd), - ); - writeFileAscii( - path.join(runtimeDir, ninjaOutput), - templateRuntimeRules + stmts.join("\n") + "\n", - ); - } catch (e) { - console.log(e); - } -} - -async function othersNinja(devmode = true) { - var compilerTarget = pseudoTarget("$bsc"); - var ninjaOutput = devmode ? "build.ninja" : "release.ninja"; - var ninjaCwd = "others"; - - var templateOthersRules = ` -bsc_flags = ${commonBsFlags} -bs-cross-module-opt -make-runtime -unsafe -w +50 -warn-error A -I runtime -${ruleCC(ninjaCwd)} -${ninjaQuickBuildList([ - [ - ["belt.cmj", "belt.cmi"], - "belt.res", - "cc", - ninjaCwd, - [], - [], - [compilerTarget, runtimeTarget], - ], -])} -`; - var othersDirFiles = fs.readdirSync(othersDir, "ascii"); - var jsPrefixSourceFiles = othersDirFiles.filter( - x => - x.startsWith("js") && - (x.endsWith(".res") || x.endsWith(".resi")) && - !x.includes(".pp") && - !x.includes("#"), - ); - var othersFiles = othersDirFiles.filter( - x => - !x.startsWith("js") && - x !== "belt.res" && - (x.endsWith(".res") || x.endsWith(".resi")) && - !x.includes("#"), - ); - var jsTargets = collectTarget(jsPrefixSourceFiles); - var allJsTargets = scanFileTargets(jsTargets, []); - let jsDepsMap = new Map(); - let depsMap = new Map(); - await Promise.all([ - ocamlDepForBscAsync(jsPrefixSourceFiles, othersDir, jsDepsMap), - ocamlDepForBscAsync(othersFiles, othersDir, depsMap), - ]); - var jsOutput = generateNinja(jsDepsMap, jsTargets, ninjaCwd, [ - compilerTarget, - runtimeTarget, - ]); - jsOutput.push(phony(js_package, fileTargets(allJsTargets), ninjaCwd)); - - // Note compiling belt.res still try to read - // belt_xx.cmi we need enforce the order to - // avoid data race issues - var beltPackage = fileTarget("belt.cmi"); - var beltTargets = collectTarget(othersFiles); - depsMap.forEach((s, k) => { - if (k.startsWith("belt")) { - s.add(beltPackage); - } - s.add(js_package); - }); - var allOthersTarget = scanFileTargets(beltTargets, []); - var beltOutput = generateNinja(depsMap, beltTargets, ninjaCwd, [ - compilerTarget, - runtimeTarget, - fileTarget("js.cmi"), - ]); - beltOutput.push(phony(othersTarget, fileTargets(allOthersTarget), ninjaCwd)); - writeFileAscii( - path.join(othersDir, ninjaOutput), - templateOthersRules + - jsOutput.join("\n") + - "\n" + - beltOutput.join("\n") + - "\n", - ); -} - -/** - * - * @param {string} text - */ -function getDeps(text) { - /** - * @type {string[]} - */ - var deps = []; - text.replace( - /(\/\*[\w\W]*?\*\/|\/\/[^\n]*|[.$]r)|\brequire\s*\(\s*["']([^"']*)["']\s*\)/g, - function (_, ignore, id) { - if (!ignore) deps.push(id); - return ""; // TODO: examine the regex - }, - ); - return deps; -} - -/** - * - * @param {string} x - * @param {string} newExt - * @example - * - * ```js - * replaceExt('xx.cmj', '.a') // return 'xx.a' - * ``` - * - */ -function replaceExt(x, newExt) { - let index = x.lastIndexOf("."); - if (index < 0) { - return x; - } - return x.slice(0, index) + newExt; -} -/** - * - * @param {string} x - */ -function baseName(x) { - return x.substr(0, x.indexOf(".")); -} - -/** - * - * @returns {Promise} - */ -async function testNinja() { - var ninjaOutput = "build.ninja"; - var ninjaCwd = `test`; - var templateTestRules = ` -bsc_flags = -bs-cross-module-opt -make-runtime-test -bs-package-output commonjs:jscomp/test -w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104 -warn-error A -I runtime -I others -${ruleCC(ninjaCwd)} -`; - var testDirFiles = fs.readdirSync(testDir, "ascii"); - //testDirFiles = []; - var sources = testDirFiles.filter(x => { - return x.endsWith(".resi") || x.endsWith(".res"); - }); - - let depsMap = createDepsMapWithTargets(sources); - await Promise.all(depModulesForBscAsync(sources, testDir, depsMap)); - var targets = collectTarget(sources); - var output = generateNinja(depsMap, targets, ninjaCwd, [ - runtimeTarget, - othersTarget, - pseudoTarget("$bsc"), - ]); - output.push( - phony( - pseudoTarget("test"), - fileTargets(scanFileTargets(targets, [])), - ninjaCwd, - ), - ); - writeFileAscii( - path.join(testDir, ninjaOutput), - templateTestRules + output.join("\n") + "\n", - ); -} - -/** - * - * @param {DepsMap} depsMap - */ -function runJSCheckAsync(depsMap) { - return new Promise(resolve => { - var count = 0; - var tasks = runtimeJsFiles.length; - var updateTick = () => { - count++; - if (count === tasks) { - resolve(count); - } - }; - runtimeJsFiles.forEach(name => { - var jsFile = path.join(jsDir, name + ".js"); - fs.readFile(jsFile, "utf8", function (err, fileContent) { - if (err === null) { - var deps = getDeps(fileContent).map(x => path.parse(x).name + ".cmj"); - fs.exists(path.join(runtimeDir, name + ".resi"), exist => { - if (exist) { - deps.push(name + ".cmi"); - } - updateDepsKVsByFile(`${name}.cmj`, deps, depsMap); - updateTick(); - }); - } else { - // file non exist or reading error ignore - updateTick(); - } - }); - }); - }); -} - -function checkEffect() { - var jsPaths = runtimeJsFiles.map(x => path.join(jsDir, x + ".js")); - var effect = jsPaths - .map(x => { - return { - file: x, - content: fs.readFileSync(x, "utf8"), - }; - }) - .map(({ file, content: x }) => { - if (/No side effect|This output is empty/.test(x)) { - return { - file, - effect: "pure", - }; - } else if (/Not a pure module/.test(x)) { - return { - file, - effect: "false", - }; - } else { - return { - file, - effect: "unknown", - }; - } - }) - .filter(({ effect }) => effect !== "pure") - .map(({ file, effect }) => { - return { file: path.basename(file), effect }; - }); - - var black_list = new Set(["caml_lexer.js", "caml_parser.js"]); - - var assert = require("assert"); - // @ts-ignore - assert( - effect.length === black_list.size && - effect.every(x => black_list.has(x.file)), - ); - - console.log(effect); -} - -function updateRelease() { - runtimeNinja(false); - othersNinja(false); -} - -function updateDev() { - writeFileAscii( - path.join(jscompDir, "build.ninja"), - ` -${BSC_COMPILER} -ocamllex = ocamllex.opt -subninja runtime/build.ninja -subninja others/build.ninja -subninja test/build.ninja -o all: phony runtime others test -`, - ); - writeFileAscii( - path.join(jscompDir, "..", "lib", "build.ninja"), - ` -ocamlopt = ocamlopt.opt -ext = exe -INCL= "4.06.1+BS" -include body.ninja -`, - ); - - runtimeNinja(); - if (fs.existsSync(bsc_exe)) { - testNinja(); - } - othersNinja(); -} -exports.updateDev = updateDev; -exports.updateRelease = updateRelease; - -function main() { - if (require.main === module) { - if (process.argv.includes("-check")) { - checkEffect(); - } - - var subcommand = process.argv[2]; - switch (subcommand) { - case "build": - try { - cp.execFileSync(vendorNinjaPath, ["all"], { - encoding: "utf8", - cwd: jscompDir, - stdio: [0, 1, 2], - }); - } catch (e) { - console.log(e.message); - console.log(`please run "./scripts/ninja.js config" first`); - process.exit(2); - } - break; - case "clean": - try { - cp.execFileSync(vendorNinjaPath, ["-t", "clean"], { - encoding: "utf8", - cwd: jscompDir, - stdio: [0, 1], - }); - } catch (e) {} - cp.execSync( - `git clean -dfx jscomp ${my_target} lib && rm -rf lib/js/*.js && rm -rf lib/es6/*.js`, - { - encoding: "utf8", - cwd: path.join(__dirname, ".."), - stdio: [0, 1, 2], - }, - ); - break; - case "config": - console.log(`config for the first time may take a while`); - updateDev(); - updateRelease(); - - break; - case "cleanbuild": - console.log(`run cleaning first`); - cp.execSync(`node ${__filename} clean`, { - cwd: __dirname, - stdio: [0, 1, 2], - }); - cp.execSync(`node ${__filename} config`, { - cwd: __dirname, - stdio: [0, 1, 2], - }); - cp.execSync(`node ${__filename} build`, { - cwd: __dirname, - stdio: [0, 1, 2], - }); - break; - case "help": - console.log(`supported subcommands: -[exe] config -[exe] build -[exe] cleanbuild -[exe] help -[exe] clean - `); - break; - default: - if (process.argv.length === 2) { - updateDev(); - updateRelease(); - } else { - var dev = process.argv.includes("-dev"); - var release = process.argv.includes("-release"); - var all = process.argv.includes("-all"); - if (all) { - updateDev(); - updateRelease(); - } else if (dev) { - updateDev(); - } else if (release) { - updateRelease(); - } - } - break; - } - } -} - -main(); diff --git a/scripts/prebuilt.js b/scripts/prebuilt.js index 9637fd67cc..39aa800e6c 100755 --- a/scripts/prebuilt.js +++ b/scripts/prebuilt.js @@ -34,64 +34,4 @@ function verifyVersion(bsVersion, version) { } } -/** - * - * @param {string} src - * @param {(file:string)=>boolean} filter - * @param {string} dest - */ -function installDirBy(src, dest, filter) { - fs.readdir(src, function (err, files) { - if (err === null) { - files.forEach(function (file) { - if (filter(file)) { - var x = path.join(src, file); - var y = path.join(dest, file); - // console.log(x, '----->', y ) - fs.copyFile(x, y, err => assert.equal(err, null)); - } - }); - } else { - throw err; - } - }); -} - -function populateLibDir() { - const root_dir = path.join(__dirname, ".."); - const lib_dir = path.join(root_dir, "lib"); - const jscomp_dir = path.join(root_dir, "jscomp"); - const runtime_dir = path.join(jscomp_dir, "runtime"); - const others_dir = path.join(jscomp_dir, "others"); - const ocaml_dir = path.join(lib_dir, "ocaml"); - - if (!fs.existsSync(ocaml_dir)) { - fs.mkdirSync(ocaml_dir); - } - // for merlin or other IDE - var installed_suffixes = [ - ".ml", - ".mli", - ".res", - ".resi", - ".cmi", - ".cmj", - ".cmt", - ".cmti", - ]; - installDirBy(runtime_dir, ocaml_dir, function (file) { - var y = path.parse(file); - return installed_suffixes.includes(y.ext); - }); - installDirBy(others_dir, ocaml_dir, file => { - var y = path.parse(file); - if (y.ext === ".cmi") { - return !y.base.match(/Belt_internal/i); - } - return installed_suffixes.includes(y.ext) && !y.name.endsWith(".cppo"); - }); -} - assert(verifyVersion(bsVersion, package_config.version)); - -populateLibDir();