firefly-compiler 0.5.35 → 0.5.37

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 (225) hide show
  1. package/.hintrc +4 -4
  2. package/.vscode/settings.json +4 -4
  3. package/bin/Release.ff +157 -154
  4. package/bin/firefly.mjs +1 -1
  5. package/compiler/Builder.ff +275 -277
  6. package/compiler/Compiler.ff +234 -233
  7. package/compiler/Dependencies.ff +186 -187
  8. package/compiler/DependencyLock.ff +17 -17
  9. package/compiler/Deriver.ff +23 -31
  10. package/compiler/Dictionaries.ff +1 -1
  11. package/compiler/Inference.ff +43 -20
  12. package/compiler/JsEmitter.ff +1437 -1282
  13. package/compiler/LspHook.ff +202 -202
  14. package/compiler/Main.ff +25 -24
  15. package/compiler/ModuleCache.ff +178 -178
  16. package/compiler/Parser.ff +36 -109
  17. package/compiler/Resolver.ff +5 -8
  18. package/compiler/Substitution.ff +1 -1
  19. package/compiler/Syntax.ff +1 -16
  20. package/compiler/Token.ff +9 -0
  21. package/compiler/Tokenizer.ff +4 -0
  22. package/compiler/Workspace.ff +88 -88
  23. package/core/.firefly/include/package.json +5 -5
  24. package/core/.firefly/package.ff +2 -2
  25. package/core/Any.ff +26 -30
  26. package/core/Array.ff +298 -265
  27. package/core/Atomic.ff +63 -64
  28. package/core/Box.ff +7 -7
  29. package/core/BrowserSystem.ff +40 -40
  30. package/core/Buffer.ff +185 -152
  31. package/core/BuildSystem.ff +156 -148
  32. package/core/Channel.ff +95 -92
  33. package/core/Char.ff +3 -2
  34. package/core/Core.ff +16 -23
  35. package/core/Crypto.ff +94 -96
  36. package/core/Equal.ff +41 -36
  37. package/core/Error.ff +15 -10
  38. package/core/FileHandle.ff +45 -37
  39. package/core/Float.ff +176 -200
  40. package/core/HttpClient.ff +142 -148
  41. package/core/Instant.ff +6 -8
  42. package/core/Int.ff +40 -24
  43. package/core/IntMap.ff +61 -39
  44. package/core/Js.ff +305 -0
  45. package/core/JsSystem.ff +135 -114
  46. package/core/JsValue.ff +303 -159
  47. package/core/Json.ff +423 -443
  48. package/core/List.ff +482 -486
  49. package/core/Lock.ff +108 -144
  50. package/core/Log.ff +25 -14
  51. package/core/NodeSystem.ff +198 -191
  52. package/core/Ordering.ff +160 -161
  53. package/core/Path.ff +377 -409
  54. package/core/Queue.ff +90 -0
  55. package/core/Random.ff +140 -134
  56. package/core/RbMap.ff +216 -216
  57. package/core/Serializable.ff +16 -13
  58. package/core/Show.ff +44 -43
  59. package/core/SourceLocation.ff +68 -68
  60. package/core/Stream.ff +1 -1
  61. package/core/String.ff +224 -202
  62. package/core/StringMap.ff +58 -36
  63. package/core/Task.ff +165 -149
  64. package/experimental/benchmarks/ListGrab.ff +23 -23
  65. package/experimental/benchmarks/ListGrab.java +55 -55
  66. package/experimental/benchmarks/Pyrotek45.ff +30 -30
  67. package/experimental/benchmarks/Pyrotek45.java +64 -64
  68. package/experimental/bidirectional/Bidi.ff +88 -88
  69. package/experimental/lines/Main.ff +40 -0
  70. package/experimental/random/Index.ff +53 -53
  71. package/experimental/random/Process.ff +120 -120
  72. package/experimental/random/RunLength.ff +65 -65
  73. package/experimental/random/Scrape.ff +51 -51
  74. package/experimental/random/Symbols.ff +73 -73
  75. package/experimental/random/Tensor.ff +52 -52
  76. package/experimental/random/Units.ff +36 -36
  77. package/experimental/s3/S3TestAuthorizationHeader.ff +39 -39
  78. package/experimental/s3/S3TestPut.ff +16 -16
  79. package/experimental/tests/TestJson.ff +26 -26
  80. package/firefly.sh +0 -0
  81. package/fireflysite/.firefly/package.ff +4 -4
  82. package/fireflysite/CommunityOverview.ff +20 -20
  83. package/fireflysite/CountingButtonDemo.ff +58 -58
  84. package/fireflysite/DocumentParser.ff +325 -331
  85. package/fireflysite/ExamplesOverview.ff +40 -40
  86. package/fireflysite/FrontPage.ff +344 -344
  87. package/fireflysite/GettingStarted.ff +45 -45
  88. package/fireflysite/Guide.ff +456 -456
  89. package/fireflysite/Main.ff +163 -152
  90. package/fireflysite/MatchingPasswordsDemo.ff +82 -82
  91. package/fireflysite/PackagesOverview.ff +49 -49
  92. package/fireflysite/PostgresqlDemo.ff +34 -34
  93. package/fireflysite/ReferenceAll.ff +18 -18
  94. package/fireflysite/ReferenceIntroduction.ff +11 -11
  95. package/fireflysite/Styles.ff +567 -567
  96. package/fireflysite/Test.ff +121 -62
  97. package/fireflysite/assets/markdown/reference/BaseTypes.md +209 -209
  98. package/fireflysite/assets/markdown/reference/EmittedJavascript.md +65 -65
  99. package/fireflysite/assets/markdown/reference/Exceptions.md +101 -101
  100. package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +364 -364
  101. package/fireflysite/assets/markdown/reference/JavascriptInterop.md +235 -172
  102. package/fireflysite/assets/markdown/reference/ModulesAndPackages.md +162 -162
  103. package/fireflysite/assets/markdown/reference/OldStructuredConcurrency.md +48 -48
  104. package/fireflysite/assets/markdown/reference/PatternMatching.md +224 -224
  105. package/fireflysite/assets/markdown/reference/StatementsAndExpressions.md +86 -86
  106. package/fireflysite/assets/markdown/reference/StructuredConcurrency.md +99 -99
  107. package/fireflysite/assets/markdown/reference/TraitsAndInstances.md +100 -100
  108. package/fireflysite/assets/markdown/reference/UserDefinedTypes.md +184 -184
  109. package/fireflysite/assets/markdown/scratch/ControlFlow.md +136 -136
  110. package/fireflysite/assets/markdown/scratch/Toc.md +40 -40
  111. package/lsp/.firefly/package.ff +1 -1
  112. package/lsp/CompletionHandler.ff +827 -827
  113. package/lsp/Handler.ff +714 -714
  114. package/lsp/HoverHandler.ff +79 -79
  115. package/lsp/LanguageServer.ff +272 -272
  116. package/lsp/SignatureHelpHandler.ff +55 -55
  117. package/lsp/SymbolHandler.ff +181 -181
  118. package/lsp/TestReferences.ff +17 -17
  119. package/lsp/TestReferencesCase.ff +7 -7
  120. package/lsp/stderr.txt +1 -1
  121. package/lsp/stdout.txt +34 -34
  122. package/lux/.firefly/package.ff +1 -1
  123. package/lux/Css.ff +648 -648
  124. package/lux/CssTest.ff +48 -48
  125. package/lux/Lux.ff +608 -617
  126. package/lux/LuxEvent.ff +79 -116
  127. package/lux/Main.ff +123 -123
  128. package/lux/Main2.ff +143 -143
  129. package/lux/TestDry.ff +28 -28
  130. package/output/js/ff/compiler/Builder.mjs +72 -71
  131. package/output/js/ff/compiler/Compiler.mjs +19 -13
  132. package/output/js/ff/compiler/Dependencies.mjs +8 -7
  133. package/output/js/ff/compiler/DependencyLock.mjs +6 -4
  134. package/output/js/ff/compiler/Deriver.mjs +26 -24
  135. package/output/js/ff/compiler/Dictionaries.mjs +14 -18
  136. package/output/js/ff/compiler/Environment.mjs +6 -4
  137. package/output/js/ff/compiler/Inference.mjs +238 -164
  138. package/output/js/ff/compiler/JsEmitter.mjs +1160 -350
  139. package/output/js/ff/compiler/JsImporter.mjs +20 -18
  140. package/output/js/ff/compiler/LspHook.mjs +12 -10
  141. package/output/js/ff/compiler/Main.mjs +61 -41
  142. package/output/js/ff/compiler/ModuleCache.mjs +10 -8
  143. package/output/js/ff/compiler/Parser.mjs +153 -669
  144. package/output/js/ff/compiler/Patterns.mjs +12 -10
  145. package/output/js/ff/compiler/Resolver.mjs +52 -78
  146. package/output/js/ff/compiler/Substitution.mjs +12 -16
  147. package/output/js/ff/compiler/Syntax.mjs +50 -341
  148. package/output/js/ff/compiler/Token.mjs +126 -4
  149. package/output/js/ff/compiler/Tokenizer.mjs +62 -52
  150. package/output/js/ff/compiler/Unification.mjs +74 -90
  151. package/output/js/ff/compiler/Wildcards.mjs +4 -2
  152. package/output/js/ff/compiler/Workspace.mjs +26 -20
  153. package/output/js/ff/core/Any.mjs +20 -20
  154. package/output/js/ff/core/Array.mjs +268 -175
  155. package/output/js/ff/core/AssetSystem.mjs +8 -6
  156. package/output/js/ff/core/Atomic.mjs +84 -52
  157. package/output/js/ff/core/Bool.mjs +6 -4
  158. package/output/js/ff/core/BrowserSystem.mjs +38 -29
  159. package/output/js/ff/core/Buffer.mjs +285 -133
  160. package/output/js/ff/core/BuildSystem.mjs +36 -56
  161. package/output/js/ff/core/Channel.mjs +250 -97
  162. package/output/js/ff/core/Char.mjs +5 -3
  163. package/output/js/ff/core/Core.mjs +28 -34
  164. package/output/js/ff/core/Crypto.mjs +30 -52
  165. package/output/js/ff/core/Duration.mjs +4 -2
  166. package/output/js/ff/core/Equal.mjs +14 -12
  167. package/output/js/ff/core/Error.mjs +17 -11
  168. package/output/js/ff/core/FileHandle.mjs +76 -38
  169. package/output/js/ff/core/Float.mjs +92 -160
  170. package/output/js/ff/core/HttpClient.mjs +208 -76
  171. package/output/js/ff/core/Instant.mjs +8 -10
  172. package/output/js/ff/core/Int.mjs +36 -26
  173. package/output/js/ff/core/IntMap.mjs +79 -33
  174. package/output/js/ff/core/Js.mjs +751 -0
  175. package/output/js/ff/core/JsSystem.mjs +54 -60
  176. package/output/js/ff/core/JsValue.mjs +294 -143
  177. package/output/js/ff/core/Json.mjs +443 -253
  178. package/output/js/ff/core/List.mjs +262 -214
  179. package/output/js/ff/core/Lock.mjs +156 -125
  180. package/output/js/ff/core/Log.mjs +20 -10
  181. package/output/js/ff/core/Map.mjs +10 -8
  182. package/output/js/ff/core/NodeSystem.mjs +189 -123
  183. package/output/js/ff/core/Nothing.mjs +4 -2
  184. package/output/js/ff/core/Option.mjs +40 -38
  185. package/output/js/ff/core/Ordering.mjs +26 -20
  186. package/output/js/ff/core/Pair.mjs +4 -2
  187. package/output/js/ff/core/Path.mjs +517 -315
  188. package/output/js/ff/core/Queue.mjs +306 -0
  189. package/output/js/ff/core/Random.mjs +141 -77
  190. package/output/js/ff/core/RbMap.mjs +36 -34
  191. package/output/js/ff/core/Serializable.mjs +44 -28
  192. package/output/js/ff/core/Set.mjs +6 -4
  193. package/output/js/ff/core/Show.mjs +8 -6
  194. package/output/js/ff/core/SourceLocation.mjs +4 -2
  195. package/output/js/ff/core/Stream.mjs +30 -50
  196. package/output/js/ff/core/String.mjs +263 -172
  197. package/output/js/ff/core/StringMap.mjs +77 -31
  198. package/output/js/ff/core/Task.mjs +91 -76
  199. package/output/js/ff/core/Try.mjs +20 -18
  200. package/output/js/ff/core/Unit.mjs +4 -2
  201. package/package.json +1 -1
  202. package/postgresql/Pg.ff +53 -59
  203. package/rpc/.firefly/package.ff +1 -1
  204. package/rpc/Rpc.ff +70 -70
  205. package/s3/.firefly/package.ff +1 -1
  206. package/s3/S3.ff +92 -94
  207. package/vscode/LICENSE.txt +21 -21
  208. package/vscode/Prepublish.ff +15 -15
  209. package/vscode/README.md +16 -16
  210. package/vscode/client/package-lock.json +544 -544
  211. package/vscode/client/package.json +22 -22
  212. package/vscode/client/src/extension.ts +104 -104
  213. package/vscode/icons/firefly-icon.svg +10 -10
  214. package/vscode/language-configuration.json +61 -61
  215. package/vscode/package-lock.json +3623 -3623
  216. package/vscode/package.json +1 -1
  217. package/vscode/snippets.json +241 -241
  218. package/vscode/syntaxes/firefly-markdown-injection.json +45 -45
  219. package/webserver/.firefly/include/package.json +5 -5
  220. package/webserver/.firefly/package.ff +2 -2
  221. package/webserver/WebServer.ff +647 -685
  222. package/websocket/.firefly/package.ff +1 -1
  223. package/websocket/WebSocket.ff +100 -131
  224. package/core/UnsafeJs.ff +0 -42
  225. package/output/js/ff/core/UnsafeJs.mjs +0 -191
