Skip to content

Commit b7b4134

Browse files
authored
Merge pull request #40 from sikanhe/release/13.0.0-beta.2
Release/13.0.0 beta.2
2 parents 097667a + d493850 commit b7b4134

26 files changed

+1902
-1132
lines changed

.gitignore

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ bsb
88
*.bs.js
99
package-lock.json
1010

11-
src/ScratchPadJs.js
12-
src/ScratchRE.re
13-
src/ScratchML.ml
14-
src/Events.re
11+
src/ScratchRe.re
12+
src/ScratchMl.ml

bsconfig.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@
2525
],
2626
"suffix": ".bs.js",
2727
"namespace": "node-js",
28-
"bs-dependencies": [
29-
],
28+
"bs-dependencies": [],
3029
"bs-dev-dependencies": [
3130
"@glennsl/bs-jest"
3231
],
3332
"ppx-flags": [],
3433
"refmt": 3,
3534
"bsc-flags": []
36-
}
35+
}

examples/StreamTextToFile.re

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
2-
let data = "Sample text to write to a file!" -> Buffer.fromString;
1+
let data = "Sample text to write to a file!"->Buffer.fromString;
32
let process = Process.process;
43

5-
let outputPath = Path.relative(
6-
~from= Process.cwd(process),
7-
~to_="example__output.txt"
8-
);
4+
let outputPath =
5+
Path.relative(~from=Process.cwd(process), ~to_="example__output.txt");
96

107
let writeStream = Fs.createWriteStream(outputPath);
118

12-
let logErrorIfExists = (maybeError) => {
13-
switch (Js.Nullable.toOption(maybeError)) {
14-
| Some(err) => Js.log2("An error occurred", err);
15-
| None => ();
16-
};
17-
}
18-
19-
writeStream -> Stream.writeWith(
20-
data,
21-
~callback=(maybeError) => {
22-
logErrorIfExists(maybeError);
23-
Js.log("Finished");
24-
},
25-
()
26-
);
9+
let logErrorIfExists = maybeError => {
10+
switch (Js.Nullable.toOption(maybeError)) {
11+
| Some(err) => Js.log2("An error occurred", err)
12+
| None => ()
13+
};
14+
};
2715

16+
let () =
17+
writeStream
18+
->Stream.writeWith(
19+
data,
20+
~callback=
21+
maybeError => {
22+
logErrorIfExists(maybeError);
23+
Js.log("Finished");
24+
},
25+
(),
26+
)
27+
->ignore;

package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{
22
"name": "reason-nodejs",
3-
"version": "13.0.0-beta.0",
3+
"version": "13.0.0-beta.2",
44
"scripts": {
55
"build": "bsb -make-world",
6+
"clean-build": "bsb -clean-world && bsb -make-world",
67
"start": "bsb -make-world -w",
7-
"clean": "bsb -clean-world",
8-
"test": "jest"
8+
"clean-start": "bsb -clean-world && bsb -make-world -w",
9+
"test": "jest",
10+
"clean-test": "bsb -clean-world && bsb -make-world && jest",
11+
"clean": "bsb -clean-world"
912
},
1013
"keywords": [
1114
"BuckleScript"
1215
],
13-
"author": "Sikan He",
16+
"author": "Sikan He & Austin Davis",
1417
"homepage": "https://github.com/sikanhe/reason-node",
1518
"license": "MIT",
19+
"dependencies": {},
1620
"devDependencies": {
1721
"@glennsl/bs-jest": "^0.4.10",
18-
"bs-platform": "7.3.2"
22+
"bs-platform": "^8.3.0"
1923
}
2024
}

src/Assert.re

