firefly-compiler 0.4.6 → 0.4.8

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.
Files changed (90) hide show
  1. package/compiler/Compiler.ff +2 -0
  2. package/compiler/Deriver.ff +7 -0
  3. package/core/Array.ff +17 -4
  4. package/core/AssetSystem.ff +1 -1
  5. package/core/BrowserSystem.ff +27 -0
  6. package/core/List.ff +4 -0
  7. package/core/Lock.ff +2 -2
  8. package/core/Random.ff +148 -0
  9. package/core/SourceLocation.ff +27 -0
  10. package/core/Task.ff +3 -0
  11. package/core/WebSocket.ff +127 -0
  12. package/httpserver/HttpServer.ff +1 -1
  13. package/lux/Css.ff +648 -0
  14. package/lux/CssTest.ff +48 -0
  15. package/lux/Lux.ff +33 -18
  16. package/lux/Main.ff +4 -1
  17. package/output/js/ff/compiler/Builder.mjs +448 -444
  18. package/output/js/ff/compiler/Compiler.mjs +420 -416
  19. package/output/js/ff/compiler/Dependencies.mjs +393 -389
  20. package/output/js/ff/compiler/Deriver.mjs +1178 -1170
  21. package/output/js/ff/compiler/Dictionaries.mjs +1315 -1309
  22. package/output/js/ff/compiler/Environment.mjs +1025 -1015
  23. package/output/js/ff/compiler/Inference.mjs +4272 -4268
  24. package/output/js/ff/compiler/JsEmitter.mjs +5405 -5391
  25. package/output/js/ff/compiler/JsImporter.mjs +270 -266
  26. package/output/js/ff/compiler/LspHook.mjs +799 -793
  27. package/output/js/ff/compiler/Main.mjs +1691 -1675
  28. package/output/js/ff/compiler/Parser.mjs +4016 -4008
  29. package/output/js/ff/compiler/Patterns.mjs +935 -927
  30. package/output/js/ff/compiler/Resolver.mjs +2311 -2307
  31. package/output/js/ff/compiler/Substitution.mjs +1154 -1150
  32. package/output/js/ff/compiler/Syntax.mjs +12566 -12434
  33. package/output/js/ff/compiler/Token.mjs +3152 -3096
  34. package/output/js/ff/compiler/Tokenizer.mjs +597 -593
  35. package/output/js/ff/compiler/Unification.mjs +1762 -1752
  36. package/output/js/ff/compiler/Wildcards.mjs +612 -608
  37. package/output/js/ff/compiler/Workspace.mjs +695 -687
  38. package/output/js/ff/core/Any.mjs +147 -143
  39. package/output/js/ff/core/Array.mjs +573 -547
  40. package/output/js/ff/core/AssetSystem.mjs +278 -274
  41. package/output/js/ff/core/Atomic.mjs +158 -154
  42. package/output/js/ff/core/Bool.mjs +156 -152
  43. package/output/js/ff/core/Box.mjs +116 -112
  44. package/output/js/ff/core/BrowserSystem.mjs +181 -126
  45. package/output/js/ff/core/Buffer.mjs +399 -395
  46. package/output/js/ff/core/BuildSystem.mjs +300 -296
  47. package/output/js/ff/core/Channel.mjs +193 -189
  48. package/output/js/ff/core/Char.mjs +153 -149
  49. package/output/js/ff/core/Core.mjs +304 -300
  50. package/output/js/ff/core/Duration.mjs +120 -116
  51. package/output/js/ff/core/Equal.mjs +183 -179
  52. package/output/js/ff/core/Error.mjs +146 -142
  53. package/output/js/ff/core/FileHandle.mjs +154 -150
  54. package/output/js/ff/core/Float.mjs +229 -225
  55. package/output/js/ff/core/HttpClient.mjs +195 -191
  56. package/output/js/ff/core/Instant.mjs +113 -109
  57. package/output/js/ff/core/Int.mjs +269 -265
  58. package/output/js/ff/core/IntMap.mjs +284 -280
  59. package/output/js/ff/core/JsSystem.mjs +242 -238
  60. package/output/js/ff/core/JsValue.mjs +712 -708
  61. package/output/js/ff/core/List.mjs +2346 -2334
  62. package/output/js/ff/core/Lock.mjs +235 -231
  63. package/output/js/ff/core/Log.mjs +167 -163
  64. package/output/js/ff/core/Map.mjs +366 -362
  65. package/output/js/ff/core/NodeSystem.mjs +298 -294
  66. package/output/js/ff/core/Nothing.mjs +108 -104
  67. package/output/js/ff/core/Option.mjs +1023 -1015
  68. package/output/js/ff/core/Ordering.mjs +734 -730
  69. package/output/js/ff/core/Pair.mjs +337 -331
  70. package/output/js/ff/core/Path.mjs +549 -545
  71. package/output/js/ff/core/Random.mjs +340 -0
  72. package/output/js/ff/core/RbMap.mjs +1944 -1940
  73. package/output/js/ff/core/Serializable.mjs +432 -428
  74. package/output/js/ff/core/Set.mjs +258 -254
  75. package/output/js/ff/core/Show.mjs +209 -205
  76. package/output/js/ff/core/SourceLocation.mjs +273 -229
  77. package/output/js/ff/core/Stack.mjs +533 -529
  78. package/output/js/ff/core/Stream.mjs +1308 -1304
  79. package/output/js/ff/core/String.mjs +369 -365
  80. package/output/js/ff/core/StringMap.mjs +284 -280
  81. package/output/js/ff/core/Task.mjs +325 -319
  82. package/output/js/ff/core/Try.mjs +511 -507
  83. package/output/js/ff/core/Unit.mjs +155 -151
  84. package/output/js/ff/core/WebSocket.mjs +198 -0
  85. package/package.json +1 -1
  86. package/vscode/package.json +1 -1
  87. package/webserver/.firefly/include/package-lock.json +16 -0
  88. package/webserver/.firefly/include/package.json +5 -0
  89. package/webserver/.firefly/package.ff +2 -0
  90. package/webserver/WebServer.ff +608 -0