@@ -48,6 +48,8 @@ import * as ff_core_Int from "../../ff/core/Int.mjs"
48
48
 
49
49
  import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
50
50
 
51
+ import * as ff_core_Js from "../../ff/core/Js.mjs"
52
+
51
53
  import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
52
54
 
53
55
  import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
@@ -74,6 +76,8 @@ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
74
76
 
75
77
  import * as ff_core_Path from "../../ff/core/Path.mjs"
76
78
 
79
+ import * as ff_core_Queue from "../../ff/core/Queue.mjs"
80
+
77
81
  import * as ff_core_Random from "../../ff/core/Random.mjs"
78
82
 
79
83
  import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
@@ -96,10 +100,10 @@ import * as ff_core_Try from "../../ff/core/Try.mjs"
96
100
 
97
101
  import * as ff_core_Unit from "../../ff/core/Unit.mjs"
98
102
 
99
- import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
100
-
101
103
  // type Path
102
-
104
+ export function Path(absolutePath_) {
105
+ return {absolutePath_};
106
+ }
103
107
 
104
108
  // type PathEntry
105
109
 
@@ -107,57 +111,252 @@ import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
107
111
 
108
112
 
109
113
  export function internalReadStream_(createReadStream_) {
110
- throw new Error('Function internalReadStream is missing on this target in sync context.');
114
+ let readable_ = ff_core_Option.None();
115
+ let seenError_ = null;
116
+ const emptyResolve_ = (() => {
117
+
118
+ });
119
+ const emptyReject_ = ((_) => {
120
+
121
+ });
122
+ let doResolve_ = emptyResolve_;
123
+ let doReject_ = emptyReject_;
124
+ const open_ = (() => {
125
+ const newReadable_ = createReadStream_();
126
+ newReadable_.on("readable", (() => {
127
+ return doResolve_()
128
+ }));
129
+ newReadable_.on("error", ((error_) => {
130
+ seenError_ = error_;
131
+ return doReject_(error_)
132
+ }));
133
+ newReadable_.on("close", (() => {
134
+ return doResolve_()
135
+ }));
136
+ readable_ = ff_core_Option.Some(newReadable_);
137
+ return newReadable_
138
+ });
139
+ return ff_core_Stream.Stream((() => {
140
+ ;
141
+ const jsStream_ = ff_core_Option.Option_else(readable_, open_);
142
+ function go_() {
143
+ _tailcall: for(;;) {
144
+ const jsBuffer_ = jsStream_.read();
145
+ if((!ff_core_JsValue.JsValue_isNullOrUndefined(jsBuffer_))) {
146
+ const buffer_ = (new DataView(jsBuffer_.buffer, jsBuffer_.byteOffset, jsBuffer_.length));
147
+ return ff_core_Option.Some(buffer_)
148
+ } else {
149
+ if((!ff_core_JsValue.JsValue_isNullOrUndefined(seenError_))) {
150
+ return ff_core_Core.throwAny_(seenError_)
151
+ } else {
152
+ if(jsStream_.destroyed) {
153
+ return ff_core_Option.None()
154
+ } else {
155
+ ff_core_Js.withSignal_(((signal_) => {
156
+ const promise_ = (new Promise(((resolve_, reject_) => {
157
+ const jsDoReject_ = ((_w1) => {
158
+ return doReject_(_w1)
159
+ });
160
+ doResolve_ = (() => {
161
+ signal_.removeEventListener("abort", jsDoReject_);
162
+ doResolve_ = emptyResolve_;
163
+ doReject_ = emptyReject_;
164
+ resolve_()
165
+ });
166
+ doReject_ = ((error_) => {
167
+ signal_.removeEventListener("abort", jsDoReject_);
168
+ doResolve_ = emptyResolve_;
169
+ doReject_ = emptyReject_;
170
+ reject_(error_)
171
+ });
172
+ return signal_.addEventListener("abort", jsDoReject_)
173
+ })));
174
+ return promise_
175
+ }));
176
+ {
177
+
178
+
179
+ continue _tailcall
180
+ }
181
+ }
182
+ }
183
+ }
184
+ return
185
+ }
186
+ }
187
+ return go_()
188
+ }), (() => {
189
+ {
190
+ const if_o = readable_
191
+ if(if_o.Some) {
192
+ const _w1 = if_o.value_;
193
+ _w1.destroy()
194
+ }
195
+ }
196
+ }))
197
+ }
198
+
199
+ export function internalWriteStream_(path_, stream_, flags_) {
200
+ const fs_ = import$0;
201
+ const writable_ = fs_.createWriteStream(path_.absolutePath_, {flags: flags_});
202
+ try {
203
+ ff_core_Stream.Stream_each(stream_, ((buffer_) => {
204
+ if((!writable_.write((new Uint8Array(buffer_.buffer, buffer_.byteOffset, buffer_.byteLength))))) {
205
+ ff_core_Js.withSignal_(((signal_) => {
206
+ return (new Promise(((resolve_, reject_) => {
207
+ signal_.addEventListener("abort", reject_);
208
+ return writable_.once("drain", (() => {
209
+ signal_.removeEventListener("abort", reject_);
210
+ return resolve_()
211
+ }))
212
+ })))
213
+ }))
214
+ }
215
+ }))
216
+ } finally {
217
+ (new Promise(((resolve_, reject_) => {
218
+ return writable_.close(((err_) => {
219
+ if(err_) {
220
+ return reject_(err_)
221
+ } else {
222
+ return resolve_()
223
+ }
224
+ }))
225
+ })))
226
+ }
111
227
  }
