Skip to content

Commit b0e17af

Browse files
committed
Update repl.js to jsoo 3.5.1
1 parent 4139746 commit b0e17af

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,8 @@ node scripts/ninja.js config && node scripts/ninja.js build
229229
BS_PLAYGROUND=../playground node scripts/repl.js
230230
```
231231

232+
_Troubleshooting: if ninja build step failed with `Error: cannot find file '+runtime.js'`, make sure `ocamlfind` is installed with `opam install ocamlfind`._
233+
232234
**You should now find following files:**
233235

234236
- `playground/exports.js` -> This is the BuckleScript compiler, which binds the BuckleScript API to the `window` object

scripts/repl.js

+21-22
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ var fs = require("fs");
55
var path = require("path");
66

77
process.env.BS_RELEASE_BUILD = 1;
8+
var ocamlVersion = "4.06.1";
89
var jscompDir = path.join(__dirname, "..", "jscomp");
10+
var jsRefmtCompDir = path.join(__dirname, "..", "lib", ocamlVersion, "unstable");
11+
912
var config = {
1013
cwd: jscompDir,
1114
encoding: "utf8",
@@ -29,13 +32,12 @@ if (!process.env.BS_PLAYGROUND) {
2932
var playground = process.env.BS_PLAYGROUND;
3033

3134
function prepare() {
32-
e(`hash hash js_of_ocaml 2>/dev/null || { echo >&2 "js_of_ocaml not found on path. Please install version 2.8.4 (although not with the buckelscript switch) and put it on your path."; exit 1; }
35+
e(`hash hash js_of_ocaml 2>/dev/null || { echo >&2 "js_of_ocaml not found on path. Please install version 3.5.1 (with opam switch ${ocamlVersion}), and put it on your path."; exit 1; }
3336
`);
3437

3538
e(`./bin/cmjbrowser.exe`);
36-
var js_compiler_path = `../lib/4.06.1/unstable`;
3739
e(
38-
`ocamlc.opt -w -30-40 -no-check-prims -I ${js_compiler_path} ${js_compiler_path}/js_refmt_compiler.mli ${js_compiler_path}/js_refmt_compiler.ml -o jsc.byte`
40+
`ocamlc.opt -w -30-40 -no-check-prims -I ${jsRefmtCompDir} ${jsRefmtCompDir}/js_refmt_compiler.mli ${jsRefmtCompDir}/js_refmt_compiler.ml -o jsc.byte`
3941
);
4042

4143
e(`cp ../lib/js/*.js ${playground}/stdlib`);
@@ -48,6 +50,7 @@ console.log(`playground : ${playground}`);
4850

4951
var includes = [`stdlib-406`, `runtime`, `others`]
5052
.map(x => path.join(jscompDir, x))
53+
.concat([jsRefmtCompDir])
5154
.map(x => `-I ${x}`)
5255
.join(` `);
5356

@@ -82,24 +85,20 @@ var cmi_files = [
8285
`js_float`,
8386
`js_json`,
8487

85-
/*
86-
These files cause troubles when compiled with JSOO (v3.4.0)
87-
Be aware, if those are included you will get an error stating something like "/static/cmis/scanf.cmi : file already exists"
88-
*/
89-
// `arrayLabels`,
90-
// `bytesLabels`,
91-
// `complex`,
92-
// `gc`,
93-
// `genlex`,
94-
// `listLabels`,
95-
// `moreLabels`,
96-
// `queue`,
97-
// `scanf`,
98-
// `sort`,
99-
// `stack`,
100-
// `stdLabels`,
101-
// `stream`,
102-
// `stringLabels`,
88+
`arrayLabels`,
89+
`bytesLabels`,
90+
`complex`,
91+
`gc`,
92+
`genlex`,
93+
`listLabels`,
94+
`moreLabels`,
95+
`queue`,
96+
`scanf`,
97+
`sort`,
98+
`stack`,
99+
`stdLabels`,
100+
`stream`,
101+
`stringLabels`,
103102

104103
`dom`,
105104
`belt`,
@@ -136,5 +135,5 @@ var cmi_files = [
136135
.map(x => `--file ${x}`)
137136
.join(` `);
138137
e(
139-
`js_of_ocaml --disable share --toplevel +weak.js ./polyfill.js jsc.byte ${includes} ${cmi_files} -o ${playground}/exports.js`
138+
`js_of_ocaml --disable share --toplevel ./polyfill.js jsc.byte ${includes} ${cmi_files} -o ${playground}/exports.js`
140139
);

0 commit comments

Comments
 (0)