|
1 |
| -(* This resolves the location of the standard library starting from the location of bsc.exe |
2 |
| - (@rescript/{platform}/bin/bsc.exe), handling different supported package layouts. *) |
3 |
| -let runtime_module_path = |
4 |
| - let build_path rest path = |
5 |
| - String.concat Filename.dir_sep (List.rev_append rest path) |
6 |
| - in |
7 |
| - match |
8 |
| - Sys.executable_name |> Filename.dirname |
9 |
| - |> String.split_on_char Filename.dir_sep.[0] |
10 |
| - |> List.rev |
11 |
| - with |
12 |
| - (* 1. Packages installed via pnpm |
13 |
| - - bin: node_modules/.pnpm/@[email protected]/node_modules/@rescript/darwin-arm64/bin |
14 |
| - - runtime: node_modules/.pnpm/node_modules/@rescript/runtime (symlink) |
15 |
| - *) |
16 |
| - | "bin" :: _platform :: "@rescript" :: "node_modules" :: _package :: ".pnpm" |
17 |
| - :: "node_modules" :: rest -> |
18 |
| - build_path rest |
19 |
| - ["node_modules"; ".pnpm"; "node_modules"; "@rescript"; "runtime"] |
20 |
| - (* 2. Packages installed via npm |
21 |
| - - bin: node_modules/@rescript/{platform}/bin |
22 |
| - - runtime: node_modules/@rescript/runtime |
23 |
| - *) |
24 |
| - | "bin" :: _platform :: "@rescript" :: "node_modules" :: rest -> |
25 |
| - build_path rest ["node_modules"; "@rescript"; "runtime"] |
26 |
| - (* 3. Several other cases that can occur in local development, e.g. |
27 |
| - - bin: <repo>/packages/@rescript/{platform}/bin, <repo>/_build/install/default/bin |
28 |
| - - runtime: <repo>/packages/@rescript/runtime |
29 |
| - *) |
30 |
| - | _ :: _ :: _ :: _ :: rest -> |
31 |
| - build_path rest ["packages"; "@rescript"; "runtime"] |
32 |
| - | _ -> "" |
33 |
| - |
34 |
| -let standard_library = |
35 |
| - let ( // ) = Filename.concat in |
36 |
| - runtime_module_path // "lib" // "ocaml" |
37 |
| - |
38 | 1 | let cmi_magic_number = "Caml1999I022"
|
39 | 2 |
|
40 | 3 | and ast_impl_magic_number = "Caml1999M022"
|
|
0 commit comments