112
228
 
113
229
  export async function internalReadStream_$(createReadStream_, $task) {
114
-
115
- let task = null
116
- let readable = null
117
- let doResolve = null
118
- let doReject = null
119
- let seenError = null
120
- const abort = () => {
121
- if(task != null) {
122
- task.controller.signal.removeEventListener('abort', abort)
123
- readable.destroy()
124
- }
125
- }
126
- function open($task) {
127
- ff_core_Task.Task_throwIfAborted($task)
128
- task = $task
129
- readable = createReadStream_()
130
- readable.on('readable', () => {
131
- if(doResolve != null) doResolve()
132
- })
133
- readable.on('error', error => {
134
- task.controller.signal.removeEventListener('abort', abort)
135
- seenError = error
136
- if(doReject != null) doReject(error)
137
- })
138
- readable.on('close', () => {
139
- task.controller.signal.removeEventListener('abort', abort)
140
- if(doResolve != null) doResolve()
141
- })
142
- $task.controller.signal.addEventListener('abort', abort)
143
- }
144
- return ff_core_Stream.Stream(async function go($task) {
145
- if(task == null) open($task)
146
- let buffer = readable.read()
147
- if(buffer != null) return ff_core_Option.Some(new DataView(buffer.buffer, buffer.byteOffset, buffer.length))
148
- if(seenError != null) throw seenError
149
- if(readable.destroyed) return ff_core_Option.None()
150
- let promise = new Promise((resolve, reject) => {
151
- doResolve = () => {doResolve = null; doReject = null; resolve()}
152
- doReject = error => {doResolve = null; doReject = null; reject(error)}
153
- }).then(() => go($task))
154
- return await promise
155
- }, abort)
156
-
230
+ let readable_ = ff_core_Option.None();
231
+ let seenError_ = null;
232
+ const emptyResolve_ = (() => {
233
+
234
+ });
235
+ const emptyReject_ = ((_) => {
236
+
237
+ });
238
+ let doResolve_ = emptyResolve_;
239
+ let doReject_ = emptyReject_;
240
+ const open_ = (async ($task) => {
241
+ const newReadable_ = (await createReadStream_($task));
242
+ newReadable_.on("readable", (() => {
243
+ return doResolve_()
244
+ }));
245
+ newReadable_.on("error", ((error_) => {
246
+ seenError_ = error_;
247
+ return doReject_(error_)
248
+ }));
249
+ newReadable_.on("close", (() => {
250
+ return doResolve_()
251
+ }));
252
+ readable_ = ff_core_Option.Some(newReadable_);
253
+ return newReadable_
254
+ });
255
+ return ff_core_Stream.Stream((async ($task) => {
256
+ ff_core_Task.Task_throwIfAborted($task);
257
+ const jsStream_ = (await ff_core_Option.Option_else$(readable_, open_, $task));
258
+ async function go_$($task) {
259
+ _tailcall: for(;;) {
260
+ const jsBuffer_ = jsStream_.read();
261
+ if((!ff_core_JsValue.JsValue_isNullOrUndefined(jsBuffer_))) {
262
+ const buffer_ = (new DataView(jsBuffer_.buffer, jsBuffer_.byteOffset, jsBuffer_.length));
263
+ return ff_core_Option.Some(buffer_)
264
+ } else {
265
+ if((!ff_core_JsValue.JsValue_isNullOrUndefined(seenError_))) {
266
+ return ff_core_Core.throwAny_(seenError_)
267
+ } else {
268
+ if(jsStream_.destroyed) {
269
+ return ff_core_Option.None()
270
+ } else {
271
+ (await ff_core_Js.withSignal_$((async (signal_, $task) => {
272
+ const promise_ = (new Promise(((resolve_, reject_) => {
273
+ const jsDoReject_ = ((_w1) => {
274
+ return doReject_(_w1)
275
+ });
276
+ doResolve_ = (() => {
277
+ signal_.removeEventListener("abort", jsDoReject_);
278
+ doResolve_ = emptyResolve_;
279
+ doReject_ = emptyReject_;
280
+ resolve_()
281
+ });
282
+ doReject_ = ((error_) => {
283
+ signal_.removeEventListener("abort", jsDoReject_);
284
+ doResolve_ = emptyResolve_;
285
+ doReject_ = emptyReject_;
286
+ reject_(error_)
287
+ });
288
+ return signal_.addEventListener("abort", jsDoReject_)
289
+ })));
290
+ return (await promise_)
291
+ }), $task));
292
+ {
293
+
294
+
295
+ continue _tailcall
296
+ }
297
+ }
298
+ }
299
+ }
300
+ return
301
+ }
302
+ }
303
+ return (await go_$($task))
304
+ }), (async ($task) => {
305
+ {
306
+ const if_o = readable_
307
+ if(if_o.Some) {
308
+ const _w1 = if_o.value_;
309
+ _w1.destroy()
310
+ }
311
+ }
312
+ }))
313
+ }
314
+
315
+ export async function internalWriteStream_$(path_, stream_, flags_, $task) {
316
+ const fs_ = import$0;
317
+ const writable_ = fs_.createWriteStream(path_.absolutePath_, {flags: flags_});
318
+ try {
319
+ (await ff_core_Stream.Stream_each$(stream_, (async (buffer_, $task) => {
320
+ if((!writable_.write((new Uint8Array(buffer_.buffer, buffer_.byteOffset, buffer_.byteLength))))) {
321
+ (await ff_core_Js.withSignal_$((async (signal_, $task) => {
322
+ return (await (new Promise(((resolve_, reject_) => {
323
+ signal_.addEventListener("abort", reject_);
324
+ return writable_.once("drain", (() => {
325
+ signal_.removeEventListener("abort", reject_);
326
+ return resolve_()
327
+ }))
328
+ }))))
329
+ }), $task))
330
+ }
331
+ }), $task))
332
+ } finally {
333
+ (await (new Promise(((resolve_, reject_) => {
334
+ return writable_.close(((err_) => {
335
+ if(err_) {
336
+ return reject_(err_)
337
+ } else {
338
+ return resolve_()
339
+ }
340
+ }))
341
+ }))))
342
+ }
157
343
  }
