firefly-compiler 0.4.4

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 (221) hide show
  1. package/.firefly-workspace +1 -0
  2. package/.vscode/settings.json +5 -0
  3. package/LICENSE.txt +21 -0
  4. package/README.md +96 -0
  5. package/bin/firefly.mjs +2 -0
  6. package/compiler/.firefly/package.ff +1 -0
  7. package/compiler/Builder.ff +218 -0
  8. package/compiler/Compiler.ff +241 -0
  9. package/compiler/Dependencies.ff +179 -0
  10. package/compiler/Deriver.ff +647 -0
  11. package/compiler/Dictionaries.ff +205 -0
  12. package/compiler/Environment.ff +166 -0
  13. package/compiler/Inference.ff +1117 -0
  14. package/compiler/JsEmitter.ff +861 -0
  15. package/compiler/JsImporter.ff +56 -0
  16. package/compiler/LspHook.ff +188 -0
  17. package/compiler/Main.ff +237 -0
  18. package/compiler/Parser.ff +1383 -0
  19. package/compiler/Patterns.ff +111 -0
  20. package/compiler/Resolver.ff +620 -0
  21. package/compiler/Substitution.ff +178 -0
  22. package/compiler/Syntax.ff +299 -0
  23. package/compiler/Token.ff +180 -0
  24. package/compiler/Tokenizer.ff +278 -0
  25. package/compiler/Unification.ff +220 -0
  26. package/compiler/Wildcards.ff +50 -0
  27. package/compiler/Workspace.ff +88 -0
  28. package/core/.firefly/package.ff +2 -0
  29. package/core/Any.ff +30 -0
  30. package/core/Array.ff +249 -0
  31. package/core/AssetSystem.ff +61 -0
  32. package/core/Atomic.ff +64 -0
  33. package/core/Bool.ff +13 -0
  34. package/core/BrowserSystem.ff +14 -0
  35. package/core/Buffer.ff +211 -0
  36. package/core/BuildSystem.ff +144 -0
  37. package/core/Channel.ff +131 -0
  38. package/core/Char.ff +18 -0
  39. package/core/Core.ff +58 -0
  40. package/core/Duration.ff +15 -0
  41. package/core/Equal.ff +52 -0
  42. package/core/Error.ff +20 -0
  43. package/core/FileHandle.ff +41 -0
  44. package/core/Float.ff +41 -0
  45. package/core/HttpClient.ff +84 -0
  46. package/core/Instant.ff +9 -0
  47. package/core/Int.ff +61 -0
  48. package/core/IntMap.ff +85 -0
  49. package/core/JsSystem.ff +66 -0
  50. package/core/JsValue.ff +240 -0
  51. package/core/List.ff +440 -0
  52. package/core/Lock.ff +144 -0
  53. package/core/Log.ff +24 -0
  54. package/core/Map.ff +126 -0
  55. package/core/NodeSystem.ff +88 -0
  56. package/core/Nothing.ff +1 -0
  57. package/core/Option.ff +133 -0
  58. package/core/Ordering.ff +157 -0
  59. package/core/Pair.ff +55 -0
  60. package/core/Path.ff +393 -0
  61. package/core/RbMap.ff +216 -0
  62. package/core/Serializable.ff +173 -0
  63. package/core/Set.ff +38 -0
  64. package/core/Show.ff +43 -0
  65. package/core/Stack.ff +263 -0
  66. package/core/Stream.ff +406 -0
  67. package/core/String.ff +175 -0
  68. package/core/StringMap.ff +85 -0
  69. package/core/Task.ff +138 -0
  70. package/core/Try.ff +81 -0
  71. package/core/Unit.ff +3 -0
  72. package/experimental/random/AltGeneric.ff +44 -0
  73. package/experimental/random/Async.ff +68 -0
  74. package/experimental/random/Buffer2.ff +77 -0
  75. package/experimental/random/Cat.ff +12 -0
  76. package/experimental/random/Dictionary.ff +52 -0
  77. package/experimental/random/Example.ff +46 -0
  78. package/experimental/random/Generic.ff +102 -0
  79. package/experimental/random/HappyEyeballs.ff +40 -0
  80. package/experimental/random/HashMap.ff +72 -0
  81. package/experimental/random/IfElseUnit.ff +9 -0
  82. package/experimental/random/InputOutput.ff +23 -0
  83. package/experimental/random/ListVsArray.ff +45 -0
  84. package/experimental/random/Main.ff +44 -0
  85. package/experimental/random/MapTest.ff +67 -0
  86. package/experimental/random/OldTaskSystem.ff +210 -0
  87. package/experimental/random/PatternTest.ff +39 -0
  88. package/experimental/random/Patterns.ff +226 -0
  89. package/experimental/random/ReadBytesTest.ff +10 -0
  90. package/experimental/random/RunLength.ff +65 -0
  91. package/experimental/random/Scrape.ff +51 -0
  92. package/experimental/random/Serialization.ff +217 -0
  93. package/experimental/random/SerializationTest.ff +46 -0
  94. package/experimental/random/Serializer.ff +36 -0
  95. package/experimental/random/StdInOutErr.ff +4 -0
  96. package/experimental/random/Symbols.ff +74 -0
  97. package/experimental/random/Tag.ff +49 -0
  98. package/experimental/random/Tensor.ff +52 -0
  99. package/experimental/random/Try.ff +56 -0
  100. package/experimental/random/Tsv.ff +9 -0
  101. package/experimental/random/TypesAreModules.ff +87 -0
  102. package/experimental/random/blueprints/Blueprint.ff +52 -0
  103. package/experimental/random/blueprints/Main.ff +11 -0
  104. package/experimental/random/blueprints/Pretty.ff +58 -0
  105. package/experimental/random/blueprints/User.ff +64 -0
  106. package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
  107. package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
  108. package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
  109. package/experimental/random/blueprintsystem/User.ff +2 -0
  110. package/experimental/random/kahrs/Kahrs.ff +112 -0
  111. package/experimental/random/kahrs/TestKahrs.ff +22 -0
  112. package/experimental/random/kahrs/TestMap.ff +18 -0
  113. package/experimental/random/streaming/Gzip.ff +3 -0
  114. package/experimental/random/streaming/Main.ff +34 -0
  115. package/experimental/random/streaming/S3Bucket.ff +11 -0
  116. package/experimental/random/streaming/Tar.ff +5 -0
  117. package/experimental/rhymeapp/Main.ff +81 -0
  118. package/experimental/rhymeapp/index.html +14 -0
  119. package/firefly.sh +5 -0
  120. package/fireflysite/Main.ff +13 -0
  121. package/httpserver/.firefly/package.ff +1 -0
  122. package/httpserver/HttpServer.ff +184 -0
  123. package/lsp/.firefly/package.ff +1 -0
  124. package/lsp/CompletionHandler.ff +814 -0
  125. package/lsp/Handler.ff +551 -0
  126. package/lsp/HoverHandler.ff +82 -0
  127. package/lsp/LanguageServer.ff +229 -0
  128. package/lsp/SignatureHelpHandler.ff +55 -0
  129. package/lsp/SymbolHandler.ff +167 -0
  130. package/output/js/ff/compiler/Builder.mjs +483 -0
  131. package/output/js/ff/compiler/Compiler.mjs +410 -0
  132. package/output/js/ff/compiler/Dependencies.mjs +388 -0
  133. package/output/js/ff/compiler/Deriver.mjs +1166 -0
  134. package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
  135. package/output/js/ff/compiler/Environment.mjs +1005 -0
  136. package/output/js/ff/compiler/Inference.mjs +4264 -0
  137. package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
  138. package/output/js/ff/compiler/JsImporter.mjs +262 -0
  139. package/output/js/ff/compiler/LspHook.mjs +789 -0
  140. package/output/js/ff/compiler/Main.mjs +1695 -0
  141. package/output/js/ff/compiler/Parser.mjs +4004 -0
  142. package/output/js/ff/compiler/Patterns.mjs +923 -0
  143. package/output/js/ff/compiler/Resolver.mjs +2303 -0
  144. package/output/js/ff/compiler/Substitution.mjs +1146 -0
  145. package/output/js/ff/compiler/Syntax.mjs +12430 -0
  146. package/output/js/ff/compiler/Token.mjs +3092 -0
  147. package/output/js/ff/compiler/Tokenizer.mjs +589 -0
  148. package/output/js/ff/compiler/Unification.mjs +1748 -0
  149. package/output/js/ff/compiler/Wildcards.mjs +604 -0
  150. package/output/js/ff/compiler/Workspace.mjs +683 -0
  151. package/output/js/ff/core/Any.mjs +139 -0
  152. package/output/js/ff/core/Array.mjs +594 -0
  153. package/output/js/ff/core/AssetSystem.mjs +270 -0
  154. package/output/js/ff/core/Atomic.mjs +186 -0
  155. package/output/js/ff/core/Bool.mjs +141 -0
  156. package/output/js/ff/core/BrowserSystem.mjs +122 -0
  157. package/output/js/ff/core/Buffer.mjs +467 -0
  158. package/output/js/ff/core/BuildSystem.mjs +320 -0
  159. package/output/js/ff/core/Channel.mjs +268 -0
  160. package/output/js/ff/core/Char.mjs +145 -0
  161. package/output/js/ff/core/Core.mjs +300 -0
  162. package/output/js/ff/core/Duration.mjs +112 -0
  163. package/output/js/ff/core/Equal.mjs +175 -0
  164. package/output/js/ff/core/Error.mjs +138 -0
  165. package/output/js/ff/core/FileHandle.mjs +164 -0
  166. package/output/js/ff/core/Float.mjs +214 -0
  167. package/output/js/ff/core/HttpClient.mjs +210 -0
  168. package/output/js/ff/core/Instant.mjs +105 -0
  169. package/output/js/ff/core/Int.mjs +254 -0
  170. package/output/js/ff/core/IntMap.mjs +282 -0
  171. package/output/js/ff/core/JsSystem.mjs +234 -0
  172. package/output/js/ff/core/JsValue.mjs +678 -0
  173. package/output/js/ff/core/List.mjs +2335 -0
  174. package/output/js/ff/core/Lock.mjs +322 -0
  175. package/output/js/ff/core/Log.mjs +159 -0
  176. package/output/js/ff/core/Map.mjs +358 -0
  177. package/output/js/ff/core/NodeSystem.mjs +288 -0
  178. package/output/js/ff/core/Nothing.mjs +100 -0
  179. package/output/js/ff/core/Option.mjs +1002 -0
  180. package/output/js/ff/core/Ordering.mjs +734 -0
  181. package/output/js/ff/core/Pair.mjs +318 -0
  182. package/output/js/ff/core/Path.mjs +768 -0
  183. package/output/js/ff/core/RbMap.mjs +1936 -0
  184. package/output/js/ff/core/Serializable.mjs +434 -0
  185. package/output/js/ff/core/Set.mjs +250 -0
  186. package/output/js/ff/core/Show.mjs +201 -0
  187. package/output/js/ff/core/Stack.mjs +595 -0
  188. package/output/js/ff/core/Stream.mjs +1300 -0
  189. package/output/js/ff/core/String.mjs +433 -0
  190. package/output/js/ff/core/StringMap.mjs +282 -0
  191. package/output/js/ff/core/Task.mjs +345 -0
  192. package/output/js/ff/core/Try.mjs +503 -0
  193. package/output/js/ff/core/Unit.mjs +103 -0
  194. package/package.json +29 -0
  195. package/postgresql/.firefly/include/package-lock.json +250 -0
  196. package/postgresql/.firefly/include/package.json +5 -0
  197. package/postgresql/.firefly/include/prepare.sh +2 -0
  198. package/postgresql/.firefly/package.ff +3 -0
  199. package/postgresql/Pg.ff +530 -0
  200. package/unsafejs/.firefly/package.ff +1 -0
  201. package/unsafejs/UnsafeJs.ff +19 -0
  202. package/vscode/.vscode/launch.json +18 -0
  203. package/vscode/.vscode/tasks.json +33 -0
  204. package/vscode/LICENSE.txt +21 -0
  205. package/vscode/Prepublish.ff +15 -0
  206. package/vscode/README.md +17 -0
  207. package/vscode/client/package-lock.json +544 -0
  208. package/vscode/client/package.json +22 -0
  209. package/vscode/client/src/extension.ts +64 -0
  210. package/vscode/client/tsconfig.json +12 -0
  211. package/vscode/icons/firefly-icon.png +0 -0
  212. package/vscode/icons/firefly-icon.svg +10 -0
  213. package/vscode/icons/firefly-logo-notext.png +0 -0
  214. package/vscode/icons/firefly-logo.png +0 -0
  215. package/vscode/language-configuration.json +39 -0
  216. package/vscode/package-lock.json +3623 -0
  217. package/vscode/package.json +144 -0
  218. package/vscode/snippets-none.json +1 -0
  219. package/vscode/snippets.json +241 -0
  220. package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
  221. package/vscode/tsconfig.json +20 -0
