1+ open Belt ;
2+
13exception UnrecognizedInput ( string) ;
24
35module Args = {
@@ -31,6 +33,7 @@ let optionToFileType = input =>
3133| "css" => Compiler2 . CSS
3234| "graphql" => Compiler2 . GraphQL
3335| "typed" => Compiler2 . Typed
36+ | "reason" => Compiler2 . Reason
3437| _ => raise (UnrecognizedInput (input))
3538 };
3639
@@ -43,28 +46,27 @@ let program =
4346|. Commander . parse(Commander . Process . argv)
4447|. Args . decode;
4548
46- let filename =
47- program|. Args . args|. Belt . Array . get(0 )|. Belt . Option . getExn;
49+ let filename = program|. Args . args|. Array . get(0 )|. Option . getExn;
4850
4951let inputType =
5052 program
5153|. Args . input
52- |. Belt . Option . mapWithDefault(
54+ |. Option . mapWithDefault(
5355 inferInputTypeFromFileExtension(filename),
5456 optionToFileType,
5557 );
5658
5759let outputType =
5860 program
5961|. Args . output
60- |. Belt . Option . map(optionToFileType)
61- |. Belt . Option . getWithDefault(Compiler2 . Typed );
62+ |. Option . map(optionToFileType)
63+ |. Option . getWithDefault(Compiler2 . Typed );
6264
6365let inputSource = Node . Fs . readFileAsUtf8Sync(filename);
6466
6567let inputFile =
6668Compiler2 . {type_: inputType, name: filename, source: inputSource};
6769
68- let output = Compiler2 . compile(inputFile, outputType);
70+ let outputs = Compiler2 . compile(inputFile, outputType);
6971
70- Js . log(output );
72+ Array . forEach(outputs , Js . log);