158
344
 
159
345
  export function Path_exists(self_, checkReadable_ = false, checkWritable_ = false, checkExecutable_ = false) {
160
- throw new Error('Function Path_exists is missing on this target in sync context.');
346
+ const fs_ = import$0;
347
+ const fsPromises_ = import$1;
348
+ const flagsR_ = (fs_.constants["R_OK"] * checkReadable_);
349
+ const flagsW_ = (fs_.constants["W_OK"] * checkWritable_);
350
+ const flagsX_ = (fs_.constants["X_OK"] * checkExecutable_);
351
+ const flags_ = ff_core_Int.Int_bitOr(flagsR_, ff_core_Int.Int_bitOr(flagsW_, flagsX_));
352
+ try {
353
+ fsPromises_.access(self_.absolutePath_, ((flags_ === 0)
354
+ ? fs_.constants["F_OK"]
355
+ : flags_));
356
+ return true
357
+ } catch {
358
+ return false
359
+ }
161
360
  }
162
361
 
163
362
  export function Path_isReadable(self_) {
@@ -173,39 +372,81 @@ return ff_core_Path.Path_exists(self_, false, false, true)
173
372
  }
174
373
 
175
374
  export function Path_isDirectory(self_) {
176
- throw new Error('Function Path_isDirectory is missing on this target in sync context.');
375
+ const fsPromises_ = import$1;
376
+ try {
377
+ return fsPromises_.lstat(self_.absolutePath_).isDirectory()
378
+ } catch {
379
+ return false
380
+ }
177
381
  }
178
382
 
179
383
  export function Path_isFile(self_) {
180
- throw new Error('Function Path_isFile is missing on this target in sync context.');
384
+ const fsPromises_ = import$1;
385
+ try {
386
+ return fsPromises_.lstat(self_.absolutePath_).isFile()
387
+ } catch {
388
+ return false
389
+ }
181
390
  }
182
391
 
183
392
  export function Path_isSymbolicLink(self_) {
184
- throw new Error('Function Path_isSymbolicLink is missing on this target in sync context.');
393
+ const fsPromises_ = import$1;
394
+ try {
395
+ return fsPromises_.lstat(self_.absolutePath_).isSymbolicLink()
396
+ } catch {
397
+ return false
398
+ }
185
399
  }
186
400
 
187
401
  export function Path_isInsideOf(self_, path_) {
188
- throw new Error('Function Path_isInsideOf is missing on this target in sync context.');
402
+ const nodePath_ = import$2;
403
+ if((path_.absolutePath_ === "/")) {
404
+ return true
405
+ } else {
406
+ const childPath_ = self_.absolutePath_;
407
+ const parentPath_ = path_.absolutePath_;
408
+ return (ff_core_String.String_startsWith(childPath_, (parentPath_ + nodePath_.sep), 0) || (childPath_ === parentPath_))
409
+ }
189
410
  }
190
411
 
191
412
  export function Path_size(self_) {
192
- throw new Error('Function Path_size is missing on this target in sync context.');
413
+ const fs_ = import$0;
414
+ return fs_.promises.stat(self_.absolutePath_)
193
415
  }
194
416
 
195
417
  export function Path_modified(self_) {
196
- throw new Error('Function Path_modified is missing on this target in sync context.');
418
+ const fs_ = import$0;
419
+ return (fs_.promises.stat(self_.absolutePath_).mtimeMs * 0.001)
197
420
  }
198
421
 
199
422
  export function Path_entries(self_) {
200
- throw new Error('Function Path_entries is missing on this target in sync context.');
423
+ const fsPromises_ = import$1;
424
+ let dir_ = null;
425
+ return ff_core_Stream.Stream((() => {
426
+ if(ff_core_JsValue.JsValue_isNull(dir_)) {
427
+ dir_ = fsPromises_.opendir(self_.absolutePath_, {bufferSize: 128})
428
+ };
429
+ const entry_ = dir_.read();
430
+ if((!ff_core_JsValue.JsValue_isNull(entry_))) {
431
+ return ff_core_Option.Some((function() {
432
+ entry_.ffPath = self_.absolutePath_;
433
+ return entry_
434
+ })())
435
+ } else return ff_core_Option.None()
436
+ }), (() => {
437
+ if((!ff_core_JsValue.JsValue_isNull(dir_))) {
438
+ dir_.close()
439
+ }
440
+ }))
201
441
  }