@@ -0,0 +1,768 @@
1
+ import * as import$0 from 'fs';
2
+
3
+ import * as import$1 from 'fs/promises';
4
+
5
+ import * as import$2 from 'path';
6
+
7
+ import * as import$3 from 'url';
8
+
9
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
10
+
11
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
12
+
13
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
14
+
15
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
16
+
17
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
18
+
19
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
20
+
21
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
22
+
23
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
24
+
25
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
26
+
27
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
28
+
29
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
30
+
31
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
32
+
33
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
34
+
35
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
36
+
37
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
38
+
39
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
40
+
41
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
42
+
43
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
44
+
45
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
46
+
47
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
48
+
49
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
50
+
51
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
52
+
53
+ import * as ff_core_List from "../../ff/core/List.mjs"
54
+
55
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
56
+
57
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
58
+
59
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
60
+
61
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
62
+
63
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
64
+
65
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
66
+
67
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
68
+
69
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
70
+
71
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
72
+
73
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
+
75
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
76
+
77
+ import * as ff_core_Show from "../../ff/core/Show.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
+ // type Path
94
+
95
+
96
+ // type PathEntry
97
+
98
+
99
+
100
+
101
+ export function internalReadStream_(createReadStream_) {
102
+ throw new Error('Function internalReadStream is missing on this target in sync context.');
103
+ }
104
+
105
+ export async function internalReadStream_$(createReadStream_, $task) {
106
+
107
+ let task = null
108
+ let readable = null
109
+ let doResolve = null
110
+ let doReject = null
111
+ let seenError = null
112
+ const abort = () => {
113
+ if(task != null) {
114
+ task.controller.signal.removeEventListener('abort', abort)
115
+ readable.destroy()
116
+ }
117
+ }
118
+ function open($task) {
119
+ ff_core_Task.Task_throwIfAborted($task)
120
+ task = $task
121
+ readable = createReadStream_()
122
+ readable.on('readable', () => {
123
+ if(doResolve != null) doResolve()
124
+ })
125
+ readable.on('error', error => {
126
+ task.controller.signal.removeEventListener('abort', abort)
127
+ seenError = error
128
+ if(doReject != null) doReject(error)
129
+ })
130
+ readable.on('close', () => {
131
+ task.controller.signal.removeEventListener('abort', abort)
132
+ if(doResolve != null) doResolve()
133
+ })
134
+ $task.controller.signal.addEventListener('abort', abort)
135
+ }
136
+ return ff_core_Stream.Stream(async function go($task) {
137
+ if(task == null) open($task)
138
+ let buffer = readable.read()
139
+ if(buffer != null) return ff_core_Option.Some(new DataView(buffer.buffer, buffer.byteOffset, buffer.length))
140
+ if(seenError != null) throw seenError
141
+ if(readable.destroyed) return ff_core_Option.None()
142
+ let promise = new Promise((resolve, reject) => {
143
+ doResolve = () => {doResolve = null; doReject = null; resolve()}
144
+ doReject = error => {doResolve = null; doReject = null; reject(error)}
145
+ }).then(() => go($task))
146
+ return await promise
147
+ }, abort)
148
+
149
+ }
150
+
151
+ export function Path_exists(self_, checkReadable_ = false, checkWritable_ = false, checkExecutable_ = false) {
152
+ throw new Error('Function Path_exists is missing on this target in sync context.');
153
+ }
154
+
155
+ export function Path_isReadable(self_) {
156
+ return ff_core_Path.Path_exists(self_, true, false, false)
157
+ }
158
+
159
+ export function Path_isWritable(self_) {
160
+ return ff_core_Path.Path_exists(self_, false, true, false)
161
+ }
162
+
163
+ export function Path_isExecutable(self_) {
164
+ return ff_core_Path.Path_exists(self_, false, false, true)
165
+ }
166
+
167
+ export function Path_isDirectory(self_) {
168
+ throw new Error('Function Path_isDirectory is missing on this target in sync context.');
169
+ }
170
+
171
+ export function Path_isFile(self_) {
172
+ throw new Error('Function Path_isFile is missing on this target in sync context.');
173
+ }
174
+
175
+ export function Path_isSymbolicLink(self_) {
176
+ throw new Error('Function Path_isSymbolicLink is missing on this target in sync context.');
177
+ }
178
+
179
+ export function Path_isInsideOf(self_, path_) {
180
+ throw new Error('Function Path_isInsideOf is missing on this target in sync context.');
181
+ }
182
+
183
+ export function Path_size(self_) {
184
+ throw new Error('Function Path_size is missing on this target in sync context.');
185
+ }
186
+
187
+ export function Path_modified(self_) {
188
+ throw new Error('Function Path_modified is missing on this target in sync context.');
189
+ }
190
+
191
+ export function Path_entries(self_) {
192
+ throw new Error('Function Path_entries is missing on this target in sync context.');
193
+ }
194
+
195
+ export function Path_absolute(self_) {
196
+ throw new Error('Function Path_absolute is missing on this target in sync context.');
197
+ }
198
+
199
+ export function Path_relativeTo(self_, path_) {
200
+ throw new Error('Function Path_relativeTo is missing on this target in sync context.');
201
+ }
202
+
203
+ export function Path_endsWith(self_, parts_) {
204
+ function go_(pathOption_, reversed_) {
205
+ {
206
+ const pathOption_a = pathOption_;
207
+ const reversed_a = reversed_;
208
+ {
209
+ if(reversed_a.Empty) {
210
+ return true
211
+ return
212
+ }
213
+ }
214
+ {
215
+ if(pathOption_a.Some) {
216
+ const path_ = pathOption_a.value_;
217
+ if(reversed_a.Link) {
218
+ const p_ = reversed_a.head_;
219
+ const ps_ = reversed_a.tail_;
220
+ return ((ff_core_Path.Path_base(path_) === p_) && go_(ff_core_Path.Path_parent(path_), ps_))
221
+ return
222
+ }
223
+ }
224
+ }
225
+ {
226
+ if(pathOption_a.None) {
227
+ return false
228
+ return
229
+ }
230
+ }
231
+ }
232
+ }
233
+ return go_(ff_core_Option.Some(self_), ff_core_List.List_reverse(parts_))
234
+ }
235
+
236
+ export function Path_base(self_) {
237
+ throw new Error('Function Path_base is missing on this target in sync context.');
238
+ }
239
+
240
+ export function Path_extension(self_) {
241
+ throw new Error('Function Path_extension is missing on this target in sync context.');
242
+ }
243
+
244
+ export function Path_url(self_) {
245
+ throw new Error('Function Path_url is missing on this target in sync context.');
246
+ }
247
+
248
+ export function Path_delimiter(self_) {
249
+ throw new Error('Function Path_delimiter is missing on this target in sync context.');
250
+ }
251
+
252
+ export function Path_separator(self_) {
253
+ throw new Error('Function Path_separator is missing on this target in sync context.');
254
+ }
255
+
256
+ export function Path_parent(self_) {
257
+ throw new Error('Function Path_parent is missing on this target in sync context.');
258
+ }
259
+
260
+ export function Path_slash(self_, relativePath_) {
261
+ throw new Error('Function Path_slash is missing on this target in sync context.');
262
+ }
263
+
264
+ export function Path_path(self_, absoluteOrRelativePath_) {
265
+ throw new Error('Function Path_path is missing on this target in sync context.');
266
+ }
267
+
268
+ export function Path_copyTo(self_, path_, retries_ = 0, retryDelay_ = 100) {
269
+ if(ff_core_Path.Path_isDirectory(self_)) {
270
+ if(ff_core_Path.Path_exists(path_, false, false, false)) {
271
+ ff_core_Path.Path_delete(path_, retries_, retryDelay_)
272
+ };
273
+ ff_core_Path.Path_createDirectory(path_, false);
274
+ ff_core_Stream.Stream_each(ff_core_Path.Path_entries(self_), ((file_) => {
275
+ ff_core_Path.Path_copyTo(ff_core_Path.PathEntry_path(file_), ff_core_Path.Path_slash(path_, ff_core_Path.Path_relativeTo(ff_core_Path.PathEntry_path(file_), self_)), retries_, retryDelay_)
276
+ }))
277
+ } else {
278
+ ff_core_Path.Path_writeStream(path_, ff_core_Path.Path_readStream(self_), false)
279
+ }
280
+ }
281
+
282
+ export function Path_createDirectory(self_, createParentDirectories_ = false) {
283
+ throw new Error('Function Path_createDirectory is missing on this target in sync context.');
284
+ }
285
+
286
+ export function Path_createSymlinkTo(self_, path_) {
287
+ throw new Error('Function Path_createSymlinkTo is missing on this target in sync context.');
288
+ }
289
+
290
+ export function Path_delete(self_, retries_ = 0, retryDelay_ = 100) {
291
+ throw new Error('Function Path_delete is missing on this target in sync context.');
292
+ }
293
+
294
+ export function Path_truncate(self_, length_ = 0) {
295
+ throw new Error('Function Path_truncate is missing on this target in sync context.');
296
+ }
297
+
298
+ export function Path_renameTo(self_, path_) {
299
+ throw new Error('Function Path_renameTo is missing on this target in sync context.');
300
+ }
301
+
302
+ export function Path_readText(self_) {
303
+ throw new Error('Function Path_readText is missing on this target in sync context.');
304
+ }
305
+
306
+ export function Path_writeText(self_, text_) {
307
+ throw new Error('Function Path_writeText is missing on this target in sync context.');
308
+ }
309
+
310
+ export function Path_appendText(self_, text_) {
311
+ throw new Error('Function Path_appendText is missing on this target in sync context.');
312
+ }
313
+
314
+ export function Path_readBuffer(self_) {
315
+ return ff_core_Stream.Stream_toBuffer(ff_core_Path.Path_readStream(self_))
316
+ }
317
+
318
+ export function Path_writeBuffer(self_, buffer_) {
319
+ ff_core_Path.Path_writeStream(self_, ff_core_List.List_toStream(ff_core_List.Link(buffer_, ff_core_List.Empty()), false), false)
320
+ }
321
+
322
+ export function Path_appendBuffer(self_, buffer_) {
323
+ ff_core_Path.Path_appendStream(self_, ff_core_List.List_toStream(ff_core_List.Link(buffer_, ff_core_List.Empty()), false))
324
+ }
325
+
326
+ export function Path_readStream(self_) {
327
+ throw new Error('Function Path_readStream is missing on this target in sync context.');
328
+ }
329
+
330
+ export function Path_writeStream(self_, stream_, createOnly_ = false) {
331
+ throw new Error('Function Path_writeStream is missing on this target in sync context.');
332
+ }
333
+
334
+ export function Path_appendStream(self_, stream_) {
335
+ throw new Error('Function Path_appendStream is missing on this target in sync context.');
336
+ }
337
+
338
+ export function Path_readHandle(self_, alsoWrite_ = false) {
339
+ throw new Error('Function Path_readHandle is missing on this target in sync context.');
340
+ }
341
+
342
+ export function Path_writeHandle(self_, alsoRead_ = false, mustCreate_ = false) {
343
+ throw new Error('Function Path_writeHandle is missing on this target in sync context.');
344
+ }
345
+
346
+ export function Path_appendHandle(self_, alsoRead_ = false, mustCreate_ = false) {
347
+ throw new Error('Function Path_appendHandle is missing on this target in sync context.');
348
+ }
349
+
350
+ export async function Path_exists$(self_, checkReadable_ = false, checkWritable_ = false, checkExecutable_ = false, $task) {
351
+
352
+ const fs = import$0
353
+ const fsPromises = import$1
354
+ const flags =
355
+ (fs.constants.R_OK * checkReadable_) |
356
+ (fs.constants.W_OK * checkWritable_) |
357
+ (fs.constants.X_OK * checkExecutable_)
358
+ try {
359
+ await fsPromises.access(self_, flags === 0 ? fs.constants.F_OK : flags)
360
+ return true
361
+ } catch(e) {
362
+ return false
363
+ }
364
+
365
+ }
366
+
367
+ export async function Path_isReadable$(self_, $task) {
368
+ return (await ff_core_Path.Path_exists$(self_, true, false, false, $task))
369
+ }
370
+
371
+ export async function Path_isWritable$(self_, $task) {
372
+ return (await ff_core_Path.Path_exists$(self_, false, true, false, $task))
373
+ }
374
+
375
+ export async function Path_isExecutable$(self_, $task) {
376
+ return (await ff_core_Path.Path_exists$(self_, false, false, true, $task))
377
+ }
378
+
379
+ export async function Path_isDirectory$(self_, $task) {
380
+
381
+ const fsPromises = import$1
382
+ try {
383
+ return (await fsPromises.lstat(self_)).isDirectory();
384
+ } catch(e) {
385
+ return false;
386
+ }
387
+
388
+ }
389
+
390
+ export async function Path_isFile$(self_, $task) {
391
+
392
+ const fsPromises = import$1
393
+ try {
394
+ return (await fsPromises.lstat(self_)).isFile();
395
+ } catch(e) {
396
+ return false;
397
+ }
398
+
399
+ }
400
+
401
+ export async function Path_isSymbolicLink$(self_, $task) {
402
+
403
+ const fsPromises = import$1
404
+ try {
405
+ return (await fsPromises.lstat(self_)).isSymbolicLink();
406
+ } catch(e) {
407
+ return false;
408
+ }
409
+
410
+ }
411
+
412
+ export async function Path_isInsideOf$(self_, path_, $task) {
413
+
414
+ const path = import$2
415
+ if(path_ === '/') return true
416
+ const childPath = path.resolve(self_)
417
+ const parentPath = path.resolve(path_)
418
+ return childPath.startsWith(parentPath + path.sep) || childPath === parentPath
419
+
420
+ }
421
+
422
+ export async function Path_size$(self_, $task) {
423
+
424
+ return (await fs.promises.stat(file)).size
425
+
426
+ }
427
+
428
+ export async function Path_modified$(self_, $task) {
429
+
430
+ return (await fs.promises.stat(file)).mtimeMs * 0.001
431
+
432
+ }
433
+
434
+ export async function Path_entries$(self_, $task) {
435
+
436
+ const fsPromises = import$1
437
+ let dir = null
438
+ return ff_core_Stream.Stream(
439
+ async () => {
440
+ if(dir === null) dir = await fsPromises.opendir(self_, {bufferSize: 128})
441
+ const entry = await dir.read()
442
+ if(entry === null) return ff_core_Option.None()
443
+ entry.ffPath = self_
444
+ return ff_core_Option.Some(entry)
445
+ },
446
+ async () => {
447
+ await dir.close()
448
+ }
449
+ )
450
+
451
+ }
452
+
453
+ export async function Path_absolute$(self_, $task) {
454
+
455
+ const path = import$2
456
+ return path.resolve(self_)
457
+
458
+ }
459
+
460
+ export async function Path_relativeTo$(self_, path_, $task) {
461
+
462
+ const path = import$2;
463
+ return path.relative(path_, self_);
464
+
465
+ }
466
+
467
+ export async function Path_endsWith$(self_, parts_, $task) {
468
+ async function go_$(pathOption_, reversed_, $task) {
469
+ {
470
+ const pathOption_a = pathOption_;
471
+ const reversed_a = reversed_;
472
+ {
473
+ if(reversed_a.Empty) {
474
+ return true
475
+ return
476
+ }
477
+ }
478
+ {
479
+ if(pathOption_a.Some) {
480
+ const path_ = pathOption_a.value_;
481
+ if(reversed_a.Link) {
482
+ const p_ = reversed_a.head_;
483
+ const ps_ = reversed_a.tail_;
484
+ return (((await ff_core_Path.Path_base$(path_, $task)) === p_) && (await go_$((await ff_core_Path.Path_parent$(path_, $task)), ps_, $task)))
485
+ return
486
+ }
487
+ }
488
+ }
489
+ {
490
+ if(pathOption_a.None) {
491
+ return false
492
+ return
493
+ }
494
+ }
495
+ }
496
+ }
497
+ return (await go_$(ff_core_Option.Some(self_), ff_core_List.List_reverse(parts_), $task))
498
+ }
499
+
500
+ export async function Path_base$(self_, $task) {
501
+
502
+ const path = import$2
503
+ return path.basename(self_)
504
+
505
+ }
506
+
507
+ export async function Path_extension$(self_, $task) {
508
+
509
+ const path = import$2
510
+ return path.extname(self_)
511
+
512
+ }
513
+
514
+ export async function Path_url$(self_, $task) {
515
+
516
+ const url = import$3;
517
+ return '' + url.pathToFileURL(self_);
518
+
519
+ }
520
+
521
+ export async function Path_delimiter$(self_, $task) {
522
+
523
+ const path = import$2;
524
+ return path.delimiter(self_);
525
+
526
+ }
527
+
528
+ export async function Path_separator$(self_, $task) {
529
+
530
+ const path = import$2;
531
+ return path.separator();
532
+
533
+ }
534
+
535
+ export async function Path_parent$(self_, $task) {
536
+
537
+ const path = import$2
538
+ const result = path.dirname(self_)
539
+ return result !== "" && result !== self_
540
+ ? ff_core_Option.Some(result)
541
+ : ff_core_Option.None()
542
+
543
+ }
544
+
545
+ export async function Path_slash$(self_, relativePath_, $task) {
546
+
547
+ const path = import$2
548
+ return path.join(self_, relativePath_)
549
+
550
+ }
551
+
552
+ export async function Path_path$(self_, absoluteOrRelativePath_, $task) {
553
+
554
+ const path = import$2
555
+ return path.resolve(self_, absoluteOrRelativePath_)
556
+
557
+ }
558
+
559
+ export async function Path_copyTo$(self_, path_, retries_ = 0, retryDelay_ = 100, $task) {
560
+ if((await ff_core_Path.Path_isDirectory$(self_, $task))) {
561
+ if((await ff_core_Path.Path_exists$(path_, false, false, false, $task))) {
562
+ (await ff_core_Path.Path_delete$(path_, retries_, retryDelay_, $task))
563
+ };
564
+ (await ff_core_Path.Path_createDirectory$(path_, false, $task));
565
+ (await ff_core_Stream.Stream_each$((await ff_core_Path.Path_entries$(self_, $task)), (async (file_, $task) => {
566
+ (await ff_core_Path.Path_copyTo$((await ff_core_Path.PathEntry_path$(file_, $task)), (await ff_core_Path.Path_slash$(path_, (await ff_core_Path.Path_relativeTo$((await ff_core_Path.PathEntry_path$(file_, $task)), self_, $task)), $task)), retries_, retryDelay_, $task))
567
+ }), $task))
568
+ } else {
569
+ (await ff_core_Path.Path_writeStream$(path_, (await ff_core_Path.Path_readStream$(self_, $task)), false, $task))
570
+ }
571
+ }
572
+
573
+ export async function Path_createDirectory$(self_, createParentDirectories_ = false, $task) {
574
+
575
+ const fsPromises = import$1
576
+ await fsPromises.mkdir(self_, {recursive: createParentDirectories_})
577
+
578
+ }
579
+
580
+ export async function Path_createSymlinkTo$(self_, path_, $task) {
581
+
582
+ const fsPromises = import$1
583
+ await fsPromises.symlink(path_, self_)
584
+
585
+ }
586
+
587
+ export async function Path_delete$(self_, retries_ = 0, retryDelay_ = 100, $task) {
588
+
589
+ const fsPromises = import$1
590
+ await fsPromises.rm(self_, {recursive: true, retries: retries_, retryDelay: retryDelay_})
591
+
592
+ }
593
+
594
+ export async function Path_truncate$(self_, length_ = 0, $task) {
595
+
596
+ const fsPromises = import$1
597
+ await fsPromises.truncate(self_, length_)
598
+
599
+ }
600
+
601
+ export async function Path_renameTo$(self_, path_, $task) {
602
+
603
+ const fsPromises = import$1
604
+ await fsPromises.rename(self_, path_)
605
+
606
+ }
607
+
608
+ export async function Path_readText$(self_, $task) {
609
+
610
+ const fsPromises = import$1
611
+ try {
612
+ return await fsPromises.readFile(self_, {encoding: 'UTF-8', signal: $task.controller.signal})
613
+ } finally {
614
+ if($task.controller.signal.aborted) $task.controller = new AbortController()
615
+ }
616
+
617
+ }
618
+
619
+ export async function Path_writeText$(self_, text_, $task) {
620
+
621
+ const fsPromises = import$1
622
+ try {
623
+ await fsPromises.writeFile(self_, text_, {encoding: 'UTF-8', signal: $task.controller.signal})
624
+ } finally {
625
+ if($task.controller.signal.aborted) $task.controller = new AbortController()
626
+ }
627
+
628
+ }
629
+
630
+ export async function Path_appendText$(self_, text_, $task) {
631
+
632
+ const fsPromises = import$1
633
+ try {
634
+ await fsPromises.appendFile(self_, text_, {encoding: 'UTF-8', signal: $task.controller.signal})
635
+ } finally {
636
+ if($task.controller.signal.aborted) $task.controller = new AbortController()
637
+ }
638
+
639
+ }
640
+
641
+ export async function Path_readBuffer$(self_, $task) {
642
+ return (await ff_core_Stream.Stream_toBuffer$((await ff_core_Path.Path_readStream$(self_, $task)), $task))
643
+ }
644
+
645
+ export async function Path_writeBuffer$(self_, buffer_, $task) {
646
+ (await ff_core_Path.Path_writeStream$(self_, (await ff_core_List.List_toStream$(ff_core_List.Link(buffer_, ff_core_List.Empty()), false, $task)), false, $task))
647
+ }
648
+
649
+ export async function Path_appendBuffer$(self_, buffer_, $task) {
650
+ (await ff_core_Path.Path_appendStream$(self_, (await ff_core_List.List_toStream$(ff_core_List.Link(buffer_, ff_core_List.Empty()), false, $task)), $task))
651
+ }
652
+
653
+ export async function Path_readStream$(self_, $task) {
654
+
655
+ const fs = import$0
656
+ return ff_core_Path.internalReadStream_$(() => fs.createReadStream(self_))
657
+
658
+ }
659
+
660
+ export async function Path_writeStream$(self_, stream_, createOnly_ = false, $task) {
661
+
662
+ const fs = import$0
663
+ let writeable = fs.createWriteStream(self_, {flags: createOnly_ ? 'wx' : 'w'})
664
+ try {
665
+ await ff_core_Stream.Stream_each$(stream_, async buffer => {
666
+ if(!writeable.write(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength))) {
667
+ await new Promise((resolve, reject) => {
668
+ $task.controller.signal.addEventListener('abort', reject)
669
+ writeable.once('drain', () => {
670
+ $task.controller.signal.removeEventListener('abort', reject)
671
+ resolve()
672
+ })
673
+ })
674
+ }
675
+ }, $task)
676
+ } finally {
677
+ writeable.close()
678
+ }
679
+
680
+ }
681
+
682
+ export async function Path_appendStream$(self_, stream_, $task) {
683
+
684
+ const fs = import$0
685
+ let writeable = fs.createWriteStream(self_, {flags: 'a'})
686
+ try {
687
+ await ff_core_Stream.Stream_each$(stream_, async buffer => {
688
+ if(!writeable.write(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength))) {
689
+ await new Promise((resolve, reject) => {
690
+ $task.controller.signal.addEventListener('abort', reject)
691
+ writeable.once('drain', () => {
692
+ $task.controller.signal.removeEventListener('abort', reject)
693
+ resolve()
694
+ })
695
+ })
696
+ }
697
+ }, $task)
698
+ } finally {
699
+ writeable.close()
700
+ }
701
+
702
+ }
703
+
704
+ export async function Path_readHandle$(self_, alsoWrite_ = false, $task) {
705
+
706
+ const fsPromises = import$1
707
+ return await fsPromises.open(self_, alsoWrite_ ? 'r+' : 'r')
708
+
709
+ }
710
+
711
+ export async function Path_writeHandle$(self_, alsoRead_ = false, mustCreate_ = false, $task) {
712
+
713
+ const fsPromises = import$1
714
+ return await fsPromises.open(self_, (mustCreate_ ? 'wx' : 'w') + (alsoRead_ ? '+' : ''))
715
+
716
+ }
717
+
718
+ export async function Path_appendHandle$(self_, alsoRead_ = false, mustCreate_ = false, $task) {
719
+
720
+ const fsPromises = import$1
721
+ return await fsPromises.open(self_, (mustCreate_ ? 'wx' : 'w') + (alsoRead_ ? '+' : ''))
722
+
723
+ }
724
+
725
+ export function PathEntry_path(self_) {
726
+ throw new Error('Function PathEntry_path is missing on this target in sync context.');
727
+ }
728
+
729
+ export function PathEntry_isDirectory(self_) {
730
+ throw new Error('Function PathEntry_isDirectory is missing on this target in sync context.');
731
+ }
732
+
733
+ export function PathEntry_isFile(self_) {
734
+ throw new Error('Function PathEntry_isFile is missing on this target in sync context.');
735
+ }
736
+
737
+ export function PathEntry_isSymbolicLink(self_) {
738
+ throw new Error('Function PathEntry_isSymbolicLink is missing on this target in sync context.');
739
+ }
740
+
741
+ export async function PathEntry_path$(self_, $task) {
742
+
743
+ const path = import$2
744
+ return path.join(self_.ffPath, self_.name)
745
+
746
+ }
747
+
748
+ export async function PathEntry_isDirectory$(self_, $task) {
749
+
750
+ return self_.isDirectory()
751
+
752
+ }
753
+
754
+ export async function PathEntry_isFile$(self_, $task) {
755
+
756
+ return self_.isFile()
757
+
758
+ }
759
+
760
+ export async function PathEntry_isSymbolicLink$(self_, $task) {
761
+
762
+ return self_.isSymbolicLink()
763
+
764
+ }
765
+
766
+
767
+
768
+