@@ -1,140 +1,144 @@
1
- import * as import$0 from 'url';
2
-
3
- import * as ff_compiler_Main from "../../ff/compiler/Main.mjs"
4
-
5
- import * as ff_compiler_Builder from "../../ff/compiler/Builder.mjs"
6
-
7
- import * as ff_compiler_Compiler from "../../ff/compiler/Compiler.mjs"
8
-
9
- import * as ff_compiler_Dependencies from "../../ff/compiler/Dependencies.mjs"
10
-
11
- import * as ff_compiler_Inference from "../../ff/compiler/Inference.mjs"
12
-
13
- import * as ff_compiler_JsEmitter from "../../ff/compiler/JsEmitter.mjs"
14
-
15
- import * as ff_compiler_LspHook from "../../ff/compiler/LspHook.mjs"
16
-
17
- import * as ff_compiler_Parser from "../../ff/compiler/Parser.mjs"
18
-
19
- import * as ff_compiler_Resolver from "../../ff/compiler/Resolver.mjs"
20
-
21
- import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
22
-
23
- import * as ff_compiler_Tokenizer from "../../ff/compiler/Tokenizer.mjs"
24
-
25
- import * as ff_compiler_Unification from "../../ff/compiler/Unification.mjs"
26
-
27
- import * as ff_core_Any from "../../ff/core/Any.mjs"
28
-
29
- import * as ff_core_Array from "../../ff/core/Array.mjs"
30
-
31
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
32
-
33
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
34
-
35
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
36
-
37
- import * as ff_core_Box from "../../ff/core/Box.mjs"
38
-
39
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
40
-
41
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
42
-
43
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
44
-
45
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
46
-
47
- import * as ff_core_Char from "../../ff/core/Char.mjs"
48
-
49
- import * as ff_core_Core from "../../ff/core/Core.mjs"
50
-
51
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
52
-
53
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
54
-
55
- import * as ff_core_Error from "../../ff/core/Error.mjs"
56
-
57
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
58
-
59
- import * as ff_core_Float from "../../ff/core/Float.mjs"
60
-
61
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
62
-
63
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
64
-
65
- import * as ff_core_Int from "../../ff/core/Int.mjs"
66
-
67
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
68
-
69
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
70
-
71
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
72
-
73
- import * as ff_core_List from "../../ff/core/List.mjs"
74
-
75
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
76
-
77
- import * as ff_core_Log from "../../ff/core/Log.mjs"
78
-
79
- import * as ff_core_Map from "../../ff/core/Map.mjs"
80
-
81
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
82
-
83
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
84
-
85
- import * as ff_core_Option from "../../ff/core/Option.mjs"
86
-
87
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
88
-
89
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
90
-
91
- import * as ff_core_Path from "../../ff/core/Path.mjs"
92
-
93
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
94
-
95
- import * as ff_core_Set from "../../ff/core/Set.mjs"
96
-
97
- import * as ff_core_Show from "../../ff/core/Show.mjs"
98
-
99
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
100
-
101
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
102
-
103
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
104
-
105
- import * as ff_core_String from "../../ff/core/String.mjs"
106
-
107
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
108
-
109
- import * as ff_core_Task from "../../ff/core/Task.mjs"
110
-
111
- import * as ff_core_Try from "../../ff/core/Try.mjs"
112
-
113
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
114
-
115
- // type MainCommand
116
- const BootstrapCommand$ = {BootstrapCommand: true};
117
- export function BootstrapCommand() {
118
- return BootstrapCommand$;
119
- }
120
- export function RunCommand(mainPath_, argument_) {
121
- return {RunCommand: true, mainPath_, argument_};
122
- }
123
- export function BrowserCommand(mainPath_) {
124
- return {BrowserCommand: true, mainPath_};
125
- }
126
- export function BuildCommand(mainPath_) {
127
- return {BuildCommand: true, mainPath_};
128
- }
129
- export function CheckCommand(filePath_) {
130
- return {CheckCommand: true, filePath_};
131
- }
132
-
133
- // type CommandLineError
134
- export function CommandLineError(problem_) {
135
- return {problem_};
136
- }
137
-
1
+ import * as import$0 from 'url';
2
+
3
+ import * as ff_compiler_Main from "../../ff/compiler/Main.mjs"
4
+
5
+ import * as ff_compiler_Builder from "../../ff/compiler/Builder.mjs"
6
+
7
+ import * as ff_compiler_Compiler from "../../ff/compiler/Compiler.mjs"
8
+
9
+ import * as ff_compiler_Dependencies from "../../ff/compiler/Dependencies.mjs"
10
+
11
+ import * as ff_compiler_Inference from "../../ff/compiler/Inference.mjs"
12
+
13
+ import * as ff_compiler_JsEmitter from "../../ff/compiler/JsEmitter.mjs"
14
+
15
+ import * as ff_compiler_LspHook from "../../ff/compiler/LspHook.mjs"
16
+
17
+ import * as ff_compiler_Parser from "../../ff/compiler/Parser.mjs"
18
+
19
+ import * as ff_compiler_Resolver from "../../ff/compiler/Resolver.mjs"
20
+
21
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
22
+
23
+ import * as ff_compiler_Tokenizer from "../../ff/compiler/Tokenizer.mjs"
24
+
25
+ import * as ff_compiler_Unification from "../../ff/compiler/Unification.mjs"
26
+
27
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
28
+
29
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
30
+
31
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
32
+
33
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
34
+
35
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
36
+
37
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
38
+
39
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
40
+
41
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
42
+
43
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
44
+
45
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
46
+
47
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
48
+
49
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
50
+
51
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
52
+
53
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
54
+
55
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
56
+
57
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
58
+
59
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
60
+
61
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
62
+
63
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
64
+
65
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
66
+
67
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
68
+
69
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
70
+
71
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
72
+
73
+ import * as ff_core_List from "../../ff/core/List.mjs"
74
+
75
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
76
+
77
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
78
+
79
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
80
+
81
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
82
+
83
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
84
+
85
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
86
+
87
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
88
+
89
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
90
+
91
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
92
+
93
+ import * as ff_core_Random from "../../ff/core/Random.mjs"
94
+
95
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
96
+
97
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
98
+
99
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
100
+
101
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
102
+
103
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
104
+
105
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
106
+
107
+ import * as ff_core_String from "../../ff/core/String.mjs"
108
+
109
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
110
+
111
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
112
+
113
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
114
+
115
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
116
+
117
+ import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
118
+
119
+ // type MainCommand
120
+ const BootstrapCommand$ = {BootstrapCommand: true};
121
+ export function BootstrapCommand() {
122
+ return BootstrapCommand$;
123
+ }
124
+ export function RunCommand(mainPath_, argument_) {
125
+ return {RunCommand: true, mainPath_, argument_};
126
+ }
127
+ export function BrowserCommand(mainPath_) {
128
+ return {BrowserCommand: true, mainPath_};
129
+ }
130
+ export function BuildCommand(mainPath_) {
131
+ return {BuildCommand: true, mainPath_};
132
+ }
133
+ export function CheckCommand(filePath_) {
134
+ return {CheckCommand: true, filePath_};
135
+ }
136
+
137
+ // type CommandLineError
138
+ export function CommandLineError(problem_) {
139
+ return {problem_};
140
+ }
141
+
138
142
  export const usageString_ = `
139
143
  usage: firefly <main-file> [<main-arguments>] | <command> [<command-arguments>]
140
144
 
@@ -144,666 +148,666 @@ These are the commands:
144
148
  build <main-file> Build the main file
145
149
  check <firefly-file> Check the firefly source file for errors
146
150
  bootstrap Bootstrap the compiler
147
- `;
148
-
149
- export function main_(system_) {
150
- const fireflyPath_ = ff_compiler_Main.detectFireflyPath_(system_);
151
- function buildScript_(mainFile_, mainPackagePair_, emitTarget_, resolvedDependencies_) {
152
- const fixedPackagePaths_ = (ff_core_Map.Map_contains(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)
153
- ? resolvedDependencies_.packagePaths_
154
- : ff_core_Map.Map_add(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(fireflyPath_, "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
155
- const compilerModulePath_ = ((ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget) && ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitExecutable(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget))
156
- ? ff_core_Option.Some(ff_core_Path.Path_slash(ff_core_Path.Path_slash(ff_core_Path.Path_slash(ff_core_Path.Path_slash(fireflyPath_, "output"), "js"), "ff"), "compiler/Builder.mjs"))
157
- : ff_core_Option.None());
158
- const targetName_ = (((_1) => {
159
- {
160
- if(_1.EmitBuild) {
161
- return "build"
162
- return
163
- }
164
- }
165
- {
166
- if(_1.EmitNode) {
167
- return "node"
168
- return
169
- }
170
- }
171
- {
172
- if(_1.EmitBrowser) {
173
- return "browser"
174
- return
175
- }
176
- }
177
- {
178
- if(_1.EmitExecutable) {
179
- return "executable"
180
- return
181
- }
182
- }
183
- }))(emitTarget_);
184
- ff_compiler_Builder.build_(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
185
- return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
186
- }))(resolvedDependencies_), compilerModulePath_, ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "temporary"), ff_core_Path.Path_path(ff_core_Path.Path_path(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "output"), targetName_), false)
187
- }
188
- function runCommand_(command_) {
189
- {
190
- const command_a = command_;
191
- {
192
- if(command_a.RunCommand) {
193
- const mainFile_ = command_a.mainPath_;
194
- const arguments_ = command_a.argument_;
195
- const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
196
- ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
197
- const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
198
- buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_);
199
- ff_compiler_Main.importAndRun_(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_)
200
- return
201
- }
202
- }
203
- {
204
- if(command_a.BrowserCommand) {
205
- const mainFile_ = command_a.mainPath_;
206
- const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
207
- ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
208
- const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
209
- buildScript_(mainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_);
210
- ff_compiler_Main.bundleForBrowser_(system_, resolvedDependencies_.mainPackagePair_, localMainFile_)
211
- return
212
- }
213
- }
214
- {
215
- if(command_a.BuildCommand) {
216
- const mainFile_ = command_a.mainPath_;
217
- const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
218
- ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
219
- const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
220
- buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_);
221
- buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_);
222
- ff_compiler_Main.bundleForPkg_(system_, resolvedDependencies_.mainPackagePair_, localMainFile_);
223
- ff_compiler_Main.importAndRun_(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, ff_core_List.Empty())
224
- return
225
- }
226
- }
227
- {
228
- if(command_a.CheckCommand) {
229
- const filePath_ = command_a.filePath_;
230
- ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true)
231
- return
232
- }
233
- }
234
- {
235
- if(command_a.BootstrapCommand) {
236
- const workingDirectory_ = ff_core_NodeSystem.NodeSystem_path(system_, ".");
237
- ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_Path.Path_slash(workingDirectory_, "compiler")), ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(workingDirectory_, "core")), ff_core_List.Empty())), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "temporary"), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "js"), true)
238
- return
239
- }
240
- }
241
- }
242
- }
243
- ff_core_Try.Try_grab(ff_core_Try.Try_catch(ff_core_Try.Try_catch(ff_core_Core.try_((() => {
244
- const command_ = ff_compiler_Main.parseCommandLine_(ff_core_Array.Array_toList(ff_core_NodeSystem.NodeSystem_arguments(system_)));
245
- return runCommand_(command_)
246
- })), ((_1, _2) => {
247
- {
248
- const message_ = _1.problem_;
249
- const error_ = _2;
250
- ff_core_Log.debug_(message_)
251
- return
252
- }
253
- }), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError), ((_1, _2) => {
254
- {
255
- const at_ = _1.at_;
256
- const message_ = _1.message_;
257
- const error_ = _2;
258
- ff_core_Log.debug_(message_);
259
- ff_core_Log.debug_((((((" at " + ff_core_String.String_replace(at_.file_, "./", "")) + ":") + at_.line_) + ":") + at_.column_))
260
- return
261
- }
262
- }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError))
263
- }
264
-
265
- export function parseCommandLine_(arguments_) {
266
- {
267
- const arguments_a = arguments_;
268
- {
269
- if(arguments_a.Link) {
270
- const mainFile_ = arguments_a.head_;
271
- const mainArguments_ = arguments_a.tail_;
272
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
273
- if(_guard1.Some) {
274
- const mainName_ = _guard1.value_;
275
- return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
276
- return
277
- }
278
- }
279
- }
280
- {
281
- if(arguments_a.Link) {
282
- if(arguments_a.head_ == "run") {
283
- const runArguments_ = arguments_a.tail_;
284
- {
285
- const _1 = runArguments_;
286
- {
287
- if(_1.Link) {
288
- const mainFile_ = _1.head_;
289
- const mainArguments_ = _1.tail_;
290
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
291
- if(_guard1.Some) {
292
- const mainName_ = _guard1.value_;
293
- return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
294
- return
295
- }
296
- }
297
- }
298
- {
299
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
300
- return
301
- }
302
- }
303
- return
304
- }
305
- }
306
- }
307
- {
308
- if(arguments_a.Link) {
309
- if(arguments_a.head_ == "browser") {
310
- const browserArguments_ = arguments_a.tail_;
311
- {
312
- const _1 = browserArguments_;
313
- {
314
- if(_1.Link) {
315
- const mainFile_ = _1.head_;
316
- if(_1.tail_.Empty) {
317
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
318
- if(_guard1.Some) {
319
- const mainName_ = _guard1.value_;
320
- return ff_compiler_Main.BrowserCommand(mainName_)
321
- return
322
- }
323
- }
324
- }
325
- }
326
- {
327
- if(_1.Link) {
328
- if(_1.tail_.Link) {
329
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
330
- return
331
- }
332
- }
333
- }
334
- {
335
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
336
- return
337
- }
338
- }
339
- return
340
- }
341
- }
342
- }
343
- {
344
- if(arguments_a.Link) {
345
- if(arguments_a.head_ == "build") {
346
- const buildArguments_ = arguments_a.tail_;
347
- {
348
- const _1 = buildArguments_;
349
- {
350
- if(_1.Link) {
351
- const mainFile_ = _1.head_;
352
- if(_1.tail_.Empty) {
353
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
354
- if(_guard1.Some) {
355
- const mainName_ = _guard1.value_;
356
- return ff_compiler_Main.BuildCommand(mainName_)
357
- return
358
- }
359
- }
360
- }
361
- }
362
- {
363
- if(_1.Link) {
364
- if(_1.tail_.Link) {
365
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
366
- return
367
- }
368
- }
369
- }
370
- {
371
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
372
- return
373
- }
374
- }
375
- return
376
- }
377
- }
378
- }
379
- {
380
- if(arguments_a.Link) {
381
- if(arguments_a.head_ == "check") {
382
- const checkArguments_ = arguments_a.tail_;
383
- {
384
- const _1 = checkArguments_;
385
- {
386
- if(_1.Link) {
387
- const fileName_ = _1.head_;
388
- if(_1.tail_.Empty) {
389
- const _guard1 = ff_core_String.String_removeLast(fileName_, ".ff");
390
- if(_guard1.Some) {
391
- return ff_compiler_Main.CheckCommand(fileName_)
392
- return
393
- }
394
- }
395
- }
396
- }
397
- {
398
- if(_1.Link) {
399
- if(_1.tail_.Link) {
400
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to check." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
401
- return
402
- }
403
- }
404
- }
405
- {
406
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
407
- return
408
- }
409
- }
410
- return
411
- }
412
- }
413
- }
414
- {
415
- if(arguments_a.Link) {
416
- if(arguments_a.head_ == "bootstrap") {
417
- if(arguments_a.tail_.Link) {
418
- if(arguments_a.tail_.tail_.Empty) {
419
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("bootstrap takes no arguments" + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
420
- return
421
- }
422
- }
423
- }
424
- }
425
- }
426
- {
427
- if(arguments_a.Link) {
428
- if(arguments_a.head_ == "bootstrap") {
429
- if(arguments_a.tail_.Empty) {
430
- return ff_compiler_Main.BootstrapCommand()
431
- return
432
- }
433
- }
434
- }
435
- }
436
- {
437
- if(arguments_a.Empty) {
438
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a command or a main file to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
439
- return
440
- }
441
- }
442
- {
443
- if(arguments_a.Link) {
444
- const s_ = arguments_a.head_;
445
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(((("Unknown command '" + s_) + "'") + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
446
- return
447
- }
448
- }
449
- }
450
- }
451
-
452
- export function bundleForPkg_(system_, packagePair_, mainFile_) {
453
- const prefix_ = ".firefly/output/executable/";
454
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
455
- const file_ = (prefix_ + "Main.bundle.js");
456
- ff_core_BuildSystem.internalNodeCallEsBuild_(system_, mainJsFile_, file_, false)
457
- }
458
-
459
- export function bundleForBrowser_(system_, packagePair_, mainFile_) {
460
- const prefix_ = ".firefly/output/browser/";
461
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
462
- const file_ = (prefix_ + "Main.bundle.js");
463
- const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, ff_core_NodeSystem.NodeSystem_path(system_, mainFile_), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair("/", (() => {
464
- return ff_core_Path.Path_readStream(ff_core_NodeSystem.NodeSystem_path(system_, "."))
465
- })), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
466
- ff_core_BuildSystem.internalCallEsBuild_(browserCode_, mainJsFile_, file_, true, true)
467
- }
468
-
469
- export function importAndRun_(fireflyPath_, target_, packagePair_, mainFile_, arguments_) {
470
- throw new Error('Function importAndRun is missing on this target in sync context.');
471
- }
472
-
473
- export function prepareFireflyDirectory_(path_) {
474
- if((!ff_core_Path.Path_exists(ff_core_Path.Path_slash(ff_core_Path.Path_slash(path_, ".firefly"), "output"), false, false, false))) {
475
- if((!ff_core_Path.Path_exists(ff_core_Path.Path_slash(path_, ".firefly"), false, false, false))) {
476
- ff_core_Path.Path_createDirectory(ff_core_Path.Path_slash(path_, ".firefly"), false)
477
- };
478
- ff_core_Path.Path_createDirectory(ff_core_Path.Path_slash(ff_core_Path.Path_slash(path_, ".firefly"), "output"), false)
479
- }
480
- }
481
-
482
- export function detectFireflyPath_(system_) {
483
- throw new Error('Function detectFireflyPath is missing on this target in sync context.');
484
- }
485
-
486
- export async function main_$(system_, $task) {
487
- const fireflyPath_ = (await ff_compiler_Main.detectFireflyPath_$(system_, $task));
488
- async function buildScript_$(mainFile_, mainPackagePair_, emitTarget_, resolvedDependencies_, $task) {
489
- const fixedPackagePaths_ = (ff_core_Map.Map_contains(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)
490
- ? resolvedDependencies_.packagePaths_
491
- : ff_core_Map.Map_add(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(fireflyPath_, "core", $task)), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
492
- const compilerModulePath_ = ((ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget) && ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitExecutable(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget))
493
- ? ff_core_Option.Some((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(fireflyPath_, "output", $task)), "js", $task)), "ff", $task)), "compiler/Builder.mjs", $task)))
494
- : ff_core_Option.None());
495
- const targetName_ = (((_1) => {
496
- {
497
- if(_1.EmitBuild) {
498
- return "build"
499
- return
500
- }
501
- }
502
- {
503
- if(_1.EmitNode) {
504
- return "node"
505
- return
506
- }
507
- }
508
- {
509
- if(_1.EmitBrowser) {
510
- return "browser"
511
- return
512
- }
513
- }
514
- {
515
- if(_1.EmitExecutable) {
516
- return "executable"
517
- return
518
- }
519
- }
520
- }))(emitTarget_);
521
- (await ff_compiler_Builder.build_$(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
522
- return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
523
- }))(resolvedDependencies_), compilerModulePath_, (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "temporary", $task)), (await ff_core_Path.Path_path$((await ff_core_Path.Path_path$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "output", $task)), targetName_, $task)), false, $task))
524
- }
525
- async function runCommand_$(command_, $task) {
526
- {
527
- const command_a = command_;
528
- {
529
- if(command_a.RunCommand) {
530
- const mainFile_ = command_a.mainPath_;
531
- const arguments_ = command_a.argument_;
532
- const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
533
- (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
534
- const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
535
- (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_, $task));
536
- (await ff_compiler_Main.importAndRun_$(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task))
537
- return
538
- }
539
- }
540
- {
541
- if(command_a.BrowserCommand) {
542
- const mainFile_ = command_a.mainPath_;
543
- const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
544
- (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
545
- const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
546
- (await buildScript_$(mainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_, $task));
547
- (await ff_compiler_Main.bundleForBrowser_$(system_, resolvedDependencies_.mainPackagePair_, localMainFile_, $task))
548
- return
549
- }
550
- }
551
- {
552
- if(command_a.BuildCommand) {
553
- const mainFile_ = command_a.mainPath_;
554
- const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
555
- (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
556
- const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
557
- (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_, $task));
558
- (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_, $task));
559
- (await ff_compiler_Main.bundleForPkg_$(system_, resolvedDependencies_.mainPackagePair_, localMainFile_, $task));
560
- (await ff_compiler_Main.importAndRun_$(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, ff_core_List.Empty(), $task))
561
- return
562
- }
563
- }
564
- {
565
- if(command_a.CheckCommand) {
566
- const filePath_ = command_a.filePath_;
567
- (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true, $task))
568
- return
569
- }
570
- }
571
- {
572
- if(command_a.BootstrapCommand) {
573
- const workingDirectory_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task));
574
- (await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), (await ff_core_Path.Path_slash$(workingDirectory_, "compiler", $task))), ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(workingDirectory_, "core", $task))), ff_core_List.Empty())), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "js", $task)), true, $task))
575
- return
576
- }
577
- }
578
- }
579
- }
580
- ff_core_Try.Try_grab(ff_core_Try.Try_catch(ff_core_Try.Try_catch((await ff_core_Core.try_$((async ($task) => {
581
- const command_ = ff_compiler_Main.parseCommandLine_(ff_core_Array.Array_toList((await ff_core_NodeSystem.NodeSystem_arguments$(system_, $task))));
582
- return (await runCommand_$(command_, $task))
583
- }), $task)), ((_1, _2) => {
584
- {
585
- const message_ = _1.problem_;
586
- const error_ = _2;
587
- ff_core_Log.debug_(message_)
588
- return
589
- }
590
- }), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError), ((_1, _2) => {
591
- {
592
- const at_ = _1.at_;
593
- const message_ = _1.message_;
594
- const error_ = _2;
595
- ff_core_Log.debug_(message_);
596
- ff_core_Log.debug_((((((" at " + ff_core_String.String_replace(at_.file_, "./", "")) + ":") + at_.line_) + ":") + at_.column_))
597
- return
598
- }
599
- }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError))
600
- }
601
-
602
- export async function parseCommandLine_$(arguments_, $task) {
603
- {
604
- const arguments_a = arguments_;
605
- {
606
- if(arguments_a.Link) {
607
- const mainFile_ = arguments_a.head_;
608
- const mainArguments_ = arguments_a.tail_;
609
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
610
- if(_guard1.Some) {
611
- const mainName_ = _guard1.value_;
612
- return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
613
- return
614
- }
615
- }
616
- }
617
- {
618
- if(arguments_a.Link) {
619
- if(arguments_a.head_ == "run") {
620
- const runArguments_ = arguments_a.tail_;
621
- {
622
- const _1 = runArguments_;
623
- {
624
- if(_1.Link) {
625
- const mainFile_ = _1.head_;
626
- const mainArguments_ = _1.tail_;
627
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
628
- if(_guard1.Some) {
629
- const mainName_ = _guard1.value_;
630
- return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
631
- return
632
- }
633
- }
634
- }
635
- {
636
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
637
- return
638
- }
639
- }
640
- return
641
- }
642
- }
643
- }
644
- {
645
- if(arguments_a.Link) {
646
- if(arguments_a.head_ == "browser") {
647
- const browserArguments_ = arguments_a.tail_;
648
- {
649
- const _1 = browserArguments_;
650
- {
651
- if(_1.Link) {
652
- const mainFile_ = _1.head_;
653
- if(_1.tail_.Empty) {
654
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
655
- if(_guard1.Some) {
656
- const mainName_ = _guard1.value_;
657
- return ff_compiler_Main.BrowserCommand(mainName_)
658
- return
659
- }
660
- }
661
- }
662
- }
663
- {
664
- if(_1.Link) {
665
- if(_1.tail_.Link) {
666
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
667
- return
668
- }
669
- }
670
- }
671
- {
672
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
673
- return
674
- }
675
- }
676
- return
677
- }
678
- }
679
- }
680
- {
681
- if(arguments_a.Link) {
682
- if(arguments_a.head_ == "build") {
683
- const buildArguments_ = arguments_a.tail_;
684
- {
685
- const _1 = buildArguments_;
686
- {
687
- if(_1.Link) {
688
- const mainFile_ = _1.head_;
689
- if(_1.tail_.Empty) {
690
- const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
691
- if(_guard1.Some) {
692
- const mainName_ = _guard1.value_;
693
- return ff_compiler_Main.BuildCommand(mainName_)
694
- return
695
- }
696
- }
697
- }
698
- }
699
- {
700
- if(_1.Link) {
701
- if(_1.tail_.Link) {
702
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
703
- return
704
- }
705
- }
706
- }
707
- {
708
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
709
- return
710
- }
711
- }
712
- return
713
- }
714
- }
715
- }
716
- {
717
- if(arguments_a.Link) {
718
- if(arguments_a.head_ == "check") {
719
- const checkArguments_ = arguments_a.tail_;
720
- {
721
- const _1 = checkArguments_;
722
- {
723
- if(_1.Link) {
724
- const fileName_ = _1.head_;
725
- if(_1.tail_.Empty) {
726
- const _guard1 = ff_core_String.String_removeLast(fileName_, ".ff");
727
- if(_guard1.Some) {
728
- return ff_compiler_Main.CheckCommand(fileName_)
729
- return
730
- }
731
- }
732
- }
733
- }
734
- {
735
- if(_1.Link) {
736
- if(_1.tail_.Link) {
737
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to check." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
738
- return
739
- }
740
- }
741
- }
742
- {
743
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
744
- return
745
- }
746
- }
747
- return
748
- }
749
- }
750
- }
751
- {
752
- if(arguments_a.Link) {
753
- if(arguments_a.head_ == "bootstrap") {
754
- if(arguments_a.tail_.Link) {
755
- if(arguments_a.tail_.tail_.Empty) {
756
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("bootstrap takes no arguments" + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
757
- return
758
- }
759
- }
760
- }
761
- }
762
- }
763
- {
764
- if(arguments_a.Link) {
765
- if(arguments_a.head_ == "bootstrap") {
766
- if(arguments_a.tail_.Empty) {
767
- return ff_compiler_Main.BootstrapCommand()
768
- return
769
- }
770
- }
771
- }
772
- }
773
- {
774
- if(arguments_a.Empty) {
775
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a command or a main file to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
776
- return
777
- }
778
- }
779
- {
780
- if(arguments_a.Link) {
781
- const s_ = arguments_a.head_;
782
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(((("Unknown command '" + s_) + "'") + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
783
- return
784
- }
785
- }
786
- }
787
- }
788
-
789
- export async function bundleForPkg_$(system_, packagePair_, mainFile_, $task) {
790
- const prefix_ = ".firefly/output/executable/";
791
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
792
- const file_ = (prefix_ + "Main.bundle.js");
793
- (await ff_core_BuildSystem.internalNodeCallEsBuild_$(system_, mainJsFile_, file_, false, $task))
794
- }
795
-
796
- export async function bundleForBrowser_$(system_, packagePair_, mainFile_, $task) {
797
- const prefix_ = ".firefly/output/browser/";
798
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
799
- const file_ = (prefix_ + "Main.bundle.js");
800
- const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, (await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair("/", (async ($task) => {
801
- return (await ff_core_Path.Path_readStream$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task))
802
- })), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
803
- (await ff_core_BuildSystem.internalCallEsBuild_$(browserCode_, mainJsFile_, file_, true, true, $task))
804
- }
805
-
806
- export async function importAndRun_$(fireflyPath_, target_, packagePair_, mainFile_, arguments_, $task) {
151
+ `;
152
+
153
+ export function main_(system_) {
154
+ const fireflyPath_ = ff_compiler_Main.detectFireflyPath_(system_);
155
+ function buildScript_(mainFile_, mainPackagePair_, emitTarget_, resolvedDependencies_) {
156
+ const fixedPackagePaths_ = (ff_core_Map.Map_contains(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)
157
+ ? resolvedDependencies_.packagePaths_
158
+ : ff_core_Map.Map_add(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(fireflyPath_, "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
159
+ const compilerModulePath_ = ((ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget) && ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitExecutable(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget))
160
+ ? ff_core_Option.Some(ff_core_Path.Path_slash(ff_core_Path.Path_slash(ff_core_Path.Path_slash(ff_core_Path.Path_slash(fireflyPath_, "output"), "js"), "ff"), "compiler/Builder.mjs"))
161
+ : ff_core_Option.None());
162
+ const targetName_ = (((_1) => {
163
+ {
164
+ if(_1.EmitBuild) {
165
+ return "build"
166
+ return
167
+ }
168
+ }
169
+ {
170
+ if(_1.EmitNode) {
171
+ return "node"
172
+ return
173
+ }
174
+ }
175
+ {
176
+ if(_1.EmitBrowser) {
177
+ return "browser"
178
+ return
179
+ }
180
+ }
181
+ {
182
+ if(_1.EmitExecutable) {
183
+ return "executable"
184
+ return
185
+ }
186
+ }
187
+ }))(emitTarget_);
188
+ ff_compiler_Builder.build_(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
189
+ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
190
+ }))(resolvedDependencies_), compilerModulePath_, ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "temporary"), ff_core_Path.Path_path(ff_core_Path.Path_path(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "output"), targetName_), false)
191
+ }
192
+ function runCommand_(command_) {
193
+ {
194
+ const command_a = command_;
195
+ {
196
+ if(command_a.RunCommand) {
197
+ const mainFile_ = command_a.mainPath_;
198
+ const arguments_ = command_a.argument_;
199
+ const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
200
+ ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
201
+ const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
202
+ buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_);
203
+ ff_compiler_Main.importAndRun_(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_)
204
+ return
205
+ }
206
+ }
207
+ {
208
+ if(command_a.BrowserCommand) {
209
+ const mainFile_ = command_a.mainPath_;
210
+ const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
211
+ ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
212
+ const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
213
+ buildScript_(mainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_);
214
+ ff_compiler_Main.bundleForBrowser_(system_, resolvedDependencies_.mainPackagePair_, localMainFile_)
215
+ return
216
+ }
217
+ }
218
+ {
219
+ if(command_a.BuildCommand) {
220
+ const mainFile_ = command_a.mainPath_;
221
+ const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff")));
222
+ ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
223
+ const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
224
+ buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_);
225
+ buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_);
226
+ ff_compiler_Main.bundleForPkg_(system_, resolvedDependencies_.mainPackagePair_, localMainFile_);
227
+ ff_compiler_Main.importAndRun_(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, ff_core_List.Empty())
228
+ return
229
+ }
230
+ }
231
+ {
232
+ if(command_a.CheckCommand) {
233
+ const filePath_ = command_a.filePath_;
234
+ ff_compiler_Builder.check_(system_, fireflyPath_, ff_core_NodeSystem.NodeSystem_path(system_, filePath_), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true)
235
+ return
236
+ }
237
+ }
238
+ {
239
+ if(command_a.BootstrapCommand) {
240
+ const workingDirectory_ = ff_core_NodeSystem.NodeSystem_path(system_, ".");
241
+ ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_Path.Path_slash(workingDirectory_, "compiler")), ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(workingDirectory_, "core")), ff_core_List.Empty())), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "temporary"), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "js"), true)
242
+ return
243
+ }
244
+ }
245
+ }
246
+ }
247
+ ff_core_Try.Try_grab(ff_core_Try.Try_catch(ff_core_Try.Try_catch(ff_core_Core.try_((() => {
248
+ const command_ = ff_compiler_Main.parseCommandLine_(ff_core_Array.Array_toList(ff_core_NodeSystem.NodeSystem_arguments(system_)));
249
+ return runCommand_(command_)
250
+ })), ((_1, _2) => {
251
+ {
252
+ const message_ = _1.problem_;
253
+ const error_ = _2;
254
+ ff_core_Log.debug_(message_)
255
+ return
256
+ }
257
+ }), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError), ((_1, _2) => {
258
+ {
259
+ const at_ = _1.at_;
260
+ const message_ = _1.message_;
261
+ const error_ = _2;
262
+ ff_core_Log.debug_(message_);
263
+ ff_core_Log.debug_((((((" at " + ff_core_String.String_replace(at_.file_, "./", "")) + ":") + at_.line_) + ":") + at_.column_))
264
+ return
265
+ }
266
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError))
267
+ }
268
+
269
+ export function parseCommandLine_(arguments_) {
270
+ {
271
+ const arguments_a = arguments_;
272
+ {
273
+ if(arguments_a.Link) {
274
+ const mainFile_ = arguments_a.head_;
275
+ const mainArguments_ = arguments_a.tail_;
276
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
277
+ if(_guard1.Some) {
278
+ const mainName_ = _guard1.value_;
279
+ return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
280
+ return
281
+ }
282
+ }
283
+ }
284
+ {
285
+ if(arguments_a.Link) {
286
+ if(arguments_a.head_ == "run") {
287
+ const runArguments_ = arguments_a.tail_;
288
+ {
289
+ const _1 = runArguments_;
290
+ {
291
+ if(_1.Link) {
292
+ const mainFile_ = _1.head_;
293
+ const mainArguments_ = _1.tail_;
294
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
295
+ if(_guard1.Some) {
296
+ const mainName_ = _guard1.value_;
297
+ return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
298
+ return
299
+ }
300
+ }
301
+ }
302
+ {
303
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
304
+ return
305
+ }
306
+ }
307
+ return
308
+ }
309
+ }
310
+ }
311
+ {
312
+ if(arguments_a.Link) {
313
+ if(arguments_a.head_ == "browser") {
314
+ const browserArguments_ = arguments_a.tail_;
315
+ {
316
+ const _1 = browserArguments_;
317
+ {
318
+ if(_1.Link) {
319
+ const mainFile_ = _1.head_;
320
+ if(_1.tail_.Empty) {
321
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
322
+ if(_guard1.Some) {
323
+ const mainName_ = _guard1.value_;
324
+ return ff_compiler_Main.BrowserCommand(mainName_)
325
+ return
326
+ }
327
+ }
328
+ }
329
+ }
330
+ {
331
+ if(_1.Link) {
332
+ if(_1.tail_.Link) {
333
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
334
+ return
335
+ }
336
+ }
337
+ }
338
+ {
339
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
340
+ return
341
+ }
342
+ }
343
+ return
344
+ }
345
+ }
346
+ }
347
+ {
348
+ if(arguments_a.Link) {
349
+ if(arguments_a.head_ == "build") {
350
+ const buildArguments_ = arguments_a.tail_;
351
+ {
352
+ const _1 = buildArguments_;
353
+ {
354
+ if(_1.Link) {
355
+ const mainFile_ = _1.head_;
356
+ if(_1.tail_.Empty) {
357
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
358
+ if(_guard1.Some) {
359
+ const mainName_ = _guard1.value_;
360
+ return ff_compiler_Main.BuildCommand(mainName_)
361
+ return
362
+ }
363
+ }
364
+ }
365
+ }
366
+ {
367
+ if(_1.Link) {
368
+ if(_1.tail_.Link) {
369
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
370
+ return
371
+ }
372
+ }
373
+ }
374
+ {
375
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
376
+ return
377
+ }
378
+ }
379
+ return
380
+ }
381
+ }
382
+ }
383
+ {
384
+ if(arguments_a.Link) {
385
+ if(arguments_a.head_ == "check") {
386
+ const checkArguments_ = arguments_a.tail_;
387
+ {
388
+ const _1 = checkArguments_;
389
+ {
390
+ if(_1.Link) {
391
+ const fileName_ = _1.head_;
392
+ if(_1.tail_.Empty) {
393
+ const _guard1 = ff_core_String.String_removeLast(fileName_, ".ff");
394
+ if(_guard1.Some) {
395
+ return ff_compiler_Main.CheckCommand(fileName_)
396
+ return
397
+ }
398
+ }
399
+ }
400
+ }
401
+ {
402
+ if(_1.Link) {
403
+ if(_1.tail_.Link) {
404
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to check." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
405
+ return
406
+ }
407
+ }
408
+ }
409
+ {
410
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
411
+ return
412
+ }
413
+ }
414
+ return
415
+ }
416
+ }
417
+ }
418
+ {
419
+ if(arguments_a.Link) {
420
+ if(arguments_a.head_ == "bootstrap") {
421
+ if(arguments_a.tail_.Link) {
422
+ if(arguments_a.tail_.tail_.Empty) {
423
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("bootstrap takes no arguments" + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
424
+ return
425
+ }
426
+ }
427
+ }
428
+ }
429
+ }
430
+ {
431
+ if(arguments_a.Link) {
432
+ if(arguments_a.head_ == "bootstrap") {
433
+ if(arguments_a.tail_.Empty) {
434
+ return ff_compiler_Main.BootstrapCommand()
435
+ return
436
+ }
437
+ }
438
+ }
439
+ }
440
+ {
441
+ if(arguments_a.Empty) {
442
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a command or a main file to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
443
+ return
444
+ }
445
+ }
446
+ {
447
+ if(arguments_a.Link) {
448
+ const s_ = arguments_a.head_;
449
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(((("Unknown command '" + s_) + "'") + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
450
+ return
451
+ }
452
+ }
453
+ }
454
+ }
455
+
456
+ export function bundleForPkg_(system_, packagePair_, mainFile_) {
457
+ const prefix_ = ".firefly/output/executable/";
458
+ const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
459
+ const file_ = (prefix_ + "Main.bundle.js");
460
+ ff_core_BuildSystem.internalNodeCallEsBuild_(system_, mainJsFile_, file_, false)
461
+ }
462
+
463
+ export function bundleForBrowser_(system_, packagePair_, mainFile_) {
464
+ const prefix_ = ".firefly/output/browser/";
465
+ const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
466
+ const file_ = (prefix_ + "Main.bundle.js");
467
+ const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, ff_core_NodeSystem.NodeSystem_path(system_, mainFile_), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair("/", (() => {
468
+ return ff_core_Path.Path_readStream(ff_core_NodeSystem.NodeSystem_path(system_, "."))
469
+ })), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
470
+ ff_core_BuildSystem.internalCallEsBuild_(browserCode_, mainJsFile_, file_, true, true)
471
+ }
472
+
473
+ export function importAndRun_(fireflyPath_, target_, packagePair_, mainFile_, arguments_) {
474
+ throw new Error('Function importAndRun is missing on this target in sync context.');
475
+ }
476
+
477
+ export function prepareFireflyDirectory_(path_) {
478
+ if((!ff_core_Path.Path_exists(ff_core_Path.Path_slash(ff_core_Path.Path_slash(path_, ".firefly"), "output"), false, false, false))) {
479
+ if((!ff_core_Path.Path_exists(ff_core_Path.Path_slash(path_, ".firefly"), false, false, false))) {
480
+ ff_core_Path.Path_createDirectory(ff_core_Path.Path_slash(path_, ".firefly"), false)
481
+ };
482
+ ff_core_Path.Path_createDirectory(ff_core_Path.Path_slash(ff_core_Path.Path_slash(path_, ".firefly"), "output"), false)
483
+ }
484
+ }
485
+
486
+ export function detectFireflyPath_(system_) {
487
+ throw new Error('Function detectFireflyPath is missing on this target in sync context.');
488
+ }
489
+
490
+ export async function main_$(system_, $task) {
491
+ const fireflyPath_ = (await ff_compiler_Main.detectFireflyPath_$(system_, $task));
492
+ async function buildScript_$(mainFile_, mainPackagePair_, emitTarget_, resolvedDependencies_, $task) {
493
+ const fixedPackagePaths_ = (ff_core_Map.Map_contains(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)
494
+ ? resolvedDependencies_.packagePaths_
495
+ : ff_core_Map.Map_add(resolvedDependencies_.packagePaths_, ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(fireflyPath_, "core", $task)), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
496
+ const compilerModulePath_ = ((ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget) && ff_core_Equal.notEquals_(emitTarget_, ff_compiler_JsEmitter.EmitExecutable(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget))
497
+ ? ff_core_Option.Some((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(fireflyPath_, "output", $task)), "js", $task)), "ff", $task)), "compiler/Builder.mjs", $task)))
498
+ : ff_core_Option.None());
499
+ const targetName_ = (((_1) => {
500
+ {
501
+ if(_1.EmitBuild) {
502
+ return "build"
503
+ return
504
+ }
505
+ }
506
+ {
507
+ if(_1.EmitNode) {
508
+ return "node"
509
+ return
510
+ }
511
+ }
512
+ {
513
+ if(_1.EmitBrowser) {
514
+ return "browser"
515
+ return
516
+ }
517
+ }
518
+ {
519
+ if(_1.EmitExecutable) {
520
+ return "executable"
521
+ return
522
+ }
523
+ }
524
+ }))(emitTarget_);
525
+ (await ff_compiler_Builder.build_$(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
526
+ return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
527
+ }))(resolvedDependencies_), compilerModulePath_, (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "temporary", $task)), (await ff_core_Path.Path_path$((await ff_core_Path.Path_path$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "output", $task)), targetName_, $task)), false, $task))
528
+ }
529
+ async function runCommand_$(command_, $task) {
530
+ {
531
+ const command_a = command_;
532
+ {
533
+ if(command_a.RunCommand) {
534
+ const mainFile_ = command_a.mainPath_;
535
+ const arguments_ = command_a.argument_;
536
+ const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
537
+ (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
538
+ const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
539
+ (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_, $task));
540
+ (await ff_compiler_Main.importAndRun_$(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task))
541
+ return
542
+ }
543
+ }
544
+ {
545
+ if(command_a.BrowserCommand) {
546
+ const mainFile_ = command_a.mainPath_;
547
+ const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
548
+ (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
549
+ const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
550
+ (await buildScript_$(mainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_, $task));
551
+ (await ff_compiler_Main.bundleForBrowser_$(system_, resolvedDependencies_.mainPackagePair_, localMainFile_, $task))
552
+ return
553
+ }
554
+ }
555
+ {
556
+ if(command_a.BuildCommand) {
557
+ const mainFile_ = command_a.mainPath_;
558
+ const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task));
559
+ (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
560
+ const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
561
+ (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_, $task));
562
+ (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_, $task));
563
+ (await ff_compiler_Main.bundleForPkg_$(system_, resolvedDependencies_.mainPackagePair_, localMainFile_, $task));
564
+ (await ff_compiler_Main.importAndRun_$(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, ff_core_List.Empty(), $task))
565
+ return
566
+ }
567
+ }
568
+ {
569
+ if(command_a.CheckCommand) {
570
+ const filePath_ = command_a.filePath_;
571
+ (await ff_compiler_Builder.check_$(system_, fireflyPath_, (await ff_core_NodeSystem.NodeSystem_path$(system_, filePath_, $task)), ff_core_Map.empty_(), ff_compiler_LspHook.disabled_(), true, $task))
572
+ return
573
+ }
574
+ }
575
+ {
576
+ if(command_a.BootstrapCommand) {
577
+ const workingDirectory_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task));
578
+ (await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), (await ff_core_Path.Path_slash$(workingDirectory_, "compiler", $task))), ff_core_List.Link(ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(workingDirectory_, "core", $task))), ff_core_List.Empty())), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "js", $task)), true, $task))
579
+ return
580
+ }
581
+ }
582
+ }
583
+ }
584
+ ff_core_Try.Try_grab(ff_core_Try.Try_catch(ff_core_Try.Try_catch((await ff_core_Core.try_$((async ($task) => {
585
+ const command_ = ff_compiler_Main.parseCommandLine_(ff_core_Array.Array_toList((await ff_core_NodeSystem.NodeSystem_arguments$(system_, $task))));
586
+ return (await runCommand_$(command_, $task))
587
+ }), $task)), ((_1, _2) => {
588
+ {
589
+ const message_ = _1.problem_;
590
+ const error_ = _2;
591
+ ff_core_Log.debug_(message_)
592
+ return
593
+ }
594
+ }), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError), ((_1, _2) => {
595
+ {
596
+ const at_ = _1.at_;
597
+ const message_ = _1.message_;
598
+ const error_ = _2;
599
+ ff_core_Log.debug_(message_);
600
+ ff_core_Log.debug_((((((" at " + ff_core_String.String_replace(at_.file_, "./", "")) + ":") + at_.line_) + ":") + at_.column_))
601
+ return
602
+ }
603
+ }), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError))
604
+ }
605
+
606
+ export async function parseCommandLine_$(arguments_, $task) {
607
+ {
608
+ const arguments_a = arguments_;
609
+ {
610
+ if(arguments_a.Link) {
611
+ const mainFile_ = arguments_a.head_;
612
+ const mainArguments_ = arguments_a.tail_;
613
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
614
+ if(_guard1.Some) {
615
+ const mainName_ = _guard1.value_;
616
+ return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
617
+ return
618
+ }
619
+ }
620
+ }
621
+ {
622
+ if(arguments_a.Link) {
623
+ if(arguments_a.head_ == "run") {
624
+ const runArguments_ = arguments_a.tail_;
625
+ {
626
+ const _1 = runArguments_;
627
+ {
628
+ if(_1.Link) {
629
+ const mainFile_ = _1.head_;
630
+ const mainArguments_ = _1.tail_;
631
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
632
+ if(_guard1.Some) {
633
+ const mainName_ = _guard1.value_;
634
+ return ff_compiler_Main.RunCommand(mainName_, mainArguments_)
635
+ return
636
+ }
637
+ }
638
+ }
639
+ {
640
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as first argument to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
641
+ return
642
+ }
643
+ }
644
+ return
645
+ }
646
+ }
647
+ }
648
+ {
649
+ if(arguments_a.Link) {
650
+ if(arguments_a.head_ == "browser") {
651
+ const browserArguments_ = arguments_a.tail_;
652
+ {
653
+ const _1 = browserArguments_;
654
+ {
655
+ if(_1.Link) {
656
+ const mainFile_ = _1.head_;
657
+ if(_1.tail_.Empty) {
658
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
659
+ if(_guard1.Some) {
660
+ const mainName_ = _guard1.value_;
661
+ return ff_compiler_Main.BrowserCommand(mainName_)
662
+ return
663
+ }
664
+ }
665
+ }
666
+ }
667
+ {
668
+ if(_1.Link) {
669
+ if(_1.tail_.Link) {
670
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
671
+ return
672
+ }
673
+ }
674
+ }
675
+ {
676
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to browser." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
677
+ return
678
+ }
679
+ }
680
+ return
681
+ }
682
+ }
683
+ }
684
+ {
685
+ if(arguments_a.Link) {
686
+ if(arguments_a.head_ == "build") {
687
+ const buildArguments_ = arguments_a.tail_;
688
+ {
689
+ const _1 = buildArguments_;
690
+ {
691
+ if(_1.Link) {
692
+ const mainFile_ = _1.head_;
693
+ if(_1.tail_.Empty) {
694
+ const _guard1 = ff_core_String.String_removeLast(mainFile_, ".ff");
695
+ if(_guard1.Some) {
696
+ const mainName_ = _guard1.value_;
697
+ return ff_compiler_Main.BuildCommand(mainName_)
698
+ return
699
+ }
700
+ }
701
+ }
702
+ }
703
+ {
704
+ if(_1.Link) {
705
+ if(_1.tail_.Link) {
706
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
707
+ return
708
+ }
709
+ }
710
+ }
711
+ {
712
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
713
+ return
714
+ }
715
+ }
716
+ return
717
+ }
718
+ }
719
+ }
720
+ {
721
+ if(arguments_a.Link) {
722
+ if(arguments_a.head_ == "check") {
723
+ const checkArguments_ = arguments_a.tail_;
724
+ {
725
+ const _1 = checkArguments_;
726
+ {
727
+ if(_1.Link) {
728
+ const fileName_ = _1.head_;
729
+ if(_1.tail_.Empty) {
730
+ const _guard1 = ff_core_String.String_removeLast(fileName_, ".ff");
731
+ if(_guard1.Some) {
732
+ return ff_compiler_Main.CheckCommand(fileName_)
733
+ return
734
+ }
735
+ }
736
+ }
737
+ }
738
+ {
739
+ if(_1.Link) {
740
+ if(_1.tail_.Link) {
741
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must only specify a single argument to check." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
742
+ return
743
+ }
744
+ }
745
+ }
746
+ {
747
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a Firefly file (.ff) as the argument to build." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
748
+ return
749
+ }
750
+ }
751
+ return
752
+ }
753
+ }
754
+ }
755
+ {
756
+ if(arguments_a.Link) {
757
+ if(arguments_a.head_ == "bootstrap") {
758
+ if(arguments_a.tail_.Link) {
759
+ if(arguments_a.tail_.tail_.Empty) {
760
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("bootstrap takes no arguments" + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
761
+ return
762
+ }
763
+ }
764
+ }
765
+ }
766
+ }
767
+ {
768
+ if(arguments_a.Link) {
769
+ if(arguments_a.head_ == "bootstrap") {
770
+ if(arguments_a.tail_.Empty) {
771
+ return ff_compiler_Main.BootstrapCommand()
772
+ return
773
+ }
774
+ }
775
+ }
776
+ }
777
+ {
778
+ if(arguments_a.Empty) {
779
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(("You must specify a command or a main file to run." + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
780
+ return
781
+ }
782
+ }
783
+ {
784
+ if(arguments_a.Link) {
785
+ const s_ = arguments_a.head_;
786
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Main.CommandLineError(((("Unknown command '" + s_) + "'") + ff_compiler_Main.usageString_)), ff_compiler_Main.ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError)})
787
+ return
788
+ }
789
+ }
790
+ }
791
+ }
792
+
793
+ export async function bundleForPkg_$(system_, packagePair_, mainFile_, $task) {
794
+ const prefix_ = ".firefly/output/executable/";
795
+ const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
796
+ const file_ = (prefix_ + "Main.bundle.js");
797
+ (await ff_core_BuildSystem.internalNodeCallEsBuild_$(system_, mainJsFile_, file_, false, $task))
798
+ }
799
+
800
+ export async function bundleForBrowser_$(system_, packagePair_, mainFile_, $task) {
801
+ const prefix_ = ".firefly/output/browser/";
802
+ const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
803
+ const file_ = (prefix_ + "Main.bundle.js");
804
+ const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, (await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair("/", (async ($task) => {
805
+ return (await ff_core_Path.Path_readStream$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task))
806
+ })), ff_core_List.Empty()), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
807
+ (await ff_core_BuildSystem.internalCallEsBuild_$(browserCode_, mainJsFile_, file_, true, true, $task))
808
+ }
809
+
810
+ export async function importAndRun_$(fireflyPath_, target_, packagePair_, mainFile_, arguments_, $task) {
807
811
 
808
812
  const process = await import('process');
809
813
  const cwd = process.cwd();
@@ -811,19 +815,19 @@ export async function importAndRun_$(fireflyPath_, target_, packagePair_, mainFi
811
815
  const packagePath = packagePair_.group_ + "/" + packagePair_.name_
812
816
  const main = await import(workingDirectory + "/.firefly/output/" + target_ + "/" + packagePath + "/" + mainFile_ + ".mjs");
813
817
  await main.$run$(fireflyPath_, ff_core_List.List_toArray(arguments_))
814
-
815
- }
816
-
817
- export async function prepareFireflyDirectory_$(path_, $task) {
818
- if((!(await ff_core_Path.Path_exists$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), "output", $task)), false, false, false, $task)))) {
819
- if((!(await ff_core_Path.Path_exists$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), false, false, false, $task)))) {
820
- (await ff_core_Path.Path_createDirectory$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), false, $task))
821
- };
822
- (await ff_core_Path.Path_createDirectory$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), "output", $task)), false, $task))
823
- }
824
- }
825
-
826
- export async function detectFireflyPath_$(system_, $task) {
818
+
819
+ }
820
+
821
+ export async function prepareFireflyDirectory_$(path_, $task) {
822
+ if((!(await ff_core_Path.Path_exists$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), "output", $task)), false, false, false, $task)))) {
823
+ if((!(await ff_core_Path.Path_exists$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), false, false, false, $task)))) {
824
+ (await ff_core_Path.Path_createDirectory$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), false, $task))
825
+ };
826
+ (await ff_core_Path.Path_createDirectory$((await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(path_, ".firefly", $task)), "output", $task)), false, $task))
827
+ }
828
+ }
829
+
830
+ export async function detectFireflyPath_$(system_, $task) {
827
831
 
828
832
  const url = import$0
829
833
  const suffix = '/output/js/ff/compiler/Main.mjs'
@@ -832,868 +836,880 @@ export async function detectFireflyPath_$(system_, $task) {
832
836
  throw 'Expected module path to end with: ' + suffix + ", but got: " + moduleUrl;
833
837
  }
834
838
  return url.fileURLToPath(new URL(moduleUrl.slice(0, -suffix.length)))
835
-
836
- }
837
-
838
-
839
-
840
- export const ff_core_Any_HasAnyTag$ff_compiler_Main_MainCommand = {
841
- anyTag_() {
842
- return ff_core_Any.internalAnyTag_((("ff:compiler/Main.MainCommand" + "[") + "]"))
843
- },
844
- async anyTag_$($task) {
845
- return ff_core_Any.internalAnyTag_((("ff:compiler/Main.MainCommand" + "[") + "]"))
846
- }
847
- };
848
-
849
- export const ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError = {
850
- anyTag_() {
851
- return ff_core_Any.internalAnyTag_((("ff:compiler/Main.CommandLineError" + "[") + "]"))
852
- },
853
- async anyTag_$($task) {
854
- return ff_core_Any.internalAnyTag_((("ff:compiler/Main.CommandLineError" + "[") + "]"))
855
- }
856
- };
857
-
858
- export const ff_core_Show_Show$ff_compiler_Main_MainCommand = {
859
- show_(value_) {
860
- {
861
- const value_a = value_;
862
- {
863
- if(value_a.BootstrapCommand) {
864
- const z_ = value_a;
865
- return "BootstrapCommand"
866
- return
867
- }
868
- }
869
- {
870
- if(value_a.RunCommand) {
871
- const z_ = value_a;
872
- return ((((("RunCommand" + "(") + 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_)) + ")")
873
- return
874
- }
875
- }
876
- {
877
- if(value_a.BrowserCommand) {
878
- const z_ = value_a;
879
- return ((("BrowserCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
880
- return
881
- }
882
- }
883
- {
884
- if(value_a.BuildCommand) {
885
- const z_ = value_a;
886
- return ((("BuildCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
887
- return
888
- }
889
- }
890
- {
891
- if(value_a.CheckCommand) {
892
- const z_ = value_a;
893
- return ((("CheckCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.filePath_)) + ")")
894
- return
895
- }
896
- }
897
- }
898
- },
899
- async show_$(value_, $task) {
900
- {
901
- const value_a = value_;
902
- {
903
- if(value_a.BootstrapCommand) {
904
- const z_ = value_a;
905
- return "BootstrapCommand"
906
- return
907
- }
908
- }
909
- {
910
- if(value_a.RunCommand) {
911
- const z_ = value_a;
912
- return ((((("RunCommand" + "(") + 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_)) + ")")
913
- return
914
- }
915
- }
916
- {
917
- if(value_a.BrowserCommand) {
918
- const z_ = value_a;
919
- return ((("BrowserCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
920
- return
921
- }
922
- }
923
- {
924
- if(value_a.BuildCommand) {
925
- const z_ = value_a;
926
- return ((("BuildCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
927
- return
928
- }
929
- }
930
- {
931
- if(value_a.CheckCommand) {
932
- const z_ = value_a;
933
- return ((("CheckCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.filePath_)) + ")")
934
- return
935
- }
936
- }
937
- }
938
- }
939
- };
940
-
941
- export const ff_core_Show_Show$ff_compiler_Main_CommandLineError = {
942
- show_(value_) {
943
- {
944
- const value_a = value_;
945
- {
946
- const z_ = value_a;
947
- return ((("CommandLineError" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.problem_)) + ")")
948
- return
949
- }
950
- }
951
- },
952
- async show_$(value_, $task) {
953
- {
954
- const value_a = value_;
955
- {
956
- const z_ = value_a;
957
- return ((("CommandLineError" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.problem_)) + ")")
958
- return
959
- }
960
- }
961
- }
962
- };
963
-
964
- export const ff_core_Equal_Equal$ff_compiler_Main_MainCommand = {
965
- equals_(x_, y_) {
966
- {
967
- const x_a = x_;
968
- const y_a = y_;
969
- {
970
- const _guard1 = (x_ === y_);
971
- if(_guard1) {
972
- return true
973
- return
974
- }
975
- }
976
- {
977
- if(x_a.RunCommand) {
978
- const x_ = x_a;
979
- if(y_a.RunCommand) {
980
- const y_ = y_a;
981
- 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_))
982
- return
983
- }
984
- }
985
- }
986
- {
987
- if(x_a.BrowserCommand) {
988
- const x_ = x_a;
989
- if(y_a.BrowserCommand) {
990
- const y_ = y_a;
991
- return (x_.mainPath_ === y_.mainPath_)
992
- return
993
- }
994
- }
995
- }
996
- {
997
- if(x_a.BuildCommand) {
998
- const x_ = x_a;
999
- if(y_a.BuildCommand) {
1000
- const y_ = y_a;
1001
- return (x_.mainPath_ === y_.mainPath_)
1002
- return
1003
- }
1004
- }
1005
- }
1006
- {
1007
- if(x_a.CheckCommand) {
1008
- const x_ = x_a;
1009
- if(y_a.CheckCommand) {
1010
- const y_ = y_a;
1011
- return (x_.filePath_ === y_.filePath_)
1012
- return
1013
- }
1014
- }
1015
- }
1016
- {
1017
- return false
1018
- return
1019
- }
1020
- }
1021
- },
1022
- async equals_$(x_, y_, $task) {
1023
- {
1024
- const x_a = x_;
1025
- const y_a = y_;
1026
- {
1027
- const _guard1 = (x_ === y_);
1028
- if(_guard1) {
1029
- return true
1030
- return
1031
- }
1032
- }
1033
- {
1034
- if(x_a.RunCommand) {
1035
- const x_ = x_a;
1036
- if(y_a.RunCommand) {
1037
- const y_ = y_a;
1038
- 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_))
1039
- return
1040
- }
1041
- }
1042
- }
1043
- {
1044
- if(x_a.BrowserCommand) {
1045
- const x_ = x_a;
1046
- if(y_a.BrowserCommand) {
1047
- const y_ = y_a;
1048
- return (x_.mainPath_ === y_.mainPath_)
1049
- return
1050
- }
1051
- }
1052
- }
1053
- {
1054
- if(x_a.BuildCommand) {
1055
- const x_ = x_a;
1056
- if(y_a.BuildCommand) {
1057
- const y_ = y_a;
1058
- return (x_.mainPath_ === y_.mainPath_)
1059
- return
1060
- }
1061
- }
1062
- }
1063
- {
1064
- if(x_a.CheckCommand) {
1065
- const x_ = x_a;
1066
- if(y_a.CheckCommand) {
1067
- const y_ = y_a;
1068
- return (x_.filePath_ === y_.filePath_)
1069
- return
1070
- }
1071
- }
1072
- }
1073
- {
1074
- return false
1075
- return
1076
- }
1077
- }
1078
- }
1079
- };
1080
-
1081
- export const ff_core_Equal_Equal$ff_compiler_Main_CommandLineError = {
1082
- equals_(x_, y_) {
1083
- {
1084
- const x_a = x_;
1085
- const y_a = y_;
1086
- {
1087
- const _guard1 = (x_ === y_);
1088
- if(_guard1) {
1089
- return true
1090
- return
1091
- }
1092
- }
1093
- {
1094
- return (x_.problem_ === y_.problem_)
1095
- return
1096
- }
1097
- }
1098
- },
1099
- async equals_$(x_, y_, $task) {
1100
- {
1101
- const x_a = x_;
1102
- const y_a = y_;
1103
- {
1104
- const _guard1 = (x_ === y_);
1105
- if(_guard1) {
1106
- return true
1107
- return
1108
- }
1109
- }
1110
- {
1111
- return (x_.problem_ === y_.problem_)
1112
- return
1113
- }
1114
- }
1115
- }
1116
- };
1117
-
1118
- export const ff_core_Ordering_Order$ff_compiler_Main_MainCommand = {
1119
- compare_(x_, y_) {
1120
- {
1121
- const x_a = x_;
1122
- const y_a = y_;
1123
- {
1124
- const _guard1 = (x_ === y_);
1125
- if(_guard1) {
1126
- return ff_core_Ordering.OrderingSame()
1127
- return
1128
- }
1129
- }
1130
- {
1131
- if(x_a.RunCommand) {
1132
- const x_ = x_a;
1133
- if(y_a.RunCommand) {
1134
- const y_ = y_a;
1135
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1136
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1137
- return mainPathOrdering_
1138
- } else {
1139
- const argumentOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.argument_, y_.argument_);
1140
- if((argumentOrdering_ !== ff_core_Ordering.OrderingSame())) {
1141
- return argumentOrdering_
1142
- } else {
1143
- return ff_core_Ordering.OrderingSame()
1144
- }
1145
- }
1146
- return
1147
- }
1148
- }
1149
- }
1150
- {
1151
- if(x_a.BrowserCommand) {
1152
- const x_ = x_a;
1153
- if(y_a.BrowserCommand) {
1154
- const y_ = y_a;
1155
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1156
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1157
- return mainPathOrdering_
1158
- } else {
1159
- return ff_core_Ordering.OrderingSame()
1160
- }
1161
- return
1162
- }
1163
- }
1164
- }
1165
- {
1166
- if(x_a.BuildCommand) {
1167
- const x_ = x_a;
1168
- if(y_a.BuildCommand) {
1169
- const y_ = y_a;
1170
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1171
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1172
- return mainPathOrdering_
1173
- } else {
1174
- return ff_core_Ordering.OrderingSame()
1175
- }
1176
- return
1177
- }
1178
- }
1179
- }
1180
- {
1181
- if(x_a.CheckCommand) {
1182
- const x_ = x_a;
1183
- if(y_a.CheckCommand) {
1184
- const y_ = y_a;
1185
- const filePathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.filePath_, y_.filePath_);
1186
- if((filePathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1187
- return filePathOrdering_
1188
- } else {
1189
- return ff_core_Ordering.OrderingSame()
1190
- }
1191
- return
1192
- }
1193
- }
1194
- }
1195
- {
1196
- function number_(z_) {
1197
- {
1198
- const z_a = z_;
1199
- {
1200
- if(z_a.BootstrapCommand) {
1201
- return 0
1202
- return
1203
- }
1204
- }
1205
- {
1206
- if(z_a.RunCommand) {
1207
- return 1
1208
- return
1209
- }
1210
- }
1211
- {
1212
- if(z_a.BrowserCommand) {
1213
- return 2
1214
- return
1215
- }
1216
- }
1217
- {
1218
- if(z_a.BuildCommand) {
1219
- return 3
1220
- return
1221
- }
1222
- }
1223
- {
1224
- if(z_a.CheckCommand) {
1225
- return 4
1226
- return
1227
- }
1228
- }
1229
- }
1230
- }
1231
- return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
1232
- return
1233
- }
1234
- }
1235
- },
1236
- async compare_$(x_, y_, $task) {
1237
- {
1238
- const x_a = x_;
1239
- const y_a = y_;
1240
- {
1241
- const _guard1 = (x_ === y_);
1242
- if(_guard1) {
1243
- return ff_core_Ordering.OrderingSame()
1244
- return
1245
- }
1246
- }
1247
- {
1248
- if(x_a.RunCommand) {
1249
- const x_ = x_a;
1250
- if(y_a.RunCommand) {
1251
- const y_ = y_a;
1252
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1253
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1254
- return mainPathOrdering_
1255
- } else {
1256
- const argumentOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.argument_, y_.argument_);
1257
- if((argumentOrdering_ !== ff_core_Ordering.OrderingSame())) {
1258
- return argumentOrdering_
1259
- } else {
1260
- return ff_core_Ordering.OrderingSame()
1261
- }
1262
- }
1263
- return
1264
- }
1265
- }
1266
- }
1267
- {
1268
- if(x_a.BrowserCommand) {
1269
- const x_ = x_a;
1270
- if(y_a.BrowserCommand) {
1271
- const y_ = y_a;
1272
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1273
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1274
- return mainPathOrdering_
1275
- } else {
1276
- return ff_core_Ordering.OrderingSame()
1277
- }
1278
- return
1279
- }
1280
- }
1281
- }
1282
- {
1283
- if(x_a.BuildCommand) {
1284
- const x_ = x_a;
1285
- if(y_a.BuildCommand) {
1286
- const y_ = y_a;
1287
- const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1288
- if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1289
- return mainPathOrdering_
1290
- } else {
1291
- return ff_core_Ordering.OrderingSame()
1292
- }
1293
- return
1294
- }
1295
- }
1296
- }
1297
- {
1298
- if(x_a.CheckCommand) {
1299
- const x_ = x_a;
1300
- if(y_a.CheckCommand) {
1301
- const y_ = y_a;
1302
- const filePathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.filePath_, y_.filePath_);
1303
- if((filePathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1304
- return filePathOrdering_
1305
- } else {
1306
- return ff_core_Ordering.OrderingSame()
1307
- }
1308
- return
1309
- }
1310
- }
1311
- }
1312
- {
1313
- function number_(z_) {
1314
- {
1315
- const z_a = z_;
1316
- {
1317
- if(z_a.BootstrapCommand) {
1318
- return 0
1319
- return
1320
- }
1321
- }
1322
- {
1323
- if(z_a.RunCommand) {
1324
- return 1
1325
- return
1326
- }
1327
- }
1328
- {
1329
- if(z_a.BrowserCommand) {
1330
- return 2
1331
- return
1332
- }
1333
- }
1334
- {
1335
- if(z_a.BuildCommand) {
1336
- return 3
1337
- return
1338
- }
1339
- }
1340
- {
1341
- if(z_a.CheckCommand) {
1342
- return 4
1343
- return
1344
- }
1345
- }
1346
- }
1347
- }
1348
- return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
1349
- return
1350
- }
1351
- }
1352
- }
1353
- };
1354
-
1355
- export const ff_core_Ordering_Order$ff_compiler_Main_CommandLineError = {
1356
- compare_(x_, y_) {
1357
- {
1358
- const x_a = x_;
1359
- const y_a = y_;
1360
- {
1361
- const _guard1 = (x_ === y_);
1362
- if(_guard1) {
1363
- return ff_core_Ordering.OrderingSame()
1364
- return
1365
- }
1366
- }
1367
- {
1368
- const problemOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.problem_, y_.problem_);
1369
- if((problemOrdering_ !== ff_core_Ordering.OrderingSame())) {
1370
- return problemOrdering_
1371
- } else {
1372
- return ff_core_Ordering.OrderingSame()
1373
- }
1374
- return
1375
- }
1376
- }
1377
- },
1378
- async compare_$(x_, y_, $task) {
1379
- {
1380
- const x_a = x_;
1381
- const y_a = y_;
1382
- {
1383
- const _guard1 = (x_ === y_);
1384
- if(_guard1) {
1385
- return ff_core_Ordering.OrderingSame()
1386
- return
1387
- }
1388
- }
1389
- {
1390
- const problemOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.problem_, y_.problem_);
1391
- if((problemOrdering_ !== ff_core_Ordering.OrderingSame())) {
1392
- return problemOrdering_
1393
- } else {
1394
- return ff_core_Ordering.OrderingSame()
1395
- }
1396
- return
1397
- }
1398
- }
1399
- }
1400
- };
1401
-
1402
- export const ff_core_Serializable_Serializable$ff_compiler_Main_MainCommand = {
1403
- serializeUsing_(serialization_, value_) {
1404
- {
1405
- const serialization_a = serialization_;
1406
- const value_a = value_;
1407
- {
1408
- if(value_a.BootstrapCommand) {
1409
- const v_ = value_a;
1410
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1411
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1412
- serialization_.offset_ += 1
1413
- return
1414
- }
1415
- }
1416
- {
1417
- if(value_a.RunCommand) {
1418
- const v_ = value_a;
1419
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1420
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
1421
- serialization_.offset_ += 1;
1422
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1423
- 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_)
1424
- return
1425
- }
1426
- }
1427
- {
1428
- if(value_a.BrowserCommand) {
1429
- const v_ = value_a;
1430
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1431
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1432
- serialization_.offset_ += 1;
1433
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1434
- return
1435
- }
1436
- }
1437
- {
1438
- if(value_a.BuildCommand) {
1439
- const v_ = value_a;
1440
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1441
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3);
1442
- serialization_.offset_ += 1;
1443
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1444
- return
1445
- }
1446
- }
1447
- {
1448
- if(value_a.CheckCommand) {
1449
- const v_ = value_a;
1450
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1451
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 4);
1452
- serialization_.offset_ += 1;
1453
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.filePath_)
1454
- return
1455
- }
1456
- }
1457
- }
1458
- },
1459
- deserializeUsing_(serialization_) {
1460
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1461
- serialization_.offset_ += 1;
1462
- {
1463
- const _1 = variantIndex_;
1464
- {
1465
- if(_1 == 0) {
1466
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1467
- return ff_compiler_Main.BootstrapCommand()
1468
- return
1469
- }
1470
- }
1471
- {
1472
- if(_1 == 1) {
1473
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1474
- return ff_compiler_Main.RunCommand(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_))
1475
- return
1476
- }
1477
- }
1478
- {
1479
- if(_1 == 2) {
1480
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1481
- return ff_compiler_Main.BrowserCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1482
- return
1483
- }
1484
- }
1485
- {
1486
- if(_1 == 3) {
1487
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1488
- return ff_compiler_Main.BuildCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1489
- return
1490
- }
1491
- }
1492
- {
1493
- if(_1 == 4) {
1494
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1495
- return ff_compiler_Main.CheckCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1496
- return
1497
- }
1498
- }
1499
- {
1500
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1501
- return
1502
- }
1503
- }
1504
- },
1505
- async serializeUsing_$(serialization_, value_, $task) {
1506
- {
1507
- const serialization_a = serialization_;
1508
- const value_a = value_;
1509
- {
1510
- if(value_a.BootstrapCommand) {
1511
- const v_ = value_a;
1512
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1513
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1514
- serialization_.offset_ += 1
1515
- return
1516
- }
1517
- }
1518
- {
1519
- if(value_a.RunCommand) {
1520
- const v_ = value_a;
1521
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1522
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
1523
- serialization_.offset_ += 1;
1524
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1525
- 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_)
1526
- return
1527
- }
1528
- }
1529
- {
1530
- if(value_a.BrowserCommand) {
1531
- const v_ = value_a;
1532
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1533
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1534
- serialization_.offset_ += 1;
1535
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1536
- return
1537
- }
1538
- }
1539
- {
1540
- if(value_a.BuildCommand) {
1541
- const v_ = value_a;
1542
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1543
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3);
1544
- serialization_.offset_ += 1;
1545
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1546
- return
1547
- }
1548
- }
1549
- {
1550
- if(value_a.CheckCommand) {
1551
- const v_ = value_a;
1552
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1553
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 4);
1554
- serialization_.offset_ += 1;
1555
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.filePath_)
1556
- return
1557
- }
1558
- }
1559
- }
1560
- },
1561
- async deserializeUsing_$(serialization_, $task) {
1562
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1563
- serialization_.offset_ += 1;
1564
- {
1565
- const _1 = variantIndex_;
1566
- {
1567
- if(_1 == 0) {
1568
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1569
- return ff_compiler_Main.BootstrapCommand()
1570
- return
1571
- }
1572
- }
1573
- {
1574
- if(_1 == 1) {
1575
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1576
- return ff_compiler_Main.RunCommand(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_))
1577
- return
1578
- }
1579
- }
1580
- {
1581
- if(_1 == 2) {
1582
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1583
- return ff_compiler_Main.BrowserCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1584
- return
1585
- }
1586
- }
1587
- {
1588
- if(_1 == 3) {
1589
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1590
- return ff_compiler_Main.BuildCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1591
- return
1592
- }
1593
- }
1594
- {
1595
- if(_1 == 4) {
1596
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1597
- return ff_compiler_Main.CheckCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1598
- return
1599
- }
1600
- }
1601
- {
1602
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1603
- return
1604
- }
1605
- }
1606
- }
1607
- };
1608
-
1609
- export const ff_core_Serializable_Serializable$ff_compiler_Main_CommandLineError = {
1610
- serializeUsing_(serialization_, value_) {
1611
- {
1612
- const serialization_a = serialization_;
1613
- const value_a = value_;
1614
- {
1615
- const v_ = value_a;
1616
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1617
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1618
- serialization_.offset_ += 1;
1619
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.problem_)
1620
- return
1621
- }
1622
- }
1623
- },
1624
- deserializeUsing_(serialization_) {
1625
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1626
- serialization_.offset_ += 1;
1627
- {
1628
- const _1 = variantIndex_;
1629
- {
1630
- if(_1 == 0) {
1631
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1632
- return ff_compiler_Main.CommandLineError(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1633
- return
1634
- }
1635
- }
1636
- {
1637
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1638
- return
1639
- }
1640
- }
1641
- },
1642
- async serializeUsing_$(serialization_, value_, $task) {
1643
- {
1644
- const serialization_a = serialization_;
1645
- const value_a = value_;
1646
- {
1647
- const v_ = value_a;
1648
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1649
- ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1650
- serialization_.offset_ += 1;
1651
- ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.problem_)
1652
- return
1653
- }
1654
- }
1655
- },
1656
- async deserializeUsing_$(serialization_, $task) {
1657
- const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1658
- serialization_.offset_ += 1;
1659
- {
1660
- const _1 = variantIndex_;
1661
- {
1662
- if(_1 == 0) {
1663
- serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1664
- return ff_compiler_Main.CommandLineError(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1665
- return
1666
- }
1667
- }
1668
- {
1669
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1670
- return
1671
- }
1672
- }
1673
- }
1674
- };
1675
-
1676
- export async function $run$(fireflyPath_, arguments_) {
1677
- Error.stackTraceLimit = 50
1678
- const $task = {controller: new AbortController(), subtasks: new Set(), promise: new Promise(() => {}), started: performance.now() * 0.001}
1679
- let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)
1680
- let system = {
1681
- task_: $task,
1682
- array_: arguments_,
1683
- fireflyPath_: fireflyPath_,
1684
- mainPackagePair_: {group_: "ff", name_: "compiler"},
1685
- executableMode_: false,
1686
- buildMode_: false
1687
- }
1688
- try {
1689
- await main_$(system, $task)
1690
- } finally {
1691
- ff_core_Task.Task_abort$($task)
1692
- clearInterval(interval)
1693
- }
1694
- }
1695
- import * as path from 'node:path'
1696
- queueMicrotask(async () => {
1697
- let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))
1698
- await $run$(fireflyPath_, process.argv.slice(2))
1699
- })
839
+
840
+ }
841
+
842
+
843
+
844
+ export const ff_core_Any_HasAnyTag$ff_compiler_Main_MainCommand = {
845
+ anyTag_() {
846
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Main.MainCommand" + "[") + "]"))
847
+ },
848
+ async anyTag_$($task) {
849
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Main.MainCommand" + "[") + "]"))
850
+ }
851
+ };
852
+
853
+ export const ff_core_Any_HasAnyTag$ff_compiler_Main_CommandLineError = {
854
+ anyTag_() {
855
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Main.CommandLineError" + "[") + "]"))
856
+ },
857
+ async anyTag_$($task) {
858
+ return ff_core_Any.internalAnyTag_((("ff:compiler/Main.CommandLineError" + "[") + "]"))
859
+ }
860
+ };
861
+
862
+ export const ff_core_Show_Show$ff_compiler_Main_MainCommand = {
863
+ show_(value_) {
864
+ {
865
+ const value_a = value_;
866
+ {
867
+ if(value_a.BootstrapCommand) {
868
+ const z_ = value_a;
869
+ return "BootstrapCommand"
870
+ return
871
+ }
872
+ }
873
+ {
874
+ if(value_a.RunCommand) {
875
+ const z_ = value_a;
876
+ return ((((("RunCommand" + "(") + 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_)) + ")")
877
+ return
878
+ }
879
+ }
880
+ {
881
+ if(value_a.BrowserCommand) {
882
+ const z_ = value_a;
883
+ return ((("BrowserCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
884
+ return
885
+ }
886
+ }
887
+ {
888
+ if(value_a.BuildCommand) {
889
+ const z_ = value_a;
890
+ return ((("BuildCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
891
+ return
892
+ }
893
+ }
894
+ {
895
+ if(value_a.CheckCommand) {
896
+ const z_ = value_a;
897
+ return ((("CheckCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.filePath_)) + ")")
898
+ return
899
+ }
900
+ }
901
+ }
902
+ },
903
+ async show_$(value_, $task) {
904
+ {
905
+ const value_a = value_;
906
+ {
907
+ if(value_a.BootstrapCommand) {
908
+ const z_ = value_a;
909
+ return "BootstrapCommand"
910
+ return
911
+ }
912
+ }
913
+ {
914
+ if(value_a.RunCommand) {
915
+ const z_ = value_a;
916
+ return ((((("RunCommand" + "(") + 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_)) + ")")
917
+ return
918
+ }
919
+ }
920
+ {
921
+ if(value_a.BrowserCommand) {
922
+ const z_ = value_a;
923
+ return ((("BrowserCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
924
+ return
925
+ }
926
+ }
927
+ {
928
+ if(value_a.BuildCommand) {
929
+ const z_ = value_a;
930
+ return ((("BuildCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.mainPath_)) + ")")
931
+ return
932
+ }
933
+ }
934
+ {
935
+ if(value_a.CheckCommand) {
936
+ const z_ = value_a;
937
+ return ((("CheckCommand" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.filePath_)) + ")")
938
+ return
939
+ }
940
+ }
941
+ }
942
+ }
943
+ };
944
+
945
+ export const ff_core_Show_Show$ff_compiler_Main_CommandLineError = {
946
+ show_(value_) {
947
+ {
948
+ const value_a = value_;
949
+ {
950
+ const z_ = value_a;
951
+ return ((("CommandLineError" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.problem_)) + ")")
952
+ return
953
+ }
954
+ }
955
+ },
956
+ async show_$(value_, $task) {
957
+ {
958
+ const value_a = value_;
959
+ {
960
+ const z_ = value_a;
961
+ return ((("CommandLineError" + "(") + ff_core_Show.ff_core_Show_Show$ff_core_String_String.show_(z_.problem_)) + ")")
962
+ return
963
+ }
964
+ }
965
+ }
966
+ };
967
+
968
+ export const ff_core_Equal_Equal$ff_compiler_Main_MainCommand = {
969
+ equals_(x_, y_) {
970
+ {
971
+ const x_a = x_;
972
+ const y_a = y_;
973
+ {
974
+ const _guard1 = (x_ === y_);
975
+ if(_guard1) {
976
+ return true
977
+ return
978
+ }
979
+ }
980
+ {
981
+ if(x_a.RunCommand) {
982
+ const x_ = x_a;
983
+ if(y_a.RunCommand) {
984
+ const y_ = y_a;
985
+ 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_))
986
+ return
987
+ }
988
+ }
989
+ }
990
+ {
991
+ if(x_a.BrowserCommand) {
992
+ const x_ = x_a;
993
+ if(y_a.BrowserCommand) {
994
+ const y_ = y_a;
995
+ return (x_.mainPath_ === y_.mainPath_)
996
+ return
997
+ }
998
+ }
999
+ }
1000
+ {
1001
+ if(x_a.BuildCommand) {
1002
+ const x_ = x_a;
1003
+ if(y_a.BuildCommand) {
1004
+ const y_ = y_a;
1005
+ return (x_.mainPath_ === y_.mainPath_)
1006
+ return
1007
+ }
1008
+ }
1009
+ }
1010
+ {
1011
+ if(x_a.CheckCommand) {
1012
+ const x_ = x_a;
1013
+ if(y_a.CheckCommand) {
1014
+ const y_ = y_a;
1015
+ return (x_.filePath_ === y_.filePath_)
1016
+ return
1017
+ }
1018
+ }
1019
+ }
1020
+ {
1021
+ return false
1022
+ return
1023
+ }
1024
+ }
1025
+ },
1026
+ async equals_$(x_, y_, $task) {
1027
+ {
1028
+ const x_a = x_;
1029
+ const y_a = y_;
1030
+ {
1031
+ const _guard1 = (x_ === y_);
1032
+ if(_guard1) {
1033
+ return true
1034
+ return
1035
+ }
1036
+ }
1037
+ {
1038
+ if(x_a.RunCommand) {
1039
+ const x_ = x_a;
1040
+ if(y_a.RunCommand) {
1041
+ const y_ = y_a;
1042
+ 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_))
1043
+ return
1044
+ }
1045
+ }
1046
+ }
1047
+ {
1048
+ if(x_a.BrowserCommand) {
1049
+ const x_ = x_a;
1050
+ if(y_a.BrowserCommand) {
1051
+ const y_ = y_a;
1052
+ return (x_.mainPath_ === y_.mainPath_)
1053
+ return
1054
+ }
1055
+ }
1056
+ }
1057
+ {
1058
+ if(x_a.BuildCommand) {
1059
+ const x_ = x_a;
1060
+ if(y_a.BuildCommand) {
1061
+ const y_ = y_a;
1062
+ return (x_.mainPath_ === y_.mainPath_)
1063
+ return
1064
+ }
1065
+ }
1066
+ }
1067
+ {
1068
+ if(x_a.CheckCommand) {
1069
+ const x_ = x_a;
1070
+ if(y_a.CheckCommand) {
1071
+ const y_ = y_a;
1072
+ return (x_.filePath_ === y_.filePath_)
1073
+ return
1074
+ }
1075
+ }
1076
+ }
1077
+ {
1078
+ return false
1079
+ return
1080
+ }
1081
+ }
1082
+ }
1083
+ };
1084
+
1085
+ export const ff_core_Equal_Equal$ff_compiler_Main_CommandLineError = {
1086
+ equals_(x_, y_) {
1087
+ {
1088
+ const x_a = x_;
1089
+ const y_a = y_;
1090
+ {
1091
+ const _guard1 = (x_ === y_);
1092
+ if(_guard1) {
1093
+ return true
1094
+ return
1095
+ }
1096
+ }
1097
+ {
1098
+ return (x_.problem_ === y_.problem_)
1099
+ return
1100
+ }
1101
+ }
1102
+ },
1103
+ async equals_$(x_, y_, $task) {
1104
+ {
1105
+ const x_a = x_;
1106
+ const y_a = y_;
1107
+ {
1108
+ const _guard1 = (x_ === y_);
1109
+ if(_guard1) {
1110
+ return true
1111
+ return
1112
+ }
1113
+ }
1114
+ {
1115
+ return (x_.problem_ === y_.problem_)
1116
+ return
1117
+ }
1118
+ }
1119
+ }
1120
+ };
1121
+
1122
+ export const ff_core_Ordering_Order$ff_compiler_Main_MainCommand = {
1123
+ compare_(x_, y_) {
1124
+ {
1125
+ const x_a = x_;
1126
+ const y_a = y_;
1127
+ {
1128
+ const _guard1 = (x_ === y_);
1129
+ if(_guard1) {
1130
+ return ff_core_Ordering.OrderingSame()
1131
+ return
1132
+ }
1133
+ }
1134
+ {
1135
+ if(x_a.RunCommand) {
1136
+ const x_ = x_a;
1137
+ if(y_a.RunCommand) {
1138
+ const y_ = y_a;
1139
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1140
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1141
+ return mainPathOrdering_
1142
+ } else {
1143
+ const argumentOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.argument_, y_.argument_);
1144
+ if((argumentOrdering_ !== ff_core_Ordering.OrderingSame())) {
1145
+ return argumentOrdering_
1146
+ } else {
1147
+ return ff_core_Ordering.OrderingSame()
1148
+ }
1149
+ }
1150
+ return
1151
+ }
1152
+ }
1153
+ }
1154
+ {
1155
+ if(x_a.BrowserCommand) {
1156
+ const x_ = x_a;
1157
+ if(y_a.BrowserCommand) {
1158
+ const y_ = y_a;
1159
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1160
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1161
+ return mainPathOrdering_
1162
+ } else {
1163
+ return ff_core_Ordering.OrderingSame()
1164
+ }
1165
+ return
1166
+ }
1167
+ }
1168
+ }
1169
+ {
1170
+ if(x_a.BuildCommand) {
1171
+ const x_ = x_a;
1172
+ if(y_a.BuildCommand) {
1173
+ const y_ = y_a;
1174
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1175
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1176
+ return mainPathOrdering_
1177
+ } else {
1178
+ return ff_core_Ordering.OrderingSame()
1179
+ }
1180
+ return
1181
+ }
1182
+ }
1183
+ }
1184
+ {
1185
+ if(x_a.CheckCommand) {
1186
+ const x_ = x_a;
1187
+ if(y_a.CheckCommand) {
1188
+ const y_ = y_a;
1189
+ const filePathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.filePath_, y_.filePath_);
1190
+ if((filePathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1191
+ return filePathOrdering_
1192
+ } else {
1193
+ return ff_core_Ordering.OrderingSame()
1194
+ }
1195
+ return
1196
+ }
1197
+ }
1198
+ }
1199
+ {
1200
+ function number_(z_) {
1201
+ {
1202
+ const z_a = z_;
1203
+ {
1204
+ if(z_a.BootstrapCommand) {
1205
+ return 0
1206
+ return
1207
+ }
1208
+ }
1209
+ {
1210
+ if(z_a.RunCommand) {
1211
+ return 1
1212
+ return
1213
+ }
1214
+ }
1215
+ {
1216
+ if(z_a.BrowserCommand) {
1217
+ return 2
1218
+ return
1219
+ }
1220
+ }
1221
+ {
1222
+ if(z_a.BuildCommand) {
1223
+ return 3
1224
+ return
1225
+ }
1226
+ }
1227
+ {
1228
+ if(z_a.CheckCommand) {
1229
+ return 4
1230
+ return
1231
+ }
1232
+ }
1233
+ }
1234
+ }
1235
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
1236
+ return
1237
+ }
1238
+ }
1239
+ },
1240
+ async compare_$(x_, y_, $task) {
1241
+ {
1242
+ const x_a = x_;
1243
+ const y_a = y_;
1244
+ {
1245
+ const _guard1 = (x_ === y_);
1246
+ if(_guard1) {
1247
+ return ff_core_Ordering.OrderingSame()
1248
+ return
1249
+ }
1250
+ }
1251
+ {
1252
+ if(x_a.RunCommand) {
1253
+ const x_ = x_a;
1254
+ if(y_a.RunCommand) {
1255
+ const y_ = y_a;
1256
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1257
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1258
+ return mainPathOrdering_
1259
+ } else {
1260
+ const argumentOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_List_List(ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String).compare_(x_.argument_, y_.argument_);
1261
+ if((argumentOrdering_ !== ff_core_Ordering.OrderingSame())) {
1262
+ return argumentOrdering_
1263
+ } else {
1264
+ return ff_core_Ordering.OrderingSame()
1265
+ }
1266
+ }
1267
+ return
1268
+ }
1269
+ }
1270
+ }
1271
+ {
1272
+ if(x_a.BrowserCommand) {
1273
+ const x_ = x_a;
1274
+ if(y_a.BrowserCommand) {
1275
+ const y_ = y_a;
1276
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1277
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1278
+ return mainPathOrdering_
1279
+ } else {
1280
+ return ff_core_Ordering.OrderingSame()
1281
+ }
1282
+ return
1283
+ }
1284
+ }
1285
+ }
1286
+ {
1287
+ if(x_a.BuildCommand) {
1288
+ const x_ = x_a;
1289
+ if(y_a.BuildCommand) {
1290
+ const y_ = y_a;
1291
+ const mainPathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.mainPath_, y_.mainPath_);
1292
+ if((mainPathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1293
+ return mainPathOrdering_
1294
+ } else {
1295
+ return ff_core_Ordering.OrderingSame()
1296
+ }
1297
+ return
1298
+ }
1299
+ }
1300
+ }
1301
+ {
1302
+ if(x_a.CheckCommand) {
1303
+ const x_ = x_a;
1304
+ if(y_a.CheckCommand) {
1305
+ const y_ = y_a;
1306
+ const filePathOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.filePath_, y_.filePath_);
1307
+ if((filePathOrdering_ !== ff_core_Ordering.OrderingSame())) {
1308
+ return filePathOrdering_
1309
+ } else {
1310
+ return ff_core_Ordering.OrderingSame()
1311
+ }
1312
+ return
1313
+ }
1314
+ }
1315
+ }
1316
+ {
1317
+ function number_(z_) {
1318
+ {
1319
+ const z_a = z_;
1320
+ {
1321
+ if(z_a.BootstrapCommand) {
1322
+ return 0
1323
+ return
1324
+ }
1325
+ }
1326
+ {
1327
+ if(z_a.RunCommand) {
1328
+ return 1
1329
+ return
1330
+ }
1331
+ }
1332
+ {
1333
+ if(z_a.BrowserCommand) {
1334
+ return 2
1335
+ return
1336
+ }
1337
+ }
1338
+ {
1339
+ if(z_a.BuildCommand) {
1340
+ return 3
1341
+ return
1342
+ }
1343
+ }
1344
+ {
1345
+ if(z_a.CheckCommand) {
1346
+ return 4
1347
+ return
1348
+ }
1349
+ }
1350
+ }
1351
+ }
1352
+ return ff_core_Ordering.ff_core_Ordering_Order$ff_core_Int_Int.compare_(number_(x_), number_(y_))
1353
+ return
1354
+ }
1355
+ }
1356
+ }
1357
+ };
1358
+
1359
+ export const ff_core_Ordering_Order$ff_compiler_Main_CommandLineError = {
1360
+ compare_(x_, y_) {
1361
+ {
1362
+ const x_a = x_;
1363
+ const y_a = y_;
1364
+ {
1365
+ const _guard1 = (x_ === y_);
1366
+ if(_guard1) {
1367
+ return ff_core_Ordering.OrderingSame()
1368
+ return
1369
+ }
1370
+ }
1371
+ {
1372
+ const problemOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.problem_, y_.problem_);
1373
+ if((problemOrdering_ !== ff_core_Ordering.OrderingSame())) {
1374
+ return problemOrdering_
1375
+ } else {
1376
+ return ff_core_Ordering.OrderingSame()
1377
+ }
1378
+ return
1379
+ }
1380
+ }
1381
+ },
1382
+ async compare_$(x_, y_, $task) {
1383
+ {
1384
+ const x_a = x_;
1385
+ const y_a = y_;
1386
+ {
1387
+ const _guard1 = (x_ === y_);
1388
+ if(_guard1) {
1389
+ return ff_core_Ordering.OrderingSame()
1390
+ return
1391
+ }
1392
+ }
1393
+ {
1394
+ const problemOrdering_ = ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String.compare_(x_.problem_, y_.problem_);
1395
+ if((problemOrdering_ !== ff_core_Ordering.OrderingSame())) {
1396
+ return problemOrdering_
1397
+ } else {
1398
+ return ff_core_Ordering.OrderingSame()
1399
+ }
1400
+ return
1401
+ }
1402
+ }
1403
+ }
1404
+ };
1405
+
1406
+ export const ff_core_Serializable_Serializable$ff_compiler_Main_MainCommand = {
1407
+ serializeUsing_(serialization_, value_) {
1408
+ {
1409
+ const serialization_a = serialization_;
1410
+ const value_a = value_;
1411
+ {
1412
+ if(value_a.BootstrapCommand) {
1413
+ const v_ = value_a;
1414
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1415
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1416
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1417
+ serialization_.offset_ += 1
1418
+ return
1419
+ }
1420
+ }
1421
+ {
1422
+ if(value_a.RunCommand) {
1423
+ const v_ = value_a;
1424
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1425
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1426
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
1427
+ serialization_.offset_ += 1;
1428
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1429
+ 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_)
1430
+ return
1431
+ }
1432
+ }
1433
+ {
1434
+ if(value_a.BrowserCommand) {
1435
+ const v_ = value_a;
1436
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1437
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1438
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1439
+ serialization_.offset_ += 1;
1440
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1441
+ return
1442
+ }
1443
+ }
1444
+ {
1445
+ if(value_a.BuildCommand) {
1446
+ const v_ = value_a;
1447
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1448
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1449
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3);
1450
+ serialization_.offset_ += 1;
1451
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1452
+ return
1453
+ }
1454
+ }
1455
+ {
1456
+ if(value_a.CheckCommand) {
1457
+ const v_ = value_a;
1458
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1459
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1460
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 4);
1461
+ serialization_.offset_ += 1;
1462
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.filePath_)
1463
+ return
1464
+ }
1465
+ }
1466
+ }
1467
+ },
1468
+ deserializeUsing_(serialization_) {
1469
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1470
+ serialization_.offset_ += 1;
1471
+ {
1472
+ const _1 = variantIndex_;
1473
+ {
1474
+ if(_1 == 0) {
1475
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1476
+ return ff_compiler_Main.BootstrapCommand()
1477
+ return
1478
+ }
1479
+ }
1480
+ {
1481
+ if(_1 == 1) {
1482
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1483
+ return ff_compiler_Main.RunCommand(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_))
1484
+ return
1485
+ }
1486
+ }
1487
+ {
1488
+ if(_1 == 2) {
1489
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1490
+ return ff_compiler_Main.BrowserCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1491
+ return
1492
+ }
1493
+ }
1494
+ {
1495
+ if(_1 == 3) {
1496
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1497
+ return ff_compiler_Main.BuildCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1498
+ return
1499
+ }
1500
+ }
1501
+ {
1502
+ if(_1 == 4) {
1503
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1504
+ return ff_compiler_Main.CheckCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1505
+ return
1506
+ }
1507
+ }
1508
+ {
1509
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1510
+ return
1511
+ }
1512
+ }
1513
+ },
1514
+ async serializeUsing_$(serialization_, value_, $task) {
1515
+ {
1516
+ const serialization_a = serialization_;
1517
+ const value_a = value_;
1518
+ {
1519
+ if(value_a.BootstrapCommand) {
1520
+ const v_ = value_a;
1521
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1522
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1523
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1524
+ serialization_.offset_ += 1
1525
+ return
1526
+ }
1527
+ }
1528
+ {
1529
+ if(value_a.RunCommand) {
1530
+ const v_ = value_a;
1531
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1532
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1533
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 1);
1534
+ serialization_.offset_ += 1;
1535
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_);
1536
+ 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_)
1537
+ return
1538
+ }
1539
+ }
1540
+ {
1541
+ if(value_a.BrowserCommand) {
1542
+ const v_ = value_a;
1543
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1544
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1545
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 2);
1546
+ serialization_.offset_ += 1;
1547
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1548
+ return
1549
+ }
1550
+ }
1551
+ {
1552
+ if(value_a.BuildCommand) {
1553
+ const v_ = value_a;
1554
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1555
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1556
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 3);
1557
+ serialization_.offset_ += 1;
1558
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.mainPath_)
1559
+ return
1560
+ }
1561
+ }
1562
+ {
1563
+ if(value_a.CheckCommand) {
1564
+ const v_ = value_a;
1565
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1566
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1567
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 4);
1568
+ serialization_.offset_ += 1;
1569
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.filePath_)
1570
+ return
1571
+ }
1572
+ }
1573
+ }
1574
+ },
1575
+ async deserializeUsing_$(serialization_, $task) {
1576
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1577
+ serialization_.offset_ += 1;
1578
+ {
1579
+ const _1 = variantIndex_;
1580
+ {
1581
+ if(_1 == 0) {
1582
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1583
+ return ff_compiler_Main.BootstrapCommand()
1584
+ return
1585
+ }
1586
+ }
1587
+ {
1588
+ if(_1 == 1) {
1589
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 27), 0);
1590
+ return ff_compiler_Main.RunCommand(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_))
1591
+ return
1592
+ }
1593
+ }
1594
+ {
1595
+ if(_1 == 2) {
1596
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 31), 0);
1597
+ return ff_compiler_Main.BrowserCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1598
+ return
1599
+ }
1600
+ }
1601
+ {
1602
+ if(_1 == 3) {
1603
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1604
+ return ff_compiler_Main.BuildCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1605
+ return
1606
+ }
1607
+ }
1608
+ {
1609
+ if(_1 == 4) {
1610
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 29), 0);
1611
+ return ff_compiler_Main.CheckCommand(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1612
+ return
1613
+ }
1614
+ }
1615
+ {
1616
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1617
+ return
1618
+ }
1619
+ }
1620
+ }
1621
+ };
1622
+
1623
+ export const ff_core_Serializable_Serializable$ff_compiler_Main_CommandLineError = {
1624
+ serializeUsing_(serialization_, value_) {
1625
+ {
1626
+ const serialization_a = serialization_;
1627
+ const value_a = value_;
1628
+ {
1629
+ const v_ = value_a;
1630
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1631
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1632
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1633
+ serialization_.offset_ += 1;
1634
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.problem_)
1635
+ return
1636
+ }
1637
+ }
1638
+ },
1639
+ deserializeUsing_(serialization_) {
1640
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1641
+ serialization_.offset_ += 1;
1642
+ {
1643
+ const _1 = variantIndex_;
1644
+ {
1645
+ if(_1 == 0) {
1646
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1647
+ return ff_compiler_Main.CommandLineError(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1648
+ return
1649
+ }
1650
+ }
1651
+ {
1652
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1653
+ return
1654
+ }
1655
+ }
1656
+ },
1657
+ async serializeUsing_$(serialization_, value_, $task) {
1658
+ {
1659
+ const serialization_a = serialization_;
1660
+ const value_a = value_;
1661
+ {
1662
+ const v_ = value_a;
1663
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1664
+ ff_core_Serializable.Serialization_autoResize(serialization_, 1);
1665
+ ff_core_Buffer.Buffer_setUint8(serialization_.buffer_, serialization_.offset_, 0);
1666
+ serialization_.offset_ += 1;
1667
+ ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.serializeUsing_(serialization_, v_.problem_)
1668
+ return
1669
+ }
1670
+ }
1671
+ },
1672
+ async deserializeUsing_$(serialization_, $task) {
1673
+ const variantIndex_ = ff_core_Buffer.Buffer_grabUint8(serialization_.buffer_, serialization_.offset_);
1674
+ serialization_.offset_ += 1;
1675
+ {
1676
+ const _1 = variantIndex_;
1677
+ {
1678
+ if(_1 == 0) {
1679
+ serialization_.checksum_ = ff_core_Int.Int_bitOr(((31 * serialization_.checksum_) + 33), 0);
1680
+ return ff_compiler_Main.CommandLineError(ff_core_Serializable.ff_core_Serializable_Serializable$ff_core_String_String.deserializeUsing_(serialization_))
1681
+ return
1682
+ }
1683
+ }
1684
+ {
1685
+ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serializable.DeserializationChecksumException(), ff_core_Serializable.ff_core_Any_HasAnyTag$ff_core_Serializable_DeserializationChecksumException)})
1686
+ return
1687
+ }
1688
+ }
1689
+ }
1690
+ };
1691
+
1692
+ export async function $run$(fireflyPath_, arguments_) {
1693
+ Error.stackTraceLimit = 50
1694
+ const $task = {controller: new AbortController(), subtasks: new Set(), promise: new Promise(() => {}), started: performance.now() * 0.001}
1695
+ let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)
1696
+ let system = {
1697
+ task_: $task,
1698
+ array_: arguments_,
1699
+ fireflyPath_: fireflyPath_,
1700
+ mainPackagePair_: {group_: "ff", name_: "compiler"},
1701
+ executableMode_: false,
1702
+ buildMode_: false
1703
+ }
1704
+ try {
1705
+ await main_$(system, $task)
1706
+ } finally {
1707
+ ff_core_Task.Task_abort$($task)
1708
+ clearInterval(interval)
1709
+ }
1710
+ }
1711
+ import * as path from 'node:path'
1712
+ queueMicrotask(async () => {
1713
+ let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))
1714
+ await $run$(fireflyPath_, process.argv.slice(2))
1715
+ })