202
442
 
203
443
  export function Path_absolute(self_) {
204
- throw new Error('Function Path_absolute is missing on this target in sync context.');
444
+ return self_.absolutePath_
205
445
  }
206
446
 
207
447
  export function Path_relativeTo(self_, path_) {
208
- throw new Error('Function Path_relativeTo is missing on this target in sync context.');
448
+ const nodePath_ = import$2;
449
+ return nodePath_.relative(path_.absolutePath_, self_.absolutePath_)
209
450
  }
210
451
 
211
452
  export function Path_endsWith(self_, parts_) {
@@ -221,7 +462,7 @@ const p_ = reversed_a[0];
221
462
  const ps_ = reversed_a.slice(1);
222
463
  return ((ff_core_Path.Path_base(path_) === p_) && go_(ff_core_Path.Path_parent(path_), ps_))
223
464
  }
224
- if(pathOption_a.None) {
465
+ {
225
466
  return false
226
467
  }
227
468
  }
@@ -235,35 +476,46 @@ return ff_core_Path.Path_contains(_w1, parts_)
235
476
  }
236
477
 
237
478
  export function Path_base(self_) {
238
- throw new Error('Function Path_base is missing on this target in sync context.');
479
+ const path_ = import$2;
480
+ return path_.basename(self_.absolutePath_)
239
481
  }
240
482
 
241
483
  export function Path_extension(self_) {
242
- throw new Error('Function Path_extension is missing on this target in sync context.');
484
+ const path_ = import$2;
485
+ return path_.extname(self_.absolutePath_)
243
486
  }
244
487
 
245
488
  export function Path_url(self_) {
246
- throw new Error('Function Path_url is missing on this target in sync context.');
489
+ const url_ = import$3;
490
+ return ("" + url_.pathToFileURL(self_.absolutePath_))
247
491
  }
248
492
 
249
493
  export function Path_delimiter(self_) {
250
- throw new Error('Function Path_delimiter is missing on this target in sync context.');
494
+ const path_ = import$2;
495
+ return path_.delimiter(self_.absolutePath_)
251
496
  }
252
497
 
253
498
  export function Path_separator(self_) {
254
- throw new Error('Function Path_separator is missing on this target in sync context.');
499
+ const path_ = import$2;
500
+ return path_.separator(self_.absolutePath_)
255
501
  }
256
502
 
257
503
  export function Path_parent(self_) {
258
- throw new Error('Function Path_parent is missing on this target in sync context.');
504
+ const path_ = import$2;
505
+ const result_ = path_.dirname(self_.absolutePath_);
506
+ if(((result_ !== "") && (result_ !== self_.absolutePath_))) {
507
+ return ff_core_Option.Some(ff_core_Path.Path(result_))
508
+ } else return ff_core_Option.None()
259
509
  }
260
510
 
261
511
  export function Path_slash(self_, relativePath_) {
262
- throw new Error('Function Path_slash is missing on this target in sync context.');
512
+ const path_ = import$2;
513
+ return ff_core_Path.Path(path_.join(self_.absolutePath_, relativePath_))
263
514
  }
264
515
 
265
516
  export function Path_path(self_, absoluteOrRelativePath_) {
266
- throw new Error('Function Path_path is missing on this target in sync context.');
517
+ const path_ = import$2;
518
+ return ff_core_Path.Path(path_.resolve(self_.absolutePath_, absoluteOrRelativePath_))
267
519
  }
268
520
 
269
521
  export function Path_copyTo(self_, path_, retries_ = 0, retryDelay_ = 100) {
@@ -283,39 +535,56 @@ ff_core_Path.Path_writeStream(path_, ff_core_Path.Path_readStream(self_), false)
283
535
  }
284
536
 
285
537
  export function Path_createDirectory(self_, createParentDirectories_ = false) {
286
- throw new Error('Function Path_createDirectory is missing on this target in sync context.');
538
+ const fsPromises_ = import$1;
539
+ fsPromises_.mkdir(self_.absolutePath_, {recursive: createParentDirectories_})
287
540
  }
288
541
 
289
542
  export function Path_createSymlinkTo(self_, path_, junction_ = false) {
290
- throw new Error('Function Path_createSymlinkTo is missing on this target in sync context.');
543
+ const fsPromises_ = import$1;
544
+ fsPromises_.symlink(path_.absolutePath_, self_.absolutePath_, (junction_
545
+ ? "junction"
546
+ : null))
291
547
  }
292
548
 
293
549
  export function Path_delete(self_, retries_ = 0, retryDelay_ = 100) {
294
- throw new Error('Function Path_delete is missing on this target in sync context.');
550
+ const fsPromises_ = import$1;
551
+ fsPromises_.rm(self_.absolutePath_, {recursive: true, retries: retries_, retryDelay: retryDelay_})
295
552
  }
296
553
 
297
554
  export function Path_truncate(self_, length_ = 0) {
298
- throw new Error('Function Path_truncate is missing on this target in sync context.');
555
+ const fsPromises_ = import$1;
556
+ fsPromises_.truncate(self_.absolutePath_, length_)
299
557
  }
300
558
 
301
559
  export function Path_renameTo(self_, path_) {
302
- throw new Error('Function Path_renameTo is missing on this target in sync context.');
560
+ const fsPromises_ = import$1;
561
+ fsPromises_.rename(self_.absolutePath_, path_.absolutePath_)
303
562
  }
304
563
 
305
564
  export function Path_readSymbolicLink(self_) {
306
- throw new Error('Function Path_readSymbolicLink is missing on this target in sync context.');
565
+ const fsPromises_ = import$1;
566
+ return fsPromises_.readlink(self_.absolutePath_)
307
567
  }
308
568
 
309
569
  export function Path_readText(self_) {
310
- throw new Error('Function Path_readText is missing on this target in sync context.');
570
+ const fsPromises_ = import$1;
571
+ return ff_core_Js.withSignal_(((signal_) => {
572
+ return fsPromises_.readFile(self_.absolutePath_, {encoding: "UTF-8", signal: signal_})
573
+ }))
311
574
  }
312
575
 
313
576
  export function Path_writeText(self_, text_) {
314
- throw new Error('Function Path_writeText is missing on this target in sync context.');
577
+ const fsPromises_ = import$1;
578
+ ff_core_Js.withSignal_(((signal_) => {
579
+ return fsPromises_.writeFile(self_.absolutePath_, text_, {encoding: "UTF-8", signal: signal_})
580
+ }))
315
581
  }
316
582
 
317
583
  export function Path_appendText(self_, text_) {
318
- throw new Error('Function Path_appendText is missing on this target in sync context.');
584
+ const fsPromises_ = import$1;
585
+ ff_core_Js.withSignal_(((signal_) => {
586
+ return fsPromises_.appendFile(self_.absolutePath_, text_, {encoding: "UTF-8", signal: signal_})
587
+ }))
319
588
  }
320
589
 
