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.
- package/.hintrc +4 -4
- package/.vscode/settings.json +4 -4
- package/bin/Release.ff +157 -154
- package/bin/firefly.mjs +1 -1
- package/compiler/Builder.ff +275 -277
- package/compiler/Compiler.ff +234 -233
- package/compiler/Dependencies.ff +186 -187
- package/compiler/DependencyLock.ff +17 -17
- package/compiler/Deriver.ff +23 -31
- package/compiler/Dictionaries.ff +1 -1
- package/compiler/Inference.ff +43 -20
- package/compiler/JsEmitter.ff +1437 -1282
- package/compiler/LspHook.ff +202 -202
- package/compiler/Main.ff +25 -24
- package/compiler/ModuleCache.ff +178 -178
- package/compiler/Parser.ff +36 -109
- package/compiler/Resolver.ff +5 -8
- package/compiler/Substitution.ff +1 -1
- package/compiler/Syntax.ff +1 -16
- package/compiler/Token.ff +9 -0
- package/compiler/Tokenizer.ff +4 -0
- package/compiler/Workspace.ff +88 -88
- package/core/.firefly/include/package.json +5 -5
- package/core/.firefly/package.ff +2 -2
- package/core/Any.ff +26 -30
- package/core/Array.ff +298 -265
- package/core/Atomic.ff +63 -64
- package/core/Box.ff +7 -7
- package/core/BrowserSystem.ff +40 -40
- package/core/Buffer.ff +185 -152
- package/core/BuildSystem.ff +156 -148
- package/core/Channel.ff +95 -92
- package/core/Char.ff +3 -2
- package/core/Core.ff +16 -23
- package/core/Crypto.ff +94 -96
- package/core/Equal.ff +41 -36
- package/core/Error.ff +15 -10
- package/core/FileHandle.ff +45 -37
- package/core/Float.ff +176 -200
- package/core/HttpClient.ff +142 -148
- package/core/Instant.ff +6 -8
- package/core/Int.ff +40 -24
- package/core/IntMap.ff +61 -39
- package/core/Js.ff +305 -0
- package/core/JsSystem.ff +135 -114
- package/core/JsValue.ff +303 -159
- package/core/Json.ff +423 -443
- package/core/List.ff +482 -486
- package/core/Lock.ff +108 -144
- package/core/Log.ff +25 -14
- package/core/NodeSystem.ff +198 -191
- package/core/Ordering.ff +160 -161
- package/core/Path.ff +377 -409
- package/core/Queue.ff +90 -0
- package/core/Random.ff +140 -134
- package/core/RbMap.ff +216 -216
- package/core/Serializable.ff +16 -13
- package/core/Show.ff +44 -43
- package/core/SourceLocation.ff +68 -68
- package/core/Stream.ff +1 -1
- package/core/String.ff +224 -202
- package/core/StringMap.ff +58 -36
- package/core/Task.ff +165 -149
- package/experimental/benchmarks/ListGrab.ff +23 -23
- package/experimental/benchmarks/ListGrab.java +55 -55
- package/experimental/benchmarks/Pyrotek45.ff +30 -30
- package/experimental/benchmarks/Pyrotek45.java +64 -64
- package/experimental/bidirectional/Bidi.ff +88 -88
- package/experimental/lines/Main.ff +40 -0
- package/experimental/random/Index.ff +53 -53
- package/experimental/random/Process.ff +120 -120
- package/experimental/random/RunLength.ff +65 -65
- package/experimental/random/Scrape.ff +51 -51
- package/experimental/random/Symbols.ff +73 -73
- package/experimental/random/Tensor.ff +52 -52
- package/experimental/random/Units.ff +36 -36
- package/experimental/s3/S3TestAuthorizationHeader.ff +39 -39
- package/experimental/s3/S3TestPut.ff +16 -16
- package/experimental/tests/TestJson.ff +26 -26
- package/firefly.sh +0 -0
- package/fireflysite/.firefly/package.ff +4 -4
- package/fireflysite/CommunityOverview.ff +20 -20
- package/fireflysite/CountingButtonDemo.ff +58 -58
- package/fireflysite/DocumentParser.ff +325 -331
- package/fireflysite/ExamplesOverview.ff +40 -40
- package/fireflysite/FrontPage.ff +344 -344
- package/fireflysite/GettingStarted.ff +45 -45
- package/fireflysite/Guide.ff +456 -456
- package/fireflysite/Main.ff +163 -152
- package/fireflysite/MatchingPasswordsDemo.ff +82 -82
- package/fireflysite/PackagesOverview.ff +49 -49
- package/fireflysite/PostgresqlDemo.ff +34 -34
- package/fireflysite/ReferenceAll.ff +18 -18
- package/fireflysite/ReferenceIntroduction.ff +11 -11
- package/fireflysite/Styles.ff +567 -567
- package/fireflysite/Test.ff +121 -62
- package/fireflysite/assets/markdown/reference/BaseTypes.md +209 -209
- package/fireflysite/assets/markdown/reference/EmittedJavascript.md +65 -65
- package/fireflysite/assets/markdown/reference/Exceptions.md +101 -101
- package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +364 -364
- package/fireflysite/assets/markdown/reference/JavascriptInterop.md +235 -172
- package/fireflysite/assets/markdown/reference/ModulesAndPackages.md +162 -162
- package/fireflysite/assets/markdown/reference/OldStructuredConcurrency.md +48 -48
- package/fireflysite/assets/markdown/reference/PatternMatching.md +224 -224
- package/fireflysite/assets/markdown/reference/StatementsAndExpressions.md +86 -86
- package/fireflysite/assets/markdown/reference/StructuredConcurrency.md +99 -99
- package/fireflysite/assets/markdown/reference/TraitsAndInstances.md +100 -100
- package/fireflysite/assets/markdown/reference/UserDefinedTypes.md +184 -184
- package/fireflysite/assets/markdown/scratch/ControlFlow.md +136 -136
- package/fireflysite/assets/markdown/scratch/Toc.md +40 -40
- package/lsp/.firefly/package.ff +1 -1
- package/lsp/CompletionHandler.ff +827 -827
- package/lsp/Handler.ff +714 -714
- package/lsp/HoverHandler.ff +79 -79
- package/lsp/LanguageServer.ff +272 -272
- package/lsp/SignatureHelpHandler.ff +55 -55
- package/lsp/SymbolHandler.ff +181 -181
- package/lsp/TestReferences.ff +17 -17
- package/lsp/TestReferencesCase.ff +7 -7
- package/lsp/stderr.txt +1 -1
- package/lsp/stdout.txt +34 -34
- package/lux/.firefly/package.ff +1 -1
- package/lux/Css.ff +648 -648
- package/lux/CssTest.ff +48 -48
- package/lux/Lux.ff +608 -617
- package/lux/LuxEvent.ff +79 -116
- package/lux/Main.ff +123 -123
- package/lux/Main2.ff +143 -143
- package/lux/TestDry.ff +28 -28
- package/output/js/ff/compiler/Builder.mjs +72 -71
- package/output/js/ff/compiler/Compiler.mjs +19 -13
- package/output/js/ff/compiler/Dependencies.mjs +8 -7
- package/output/js/ff/compiler/DependencyLock.mjs +6 -4
- package/output/js/ff/compiler/Deriver.mjs +26 -24
- package/output/js/ff/compiler/Dictionaries.mjs +14 -18
- package/output/js/ff/compiler/Environment.mjs +6 -4
- package/output/js/ff/compiler/Inference.mjs +238 -164
- package/output/js/ff/compiler/JsEmitter.mjs +1160 -350
- package/output/js/ff/compiler/JsImporter.mjs +20 -18
- package/output/js/ff/compiler/LspHook.mjs +12 -10
- package/output/js/ff/compiler/Main.mjs +61 -41
- package/output/js/ff/compiler/ModuleCache.mjs +10 -8
- package/output/js/ff/compiler/Parser.mjs +153 -669
- package/output/js/ff/compiler/Patterns.mjs +12 -10
- package/output/js/ff/compiler/Resolver.mjs +52 -78
- package/output/js/ff/compiler/Substitution.mjs +12 -16
- package/output/js/ff/compiler/Syntax.mjs +50 -341
- package/output/js/ff/compiler/Token.mjs +126 -4
- package/output/js/ff/compiler/Tokenizer.mjs +62 -52
- package/output/js/ff/compiler/Unification.mjs +74 -90
- package/output/js/ff/compiler/Wildcards.mjs +4 -2
- package/output/js/ff/compiler/Workspace.mjs +26 -20
- package/output/js/ff/core/Any.mjs +20 -20
- package/output/js/ff/core/Array.mjs +268 -175
- package/output/js/ff/core/AssetSystem.mjs +8 -6
- package/output/js/ff/core/Atomic.mjs +84 -52
- package/output/js/ff/core/Bool.mjs +6 -4
- package/output/js/ff/core/BrowserSystem.mjs +38 -29
- package/output/js/ff/core/Buffer.mjs +285 -133
- package/output/js/ff/core/BuildSystem.mjs +36 -56
- package/output/js/ff/core/Channel.mjs +250 -97
- package/output/js/ff/core/Char.mjs +5 -3
- package/output/js/ff/core/Core.mjs +28 -34
- package/output/js/ff/core/Crypto.mjs +30 -52
- package/output/js/ff/core/Duration.mjs +4 -2
- package/output/js/ff/core/Equal.mjs +14 -12
- package/output/js/ff/core/Error.mjs +17 -11
- package/output/js/ff/core/FileHandle.mjs +76 -38
- package/output/js/ff/core/Float.mjs +92 -160
- package/output/js/ff/core/HttpClient.mjs +208 -76
- package/output/js/ff/core/Instant.mjs +8 -10
- package/output/js/ff/core/Int.mjs +36 -26
- package/output/js/ff/core/IntMap.mjs +79 -33
- package/output/js/ff/core/Js.mjs +751 -0
- package/output/js/ff/core/JsSystem.mjs +54 -60
- package/output/js/ff/core/JsValue.mjs +294 -143
- package/output/js/ff/core/Json.mjs +443 -253
- package/output/js/ff/core/List.mjs +262 -214
- package/output/js/ff/core/Lock.mjs +156 -125
- package/output/js/ff/core/Log.mjs +20 -10
- package/output/js/ff/core/Map.mjs +10 -8
- package/output/js/ff/core/NodeSystem.mjs +189 -123
- package/output/js/ff/core/Nothing.mjs +4 -2
- package/output/js/ff/core/Option.mjs +40 -38
- package/output/js/ff/core/Ordering.mjs +26 -20
- package/output/js/ff/core/Pair.mjs +4 -2
- package/output/js/ff/core/Path.mjs +517 -315
- package/output/js/ff/core/Queue.mjs +306 -0
- package/output/js/ff/core/Random.mjs +141 -77
- package/output/js/ff/core/RbMap.mjs +36 -34
- package/output/js/ff/core/Serializable.mjs +44 -28
- package/output/js/ff/core/Set.mjs +6 -4
- package/output/js/ff/core/Show.mjs +8 -6
- package/output/js/ff/core/SourceLocation.mjs +4 -2
- package/output/js/ff/core/Stream.mjs +30 -50
- package/output/js/ff/core/String.mjs +263 -172
- package/output/js/ff/core/StringMap.mjs +77 -31
- package/output/js/ff/core/Task.mjs +91 -76
- package/output/js/ff/core/Try.mjs +20 -18
- package/output/js/ff/core/Unit.mjs +4 -2
- package/package.json +1 -1
- package/postgresql/Pg.ff +53 -59
- package/rpc/.firefly/package.ff +1 -1
- package/rpc/Rpc.ff +70 -70
- package/s3/.firefly/package.ff +1 -1
- package/s3/S3.ff +92 -94
- package/vscode/LICENSE.txt +21 -21
- package/vscode/Prepublish.ff +15 -15
- package/vscode/README.md +16 -16
- package/vscode/client/package-lock.json +544 -544
- package/vscode/client/package.json +22 -22
- package/vscode/client/src/extension.ts +104 -104
- package/vscode/icons/firefly-icon.svg +10 -10
- package/vscode/language-configuration.json +61 -61
- package/vscode/package-lock.json +3623 -3623
- package/vscode/package.json +1 -1
- package/vscode/snippets.json +241 -241
- package/vscode/syntaxes/firefly-markdown-injection.json +45 -45
- package/webserver/.firefly/include/package.json +5 -5
- package/webserver/.firefly/package.ff +2 -2
- package/webserver/WebServer.ff +647 -685
- package/websocket/.firefly/package.ff +1 -1
- package/websocket/WebSocket.ff +100 -131
- package/core/UnsafeJs.ff +0 -42
- 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
|
-
|
|
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
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
413
|
+
const fs_ = import$0;
|
|
414
|
+
return fs_.promises.stat(self_.absolutePath_)
|
|
193
415
|
}
|
|
194
416
|
|
|
195
417
|
export function Path_modified(self_) {
|
|
196
|
-
|
|
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
|
-
|
|
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
|
-
|
|
444
|
+
return self_.absolutePath_
|
|
205
445
|
}
|
|
206
446
|
|
|
207
447
|
export function Path_relativeTo(self_, path_) {
|
|
208
|
-
|
|
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
|
-
|
|
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
|
-
|
|
479
|
+
const path_ = import$2;
|
|
480
|
+
return path_.basename(self_.absolutePath_)
|
|
239
481
|
}
|
|
240
482
|
|
|
241
483
|
export function Path_extension(self_) {
|
|
242
|
-
|
|
484
|
+
const path_ = import$2;
|
|
485
|
+
return path_.extname(self_.absolutePath_)
|
|
243
486
|
}
|
|
244
487
|
|
|
245
488
|
export function Path_url(self_) {
|
|
246
|
-
|
|
489
|
+
const url_ = import$3;
|
|
490
|
+
return ("" + url_.pathToFileURL(self_.absolutePath_))
|
|
247
491
|
}
|
|
248
492
|
|
|
249
493
|
export function Path_delimiter(self_) {
|
|
250
|
-
|
|
494
|
+
const path_ = import$2;
|
|
495
|
+
return path_.delimiter(self_.absolutePath_)
|
|
251
496
|
}
|
|
252
497
|
|
|
253
498
|
export function Path_separator(self_) {
|
|
254
|
-
|
|
499
|
+
const path_ = import$2;
|
|
500
|
+
return path_.separator(self_.absolutePath_)
|
|
255
501
|
}
|
|
256
502
|
|
|
257
503
|
export function Path_parent(self_) {
|
|
258
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
555
|
+
const fsPromises_ = import$1;
|
|
556
|
+
fsPromises_.truncate(self_.absolutePath_, length_)
|
|
299
557
|
}
|
|
300
558
|
|
|
301
559
|
export function Path_renameTo(self_, path_) {
|
|
302
|
-
|
|
560
|
+
const fsPromises_ = import$1;
|
|
561
|
+
fsPromises_.rename(self_.absolutePath_, path_.absolutePath_)
|
|
303
562
|
}
|
|
304
563
|
|
|
305
564
|
export function Path_readSymbolicLink(self_) {
|
|
306
|
-
|
|
565
|
+
const fsPromises_ = import$1;
|
|
566
|
+
return fsPromises_.readlink(self_.absolutePath_)
|
|
307
567
|
}
|
|
308
568
|
|
|
309
569
|
export function Path_readText(self_) {
|
|
310
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
616
|
+
ff_core_Path.internalWriteStream_(self_, stream_, "a")
|
|
343
617
|
}
|
|
344
618
|
|
|
345
619
|
export function Path_readHandle(self_, alsoWrite_ = false) {
|
|
346
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
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
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
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
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
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
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
585
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
620
|
-
|
|
621
|
-
|
|
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
|
-
|
|
631
|
-
|
|
632
|
-
|
|
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
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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
|
-
|
|
665
|
-
|
|
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
|
-
|
|
672
|
-
|
|
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
|
-
|
|
720
|
-
|
|
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
|
-
|
|
727
|
-
|
|
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
|
-
|
|
734
|
-
|
|
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
|
-
|
|
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
|
-
|
|
953
|
+
return self_.isDirectory()
|
|
744
954
|
}
|
|
745
955
|
|
|
746
956
|
export function PathEntry_isFile(self_) {
|
|
747
|
-
|
|
957
|
+
return self_.isFile()
|
|
748
958
|
}
|
|
749
959
|
|
|
750
960
|
export function PathEntry_isSymbolicLink(self_) {
|
|
751
|
-
|
|
961
|
+
return self_.isSymbolicLink()
|
|
752
962
|
}
|
|
753
963
|
|
|
754
964
|
export async function PathEntry_path$(self_, $task) {
|
|
755
|
-
|
|
756
|
-
|
|
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
|
|