+14-10
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,28 @@ external notStrictEqual: ('a, 'a) => unit = "notStrictEqual";
1010
external deepStrictEqual: ('a, 'a) => unit = "deepStrictEqual";
1111
[@bs.module "assert"]
1212
external notDeepStrictEqual: ('a, 'a) => unit = "notDeepStrictEqual";
13-
14-
[@bs.module "assert"] external throws: (unit => 'a) => unit = "throws";
1513
[@bs.module "assert"]
16-
external throwsError: (unit => 'a, 'e) => unit = "throws";
14+
external throws: ([@bs.uncurry] (unit => 'a)) => unit = "throws";
1715
[@bs.module "assert"]
18-
external doesNotThrow: (unit => 'a) => unit = "doesNotThrow";
16+
external throwsError: ([@bs.uncurry] (unit => 'a), 'e) => unit = "throws";
1917
[@bs.module "assert"]
20-
external doesNotThrowError: (unit => 'a, 'e) => unit = "doesNotThrow";
21-
18+
external doesNotThrow: ([@bs.uncurry] (unit => 'a)) => unit = "doesNotThrow";
19+
[@bs.module "assert"]
20+
external doesNotThrowError: ([@bs.uncurry] (unit => 'a), 'e) => unit =
21+
"doesNotThrow";
2222
[@bs.module "assert"] external ifError: 'a => unit = "ifError";
2323
[@bs.module "assert"]
24-
external rejects: (unit => Js.Promise.t('a)) => unit = "rejects";
24+
external rejects: ([@bs.uncurry] (unit => Js.Promise.t('a))) => unit =
25+
"rejects";
2526
[@bs.module "assert"]
26-
external rejectsError: (unit => Js.Promise.t('a), 'e) => unit = "rejects";
27+
external rejectsError: ([@bs.uncurry] (unit => Js.Promise.t('a)), 'e) => unit =
28+
"rejects";
2729
[@bs.module "assert"]
28-
external doesNotReject: (unit => Js.Promise.t('a)) => unit = "doesNotReject";
30+
external doesNotReject: ([@bs.uncurry] (unit => Js.Promise.t('a))) => unit =
31+
"doesNotReject";
2932
[@bs.module "assert"]
30-
external doesNotRejectError: (unit => Js.Promise.t('a), 'e) => unit =
33+
external doesNotRejectError:
34+
([@bs.uncurry] (unit => Js.Promise.t('a)), 'e) => unit =
3135
"doesNotReject";
3236

3337
module AssertionError = Errors.AssertionError;

src/BigInt.re

+15-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,25 @@ external (+): (t, t) => t = "%addfloat";
1010
external (-): (t, t) => t = "%subfloat";
1111
external ( * ): (t, t) => t = "%mulfloat";
1212
external (/): (t, t) => t = "%divfloat";
13-
external (%): (t, t) => t = "%modfloat";
13+
let (mod): (t, t) => t = Obj.magic(mod_float);
1414
let ( ** ): (t, t) => t = [%raw {|function (a, b) { return (a ** b); }|}];
1515
external (land): (t, t) => t = "%andint";
1616
external (lor): (t, t) => t = "%orint";
1717
external (lxor): (t, t) => t = "%xorint";
1818
let lnot: t => t = x => x lxor _NEGATIVE_ONE;
1919
external (lsl): (t, t) => t = "%lslint";
2020
external (asr): (t, t) => t = "%asrint";
21+
22+
external negate: t => t = "%negfloat";
23+
external add: (t, t) => t = "%addfloat";
24+
external subtract: (t, t) => t = "%subfloat";
25+
external multiply: (t, t) => t = "%mulfloat";
26+
external divide: (t, t) => t = "%divfloat";
27+
let modulo: (t, t) => t = Obj.magic(mod_float);
28+
let power: (t, t) => t = ( ** );
29+
external logicalAnd: (t, t) => t = "%andint";
30+
external logicalOr: (t, t) => t = "%orint";
31+
external logicalXor: (t, t) => t = "%xorint";
32+
let logicalNot: t => t = x => x lxor _NEGATIVE_ONE;
33+
external logicalShiftLeft: (t, t) => t = "%lslint";
34+
external arithmeticShiftRight: (t, t) => t = "%asrint";

src/ChildProcess.re

+12-16
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ external execOptions:
9393
(
9494
~cwd: string=?,
9595
~env: Js.Dict.t(string)=?,
96-
~encoding: string=?,
9796
~shell: string=?,
9897
~timeout: int=?,
9998
~maxBuffer: int=?,
@@ -106,12 +105,12 @@ external execOptions:
106105
execOptions;
107106

108107
[@bs.module "child_process"] [@bs.val]
109-
external exec: (string, (option(Js.Exn.t), string, string) => unit) => t =
108+
external exec: (string, (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
110109
"exec";
111110

112111
[@bs.module "child_process"] [@bs.val]
113112
external execWith:
114-
(string, execOptions, (option(Js.Exn.t), string, string) => unit) => t =
113+
(string, execOptions, (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
115114
"exec";
116115

117116
type execFileOptions;
@@ -121,7 +120,6 @@ external execFileOption:
121120
(
122121
~cwd: string=?,
123122
~env: Js.Dict.t(string)=?,
124-
~encoding: string=?,
125123
~timeout: int=?,
126124
~maxBuffer: int=?,
127125
~killSignal: string=?,
@@ -135,7 +133,7 @@ external execFileOption:
135133

136134
[@bs.module "child_process"] [@bs.val]
137135
external execFile:
138-
(string, array(string), (option(Js.Exn.t), string, string) => unit) => t =
136+
(string, array(string), (Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit) => t =
139137
"execFile";
140138

141139
[@bs.module "child_process"] [@bs.val]
@@ -144,7 +142,7 @@ external execFileWith:
144142
string,
145143
array(string),
146144
execFileOptions,
147-
(option(Js.Exn.t), string, string) => unit
145+
(Js.nullable(Js.Exn.t), Buffer.t, Buffer.t) => unit
148146
) =>
149147
t =
150148
"execFile";
@@ -202,11 +200,11 @@ external spawnWith: (string, array(string), spawnOptions) => t = "spawn";
202200
type spawnSyncResult('a) = {
203201
pid: int,
204202
output: array('a),
205-
stdout: string,
206-
stderr: string,
203+
stdout: Buffer.t,
204+
stderr: Buffer.t,
207205
status: int,
208-
signal: Js.Nullable.t(string),
209-
error: option(Js.Exn.t),
206+
signal: Js.nullable(string),
207+
error: Js.nullable(Js.Exn.t),
210208
};
211209

212210
type spawnSyncOptions;
@@ -247,7 +245,6 @@ external execSyncOptions:
247245
~cwd: string=?,
248246
~env: Js.Dict.t(string)=?,
249247
~input: Buffer.t=?,
250-
~encoding: string=?,
251248
~shell: string=?,
252249
~timeout: int=?,
253250
~maxBuffer: int=?,
@@ -260,10 +257,10 @@ external execSyncOptions:
260257
execSyncOptions;
261258

262259
[@bs.module "child_process"] [@bs.val]
263-
external execSync: string => string = "execSync";
260+
external execSync: string => Buffer.t = "execSync";
264261

265262
[@bs.module "child_process"] [@bs.val]
266-
external execSyncWith: (string, execSyncOptions) => string = "execSync";
263+
external execSyncWith: (string, execSyncOptions) => Buffer.t = "execSync";
267264

268265
type execFileSyncOptions;
269266

@@ -273,7 +270,6 @@ external execFileSyncOptions:
273270
~cwd: string=?,
274271
~env: Js.Dict.t(string)=?,
275272
~input: Buffer.t=?,
276-
~encoding: string=?,
277273
~shell: string=?,
278274
~timeout: int=?,
279275
~maxBuffer: int=?,
@@ -286,9 +282,9 @@ external execFileSyncOptions:
286282
execFileSyncOptions;
287283

288284
[@bs.module "child_process"] [@bs.val]
289-
external execFileSync: (string, array(string)) => string = "execFileSync";
285+
external execFileSync: (string, array(string)) => Buffer.t = "execFileSync";
290286

291287
[@bs.module "child_process"] [@bs.val]
292288
external execFileSyncWith:
293-
(string, array(string), execFileSyncOptions) => string =
289+
(string, array(string), execFileSyncOptions) => Buffer.t =
294290
"execFileSync";

src/Console.re

+5-5
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ type consoleOptions;
88
[@bs.obj]
99
external consoleOptions:
1010
(
11-
~stdout: Stream.Writable.subtype('w, 'r, 'a),
12-
~stderr: Stream.Writable.subtype('w, 'r, 'a)=?,
11+
~stdout: Stream.Writable.subtype('w, 'a),
12+
~stderr: Stream.Writable.subtype('w, 'a)=?,
1313
~ignoreErrors: bool=?,
1414
~colorMode: bool=?,
1515
~inspectOptions: Util.inspectOptions=?,
@@ -20,21 +20,21 @@ external consoleOptions:
2020
[@bs.new] [@bs.module "console"]
2121
external make: consoleOptions => t = "Console";
2222
[@bs.new] [@bs.module "console"]
23-
external make2: {.. "stdout": Stream.Writable.subtype('w, 'r, 'a)} => t =
23+
external make2: {.. "stdout": Stream.Writable.subtype('w, 'a)} => t =
2424
"Console";
2525

2626
[@bs.send] external assert_: (t, bool) => unit = "assert";
2727
// TODO: reconsider naming
2828
[@bs.send] external assertWithMessage: (t, bool, string) => unit = "assert";
29-
[@bs.send] external clear: (t, unit) => unit = "clear";
29+
[@bs.send] external clear: (t) => unit = "clear";
3030
[@bs.send] external count: (t, string) => unit = "count";
3131
[@bs.send] external countReset: (t, string) => unit = "countReset";
3232

3333
[@bs.send] external debug: (t, string) => unit = "debug";
3434
[@bs.send] [@bs.variadic]
3535
external debugMany: (t, array('a)) => unit = "debug";
3636

37-
[@bs.send] external dir: (t, string) => unit = "dir";
37+
[@bs.send] external dir: (t, 'a) => unit = "dir";
3838
[@bs.send] [@bs.variadic] external dirMany: (t, array('a)) => unit = "dir";
3939

4040
[@bs.send] external dirxml: (t, string) => unit = "dirxml";

0 commit comments

Comments
 (0)