321
590
  export function Path_readBuffer(self_) {
@@ -331,44 +600,64 @@ ff_core_Path.Path_appendStream(self_, ff_core_List.List_toStream([buffer_], fals
331
600
  }
332
601
 
333
602
  export function Path_readStream(self_) {
334
- throw new Error('Function Path_readStream is missing on this target in sync context.');
603
+ const fs_ = import$0;
604
+ return ff_core_Path.internalReadStream_((() => {
605
+ return fs_.createReadStream(self_.absolutePath_)
606
+ }))
335
607
  }
336
608
 
337
609
  export function Path_writeStream(self_, stream_, createOnly_ = false) {
338
- throw new Error('Function Path_writeStream is missing on this target in sync context.');
610
+ ff_core_Path.internalWriteStream_(self_, stream_, (createOnly_
611
+ ? "wx"
612
+ : "w"))
339
613
  }
340
614
 
341
615
  export function Path_appendStream(self_, stream_) {
342
- throw new Error('Function Path_appendStream is missing on this target in sync context.');
616
+ ff_core_Path.internalWriteStream_(self_, stream_, "a")
343
617
  }
344
618
 
345
619
  export function Path_readHandle(self_, alsoWrite_ = false) {
346
- throw new Error('Function Path_readHandle is missing on this target in sync context.');
620
+ const fsPromises_ = import$1;
621
+ return fsPromises_.open(self_.absolutePath_, (alsoWrite_
622
+ ? "r+"
623
+ : "r"))
347
624
  }
348
625
 
349
626
  export function Path_writeHandle(self_, alsoRead_ = false, mustCreate_ = false) {
350
- throw new Error('Function Path_writeHandle is missing on this target in sync context.');
627
+ const fsPromises_ = import$1;
628
+ const flags_ = ((mustCreate_
629
+ ? "wx"
630
+ : "w") + (alsoRead_
631
+ ? "+"
632
+ : ""));
633
+ return fsPromises_.open(self_.absolutePath_, flags_)
351
634
  }
352
635
 
353
636
  export function Path_appendHandle(self_, alsoRead_ = false, mustCreate_ = false) {
354
- throw new Error('Function Path_appendHandle is missing on this target in sync context.');
637
+ const fsPromises_ = import$1;
638
+ const flags_ = ((mustCreate_
639
+ ? "ax"
640
+ : "a") + (alsoRead_
641
+ ? "+"
642
+ : ""));
643
+ return fsPromises_.open(self_.absolutePath_, flags_)
355
644
  }
356
645
 
357
646
  export async function Path_exists$(self_, checkReadable_ = false, checkWritable_ = false, checkExecutable_ = false, $task) {
358
-
359
- const fs = import$0
360
- const fsPromises = import$1
361
- const flags =
362
- (fs.constants.R_OK * checkReadable_) |
363
- (fs.constants.W_OK * checkWritable_) |
364
- (fs.constants.X_OK * checkExecutable_)
365
- try {
366
- await fsPromises.access(self_, flags === 0 ? fs.constants.F_OK : flags)
367
- return true
368
- } catch(e) {
369
- return false
370
- }
371
-
647
+ const fs_ = import$0;
648
+ const fsPromises_ = import$1;
649
+ const flagsR_ = (fs_.constants["R_OK"] * checkReadable_);
650
+ const flagsW_ = (fs_.constants["W_OK"] * checkWritable_);
651
+ const flagsX_ = (fs_.constants["X_OK"] * checkExecutable_);
652
+ const flags_ = ff_core_Int.Int_bitOr(flagsR_, ff_core_Int.Int_bitOr(flagsW_, flagsX_));
653
+ try {
654
+ (await fsPromises_.access(self_.absolutePath_, ((flags_ === 0)
655
+ ? fs_.constants["F_OK"]
656
+ : flags_)));
657
+ return true
658
+ } catch {
659
+ return false
660
+ }
372
661
  }
373
662
 
374
663
  export async function Path_isReadable$(self_, $task) {
@@ -384,91 +673,81 @@ return (await ff_core_Path.Path_exists$(self_, false, false, true, $task))
384
673
  }
385
674
 
386
675
  export async function Path_isDirectory$(self_, $task) {
387
-
388
- const fsPromises = import$1
389
- try {
390
- return (await fsPromises.lstat(self_)).isDirectory();
391
- } catch(e) {
392
- return false;
393
- }
394
-
676
+ const fsPromises_ = import$1;
677
+ try {
678
+ return (await fsPromises_.lstat(self_.absolutePath_)).isDirectory()
679
+ } catch {
680
+ return false
681
+ }
395
682
  }
396
683
 
397
684
  export async function Path_isFile$(self_, $task) {
398
-
399
- const fsPromises = import$1
400
- try {
401
- return (await fsPromises.lstat(self_)).isFile();
402
- } catch(e) {
403
- return false;
404
- }
405
-
685
+ const fsPromises_ = import$1;
686
+ try {
687
+ return (await fsPromises_.lstat(self_.absolutePath_)).isFile()
688
+ } catch {
689
+ return false
690
+ }
406
691
  }
407
692
 
408
693
  export async function Path_isSymbolicLink$(self_, $task) {
409
-
410
- const fsPromises = import$1
411
- try {
412
- return (await fsPromises.lstat(self_)).isSymbolicLink();
413
- } catch(e) {
414
- return false;
415
- }
416
-
694
+ const fsPromises_ = import$1;
695
+ try {
696
+ return (await fsPromises_.lstat(self_.absolutePath_)).isSymbolicLink()
697
+ } catch {
698
+ return false
699
+ }
417
700
  }
418
701
 
419
702
  export async function Path_isInsideOf$(self_, path_, $task) {
420
-
421
- const path = import$2
422
- if(path_ === '/') return true
423
- const childPath = path.resolve(self_)
424
- const parentPath = path.resolve(path_)
425
- return childPath.startsWith(parentPath + path.sep) || childPath === parentPath
426
-
703
+ const nodePath_ = import$2;
704
+ if((path_.absolutePath_ === "/")) {
705
+ return true
706
+ } else {
707
+ const childPath_ = self_.absolutePath_;
708
+ const parentPath_ = path_.absolutePath_;
709
+ return (ff_core_String.String_startsWith(childPath_, (parentPath_ + nodePath_.sep), 0) || (childPath_ === parentPath_))
710
+ }
427
711
  }
428
712
 
429
713
  export async function Path_size$(self_, $task) {
430
-
431
- return (await fs.promises.stat(file)).size
432
-
714
+ const fs_ = import$0;
715
+ return (await fs_.promises.stat(self_.absolutePath_))
433
716
  }
434
717
 
435
718
  export async function Path_modified$(self_, $task) {
436
-
437
- return (await fs.promises.stat(file)).mtimeMs * 0.001
438
-
719
+ const fs_ = import$0;
720
+ return ((await fs_.promises.stat(self_.absolutePath_)).mtimeMs * 0.001)
439
721
  }
440
722
 
441
723
  export async function Path_entries$(self_, $task) {
442
-
443
- const fsPromises = import$1
444
- let dir = null
445
- return ff_core_Stream.Stream(
446
- async () => {
447
- if(dir === null) dir = await fsPromises.opendir(self_, {bufferSize: 128})
448
- const entry = await dir.read()
449
- if(entry === null) return ff_core_Option.None()
450
- entry.ffPath = self_
451
- return ff_core_Option.Some(entry)
452
- },
453
- async () => {
454
- if(dir !== null) await dir.close()
455
- }
456
- )
457
-
724
+ const fsPromises_ = import$1;
725
+ let dir_ = null;
726
+ return ff_core_Stream.Stream((async ($task) => {
727
+ if(ff_core_JsValue.JsValue_isNull(dir_)) {
728
+ dir_ = (await fsPromises_.opendir(self_.absolutePath_, {bufferSize: 128}))
729
+ };
730
+ const entry_ = (await dir_.read());
731
+ if((!ff_core_JsValue.JsValue_isNull(entry_))) {
732
+ return ff_core_Option.Some((await (async function() {
733
+ entry_.ffPath = self_.absolutePath_;
734
+ return entry_
735
+ })()))
736
+ } else return ff_core_Option.None()
737
+ }), (async ($task) => {
738
+ if((!ff_core_JsValue.JsValue_isNull(dir_))) {
739
+ (await dir_.close())
740
+ }
741
+ }))
458
742
  }
459
743
 
460
744
  export async function Path_absolute$(self_, $task) {
461
-
462
- const path = import$2
463
- return path.resolve(self_)
464
-
745
+ return self_.absolutePath_
465
746
  }
466
747
 
467
748
  export async function Path_relativeTo$(self_, path_, $task) {
468
-
469
- const path = import$2;
470
- return path.relative(path_, self_);
471
-
749
+ const nodePath_ = import$2;
750
+ return nodePath_.relative(path_.absolutePath_, self_.absolutePath_)
472
751
  }
473
752
 
474
753
  export async function Path_endsWith$(self_, parts_, $task) {
@@ -484,7 +763,7 @@ const p_ = reversed_a[0];
484
763
  const ps_ = reversed_a.slice(1);
485
764
  return (((await ff_core_Path.Path_base$(path_, $task)) === p_) && (await go_$((await ff_core_Path.Path_parent$(path_, $task)), ps_, $task)))
486
765
  }
487
- if(pathOption_a.None) {
766
+ {
488
767
  return false
489
768
  }
490
769
  }
@@ -498,62 +777,46 @@ return (await ff_core_Path.Path_contains$(_w1, parts_, $task))
498
777
  }
499
778
 
500
779
  export async function Path_base$(self_, $task) {
501
-
502
- const path = import$2
503
- return path.basename(self_)
504
-
780
+ const path_ = import$2;
781
+ return path_.basename(self_.absolutePath_)
505
782
  }
506
783
 
507
784
  export async function Path_extension$(self_, $task) {
508
-
509
- const path = import$2
510
- return path.extname(self_)
511
-
785
+ const path_ = import$2;
786
+ return path_.extname(self_.absolutePath_)
512
787
  }
513
788
 
514
789
  export async function Path_url$(self_, $task) {
515
-
516
- const url = import$3;
517
- return '' + url.pathToFileURL(self_);
518
-
790
+ const url_ = import$3;
791
+ return ("" + url_.pathToFileURL(self_.absolutePath_))
519
792
  }
520
793
 
521
794
  export async function Path_delimiter$(self_, $task) {
522
-
523
- const path = import$2;
524
- return path.delimiter(self_);
525
-
795
+ const path_ = import$2;
796
+ return path_.delimiter(self_.absolutePath_)
526
797
  }
527
798
 
528
799
  export async function Path_separator$(self_, $task) {
529
-
530
- const path = import$2;
531
- return path.separator();
532
-
800
+ const path_ = import$2;
801
+ return path_.separator(self_.absolutePath_)
533
802
  }
534
803
 
535
804
  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
-
805
+ const path_ = import$2;
806
+ const result_ = path_.dirname(self_.absolutePath_);
807
+ if(((result_ !== "") && (result_ !== self_.absolutePath_))) {
808
+ return ff_core_Option.Some(ff_core_Path.Path(result_))
809
+ } else return ff_core_Option.None()
543
810
  }
