firefly-compiler 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.firefly-workspace +1 -0
- package/.vscode/settings.json +5 -0
- package/LICENSE.txt +21 -0
- package/README.md +96 -0
- package/bin/firefly.mjs +2 -0
- package/compiler/.firefly/package.ff +1 -0
- package/compiler/Builder.ff +218 -0
- package/compiler/Compiler.ff +241 -0
- package/compiler/Dependencies.ff +179 -0
- package/compiler/Deriver.ff +647 -0
- package/compiler/Dictionaries.ff +205 -0
- package/compiler/Environment.ff +166 -0
- package/compiler/Inference.ff +1117 -0
- package/compiler/JsEmitter.ff +861 -0
- package/compiler/JsImporter.ff +56 -0
- package/compiler/LspHook.ff +188 -0
- package/compiler/Main.ff +237 -0
- package/compiler/Parser.ff +1383 -0
- package/compiler/Patterns.ff +111 -0
- package/compiler/Resolver.ff +620 -0
- package/compiler/Substitution.ff +178 -0
- package/compiler/Syntax.ff +299 -0
- package/compiler/Token.ff +180 -0
- package/compiler/Tokenizer.ff +278 -0
- package/compiler/Unification.ff +220 -0
- package/compiler/Wildcards.ff +50 -0
- package/compiler/Workspace.ff +88 -0
- package/core/.firefly/package.ff +2 -0
- package/core/Any.ff +30 -0
- package/core/Array.ff +249 -0
- package/core/AssetSystem.ff +61 -0
- package/core/Atomic.ff +64 -0
- package/core/Bool.ff +13 -0
- package/core/BrowserSystem.ff +14 -0
- package/core/Buffer.ff +211 -0
- package/core/BuildSystem.ff +144 -0
- package/core/Channel.ff +131 -0
- package/core/Char.ff +18 -0
- package/core/Core.ff +58 -0
- package/core/Duration.ff +15 -0
- package/core/Equal.ff +52 -0
- package/core/Error.ff +20 -0
- package/core/FileHandle.ff +41 -0
- package/core/Float.ff +41 -0
- package/core/HttpClient.ff +84 -0
- package/core/Instant.ff +9 -0
- package/core/Int.ff +61 -0
- package/core/IntMap.ff +85 -0
- package/core/JsSystem.ff +66 -0
- package/core/JsValue.ff +240 -0
- package/core/List.ff +440 -0
- package/core/Lock.ff +144 -0
- package/core/Log.ff +24 -0
- package/core/Map.ff +126 -0
- package/core/NodeSystem.ff +88 -0
- package/core/Nothing.ff +1 -0
- package/core/Option.ff +133 -0
- package/core/Ordering.ff +157 -0
- package/core/Pair.ff +55 -0
- package/core/Path.ff +393 -0
- package/core/RbMap.ff +216 -0
- package/core/Serializable.ff +173 -0
- package/core/Set.ff +38 -0
- package/core/Show.ff +43 -0
- package/core/Stack.ff +263 -0
- package/core/Stream.ff +406 -0
- package/core/String.ff +175 -0
- package/core/StringMap.ff +85 -0
- package/core/Task.ff +138 -0
- package/core/Try.ff +81 -0
- package/core/Unit.ff +3 -0
- package/experimental/random/AltGeneric.ff +44 -0
- package/experimental/random/Async.ff +68 -0
- package/experimental/random/Buffer2.ff +77 -0
- package/experimental/random/Cat.ff +12 -0
- package/experimental/random/Dictionary.ff +52 -0
- package/experimental/random/Example.ff +46 -0
- package/experimental/random/Generic.ff +102 -0
- package/experimental/random/HappyEyeballs.ff +40 -0
- package/experimental/random/HashMap.ff +72 -0
- package/experimental/random/IfElseUnit.ff +9 -0
- package/experimental/random/InputOutput.ff +23 -0
- package/experimental/random/ListVsArray.ff +45 -0
- package/experimental/random/Main.ff +44 -0
- package/experimental/random/MapTest.ff +67 -0
- package/experimental/random/OldTaskSystem.ff +210 -0
- package/experimental/random/PatternTest.ff +39 -0
- package/experimental/random/Patterns.ff +226 -0
- package/experimental/random/ReadBytesTest.ff +10 -0
- package/experimental/random/RunLength.ff +65 -0
- package/experimental/random/Scrape.ff +51 -0
- package/experimental/random/Serialization.ff +217 -0
- package/experimental/random/SerializationTest.ff +46 -0
- package/experimental/random/Serializer.ff +36 -0
- package/experimental/random/StdInOutErr.ff +4 -0
- package/experimental/random/Symbols.ff +74 -0
- package/experimental/random/Tag.ff +49 -0
- package/experimental/random/Tensor.ff +52 -0
- package/experimental/random/Try.ff +56 -0
- package/experimental/random/Tsv.ff +9 -0
- package/experimental/random/TypesAreModules.ff +87 -0
- package/experimental/random/blueprints/Blueprint.ff +52 -0
- package/experimental/random/blueprints/Main.ff +11 -0
- package/experimental/random/blueprints/Pretty.ff +58 -0
- package/experimental/random/blueprints/User.ff +64 -0
- package/experimental/random/blueprintsystem/BlueprintSystem.ff +48 -0
- package/experimental/random/blueprintsystem/Deserialize.ff +53 -0
- package/experimental/random/blueprintsystem/ReadJs.ff +13 -0
- package/experimental/random/blueprintsystem/User.ff +2 -0
- package/experimental/random/kahrs/Kahrs.ff +112 -0
- package/experimental/random/kahrs/TestKahrs.ff +22 -0
- package/experimental/random/kahrs/TestMap.ff +18 -0
- package/experimental/random/streaming/Gzip.ff +3 -0
- package/experimental/random/streaming/Main.ff +34 -0
- package/experimental/random/streaming/S3Bucket.ff +11 -0
- package/experimental/random/streaming/Tar.ff +5 -0
- package/experimental/rhymeapp/Main.ff +81 -0
- package/experimental/rhymeapp/index.html +14 -0
- package/firefly.sh +5 -0
- package/fireflysite/Main.ff +13 -0
- package/httpserver/.firefly/package.ff +1 -0
- package/httpserver/HttpServer.ff +184 -0
- package/lsp/.firefly/package.ff +1 -0
- package/lsp/CompletionHandler.ff +814 -0
- package/lsp/Handler.ff +551 -0
- package/lsp/HoverHandler.ff +82 -0
- package/lsp/LanguageServer.ff +229 -0
- package/lsp/SignatureHelpHandler.ff +55 -0
- package/lsp/SymbolHandler.ff +167 -0
- package/output/js/ff/compiler/Builder.mjs +483 -0
- package/output/js/ff/compiler/Compiler.mjs +410 -0
- package/output/js/ff/compiler/Dependencies.mjs +388 -0
- package/output/js/ff/compiler/Deriver.mjs +1166 -0
- package/output/js/ff/compiler/Dictionaries.mjs +1305 -0
- package/output/js/ff/compiler/Environment.mjs +1005 -0
- package/output/js/ff/compiler/Inference.mjs +4264 -0
- package/output/js/ff/compiler/JsEmitter.mjs +5353 -0
- package/output/js/ff/compiler/JsImporter.mjs +262 -0
- package/output/js/ff/compiler/LspHook.mjs +789 -0
- package/output/js/ff/compiler/Main.mjs +1695 -0
- package/output/js/ff/compiler/Parser.mjs +4004 -0
- package/output/js/ff/compiler/Patterns.mjs +923 -0
- package/output/js/ff/compiler/Resolver.mjs +2303 -0
- package/output/js/ff/compiler/Substitution.mjs +1146 -0
- package/output/js/ff/compiler/Syntax.mjs +12430 -0
- package/output/js/ff/compiler/Token.mjs +3092 -0
- package/output/js/ff/compiler/Tokenizer.mjs +589 -0
- package/output/js/ff/compiler/Unification.mjs +1748 -0
- package/output/js/ff/compiler/Wildcards.mjs +604 -0
- package/output/js/ff/compiler/Workspace.mjs +683 -0
- package/output/js/ff/core/Any.mjs +139 -0
- package/output/js/ff/core/Array.mjs +594 -0
- package/output/js/ff/core/AssetSystem.mjs +270 -0
- package/output/js/ff/core/Atomic.mjs +186 -0
- package/output/js/ff/core/Bool.mjs +141 -0
- package/output/js/ff/core/BrowserSystem.mjs +122 -0
- package/output/js/ff/core/Buffer.mjs +467 -0
- package/output/js/ff/core/BuildSystem.mjs +320 -0
- package/output/js/ff/core/Channel.mjs +268 -0
- package/output/js/ff/core/Char.mjs +145 -0
- package/output/js/ff/core/Core.mjs +300 -0
- package/output/js/ff/core/Duration.mjs +112 -0
- package/output/js/ff/core/Equal.mjs +175 -0
- package/output/js/ff/core/Error.mjs +138 -0
- package/output/js/ff/core/FileHandle.mjs +164 -0
- package/output/js/ff/core/Float.mjs +214 -0
- package/output/js/ff/core/HttpClient.mjs +210 -0
- package/output/js/ff/core/Instant.mjs +105 -0
- package/output/js/ff/core/Int.mjs +254 -0
- package/output/js/ff/core/IntMap.mjs +282 -0
- package/output/js/ff/core/JsSystem.mjs +234 -0
- package/output/js/ff/core/JsValue.mjs +678 -0
- package/output/js/ff/core/List.mjs +2335 -0
- package/output/js/ff/core/Lock.mjs +322 -0
- package/output/js/ff/core/Log.mjs +159 -0
- package/output/js/ff/core/Map.mjs +358 -0
- package/output/js/ff/core/NodeSystem.mjs +288 -0
- package/output/js/ff/core/Nothing.mjs +100 -0
- package/output/js/ff/core/Option.mjs +1002 -0
- package/output/js/ff/core/Ordering.mjs +734 -0
- package/output/js/ff/core/Pair.mjs +318 -0
- package/output/js/ff/core/Path.mjs +768 -0
- package/output/js/ff/core/RbMap.mjs +1936 -0
- package/output/js/ff/core/Serializable.mjs +434 -0
- package/output/js/ff/core/Set.mjs +250 -0
- package/output/js/ff/core/Show.mjs +201 -0
- package/output/js/ff/core/Stack.mjs +595 -0
- package/output/js/ff/core/Stream.mjs +1300 -0
- package/output/js/ff/core/String.mjs +433 -0
- package/output/js/ff/core/StringMap.mjs +282 -0
- package/output/js/ff/core/Task.mjs +345 -0
- package/output/js/ff/core/Try.mjs +503 -0
- package/output/js/ff/core/Unit.mjs +103 -0
- package/package.json +29 -0
- package/postgresql/.firefly/include/package-lock.json +250 -0
- package/postgresql/.firefly/include/package.json +5 -0
- package/postgresql/.firefly/include/prepare.sh +2 -0
- package/postgresql/.firefly/package.ff +3 -0
- package/postgresql/Pg.ff +530 -0
- package/unsafejs/.firefly/package.ff +1 -0
- package/unsafejs/UnsafeJs.ff +19 -0
- package/vscode/.vscode/launch.json +18 -0
- package/vscode/.vscode/tasks.json +33 -0
- package/vscode/LICENSE.txt +21 -0
- package/vscode/Prepublish.ff +15 -0
- package/vscode/README.md +17 -0
- package/vscode/client/package-lock.json +544 -0
- package/vscode/client/package.json +22 -0
- package/vscode/client/src/extension.ts +64 -0
- package/vscode/client/tsconfig.json +12 -0
- package/vscode/icons/firefly-icon.png +0 -0
- package/vscode/icons/firefly-icon.svg +10 -0
- package/vscode/icons/firefly-logo-notext.png +0 -0
- package/vscode/icons/firefly-logo.png +0 -0
- package/vscode/language-configuration.json +39 -0
- package/vscode/package-lock.json +3623 -0
- package/vscode/package.json +144 -0
- package/vscode/snippets-none.json +1 -0
- package/vscode/snippets.json +241 -0
- package/vscode/syntaxes/firefly.tmLanguage.json +294 -0
- package/vscode/tsconfig.json +20 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import * as import$0 from 'esbuild';
|
|
2
|
+
|
|
3
|
+
import * as ff_core_Any from "../../ff/core/Any.mjs"
|
|
4
|
+
|
|
5
|
+
import * as ff_core_Array from "../../ff/core/Array.mjs"
|
|
6
|
+
|
|
7
|
+
import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
|
|
8
|
+
|
|
9
|
+
import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
|
|
10
|
+
|
|
11
|
+
import * as ff_core_Bool from "../../ff/core/Bool.mjs"
|
|
12
|
+
|
|
13
|
+
import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
|
|
14
|
+
|
|
15
|
+
import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
|
|
16
|
+
|
|
17
|
+
import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
|
|
18
|
+
|
|
19
|
+
import * as ff_core_Channel from "../../ff/core/Channel.mjs"
|
|
20
|
+
|
|
21
|
+
import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
22
|
+
|
|
23
|
+
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
|
+
|
|
25
|
+
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
|
+
|
|
27
|
+
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
28
|
+
|
|
29
|
+
import * as ff_core_Error from "../../ff/core/Error.mjs"
|
|
30
|
+
|
|
31
|
+
import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
|
|
32
|
+
|
|
33
|
+
import * as ff_core_Float from "../../ff/core/Float.mjs"
|
|
34
|
+
|
|
35
|
+
import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
|
|
36
|
+
|
|
37
|
+
import * as ff_core_Instant from "../../ff/core/Instant.mjs"
|
|
38
|
+
|
|
39
|
+
import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
40
|
+
|
|
41
|
+
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
42
|
+
|
|
43
|
+
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
44
|
+
|
|
45
|
+
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
46
|
+
|
|
47
|
+
import * as ff_core_List from "../../ff/core/List.mjs"
|
|
48
|
+
|
|
49
|
+
import * as ff_core_Lock from "../../ff/core/Lock.mjs"
|
|
50
|
+
|
|
51
|
+
import * as ff_core_Log from "../../ff/core/Log.mjs"
|
|
52
|
+
|
|
53
|
+
import * as ff_core_Map from "../../ff/core/Map.mjs"
|
|
54
|
+
|
|
55
|
+
import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
|
|
56
|
+
|
|
57
|
+
import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
|
|
58
|
+
|
|
59
|
+
import * as ff_core_Option from "../../ff/core/Option.mjs"
|
|
60
|
+
|
|
61
|
+
import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
|
|
62
|
+
|
|
63
|
+
import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
64
|
+
|
|
65
|
+
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
66
|
+
|
|
67
|
+
import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
|
|
68
|
+
|
|
69
|
+
import * as ff_core_Set from "../../ff/core/Set.mjs"
|
|
70
|
+
|
|
71
|
+
import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
72
|
+
|
|
73
|
+
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
74
|
+
|
|
75
|
+
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
76
|
+
|
|
77
|
+
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
78
|
+
|
|
79
|
+
import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
|
|
80
|
+
|
|
81
|
+
import * as ff_core_Task from "../../ff/core/Task.mjs"
|
|
82
|
+
|
|
83
|
+
import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
84
|
+
|
|
85
|
+
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
86
|
+
|
|
87
|
+
// type BuildSystem
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// type BrowserCode
|
|
91
|
+
export function BrowserCode(packageGroup_, packageName_, mainFile_, assetSystem_) {
|
|
92
|
+
return {packageGroup_, packageName_, mainFile_, assetSystem_};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// type BrowserBundle
|
|
96
|
+
export function BrowserBundle(assetSystem_) {
|
|
97
|
+
return {assetSystem_};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
export function internalCallEsBuild_(self_, mainJsFile_, outputPath_, minify_, sourceMap_) {
|
|
103
|
+
throw new Error('Function internalCallEsBuild is missing on this target in sync context.');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function internalNodeCallEsBuild_(self_, mainJsFile_, outputPath_, minify_) {
|
|
107
|
+
throw new Error('Function internalNodeCallEsBuild is missing on this target in sync context.');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function internalListDirectory_(path_) {
|
|
111
|
+
function go_(currentPath_) {
|
|
112
|
+
return ff_core_Stream.Stream_flatMap(ff_core_Path.Path_entries(currentPath_), ((file_) => {
|
|
113
|
+
if(ff_core_Path.PathEntry_isDirectory(file_)) {
|
|
114
|
+
return go_(ff_core_Path.PathEntry_path(file_))
|
|
115
|
+
} else {
|
|
116
|
+
return ff_core_List.List_toStream(ff_core_List.Link(ff_core_Path.PathEntry_path(file_), ff_core_List.Empty()), false)
|
|
117
|
+
}
|
|
118
|
+
}))
|
|
119
|
+
}
|
|
120
|
+
return ff_core_Stream.Stream_toList(ff_core_Stream.Stream_map(go_(path_), ((file_) => {
|
|
121
|
+
return ff_core_Pair.Pair(("/" + ff_core_Path.Path_relativeTo(file_, path_)), (() => {
|
|
122
|
+
return ff_core_Path.Path_readStream(file_)
|
|
123
|
+
}))
|
|
124
|
+
})))
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export function internalPath_(buildSystem_, absoluteOrRelative_) {
|
|
128
|
+
throw new Error('Function internalPath is missing on this target in sync context.');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export function internalCompile_(buildSystem_, mainFile_, target_) {
|
|
132
|
+
throw new Error('Function internalCompile is missing on this target in sync context.');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function internalMainPackagePair_(buildSystem_) {
|
|
136
|
+
throw new Error('Function internalMainPackagePair is missing on this target in sync context.');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export async function internalCallEsBuild_$(self_, mainJsFile_, outputPath_, minify_, sourceMap_, $task) {
|
|
140
|
+
|
|
141
|
+
const esbuild = import$0
|
|
142
|
+
return await esbuild.build({
|
|
143
|
+
entryPoints: [mainJsFile_],
|
|
144
|
+
bundle: true,
|
|
145
|
+
minify: minify_,
|
|
146
|
+
sourcemap: sourceMap_,
|
|
147
|
+
platform: 'browser',
|
|
148
|
+
target: 'es6',
|
|
149
|
+
external: ['../../../node_modules/*'], // TODO
|
|
150
|
+
outfile: outputPath_
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export async function internalNodeCallEsBuild_$(self_, mainJsFile_, outputPath_, minify_, $task) {
|
|
156
|
+
|
|
157
|
+
const esbuild = import$0
|
|
158
|
+
return await esbuild.build({
|
|
159
|
+
entryPoints: [mainJsFile_],
|
|
160
|
+
bundle: true,
|
|
161
|
+
minify: minify_,
|
|
162
|
+
sourcemap: true,
|
|
163
|
+
platform: 'node',
|
|
164
|
+
target: 'es6',
|
|
165
|
+
external: ['../../../node_modules/*'], // TODO
|
|
166
|
+
outfile: outputPath_
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function internalListDirectory_$(path_, $task) {
|
|
172
|
+
async function go_$(currentPath_, $task) {
|
|
173
|
+
return (await ff_core_Stream.Stream_flatMap$((await ff_core_Path.Path_entries$(currentPath_, $task)), (async (file_, $task) => {
|
|
174
|
+
if((await ff_core_Path.PathEntry_isDirectory$(file_, $task))) {
|
|
175
|
+
return (await go_$((await ff_core_Path.PathEntry_path$(file_, $task)), $task))
|
|
176
|
+
} else {
|
|
177
|
+
return (await ff_core_List.List_toStream$(ff_core_List.Link((await ff_core_Path.PathEntry_path$(file_, $task)), ff_core_List.Empty()), false, $task))
|
|
178
|
+
}
|
|
179
|
+
}), $task))
|
|
180
|
+
}
|
|
181
|
+
return (await ff_core_Stream.Stream_toList$((await ff_core_Stream.Stream_map$((await go_$(path_, $task)), (async (file_, $task) => {
|
|
182
|
+
return ff_core_Pair.Pair(("/" + (await ff_core_Path.Path_relativeTo$(file_, path_, $task))), (async ($task) => {
|
|
183
|
+
return (await ff_core_Path.Path_readStream$(file_, $task))
|
|
184
|
+
}))
|
|
185
|
+
}), $task)), $task))
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export async function internalPath_$(buildSystem_, absoluteOrRelative_, $task) {
|
|
189
|
+
|
|
190
|
+
return absoluteOrRelative_
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export async function internalCompile_$(buildSystem_, mainFile_, target_, $task) {
|
|
195
|
+
|
|
196
|
+
return await $firefly_compiler.buildViaBuildSystem_$(buildSystem_, buildSystem_.fireflyPath_, mainFile_, target_, $task)
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export async function internalMainPackagePair_$(buildSystem_, $task) {
|
|
201
|
+
|
|
202
|
+
return {first_: buildSystem_.mainPackagePair_.group_, second_: buildSystem_.mainPackagePair_.name_}
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function BuildSystem_compileForBrowser(self_, mainFile_) {
|
|
207
|
+
ff_core_BuildSystem.internalCompile_(self_, ff_core_BuildSystem.internalPath_(self_, mainFile_), "browser");
|
|
208
|
+
const streams_ = ff_core_BuildSystem.internalListDirectory_(ff_core_BuildSystem.internalPath_(self_, ".firefly/output/browser"));
|
|
209
|
+
const mainPackagePair_ = ff_core_BuildSystem.internalMainPackagePair_(self_);
|
|
210
|
+
return ff_core_BuildSystem.BrowserCode(mainPackagePair_.first_, mainPackagePair_.second_, ff_core_BuildSystem.internalPath_(self_, mainFile_), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function BuildSystem_buildMode(self_) {
|
|
214
|
+
throw new Error('Function BuildSystem_buildMode is missing on this target in sync context.');
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function BuildSystem_setAssets(self_, assetSystem_) {
|
|
218
|
+
throw new Error('Function BuildSystem_setAssets is missing on this target in sync context.');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export function BuildSystem_packageAssets(self_) {
|
|
222
|
+
const streams_ = ff_core_BuildSystem.internalListDirectory_(ff_core_BuildSystem.internalPath_(self_, "."));
|
|
223
|
+
return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function BuildSystem_dependencyAssets(self_, user_, package_) {
|
|
227
|
+
return ff_core_Core.panic_("dependencyAssets not yet implemented")
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function BuildSystem_arguments(self_) {
|
|
231
|
+
throw new Error('Function BuildSystem_arguments is missing on this target in sync context.');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function BuildSystem_mainTask(self_) {
|
|
235
|
+
throw new Error('Function BuildSystem_mainTask is missing on this target in sync context.');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export async function BuildSystem_compileForBrowser$(self_, mainFile_, $task) {
|
|
239
|
+
(await ff_core_BuildSystem.internalCompile_$(self_, (await ff_core_BuildSystem.internalPath_$(self_, mainFile_, $task)), "browser", $task));
|
|
240
|
+
const streams_ = (await ff_core_BuildSystem.internalListDirectory_$((await ff_core_BuildSystem.internalPath_$(self_, ".firefly/output/browser", $task)), $task));
|
|
241
|
+
const mainPackagePair_ = (await ff_core_BuildSystem.internalMainPackagePair_$(self_, $task));
|
|
242
|
+
return ff_core_BuildSystem.BrowserCode(mainPackagePair_.first_, mainPackagePair_.second_, (await ff_core_BuildSystem.internalPath_$(self_, mainFile_, $task)), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export async function BuildSystem_buildMode$(self_, $task) {
|
|
246
|
+
return !!self_.buildMode_
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export async function BuildSystem_setAssets$(self_, assetSystem_, $task) {
|
|
250
|
+
self_.assets_ = assetSystem_
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export async function BuildSystem_packageAssets$(self_, $task) {
|
|
254
|
+
const streams_ = (await ff_core_BuildSystem.internalListDirectory_$((await ff_core_BuildSystem.internalPath_$(self_, ".", $task)), $task));
|
|
255
|
+
return ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(streams_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export async function BuildSystem_dependencyAssets$(self_, user_, package_, $task) {
|
|
259
|
+
return ff_core_Core.panic_("dependencyAssets not yet implemented")
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export async function BuildSystem_arguments$(self_, $task) {
|
|
263
|
+
return self_.array_
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export async function BuildSystem_mainTask$(self_, $task) {
|
|
267
|
+
return self_.task_
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export function BrowserCode_assets(self_) {
|
|
271
|
+
return self_.assetSystem_
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function BrowserCode_bundle(self_, minify_ = true, sourceMap_ = false) {
|
|
275
|
+
const prefix_ = ".firefly/output/browser";
|
|
276
|
+
const mainJsBaseFile_ = (ff_core_Option.Option_grab(ff_core_String.String_removeLast(ff_core_Path.Path_absolute(self_.mainFile_), ".ff")) + ".mjs");
|
|
277
|
+
const mainJsFile_ = ((((((prefix_ + "/") + self_.packageGroup_) + "/") + self_.packageName_) + "/") + mainJsBaseFile_);
|
|
278
|
+
const file_ = (prefix_ + "/Main.bundle.js");
|
|
279
|
+
ff_core_BuildSystem.internalCallEsBuild_(self_, mainJsFile_, file_, minify_, sourceMap_);
|
|
280
|
+
const assets_ = ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_core_String.String_dropFirst(file_, ff_core_String.String_size(prefix_)), (() => {
|
|
281
|
+
return ff_core_Path.Path_readStream(ff_core_Path.Path_path(self_.mainFile_, file_))
|
|
282
|
+
})), (sourceMap_
|
|
283
|
+
? ff_core_List.Link(ff_core_Pair.Pair((ff_core_String.String_dropFirst(file_, ff_core_String.String_size(prefix_)) + ".map"), (() => {
|
|
284
|
+
return ff_core_Path.Path_readStream(ff_core_Path.Path_path(self_.mainFile_, (file_ + ".map")))
|
|
285
|
+
})), ff_core_List.Empty())
|
|
286
|
+
: ff_core_List.Empty())), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String));
|
|
287
|
+
return ff_core_BuildSystem.BrowserBundle(assets_)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export async function BrowserCode_assets$(self_, $task) {
|
|
291
|
+
return self_.assetSystem_
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export async function BrowserCode_bundle$(self_, minify_ = true, sourceMap_ = false, $task) {
|
|
295
|
+
const prefix_ = ".firefly/output/browser";
|
|
296
|
+
const mainJsBaseFile_ = (ff_core_Option.Option_grab(ff_core_String.String_removeLast((await ff_core_Path.Path_absolute$(self_.mainFile_, $task)), ".ff")) + ".mjs");
|
|
297
|
+
const mainJsFile_ = ((((((prefix_ + "/") + self_.packageGroup_) + "/") + self_.packageName_) + "/") + mainJsBaseFile_);
|
|
298
|
+
const file_ = (prefix_ + "/Main.bundle.js");
|
|
299
|
+
(await ff_core_BuildSystem.internalCallEsBuild_$(self_, mainJsFile_, file_, minify_, sourceMap_, $task));
|
|
300
|
+
const assets_ = ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap(ff_core_List.Link(ff_core_Pair.Pair(ff_core_String.String_dropFirst(file_, ff_core_String.String_size(prefix_)), (async ($task) => {
|
|
301
|
+
return (await ff_core_Path.Path_readStream$((await ff_core_Path.Path_path$(self_.mainFile_, file_, $task)), $task))
|
|
302
|
+
})), (sourceMap_
|
|
303
|
+
? ff_core_List.Link(ff_core_Pair.Pair((ff_core_String.String_dropFirst(file_, ff_core_String.String_size(prefix_)) + ".map"), (async ($task) => {
|
|
304
|
+
return (await ff_core_Path.Path_readStream$((await ff_core_Path.Path_path$(self_.mainFile_, (file_ + ".map"), $task)), $task))
|
|
305
|
+
})), ff_core_List.Empty())
|
|
306
|
+
: ff_core_List.Empty())), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String));
|
|
307
|
+
return ff_core_BuildSystem.BrowserBundle(assets_)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export function BrowserBundle_assets(self_) {
|
|
311
|
+
return self_.assetSystem_
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export async function BrowserBundle_assets$(self_, $task) {
|
|
315
|
+
return self_.assetSystem_
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import * as ff_core_Any from "../../ff/core/Any.mjs"
|
|
4
|
+
|
|
5
|
+
import * as ff_core_Array from "../../ff/core/Array.mjs"
|
|
6
|
+
|
|
7
|
+
import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
|
|
8
|
+
|
|
9
|
+
import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
|
|
10
|
+
|
|
11
|
+
import * as ff_core_Bool from "../../ff/core/Bool.mjs"
|
|
12
|
+
|
|
13
|
+
import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
|
|
14
|
+
|
|
15
|
+
import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
|
|
16
|
+
|
|
17
|
+
import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
|
|
18
|
+
|
|
19
|
+
import * as ff_core_Channel from "../../ff/core/Channel.mjs"
|
|
20
|
+
|
|
21
|
+
import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
22
|
+
|
|
23
|
+
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
24
|
+
|
|
25
|
+
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
26
|
+
|
|
27
|
+
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
28
|
+
|
|
29
|
+
import * as ff_core_Error from "../../ff/core/Error.mjs"
|
|
30
|
+
|
|
31
|
+
import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
|
|
32
|
+
|
|
33
|
+
import * as ff_core_Float from "../../ff/core/Float.mjs"
|
|
34
|
+
|
|
35
|
+
import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
|
|
36
|
+
|
|
37
|
+
import * as ff_core_Instant from "../../ff/core/Instant.mjs"
|
|
38
|
+
|
|
39
|
+
import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
40
|
+
|
|
41
|
+
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
42
|
+
|
|
43
|
+
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
44
|
+
|
|
45
|
+
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
46
|
+
|
|
47
|
+
import * as ff_core_List from "../../ff/core/List.mjs"
|
|
48
|
+
|
|
49
|
+
import * as ff_core_Lock from "../../ff/core/Lock.mjs"
|
|
50
|
+
|
|
51
|
+
import * as ff_core_Log from "../../ff/core/Log.mjs"
|
|
52
|
+
|
|
53
|
+
import * as ff_core_Map from "../../ff/core/Map.mjs"
|
|
54
|
+
|
|
55
|
+
import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
|
|
56
|
+
|
|
57
|
+
import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
|
|
58
|
+
|
|
59
|
+
import * as ff_core_Option from "../../ff/core/Option.mjs"
|
|
60
|
+
|
|
61
|
+
import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
|
|
62
|
+
|
|
63
|
+
import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
64
|
+
|
|
65
|
+
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
66
|
+
|
|
67
|
+
import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
|
|
68
|
+
|
|
69
|
+
import * as ff_core_Set from "../../ff/core/Set.mjs"
|
|
70
|
+
|
|
71
|
+
import * as ff_core_Show from "../../ff/core/Show.mjs"
|
|
72
|
+
|
|
73
|
+
import * as ff_core_Stack from "../../ff/core/Stack.mjs"
|
|
74
|
+
|
|
75
|
+
import * as ff_core_Stream from "../../ff/core/Stream.mjs"
|
|
76
|
+
|
|
77
|
+
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
78
|
+
|
|
79
|
+
import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
|
|
80
|
+
|
|
81
|
+
import * as ff_core_Task from "../../ff/core/Task.mjs"
|
|
82
|
+
|
|
83
|
+
import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
84
|
+
|
|
85
|
+
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
86
|
+
|
|
87
|
+
// type Channel
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
// type ChannelAction
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
export function readOr_(channel_, body_) {
|
|
96
|
+
throw new Error('Function readOr is missing on this target in sync context.');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function writeOr_(channel_, message_, body_) {
|
|
100
|
+
throw new Error('Function writeOr is missing on this target in sync context.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function internalRunChannelAction_(action_, mode_) {
|
|
104
|
+
throw new Error('Function internalRunChannelAction is missing on this target in sync context.');
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export async function readOr_$(channel_, body_, $task) {
|
|
108
|
+
return {channel: channel_, body: body_, previous: null}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export async function writeOr_$(channel_, message_, body_, $task) {
|
|
112
|
+
return {channel: channel_, body: body_, message: message_, previous: null}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export async function internalRunChannelAction_$(action_, mode_, $task) {
|
|
116
|
+
|
|
117
|
+
ff_core_Task.Task_throwIfAborted($task)
|
|
118
|
+
|
|
119
|
+
// Convert the linked actions into an array.
|
|
120
|
+
let actions = []
|
|
121
|
+
while(action_ != null) {
|
|
122
|
+
actions.push(action_)
|
|
123
|
+
action_ = action_.previous
|
|
124
|
+
}
|
|
125
|
+
actions.reverse()
|
|
126
|
+
|
|
127
|
+
// If any reads or writes can be done immediately, do the first one and return.
|
|
128
|
+
for(let action of actions) {
|
|
129
|
+
if(action.hasOwnProperty("message")) {
|
|
130
|
+
if(action.channel.readers.size != 0) {
|
|
131
|
+
let reader = action.channel.readers.values().next().value
|
|
132
|
+
action.channel.readers.delete(reader)
|
|
133
|
+
reader.resolve(action.message)
|
|
134
|
+
return await action.body($task)
|
|
135
|
+
} else if(action.channel.buffer.length < action.channel.capacity) {
|
|
136
|
+
action.channel.buffer.push(action.message)
|
|
137
|
+
return await action.body($task)
|
|
138
|
+
}
|
|
139
|
+
} else {
|
|
140
|
+
if(action.channel.buffer.length != 0) {
|
|
141
|
+
return await action.body(action.channel.buffer.shift(), $task)
|
|
142
|
+
} else if(action.channel.writers.size != 0) {
|
|
143
|
+
let writer = action.channel.writers.values().next().value
|
|
144
|
+
action.channel.writers.delete(writer)
|
|
145
|
+
writer.resolve()
|
|
146
|
+
return await action.body(writer.message, $task)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// If there's an "immediately(body)" action, do that now.
|
|
152
|
+
if(mode_.value_ && mode_.value_.second_.value_ == null) return await mode_.value_.first_($task)
|
|
153
|
+
|
|
154
|
+
// Otherwise, start waiting for one of the readers or writers (or timeout(body), or cancellation) to happen.
|
|
155
|
+
let abort = null
|
|
156
|
+
let finish = null
|
|
157
|
+
let cleanups = []
|
|
158
|
+
function doCleanup() {
|
|
159
|
+
for(let cleanup of cleanups) cleanup()
|
|
160
|
+
}
|
|
161
|
+
let promise = new Promise((resolve, reject) => {
|
|
162
|
+
if(mode_.value_) finish = () => {doCleanup(); resolve(() => mode_.value_.first_($task))}
|
|
163
|
+
abort = () => {doCleanup(); reject($task.controller.signal.reason)}
|
|
164
|
+
for(let action of actions) {
|
|
165
|
+
if(action.hasOwnProperty("message")) {
|
|
166
|
+
let writer = {
|
|
167
|
+
resolve: () => {
|
|
168
|
+
doCleanup()
|
|
169
|
+
resolve(() => action.body($task))
|
|
170
|
+
},
|
|
171
|
+
message: action.message
|
|
172
|
+
}
|
|
173
|
+
cleanups.push(() => action.channel.writers.delete(writer))
|
|
174
|
+
action.channel.writers.add(writer)
|
|
175
|
+
} else {
|
|
176
|
+
let reader = {
|
|
177
|
+
resolve: m => {
|
|
178
|
+
doCleanup()
|
|
179
|
+
resolve(() => action.body(m, $task))
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
cleanups.push(() => action.channel.readers.delete(reader))
|
|
183
|
+
action.channel.readers.add(reader)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
})
|
|
187
|
+
let timeout = null
|
|
188
|
+
try {
|
|
189
|
+
$task.controller.signal.addEventListener('abort', abort)
|
|
190
|
+
if(finish != null) timeout = setTimeout(finish, mode_.value_.second_.value_ * 1000)
|
|
191
|
+
let body = await promise
|
|
192
|
+
if(timeout != null) { clearTimeout(timeout); timeout = null }
|
|
193
|
+
return await body()
|
|
194
|
+
} finally {
|
|
195
|
+
if(timeout != null) clearTimeout(timeout)
|
|
196
|
+
$task.controller.signal.removeEventListener('abort', abort)
|
|
197
|
+
if($task.controller.signal.aborted) $task.controller = new AbortController()
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export function Channel_read(self_) {
|
|
203
|
+
return ff_core_Channel.ChannelAction_wait(ff_core_Channel.readOr_(self_, ((_w1) => {
|
|
204
|
+
return _w1
|
|
205
|
+
})))
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export function Channel_write(self_, message_) {
|
|
209
|
+
ff_core_Channel.ChannelAction_wait(ff_core_Channel.writeOr_(self_, message_, (() => {
|
|
210
|
+
|
|
211
|
+
})))
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export async function Channel_read$(self_, $task) {
|
|
215
|
+
return (await ff_core_Channel.ChannelAction_wait$((await ff_core_Channel.readOr_$(self_, (async (_w1, $task) => {
|
|
216
|
+
return _w1
|
|
217
|
+
}), $task)), $task))
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export async function Channel_write$(self_, message_, $task) {
|
|
221
|
+
(await ff_core_Channel.ChannelAction_wait$((await ff_core_Channel.writeOr_$(self_, message_, (async ($task) => {
|
|
222
|
+
|
|
223
|
+
}), $task)), $task))
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export function ChannelAction_readOr(self_, channel_, body_) {
|
|
227
|
+
throw new Error('Function ChannelAction_readOr is missing on this target in sync context.');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export function ChannelAction_writeOr(self_, channel_, message_, body_) {
|
|
231
|
+
throw new Error('Function ChannelAction_writeOr is missing on this target in sync context.');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function ChannelAction_wait(self_) {
|
|
235
|
+
return ff_core_Channel.internalRunChannelAction_(self_, ff_core_Option.None())
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function ChannelAction_timeout(self_, duration_, body_) {
|
|
239
|
+
return ff_core_Channel.internalRunChannelAction_(self_, ff_core_Option.Some(ff_core_Pair.Pair(body_, ff_core_Option.Some(duration_))))
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export function ChannelAction_immediately(self_, body_) {
|
|
243
|
+
return ff_core_Channel.internalRunChannelAction_(self_, ff_core_Option.Some(ff_core_Pair.Pair(body_, ff_core_Option.None())))
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export async function ChannelAction_readOr$(self_, channel_, body_, $task) {
|
|
247
|
+
return {channel: channel_, body: body_, previous: self_}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export async function ChannelAction_writeOr$(self_, channel_, message_, body_, $task) {
|
|
251
|
+
return {channel: channel_, body: body_, message: message_, previous: self_}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export async function ChannelAction_wait$(self_, $task) {
|
|
255
|
+
return (await ff_core_Channel.internalRunChannelAction_$(self_, ff_core_Option.None(), $task))
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export async function ChannelAction_timeout$(self_, duration_, body_, $task) {
|
|
259
|
+
return (await ff_core_Channel.internalRunChannelAction_$(self_, ff_core_Option.Some(ff_core_Pair.Pair(body_, ff_core_Option.Some(duration_))), $task))
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export async function ChannelAction_immediately$(self_, body_, $task) {
|
|
263
|
+
return (await ff_core_Channel.internalRunChannelAction_$(self_, ff_core_Option.Some(ff_core_Pair.Pair(body_, ff_core_Option.None())), $task))
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|