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,274 +1,278 @@
1
-
2
-
3
- import * as ff_core_Any from "../../ff/core/Any.mjs"
4
-
5
- import * as ff_core_Array from "../../ff/core/Array.mjs"
6
-
7
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
-
9
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
-
11
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
-
13
- import * as ff_core_Box from "../../ff/core/Box.mjs"
14
-
15
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
16
-
17
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
18
-
19
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
20
-
21
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
22
-
23
- import * as ff_core_Char from "../../ff/core/Char.mjs"
24
-
25
- import * as ff_core_Core from "../../ff/core/Core.mjs"
26
-
27
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
-
29
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
-
31
- import * as ff_core_Error from "../../ff/core/Error.mjs"
32
-
33
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
-
35
- import * as ff_core_Float from "../../ff/core/Float.mjs"
36
-
37
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
-
39
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
-
41
- import * as ff_core_Int from "../../ff/core/Int.mjs"
42
-
43
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
-
45
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
-
47
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
-
49
- import * as ff_core_List from "../../ff/core/List.mjs"
50
-
51
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
52
-
53
- import * as ff_core_Log from "../../ff/core/Log.mjs"
54
-
55
- import * as ff_core_Map from "../../ff/core/Map.mjs"
56
-
57
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
58
-
59
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
60
-
61
- import * as ff_core_Option from "../../ff/core/Option.mjs"
62
-
63
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
64
-
65
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
66
-
67
- import * as ff_core_Path from "../../ff/core/Path.mjs"
68
-
69
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
70
-
71
- import * as ff_core_Set from "../../ff/core/Set.mjs"
72
-
73
- import * as ff_core_Show from "../../ff/core/Show.mjs"
74
-
75
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
76
-
77
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
78
-
79
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
80
-
81
- import * as ff_core_String from "../../ff/core/String.mjs"
82
-
83
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
84
-
85
- import * as ff_core_Task from "../../ff/core/Task.mjs"
86
-
87
- import * as ff_core_Try from "../../ff/core/Try.mjs"
88
-
89
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
90
-
91
- // type AssetSystem
92
- export function AssetSystem(files_) {
93
- return {files_};
94
- }
95
-
96
-
97
-
98
- export function create_() {
99
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
100
- }
101
-
102
- export async function create_$($task) {
103
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
104
- }
105
-
106
- export function AssetSystem_addAssets(self_, path_, assets_) {
107
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
108
- ? ff_core_String.String_dropLast(path_, 1)
109
- : path_);
110
- return ff_core_AssetSystem.AssetSystem(ff_core_Map.Map_addAll(self_.files_, ff_core_Map.Map_map(assets_.files_, ((p_, stream_) => {
111
- return ff_core_Pair.Pair((prefix_ + p_), stream_)
112
- }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
113
- }
114
-
115
- export function AssetSystem_assets(self_, path_) {
116
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
117
- ? path_
118
- : (path_ + "/"));
119
- const streams_ = ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
120
- {
121
- const p_ = _1.first_;
122
- const s_ = _1.second_;
123
- const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
124
- if(_guard1) {
125
- return ff_core_Option.Some(ff_core_Pair.Pair(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), s_))
126
- return
127
- }
128
- }
129
- {
130
- return ff_core_Option.None()
131
- return
132
- }
133
- }));
134
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
135
- }
136
-
137
- export function AssetSystem_asset(self_, path_) {
138
- const name_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(path_), ((_w1) => {
139
- return (_w1 !== 47)
140
- })));
141
- const streams_ = ff_core_List.List_map(ff_core_Option.Option_toList(ff_core_Map.Map_get(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), ((s_) => {
142
- return ff_core_Pair.Pair(("/" + name_), s_)
143
- }));
144
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
145
- }
146
-
147
- export function AssetSystem_list(self_, path_) {
148
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
149
- ? path_
150
- : (path_ + "/"));
151
- return ff_core_List.List_distinct(ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
152
- {
153
- const p_ = _1.first_;
154
- const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
155
- if(_guard1) {
156
- return ff_core_Option.Some(ff_core_String.String_takeWhile(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), ((_w1) => {
157
- return (_w1 !== 47)
158
- })))
159
- return
160
- }
161
- }
162
- {
163
- return ff_core_Option.None()
164
- return
165
- }
166
- })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
167
- }
168
-
169
- export function AssetSystem_exists(self_, path_) {
170
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
171
- ? path_
172
- : (path_ + "/"));
173
- return (ff_core_Map.Map_contains(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || ff_core_List.List_any(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
174
- return ff_core_String.String_startsWith(_w1.first_, prefix_, 0)
175
- })))
176
- }
177
-
178
- export function AssetSystem_readStream(self_, file_) {
179
- const makeStream_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.files_, file_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
180
- return ff_core_Core.panic_(("Asset not found for readStream: " + file_))
181
- }));
182
- return makeStream_()
183
- }
184
-
185
- export function AssetSystem_readText(self_, file_) {
186
- return ff_core_Stream.Stream_toString(ff_core_AssetSystem.AssetSystem_readStream(self_, file_), "utf8")
187
- }
188
-
189
- export async function AssetSystem_addAssets$(self_, path_, assets_, $task) {
190
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
191
- ? ff_core_String.String_dropLast(path_, 1)
192
- : path_);
193
- return ff_core_AssetSystem.AssetSystem(ff_core_Map.Map_addAll(self_.files_, ff_core_Map.Map_map(assets_.files_, ((p_, stream_) => {
194
- return ff_core_Pair.Pair((prefix_ + p_), stream_)
195
- }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
196
- }
197
-
198
- export async function AssetSystem_assets$(self_, path_, $task) {
199
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
200
- ? path_
201
- : (path_ + "/"));
202
- const streams_ = ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
203
- {
204
- const p_ = _1.first_;
205
- const s_ = _1.second_;
206
- const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
207
- if(_guard1) {
208
- return ff_core_Option.Some(ff_core_Pair.Pair(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), s_))
209
- return
210
- }
211
- }
212
- {
213
- return ff_core_Option.None()
214
- return
215
- }
216
- }));
217
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
218
- }
219
-
220
- export async function AssetSystem_asset$(self_, path_, $task) {
221
- const name_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(path_), ((_w1) => {
222
- return (_w1 !== 47)
223
- })));
224
- const streams_ = ff_core_List.List_map(ff_core_Option.Option_toList(ff_core_Map.Map_get(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), ((s_) => {
225
- return ff_core_Pair.Pair(("/" + name_), s_)
226
- }));
227
- return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
228
- }
229
-
230
- export async function AssetSystem_list$(self_, path_, $task) {
231
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
232
- ? path_
233
- : (path_ + "/"));
234
- return ff_core_List.List_distinct(ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
235
- {
236
- const p_ = _1.first_;
237
- const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
238
- if(_guard1) {
239
- return ff_core_Option.Some(ff_core_String.String_takeWhile(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), ((_w1) => {
240
- return (_w1 !== 47)
241
- })))
242
- return
243
- }
244
- }
245
- {
246
- return ff_core_Option.None()
247
- return
248
- }
249
- })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
250
- }
251
-
252
- export async function AssetSystem_exists$(self_, path_, $task) {
253
- const prefix_ = (ff_core_String.String_endsWith(path_, "/")
254
- ? path_
255
- : (path_ + "/"));
256
- return (ff_core_Map.Map_contains(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || ff_core_List.List_any(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
257
- return ff_core_String.String_startsWith(_w1.first_, prefix_, 0)
258
- })))
259
- }
260
-
261
- export async function AssetSystem_readStream$(self_, file_, $task) {
262
- const makeStream_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.files_, file_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
263
- return ff_core_Core.panic_(("Asset not found for readStream: " + file_))
264
- }));
265
- return (await makeStream_($task))
266
- }
267
-
268
- export async function AssetSystem_readText$(self_, file_, $task) {
269
- return (await ff_core_Stream.Stream_toString$((await ff_core_AssetSystem.AssetSystem_readStream$(self_, file_, $task)), "utf8", $task))
270
- }
271
-
272
-
273
-
274
-
1
+
2
+
3
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
4
+
5
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
6
+
7
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
8
+
9
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
10
+
11
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
12
+
13
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
14
+
15
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
16
+
17
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
18
+
19
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
20
+
21
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
22
+
23
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
24
+
25
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
26
+
27
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
+
29
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
+
31
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
32
+
33
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
+
35
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
36
+
37
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
+
39
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
+
41
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
42
+
43
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
+
45
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
+
47
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
+
49
+ import * as ff_core_List from "../../ff/core/List.mjs"
50
+
51
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
52
+
53
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
54
+
55
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
56
+
57
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
58
+
59
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
60
+
61
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
62
+
63
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
64
+
65
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
66
+
67
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
68
+
69
+ import * as ff_core_Random from "../../ff/core/Random.mjs"
70
+
71
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
72
+
73
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
74
+
75
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
76
+
77
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
78
+
79
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
80
+
81
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
+
83
+ import * as ff_core_String from "../../ff/core/String.mjs"
84
+
85
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
+
87
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
88
+
89
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
+
91
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
+
93
+ import * as ff_core_WebSocket from "../../ff/core/WebSocket.mjs"
94
+
95
+ // type AssetSystem
96
+ export function AssetSystem(files_) {
97
+ return {files_};
98
+ }
99
+
100
+
101
+
102
+ export function create_() {
103
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
104
+ }
105
+
106
+ export async function create_$($task) {
107
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Empty(), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
108
+ }
109
+
110
+ export function AssetSystem_addAssets(self_, path_, assets_) {
111
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
112
+ ? ff_core_String.String_dropLast(path_, 1)
113
+ : path_);
114
+ return ff_core_AssetSystem.AssetSystem(ff_core_Map.Map_addAll(self_.files_, ff_core_Map.Map_map(assets_.files_, ((p_, stream_) => {
115
+ return ff_core_Pair.Pair((prefix_ + p_), stream_)
116
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
117
+ }
118
+
119
+ export function AssetSystem_assets(self_, path_) {
120
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
121
+ ? path_
122
+ : (path_ + "/"));
123
+ const streams_ = ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
124
+ {
125
+ const p_ = _1.first_;
126
+ const s_ = _1.second_;
127
+ const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
128
+ if(_guard1) {
129
+ return ff_core_Option.Some(ff_core_Pair.Pair(ff_core_String.String_dropFirst(p_, (ff_core_String.String_size(prefix_) - 1)), s_))
130
+ return
131
+ }
132
+ }
133
+ {
134
+ return ff_core_Option.None()
135
+ return
136
+ }
137
+ }));
138
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
139
+ }
140
+
141
+ export function AssetSystem_asset(self_, path_) {
142
+ const name_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(path_), ((_w1) => {
143
+ return (_w1 !== 47)
144
+ })));
145
+ const streams_ = ff_core_List.List_map(ff_core_Option.Option_toList(ff_core_Map.Map_get(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), ((s_) => {
146
+ return ff_core_Pair.Pair(("/" + name_), s_)
147
+ }));
148
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
149
+ }
150
+
151
+ export function AssetSystem_list(self_, path_) {
152
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
153
+ ? path_
154
+ : (path_ + "/"));
155
+ return ff_core_List.List_distinct(ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
156
+ {
157
+ const p_ = _1.first_;
158
+ const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
159
+ if(_guard1) {
160
+ return ff_core_Option.Some(ff_core_String.String_takeWhile(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), ((_w1) => {
161
+ return (_w1 !== 47)
162
+ })))
163
+ return
164
+ }
165
+ }
166
+ {
167
+ return ff_core_Option.None()
168
+ return
169
+ }
170
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
171
+ }
172
+
173
+ export function AssetSystem_exists(self_, path_) {
174
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
175
+ ? path_
176
+ : (path_ + "/"));
177
+ return (ff_core_Map.Map_contains(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || ff_core_List.List_any(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
178
+ return ff_core_String.String_startsWith(_w1.first_, prefix_, 0)
179
+ })))
180
+ }
181
+
182
+ export function AssetSystem_readStream(self_, file_) {
183
+ const makeStream_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.files_, file_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
184
+ return ff_core_Core.panic_(("Asset not found for readStream: " + file_))
185
+ }));
186
+ return makeStream_()
187
+ }
188
+
189
+ export function AssetSystem_readText(self_, file_) {
190
+ return ff_core_Stream.Stream_toString(ff_core_AssetSystem.AssetSystem_readStream(self_, file_), "utf8")
191
+ }
192
+
193
+ export async function AssetSystem_addAssets$(self_, path_, assets_, $task) {
194
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
195
+ ? ff_core_String.String_dropLast(path_, 1)
196
+ : path_);
197
+ return ff_core_AssetSystem.AssetSystem(ff_core_Map.Map_addAll(self_.files_, ff_core_Map.Map_map(assets_.files_, ((p_, stream_) => {
198
+ return ff_core_Pair.Pair((prefix_ + p_), stream_)
199
+ }), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
200
+ }
201
+
202
+ export async function AssetSystem_assets$(self_, path_, $task) {
203
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
204
+ ? path_
205
+ : (path_ + "/"));
206
+ const streams_ = ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
207
+ {
208
+ const p_ = _1.first_;
209
+ const s_ = _1.second_;
210
+ const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
211
+ if(_guard1) {
212
+ return ff_core_Option.Some(ff_core_Pair.Pair(ff_core_String.String_dropFirst(p_, (ff_core_String.String_size(prefix_) - 1)), s_))
213
+ return
214
+ }
215
+ }
216
+ {
217
+ return ff_core_Option.None()
218
+ return
219
+ }
220
+ }));
221
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
222
+ }
223
+
224
+ export async function AssetSystem_asset$(self_, path_, $task) {
225
+ const name_ = ff_core_String.String_reverse(ff_core_String.String_takeWhile(ff_core_String.String_reverse(path_), ((_w1) => {
226
+ return (_w1 !== 47)
227
+ })));
228
+ const streams_ = ff_core_List.List_map(ff_core_Option.Option_toList(ff_core_Map.Map_get(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)), ((s_) => {
229
+ return ff_core_Pair.Pair(("/" + name_), s_)
230
+ }));
231
+ return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
232
+ }
233
+
234
+ export async function AssetSystem_list$(self_, path_, $task) {
235
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
236
+ ? path_
237
+ : (path_ + "/"));
238
+ return ff_core_List.List_distinct(ff_core_List.List_collect(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_1) => {
239
+ {
240
+ const p_ = _1.first_;
241
+ const _guard1 = ff_core_String.String_startsWith(p_, prefix_, 0);
242
+ if(_guard1) {
243
+ return ff_core_Option.Some(ff_core_String.String_takeWhile(ff_core_String.String_dropFirst(p_, ff_core_String.String_size(prefix_)), ((_w1) => {
244
+ return (_w1 !== 47)
245
+ })))
246
+ return
247
+ }
248
+ }
249
+ {
250
+ return ff_core_Option.None()
251
+ return
252
+ }
253
+ })), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)
254
+ }
255
+
256
+ export async function AssetSystem_exists$(self_, path_, $task) {
257
+ const prefix_ = (ff_core_String.String_endsWith(path_, "/")
258
+ ? path_
259
+ : (path_ + "/"));
260
+ return (ff_core_Map.Map_contains(self_.files_, path_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String) || ff_core_List.List_any(ff_core_Map.Map_pairs(self_.files_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), ((_w1) => {
261
+ return ff_core_String.String_startsWith(_w1.first_, prefix_, 0)
262
+ })))
263
+ }
264
+
265
+ export async function AssetSystem_readStream$(self_, file_, $task) {
266
+ const makeStream_ = ff_core_Option.Option_else(ff_core_Map.Map_get(self_.files_, file_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String), (() => {
267
+ return ff_core_Core.panic_(("Asset not found for readStream: " + file_))
268
+ }));
269
+ return (await makeStream_($task))
270
+ }
271
+
272
+ export async function AssetSystem_readText$(self_, file_, $task) {
273
+ return (await ff_core_Stream.Stream_toString$((await ff_core_AssetSystem.AssetSystem_readStream$(self_, file_, $task)), "utf8", $task))
274
+ }
275
+
276
+
277
+
278
+