544
811
 
545
812
  export async function Path_slash$(self_, relativePath_, $task) {
546
-
547
- const path = import$2
548
- return path.join(self_, relativePath_)
549
-
813
+ const path_ = import$2;
814
+ return ff_core_Path.Path(path_.join(self_.absolutePath_, relativePath_))
550
815
  }
551
816
 
552
817
  export async function Path_path$(self_, absoluteOrRelativePath_, $task) {
553
-
554
- const path = import$2
555
- return path.resolve(self_, absoluteOrRelativePath_)
556
-
818
+ const path_ = import$2;
819
+ return ff_core_Path.Path(path_.resolve(self_.absolutePath_, absoluteOrRelativePath_))
557
820
  }
558
821
 
559
822
  export async function Path_copyTo$(self_, path_, retries_ = 0, retryDelay_ = 100, $task) {
@@ -573,78 +836,56 @@ if((await ff_core_Path.Path_exists$(path_, false, false, false, $task))) {
573
836
  }
574
837
 
575
838
  export async function Path_createDirectory$(self_, createParentDirectories_ = false, $task) {
576
-
577
- const fsPromises = import$1
578
- await fsPromises.mkdir(self_, {recursive: createParentDirectories_})
579
-
839
+ const fsPromises_ = import$1;
840
+ (await fsPromises_.mkdir(self_.absolutePath_, {recursive: createParentDirectories_}))
580
841
  }
581
842
 
582
843
  export async function Path_createSymlinkTo$(self_, path_, junction_ = false, $task) {
583
-
584
- const fsPromises = import$1
585
- await fsPromises.symlink(path_, self_, junction_ ? 'junction' : null)
586
-
844
+ const fsPromises_ = import$1;
845
+ (await fsPromises_.symlink(path_.absolutePath_, self_.absolutePath_, (junction_
846
+ ? "junction"
847
+ : null)))
587
848
  }
588
849
 
589
850
  export async function Path_delete$(self_, retries_ = 0, retryDelay_ = 100, $task) {
590
-
591
- const fsPromises = import$1
592
- await fsPromises.rm(self_, {recursive: true, retries: retries_, retryDelay: retryDelay_})
593
-
851
+ const fsPromises_ = import$1;
852
+ (await fsPromises_.rm(self_.absolutePath_, {recursive: true, retries: retries_, retryDelay: retryDelay_}))
594
853
  }
595
854
 
596
855
  export async function Path_truncate$(self_, length_ = 0, $task) {
597
-
598
- const fsPromises = import$1
599
- await fsPromises.truncate(self_, length_)
600
-
856
+ const fsPromises_ = import$1;
857
+ (await fsPromises_.truncate(self_.absolutePath_, length_))
601
858
  }
602
859
 
603
860
  export async function Path_renameTo$(self_, path_, $task) {
604
-
605
- const fsPromises = import$1
606
- await fsPromises.rename(self_, path_)
607
-
861
+ const fsPromises_ = import$1;
862
+ (await fsPromises_.rename(self_.absolutePath_, path_.absolutePath_))
608
863
  }
609
864
 
610
865
  export async function Path_readSymbolicLink$(self_, $task) {
611
-
612
- const fsPromises = import$1
613
- return await fsPromises.readlink(self_)
614
-
866
+ const fsPromises_ = import$1;
867
+ return (await fsPromises_.readlink(self_.absolutePath_))
615
868
  }
616
869
 
617
870
  export async function Path_readText$(self_, $task) {
618
-
619
- const fsPromises = import$1
620
- try {
621
- return await fsPromises.readFile(self_, {encoding: 'UTF-8', signal: $task.controller.signal})
622
- } finally {
623
- if($task.controller.signal.aborted) $task.controller = new AbortController()
624
- }
625
-
871
+ const fsPromises_ = import$1;
872
+ return (await ff_core_Js.withSignal_$((async (signal_, $task) => {
873
+ return (await fsPromises_.readFile(self_.absolutePath_, {encoding: "UTF-8", signal: signal_}))
874
+ }), $task))
626
875
  }
627
876
 
628
877
  export async function Path_writeText$(self_, text_, $task) {
629
-
630
- const fsPromises = import$1
631
- try {
632
- await fsPromises.writeFile(self_, text_, {encoding: 'UTF-8', signal: $task.controller.signal})
633
- } finally {
634
- if($task.controller.signal.aborted) $task.controller = new AbortController()
635
- }
636
-
878
+ const fsPromises_ = import$1;
879
+ (await ff_core_Js.withSignal_$((async (signal_, $task) => {
880
+ return (await fsPromises_.writeFile(self_.absolutePath_, text_, {encoding: "UTF-8", signal: signal_}))
881
+ }), $task))
637
882
  }
638
883
 
639
884
  export async function Path_appendText$(self_, text_, $task) {
640
-
641
- const fsPromises = import$1
642
- try {
643
- await fsPromises.appendFile(self_, text_, {encoding: 'UTF-8', signal: $task.controller.signal})
644
- } finally {
645
- if($task.controller.signal.aborted) $task.controller = new AbortController()
646
- }
647
-
885
+ const fsPromises_ = import$1;
886
+ (await ff_core_Js.withSignal_$((async (signal_, $task) => {
887
+ return (await fsPromises_.appendFile(self_.absolutePath_, text_, {encoding: "UTF-8", signal: signal_}))
888
+ }), $task))
648
889
  }
649
890
 
650
891
  export async function Path_readBuffer$(self_, $task) {
@@ -660,120 +901,81 @@ export async function Path_appendBuffer$(self_, buffer_, $task) {
660
901
  }
661
902
 
662
903
  export async function Path_readStream$(self_, $task) {
663
-
664
- const fs = import$0
665
- return ff_core_Path.internalReadStream_$(() => fs.createReadStream(self_))
666
-
904
+ const fs_ = import$0;
905
+ return (await ff_core_Path.internalReadStream_$((async ($task) => {
906
+ return fs_.createReadStream(self_.absolutePath_)
907
+ }), $task))
667
908
  }
668
909
 
669
910
  export async function Path_writeStream$(self_, stream_, createOnly_ = false, $task) {
670
-
671
- const fs = import$0
672
- let writeable = fs.createWriteStream(self_, {flags: createOnly_ ? 'wx' : 'w'})
673
- try {
674
- await ff_core_Stream.Stream_each$(stream_, async buffer => {
675
- if(!writeable.write(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength))) {
676
- await new Promise((resolve, reject) => {
677
- $task.controller.signal.addEventListener('abort', reject)
678
- writeable.once('drain', () => {
679
- $task.controller.signal.removeEventListener('abort', reject)
680
- resolve()
681
- })
682
- })
683
- }
684
- }, $task)
685
- } finally {
686
- await new Promise((resolve, reject) => {
687
- writeable.close(err => {if(err) reject(err); else resolve();});
688
- });
689
- }
690
-
911
+ (await ff_core_Path.internalWriteStream_$(self_, stream_, (createOnly_
912
+ ? "wx"
913
+ : "w"), $task))
691
914
  }
692
915
 
693
916
  export async function Path_appendStream$(self_, stream_, $task) {
694
-
695
- const fs = import$0
696
- let writeable = fs.createWriteStream(self_, {flags: 'a'})
697
- try {
698
- await ff_core_Stream.Stream_each$(stream_, async buffer => {
699
- if(!writeable.write(new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength))) {
700
- await new Promise((resolve, reject) => {
701
- $task.controller.signal.addEventListener('abort', reject)
702
- writeable.once('drain', () => {
703
- $task.controller.signal.removeEventListener('abort', reject)
704
- resolve()
705
- })
706
- })
707
- }
708
- }, $task)
709
- } finally {
710
- await new Promise((resolve, reject) => {
711
- writeable.close(err => {if(err) reject(err); else resolve();});
712
- });
713
- }
714
-
917
+ (await ff_core_Path.internalWriteStream_$(self_, stream_, "a", $task))
715
918
  }
