firefly-compiler 0.5.80 → 0.5.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -131,8 +131,8 @@ return BootstrapCommand$;
131
131
  export function RunCommand(mainPath_, argument_) {
132
132
  return {RunCommand: true, mainPath_, argument_};
133
133
  }
134
- export function DevelopCommand(mainPath_, argument_) {
135
- return {DevelopCommand: true, mainPath_, argument_};
134
+ export function DevelopCommand(proxyPort_, targetPort_, mainPath_, argument_) {
135
+ return {DevelopCommand: true, proxyPort_, targetPort_, mainPath_, argument_};
136
136
  }
137
137
  export function BrowserCommand(mainPath_) {
138
138
  return {BrowserCommand: true, mainPath_};
@@ -152,7 +152,7 @@ export function CommandLineError(problem_) {
152
152
  return {problem_};
153
153
  }
154
154
 
155
- export const usageString_ = "\r\nusage: firefly <main-file> [<main-arguments>] | <command> [<command-arguments>]\r\n\r\nThese are the commands:\r\n run <main-file> [<main-arguments>] Run the main file with the provided arguments\r\n develop <main-file> [<main-arguments>] Develop the main file with the provided arguments\r\n browser <main-file> Compile the main file for the browser\r\n build <main-file> Build the main file\r\n check <firefly-file> Check the firefly source file for errors\r\n symbols <out-file> <firefly-file> Print a .tsv with the symbols of a firefly source file\r\n bootstrap Bootstrap the compiler\r\n";
155
+ export const usageString_ = "\r\nusage: firefly <main-file> [<main-arguments>] | <command> [<command-arguments>]\r\n\r\nThese are the commands:\r\n run <main-file> [<main-arguments>] Run the main file with the provided arguments\r\n develop [<proxy-port> <target-port>] \r\n <main-file> [<main-arguments>] Develop the main file with the provided arguments\r\n browser <main-file> Compile the main file for the browser\r\n build <main-file> Build the main file\r\n check <firefly-file> Check the firefly source file for errors\r\n symbols <out-file> <firefly-file> Print a .tsv with the symbols of a firefly source file\r\n bootstrap Bootstrap the compiler\r\n";
156
156
 
157
157
  export function main_(system_) {
158
158
  const fireflyPath_ = ff_compiler_Main.detectFireflyPath_(system_);
@@ -172,9 +172,11 @@ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "This mod
172
172
  return
173
173
  }
174
174
  if(command_a.DevelopCommand) {
175
+ const proxyPort_ = command_a.proxyPort_;
176
+ const targetPort_ = command_a.targetPort_;
175
177
  const mainFile_ = command_a.mainPath_;
176
178
  const arguments_ = command_a.argument_;
177
- ff_compiler_DevelopMode.run_(system_, fireflyPath_, mainFile_, arguments_)
179
+ ff_compiler_DevelopMode.run_(system_, fireflyPath_, proxyPort_, targetPort_, mainFile_, arguments_)
178
180
  return
179
181
  }
180
182
  if(command_a.BrowserCommand) {
@@ -342,17 +344,36 @@ if(arguments_a.length >= 1 && arguments_a[0] === "develop") {
342
344
  const runArguments_ = arguments_a.slice(1);
343
345
  {
344
346
  const _1 = runArguments_;
347
+ if(_1.length >= 3) {
348
+ const proxyPort_ = _1[0];
349
+ const targetPort_ = _1[1];
350
+ const mainFile_ = _1[2];
351
+ const mainArguments_ = _1.slice(3);
352
+ const _guard3 = ff_core_String.String_getInt(proxyPort_);
353
+ if(_guard3.Some) {
354
+ const proxy_ = _guard3.value_;
355
+ const _guard2 = ff_core_String.String_getInt(targetPort_);
356
+ if(_guard2.Some) {
357
+ const target_ = _guard2.value_;
358
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
359
+ if(_guard1.Some) {
360
+ const mainName_ = _guard1.value_;
361
+ return ff_compiler_Main.DevelopCommand(proxy_, target_, mainFile_, mainArguments_)
362
+ }
363
+ }
364
+ }
365
+ }
345
366
  if(_1.length >= 1) {
346
367
  const mainFile_ = _1[0];
347
368
  const mainArguments_ = _1.slice(1);
348
369
  const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
349
370
  if(_guard1.Some) {
350
371
  const mainName_ = _guard1.value_;
351
- return ff_compiler_Main.DevelopCommand(mainFile_, mainArguments_)
372
+ return ff_compiler_Main.DevelopCommand(8081, 8080, mainFile_, mainArguments_)
352
373
  }
353
374
  }
354
375
  {
355
- throw ff_core_Js.initializeError_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to develop." + ff_compiler_Main.usageString_)), new Error(), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError, ff_compiler_Main.ff_core_Show_Show$ff_compiler_Main_CommandLineError)
376
+ throw ff_core_Js.initializeError_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) or proxy+target port as first argument(s) to develop." + ff_compiler_Main.usageString_)), new Error(), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError, ff_compiler_Main.ff_core_Show_Show$ff_compiler_Main_CommandLineError)
356
377
  }
357
378
  }
358
379
  return
@@ -470,12 +491,7 @@ const runFilePath_ = (ff_core_String.String_contains(runFile_, "://")
470
491
  : ff_core_NodeSystem.NodeSystem_path(system_, runFile_));
471
492
  if(ff_core_Path.Path_exists(runFilePath_, false, false, false)) {
472
493
  const main_ = import(runFile_);
473
- try {
474
- main_["$run$"](fireflyPath_.absolutePath_, arguments_)
475
- } catch(error_) {
476
- console.error(ff_core_Error.Error_stack(error_));
477
- process.exit(1)
478
- };
494
+ main_["$run$"](fireflyPath_.absolutePath_, arguments_);
479
495
  return true
480
496
  } else {
481
497
  return false
@@ -612,9 +628,11 @@ throw ff_core_Js.initializeError_(ff_compiler_Syntax.CompileError(at_, "This mod
612
628
  return
613
629
  }
614
630
  if(command_a.DevelopCommand) {
631
+ const proxyPort_ = command_a.proxyPort_;
632
+ const targetPort_ = command_a.targetPort_;
615
633
  const mainFile_ = command_a.mainPath_;
616
634
  const arguments_ = command_a.argument_;
617
- (await ff_compiler_DevelopMode.run_$(system_, fireflyPath_, mainFile_, arguments_, $task))
635
+ (await ff_compiler_DevelopMode.run_$(system_, fireflyPath_, proxyPort_, targetPort_, mainFile_, arguments_, $task))
618
636
  return
619
637
  }
620
638
  if(command_a.BrowserCommand) {
@@ -782,17 +800,36 @@ if(arguments_a.length >= 1 && arguments_a[0] === "develop") {
782
800
  const runArguments_ = arguments_a.slice(1);
783
801
  {
784
802
  const _1 = runArguments_;
803
+ if(_1.length >= 3) {
804
+ const proxyPort_ = _1[0];
805
+ const targetPort_ = _1[1];
806
+ const mainFile_ = _1[2];
807
+ const mainArguments_ = _1.slice(3);
808
+ const _guard3 = ff_core_String.String_getInt(proxyPort_);
809
+ if(_guard3.Some) {
810
+ const proxy_ = _guard3.value_;
811
+ const _guard2 = ff_core_String.String_getInt(targetPort_);
812
+ if(_guard2.Some) {
813
+ const target_ = _guard2.value_;
814
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
815
+ if(_guard1.Some) {
816
+ const mainName_ = _guard1.value_;
817
+ return ff_compiler_Main.DevelopCommand(proxy_, target_, mainFile_, mainArguments_)
818
+ }
819
+ }
820
+ }
821
+ }
785
822
  if(_1.length >= 1) {
786
823
  const mainFile_ = _1[0];
787
824
  const mainArguments_ = _1.slice(1);
788
825
  const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
789
826
  if(_guard1.Some) {
790
827
  const mainName_ = _guard1.value_;
791
- return ff_compiler_Main.DevelopCommand(mainFile_, mainArguments_)
828
+ return ff_compiler_Main.DevelopCommand(8081, 8080, mainFile_, mainArguments_)
792
829
  }
793
830
  }
794
831
  {
795
- throw ff_core_Js.initializeError_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to develop." + ff_compiler_Main.usageString_)), new Error(), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError, ff_compiler_Main.ff_core_Show_Show$ff_compiler_Main_CommandLineError)
832
+ throw ff_core_Js.initializeError_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) or proxy+target port as first argument(s) to develop." + ff_compiler_Main.usageString_)), new Error(), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError, ff_compiler_Main.ff_core_Show_Show$ff_compiler_Main_CommandLineError)
796
833
  }
797
834
  }
798
835
  return
@@ -910,12 +947,7 @@ const runFilePath_ = (ff_core_String.String_contains(runFile_, "://")
910
947
  : (await ff_core_NodeSystem.NodeSystem_path$(system_, runFile_, $task)));
911
948
  if((await ff_core_Path.Path_exists$(runFilePath_, false, false, false, $task))) {
912
949
  const main_ = (await import(runFile_));
913
- try {
914
- (await main_["$run$"](fireflyPath_.absolutePath_, arguments_))
915
- } catch(error_) {
916
- console.error(ff_core_Error.Error_stack(error_));
917
- process.exit(1)
918
- };
950
+ (await main_["$run$"](fireflyPath_.absolutePath_, arguments_));
919
951
  return true
920
952
  } else {
921
953
  return false
@@ -1065,7 +1097,7 @@ return ((((("RunCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_
1065
1097
  }
1066
1098
  if(value_a.DevelopCommand) {
1067
1099
  const z_ = value_a;
1068
- return ((((("DevelopCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.argument_)) + ")")
1100
+ return ((((((((("DevelopCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_Int_Int.show_(z_.proxyPort_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Int_Int.show_(z_.targetPort_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.argument_)) + ")")
1069
1101
  }
1070
1102
  if(value_a.BrowserCommand) {
1071
1103
  const z_ = value_a;
@@ -1096,7 +1128,7 @@ return ((((("RunCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_
1096
1128
  }
1097
1129
  if(value_a.DevelopCommand) {
1098
1130
  const z_ = value_a;
1099
- return ((((("DevelopCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.argument_)) + ")")
1131
+ return ((((((((("DevelopCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_Int_Int.show_(z_.proxyPort_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_Int_Int.show_(z_.targetPort_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ", ") + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Show.ff_core_Show_Show$ff_core_String_String).show_(z_.argument_)) + ")")
1100
1132
  }
1101
1133
  if(value_a.BrowserCommand) {
1102
1134
  const z_ = value_a;
@@ -1149,7 +1181,7 @@ return ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_c
1149
1181
  if(x_a.DevelopCommand && y_a.DevelopCommand) {
1150
1182
  const x_ = x_a;
1151
1183
  const y_ = y_a;
1152
- return ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.argument_, y_.argument_))
1184
+ return ((x_.proxyPort_ === y_.proxyPort_) && ((x_.targetPort_ === y_.targetPort_) && ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.argument_, y_.argument_))))
1153
1185
  }
1154
1186
  if(x_a.BrowserCommand && y_a.BrowserCommand) {
1155
1187
  const x_ = x_a;
@@ -1189,7 +1221,7 @@ return ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_c
1189
1221
  if(x_a.DevelopCommand && y_a.DevelopCommand) {
1190
1222
  const x_ = x_a;
1191
1223
  const y_ = y_a;
1192
- return ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.argument_, y_.argument_))
1224
+ return ((x_.proxyPort_ === y_.proxyPort_) && ((x_.targetPort_ === y_.targetPort_) && ((x_.mainPath_ === y_.mainPath_) && ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String).equals_(x_.argument_, y_.argument_))))
1193
1225
  }
1194
1226
  if(x_a.BrowserCommand && y_a.BrowserCommand) {
1195
1227
  const x_ = x_a;
@@ -1266,6 +1298,14 @@ return
1266
1298
  if(x_a.DevelopCommand && y_a.DevelopCommand) {
1267
1299
  const x_ = x_a;
1268
1300
  const y_ = y_a;
1301
+ const proxyPortOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.proxyPort_, y_.proxyPort_);
1302
+ if((proxyPortOrdering_ !== ff_core_Ordering.OrderingSame())) {
1303
+ return proxyPortOrdering_
1304
+ } else {
1305
+ const targetPortOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.targetPort_, y_.targetPort_);
1306
+ if((targetPortOrdering_ !== ff_core_Ordering.OrderingSame())) {
1307
+ return targetPortOrdering_
1308
+ } else {
1269
1309
  const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1270
1310
  if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1271
1311
  return mainPathOrdering_
@@ -1277,6 +1317,8 @@ return argumentOrdering_
1277
1317
  return ff_core_Ordering.OrderingSame()
1278
1318
  }
1279
1319
  }
1320
+ }
1321
+ }
1280
1322
  return
1281
1323
  }
1282
1324
  if(x_a.BrowserCommand && y_a.BrowserCommand) {
@@ -1381,6 +1423,14 @@ return
1381
1423
  if(x_a.DevelopCommand && y_a.DevelopCommand) {
1382
1424
  const x_ = x_a;
1383
1425
  const y_ = y_a;
1426
+ const proxyPortOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.proxyPort_, y_.proxyPort_);
1427
+ if((proxyPortOrdering_ !== ff_core_Ordering.OrderingSame())) {
1428
+ return proxyPortOrdering_
1429
+ } else {
1430
+ const targetPortOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(x_.targetPort_, y_.targetPort_);
1431
+ if((targetPortOrdering_ !== ff_core_Ordering.OrderingSame())) {
1432
+ return targetPortOrdering_
1433
+ } else {
1384
1434
  const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1385
1435
  if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1386
1436
  return mainPathOrdering_
@@ -1392,6 +1442,8 @@ return argumentOrdering_
1392
1442
  return ff_core_Ordering.OrderingSame()
1393
1443
  }
1394
1444
  }
1445
+ }
1446
+ }
1395
1447
  return
1396
1448
  }
1397
1449
  if(x_a.BrowserCommand && y_a.BrowserCommand) {
@@ -1536,6 +1588,8 @@ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_
1536
1588
  ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1537
1589
  ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1538
1590
  serialization_.offset_ += 1;
1591
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.serializeUsing_(serialization_, v_.proxyPort_);
1592
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.serializeUsing_(serialization_, v_.targetPort_);
1539
1593
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1540
1594
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.argument_)
1541
1595
  return
@@ -1593,7 +1647,7 @@ return ff_compiler_Main.RunCommand(ff_core_Serializable.ff_core_Serializable_Ser
1593
1647
  }
1594
1648
  if(_1 === 2) {
1595
1649
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1596
- return ff_compiler_Main.DevelopCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
1650
+ return ff_compiler_Main.DevelopCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
1597
1651
  }
1598
1652
  if(_1 === 3) {
1599
1653
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
@@ -1643,6 +1697,8 @@ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_
1643
1697
  ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1644
1698
  ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1645
1699
  serialization_.offset_ += 1;
1700
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.serializeUsing_(serialization_, v_.proxyPort_);
1701
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.serializeUsing_(serialization_, v_.targetPort_);
1646
1702
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1647
1703
  ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).serializeUsing_(serialization_, v_.argument_)
1648
1704
  return
@@ -1700,7 +1756,7 @@ return ff_compiler_Main.RunCommand(ff_core_Serializable.ff_core_Serializable_Ser
1700
1756
  }
1701
1757
  if(_1 === 2) {
1702
1758
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1703
- return ff_compiler_Main.DevelopCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
1759
+ return ff_compiler_Main.DevelopCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_Int_Int.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_), ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_List_List(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String).deserializeUsing_(serialization_))
1704
1760
  }
1705
1761
  if(_1 === 3) {
1706
1762
  serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);