716
919
 
717
920
  export async function Path_readHandle$(self_, alsoWrite_ = false, $task) {
718
-
719
- const fsPromises = import$1
720
- return await fsPromises.open(self_, alsoWrite_ ? 'r+' : 'r')
721
-
921
+ const fsPromises_ = import$1;
922
+ return (await fsPromises_.open(self_.absolutePath_, (alsoWrite_
923
+ ? "r+"
924
+ : "r")))
722
925
  }
723
926
 
724
927
  export async function Path_writeHandle$(self_, alsoRead_ = false, mustCreate_ = false, $task) {
725
-
726
- const fsPromises = import$1
727
- return await fsPromises.open(self_, (mustCreate_ ? 'wx' : 'w') + (alsoRead_ ? '+' : ''))
728
-
928
+ const fsPromises_ = import$1;
929
+ const flags_ = ((mustCreate_
930
+ ? "wx"
931
+ : "w") + (alsoRead_
932
+ ? "+"
933
+ : ""));
934
+ return (await fsPromises_.open(self_.absolutePath_, flags_))
729
935
  }
730
936
 
731
937
  export async function Path_appendHandle$(self_, alsoRead_ = false, mustCreate_ = false, $task) {
732
-
733
- const fsPromises = import$1
734
- return await fsPromises.open(self_, (mustCreate_ ? 'wx' : 'w') + (alsoRead_ ? '+' : ''))
735
-
938
+ const fsPromises_ = import$1;
939
+ const flags_ = ((mustCreate_
940
+ ? "ax"
941
+ : "a") + (alsoRead_
942
+ ? "+"
943
+ : ""));
944
+ return (await fsPromises_.open(self_.absolutePath_, flags_))
736
945
  }
737
946
 
738
947
  export function PathEntry_path(self_) {
739
- throw new Error('Function PathEntry_path is missing on this target in sync context.');
948
+ const path_ = import$2;
949
+ return ff_core_Path.Path(path_.join(self_.ffPath, self_.name))
740
950
  }
741
951
 
742
952
  export function PathEntry_isDirectory(self_) {
743
- throw new Error('Function PathEntry_isDirectory is missing on this target in sync context.');
953
+ return self_.isDirectory()
744
954
  }
745
955
 
746
956
  export function PathEntry_isFile(self_) {
747
- throw new Error('Function PathEntry_isFile is missing on this target in sync context.');
957
+ return self_.isFile()
748
958
  }
749
959
 
750
960
  export function PathEntry_isSymbolicLink(self_) {
751
- throw new Error('Function PathEntry_isSymbolicLink is missing on this target in sync context.');
961
+ return self_.isSymbolicLink()
752
962
  }
753
963
 
754
964
  export async function PathEntry_path$(self_, $task) {
755
-
756
- const path = import$2
757
- return path.join(self_.ffPath, self_.name)
758
-
965
+ const path_ = import$2;
966
+ return ff_core_Path.Path(path_.join(self_.ffPath, self_.name))
759
967
  }
760
968
 
761
969
  export async function PathEntry_isDirectory$(self_, $task) {
762
-
763
- return self_.isDirectory()
764
-
970
+ return self_.isDirectory()
765
971
  }
766
972
 
767
973
  export async function PathEntry_isFile$(self_, $task) {
768
-
769
- return self_.isFile()
770
-
974
+ return self_.isFile()
771
975
  }
772
976
 
773
977
  export async function PathEntry_isSymbolicLink$(self_, $task) {
774
-
775
- return self_.isSymbolicLink()
776
-
978
+ return self_.isSymbolicLink()
777
979
  }
778
980
 
779
981