firefly-compiler 0.4.5 → 0.4.6

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 (78) hide show
  1. package/.hintrc +4 -4
  2. package/README.md +1 -1
  3. package/core/HttpClient.ff +1 -1
  4. package/lsp/LanguageServer.ff +32 -7
  5. package/lsp/stderr.txt +1 -0
  6. package/lsp/stdin.txt +11 -0
  7. package/lsp/stdout.txt +41 -0
  8. package/lux/Main.ff +56 -2
  9. package/meetup/AutoCompletion.ff +6 -0
  10. package/output/js/ff/compiler/Builder.mjs +444 -444
  11. package/output/js/ff/compiler/Compiler.mjs +416 -416
  12. package/output/js/ff/compiler/Dependencies.mjs +389 -389
  13. package/output/js/ff/compiler/Deriver.mjs +1170 -1170
  14. package/output/js/ff/compiler/Dictionaries.mjs +1309 -1309
  15. package/output/js/ff/compiler/Environment.mjs +1015 -1015
  16. package/output/js/ff/compiler/Inference.mjs +4268 -4268
  17. package/output/js/ff/compiler/JsEmitter.mjs +5391 -5391
  18. package/output/js/ff/compiler/JsImporter.mjs +266 -266
  19. package/output/js/ff/compiler/LspHook.mjs +793 -793
  20. package/output/js/ff/compiler/Main.mjs +1675 -1675
  21. package/output/js/ff/compiler/Parser.mjs +4008 -4008
  22. package/output/js/ff/compiler/Patterns.mjs +927 -927
  23. package/output/js/ff/compiler/Resolver.mjs +2307 -2307
  24. package/output/js/ff/compiler/Substitution.mjs +1150 -1150
  25. package/output/js/ff/compiler/Syntax.mjs +12434 -12434
  26. package/output/js/ff/compiler/Token.mjs +3096 -3096
  27. package/output/js/ff/compiler/Tokenizer.mjs +593 -593
  28. package/output/js/ff/compiler/Unification.mjs +1752 -1752
  29. package/output/js/ff/compiler/Wildcards.mjs +608 -608
  30. package/output/js/ff/compiler/Workspace.mjs +687 -687
  31. package/output/js/ff/core/Any.mjs +143 -143
  32. package/output/js/ff/core/Array.mjs +547 -547
  33. package/output/js/ff/core/AssetSystem.mjs +274 -274
  34. package/output/js/ff/core/Atomic.mjs +154 -154
  35. package/output/js/ff/core/Bool.mjs +152 -152
  36. package/output/js/ff/core/Box.mjs +112 -112
  37. package/output/js/ff/core/BrowserSystem.mjs +126 -126
  38. package/output/js/ff/core/Buffer.mjs +395 -395
  39. package/output/js/ff/core/BuildSystem.mjs +296 -296
  40. package/output/js/ff/core/Channel.mjs +189 -189
  41. package/output/js/ff/core/Char.mjs +149 -149
  42. package/output/js/ff/core/Core.mjs +300 -300
  43. package/output/js/ff/core/Duration.mjs +116 -116
  44. package/output/js/ff/core/Equal.mjs +179 -179
  45. package/output/js/ff/core/Error.mjs +142 -142
  46. package/output/js/ff/core/FileHandle.mjs +150 -150
  47. package/output/js/ff/core/Float.mjs +225 -225
  48. package/output/js/ff/core/HttpClient.mjs +190 -190
  49. package/output/js/ff/core/Instant.mjs +109 -109
  50. package/output/js/ff/core/Int.mjs +265 -265
  51. package/output/js/ff/core/IntMap.mjs +280 -280
  52. package/output/js/ff/core/JsSystem.mjs +238 -238
  53. package/output/js/ff/core/JsValue.mjs +708 -708
  54. package/output/js/ff/core/List.mjs +2334 -2334
  55. package/output/js/ff/core/Lock.mjs +229 -229
  56. package/output/js/ff/core/Log.mjs +163 -163
  57. package/output/js/ff/core/Map.mjs +362 -362
  58. package/output/js/ff/core/NodeSystem.mjs +294 -294
  59. package/output/js/ff/core/Nothing.mjs +104 -104
  60. package/output/js/ff/core/Option.mjs +1015 -1015
  61. package/output/js/ff/core/Ordering.mjs +730 -730
  62. package/output/js/ff/core/Pair.mjs +331 -331
  63. package/output/js/ff/core/Path.mjs +545 -545
  64. package/output/js/ff/core/RbMap.mjs +1940 -1940
  65. package/output/js/ff/core/Serializable.mjs +428 -428
  66. package/output/js/ff/core/Set.mjs +254 -254
  67. package/output/js/ff/core/Show.mjs +205 -205
  68. package/output/js/ff/core/SourceLocation.mjs +229 -229
  69. package/output/js/ff/core/Stack.mjs +529 -529
  70. package/output/js/ff/core/Stream.mjs +1304 -1304
  71. package/output/js/ff/core/String.mjs +365 -365
  72. package/output/js/ff/core/StringMap.mjs +280 -280
  73. package/output/js/ff/core/Task.mjs +320 -320
  74. package/output/js/ff/core/Try.mjs +507 -507
  75. package/output/js/ff/core/Unit.mjs +151 -151
  76. package/package.json +29 -29
  77. package/vscode/package-lock.json +5 -5
  78. package/vscode/package.json +1 -1
@@ -1,392 +1,392 @@
1
- import * as import$0 from 'tar';
2
-
3
- import * as ff_compiler_Dependencies from "../../ff/compiler/Dependencies.mjs"
4
-
5
- import * as ff_compiler_LspHook from "../../ff/compiler/LspHook.mjs"
6
-
7
- import * as ff_compiler_Parser from "../../ff/compiler/Parser.mjs"
8
-
9
- import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
10
-
11
- import * as ff_compiler_Tokenizer from "../../ff/compiler/Tokenizer.mjs"
12
-
13
- import * as ff_compiler_Workspace from "../../ff/compiler/Workspace.mjs"
14
-
15
- import * as ff_core_Any from "../../ff/core/Any.mjs"
16
-
17
- import * as ff_core_Array from "../../ff/core/Array.mjs"
18
-
19
- import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
20
-
21
- import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
22
-
23
- import * as ff_core_Bool from "../../ff/core/Bool.mjs"
24
-
25
- import * as ff_core_Box from "../../ff/core/Box.mjs"
26
-
27
- import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
28
-
29
- import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
30
-
31
- import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
32
-
33
- import * as ff_core_Channel from "../../ff/core/Channel.mjs"
34
-
35
- import * as ff_core_Char from "../../ff/core/Char.mjs"
36
-
37
- import * as ff_core_Core from "../../ff/core/Core.mjs"
38
-
39
- import * as ff_core_Duration from "../../ff/core/Duration.mjs"
40
-
41
- import * as ff_core_Equal from "../../ff/core/Equal.mjs"
42
-
43
- import * as ff_core_Error from "../../ff/core/Error.mjs"
44
-
45
- import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
46
-
47
- import * as ff_core_Float from "../../ff/core/Float.mjs"
48
-
49
- import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
50
-
51
- import * as ff_core_Instant from "../../ff/core/Instant.mjs"
52
-
53
- import * as ff_core_Int from "../../ff/core/Int.mjs"
54
-
55
- import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
56
-
57
- import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
58
-
59
- import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
60
-
61
- import * as ff_core_List from "../../ff/core/List.mjs"
62
-
63
- import * as ff_core_Lock from "../../ff/core/Lock.mjs"
64
-
65
- import * as ff_core_Log from "../../ff/core/Log.mjs"
66
-
67
- import * as ff_core_Map from "../../ff/core/Map.mjs"
68
-
69
- import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
70
-
71
- import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
72
-
73
- import * as ff_core_Option from "../../ff/core/Option.mjs"
74
-
75
- import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
76
-
77
- import * as ff_core_Pair from "../../ff/core/Pair.mjs"
78
-
79
- import * as ff_core_Path from "../../ff/core/Path.mjs"
80
-
81
- import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
82
-
83
- import * as ff_core_Set from "../../ff/core/Set.mjs"
84
-
85
- import * as ff_core_Show from "../../ff/core/Show.mjs"
86
-
87
- import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
88
-
89
- import * as ff_core_Stack from "../../ff/core/Stack.mjs"
90
-
91
- import * as ff_core_Stream from "../../ff/core/Stream.mjs"
92
-
93
- import * as ff_core_String from "../../ff/core/String.mjs"
94
-
95
- import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
96
-
97
- import * as ff_core_Task from "../../ff/core/Task.mjs"
98
-
99
- import * as ff_core_Try from "../../ff/core/Try.mjs"
100
-
101
- import * as ff_core_Unit from "../../ff/core/Unit.mjs"
102
-
103
- // type Dependencies
104
- export function Dependencies(workspace_, packages_, packagePaths_, singleFilePackages_) {
105
- return {workspace_, packages_, packagePaths_, singleFilePackages_};
106
- }
107
-
108
- // type ResolvedDependencies
109
- export function ResolvedDependencies(mainPackagePair_, packages_, packagePaths_, singleFilePackages_) {
110
- return {mainPackagePair_, packages_, packagePaths_, singleFilePackages_};
111
- }
112
-
113
-
114
-
115
- export function process_(fetch_, path_) {
116
- const workspace_ = ff_compiler_Workspace.loadWorkspace_(path_);
117
- const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
118
- const packageInfo_ = ff_compiler_Dependencies.Dependencies_loadPackageInfo(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_);
119
- const newDependencies_ = ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, packageInfo_);
120
- ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, fetch_, newDependencies_);
121
- const packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, packageInfo_.package_.packagePair_, ff_compiler_Dependencies.findScriptPackageLocation_(path_), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
122
- return ff_compiler_Dependencies.ResolvedDependencies(packageInfo_.package_.packagePair_, self_.packages_, packagePaths_, self_.singleFilePackages_)
123
- }
124
-
125
- export function findScriptPackageLocation_(path_) {
126
- const packageDirectory_ = ((ff_core_Path.Path_extension(path_) === ".ff")
127
- ? ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_))
128
- : path_);
129
- function go_(directory_) {
130
- const packageFile_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(directory_, ".firefly"), "package.ff");
131
- if(ff_core_Path.Path_exists(packageFile_, false, false, false)) {
132
- return directory_
133
- } else if((!ff_core_Option.Option_isEmpty(ff_core_Path.Path_parent(directory_)))) {
134
- return go_(ff_core_Option.Option_grab(ff_core_Path.Path_parent(directory_)))
135
- } else {
136
- return packageDirectory_
137
- }
138
- }
139
- return go_(packageDirectory_)
140
- }
141
-
142
- export function checkPackagePairs_(dependencyPair_, packagePair_) {
143
- if(((packagePair_.group_ !== dependencyPair_.group_) || (packagePair_.name_ !== dependencyPair_.name_))) {
144
- ff_core_Core.panic_(((("Dependency declaration and package declaration disagree on package name: " + ff_compiler_Syntax.PackagePair_groupName(dependencyPair_, ":")) + " vs. ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")))
145
- }
146
- }
147
-
148
- export function internalExtractTarGz_(tarGzPath_, path_) {
149
- throw new Error('Function internalExtractTarGz is missing on this target in sync context.');
150
- }
151
-
152
- export async function process_$(fetch_, path_, $task) {
153
- const workspace_ = (await ff_compiler_Workspace.loadWorkspace_$(path_, $task));
154
- const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
155
- const packageInfo_ = (await ff_compiler_Dependencies.Dependencies_loadPackageInfo$(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_, $task));
156
- const newDependencies_ = (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, packageInfo_, $task));
157
- (await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, fetch_, newDependencies_, $task));
158
- const packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, packageInfo_.package_.packagePair_, (await ff_compiler_Dependencies.findScriptPackageLocation_$(path_, $task)), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
159
- return ff_compiler_Dependencies.ResolvedDependencies(packageInfo_.package_.packagePair_, self_.packages_, packagePaths_, self_.singleFilePackages_)
160
- }
161
-
162
- export async function findScriptPackageLocation_$(path_, $task) {
163
- const packageDirectory_ = (((await ff_core_Path.Path_extension$(path_, $task)) === ".ff")
164
- ? ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task)))
165
- : path_);
166
- async function go_$(directory_, $task) {
167
- const packageFile_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(directory_, ".firefly", $task)), "package.ff", $task));
168
- if((await ff_core_Path.Path_exists$(packageFile_, false, false, false, $task))) {
169
- return directory_
170
- } else if((!ff_core_Option.Option_isEmpty((await ff_core_Path.Path_parent$(directory_, $task))))) {
171
- return (await go_$(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(directory_, $task))), $task))
172
- } else {
173
- return packageDirectory_
174
- }
175
- }
176
- return (await go_$(packageDirectory_, $task))
177
- }
178
-
179
- export async function checkPackagePairs_$(dependencyPair_, packagePair_, $task) {
180
- if(((packagePair_.group_ !== dependencyPair_.group_) || (packagePair_.name_ !== dependencyPair_.name_))) {
181
- ff_core_Core.panic_(((("Dependency declaration and package declaration disagree on package name: " + ff_compiler_Syntax.PackagePair_groupName(dependencyPair_, ":")) + " vs. ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")))
182
- }
183
- }
184
-
185
- export async function internalExtractTarGz_$(tarGzPath_, path_, $task) {
1
+ import * as import$0 from 'tar';
2
+
3
+ import * as ff_compiler_Dependencies from "../../ff/compiler/Dependencies.mjs"
4
+
5
+ import * as ff_compiler_LspHook from "../../ff/compiler/LspHook.mjs"
6
+
7
+ import * as ff_compiler_Parser from "../../ff/compiler/Parser.mjs"
8
+
9
+ import * as ff_compiler_Syntax from "../../ff/compiler/Syntax.mjs"
10
+
11
+ import * as ff_compiler_Tokenizer from "../../ff/compiler/Tokenizer.mjs"
12
+
13
+ import * as ff_compiler_Workspace from "../../ff/compiler/Workspace.mjs"
14
+
15
+ import * as ff_core_Any from "../../ff/core/Any.mjs"
16
+
17
+ import * as ff_core_Array from "../../ff/core/Array.mjs"
18
+
19
+ import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
20
+
21
+ import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
22
+
23
+ import * as ff_core_Bool from "../../ff/core/Bool.mjs"
24
+
25
+ import * as ff_core_Box from "../../ff/core/Box.mjs"
26
+
27
+ import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
28
+
29
+ import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
30
+
31
+ import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
32
+
33
+ import * as ff_core_Channel from "../../ff/core/Channel.mjs"
34
+
35
+ import * as ff_core_Char from "../../ff/core/Char.mjs"
36
+
37
+ import * as ff_core_Core from "../../ff/core/Core.mjs"
38
+
39
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
40
+
41
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
42
+
43
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
44
+
45
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
46
+
47
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
48
+
49
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
50
+
51
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
52
+
53
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
54
+
55
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
56
+
57
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
58
+
59
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
60
+
61
+ import * as ff_core_List from "../../ff/core/List.mjs"
62
+
63
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
64
+
65
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
66
+
67
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
68
+
69
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
70
+
71
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
72
+
73
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
74
+
75
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
76
+
77
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
78
+
79
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
80
+
81
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
82
+
83
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
84
+
85
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
86
+
87
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
88
+
89
+ import * as ff_core_Stack from "../../ff/core/Stack.mjs"
90
+
91
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
92
+
93
+ import * as ff_core_String from "../../ff/core/String.mjs"
94
+
95
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
96
+
97
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
98
+
99
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
100
+
101
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
102
+
103
+ // type Dependencies
104
+ export function Dependencies(workspace_, packages_, packagePaths_, singleFilePackages_) {
105
+ return {workspace_, packages_, packagePaths_, singleFilePackages_};
106
+ }
107
+
108
+ // type ResolvedDependencies
109
+ export function ResolvedDependencies(mainPackagePair_, packages_, packagePaths_, singleFilePackages_) {
110
+ return {mainPackagePair_, packages_, packagePaths_, singleFilePackages_};
111
+ }
112
+
113
+
114
+
115
+ export function process_(fetch_, path_) {
116
+ const workspace_ = ff_compiler_Workspace.loadWorkspace_(path_);
117
+ const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
118
+ const packageInfo_ = ff_compiler_Dependencies.Dependencies_loadPackageInfo(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_);
119
+ const newDependencies_ = ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, packageInfo_);
120
+ ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, fetch_, newDependencies_);
121
+ const packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, packageInfo_.package_.packagePair_, ff_compiler_Dependencies.findScriptPackageLocation_(path_), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
122
+ return ff_compiler_Dependencies.ResolvedDependencies(packageInfo_.package_.packagePair_, self_.packages_, packagePaths_, self_.singleFilePackages_)
123
+ }
124
+
125
+ export function findScriptPackageLocation_(path_) {
126
+ const packageDirectory_ = ((ff_core_Path.Path_extension(path_) === ".ff")
127
+ ? ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_))
128
+ : path_);
129
+ function go_(directory_) {
130
+ const packageFile_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(directory_, ".firefly"), "package.ff");
131
+ if(ff_core_Path.Path_exists(packageFile_, false, false, false)) {
132
+ return directory_
133
+ } else if((!ff_core_Option.Option_isEmpty(ff_core_Path.Path_parent(directory_)))) {
134
+ return go_(ff_core_Option.Option_grab(ff_core_Path.Path_parent(directory_)))
135
+ } else {
136
+ return packageDirectory_
137
+ }
138
+ }
139
+ return go_(packageDirectory_)
140
+ }
141
+
142
+ export function checkPackagePairs_(dependencyPair_, packagePair_) {
143
+ if(((packagePair_.group_ !== dependencyPair_.group_) || (packagePair_.name_ !== dependencyPair_.name_))) {
144
+ ff_core_Core.panic_(((("Dependency declaration and package declaration disagree on package name: " + ff_compiler_Syntax.PackagePair_groupName(dependencyPair_, ":")) + " vs. ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")))
145
+ }
146
+ }
147
+
148
+ export function internalExtractTarGz_(tarGzPath_, path_) {
149
+ throw new Error('Function internalExtractTarGz is missing on this target in sync context.');
150
+ }
151
+
152
+ export async function process_$(fetch_, path_, $task) {
153
+ const workspace_ = (await ff_compiler_Workspace.loadWorkspace_$(path_, $task));
154
+ const self_ = ff_compiler_Dependencies.Dependencies(workspace_, ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet(ff_core_List.Empty(), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair));
155
+ const packageInfo_ = (await ff_compiler_Dependencies.Dependencies_loadPackageInfo$(self_, ff_compiler_Syntax.PackagePair("script", "script"), path_, $task));
156
+ const newDependencies_ = (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, packageInfo_, $task));
157
+ (await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, fetch_, newDependencies_, $task));
158
+ const packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, packageInfo_.package_.packagePair_, (await ff_compiler_Dependencies.findScriptPackageLocation_$(path_, $task)), ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
159
+ return ff_compiler_Dependencies.ResolvedDependencies(packageInfo_.package_.packagePair_, self_.packages_, packagePaths_, self_.singleFilePackages_)
160
+ }
161
+
162
+ export async function findScriptPackageLocation_$(path_, $task) {
163
+ const packageDirectory_ = (((await ff_core_Path.Path_extension$(path_, $task)) === ".ff")
164
+ ? ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task)))
165
+ : path_);
166
+ async function go_$(directory_, $task) {
167
+ const packageFile_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(directory_, ".firefly", $task)), "package.ff", $task));
168
+ if((await ff_core_Path.Path_exists$(packageFile_, false, false, false, $task))) {
169
+ return directory_
170
+ } else if((!ff_core_Option.Option_isEmpty((await ff_core_Path.Path_parent$(directory_, $task))))) {
171
+ return (await go_$(ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(directory_, $task))), $task))
172
+ } else {
173
+ return packageDirectory_
174
+ }
175
+ }
176
+ return (await go_$(packageDirectory_, $task))
177
+ }
178
+
179
+ export async function checkPackagePairs_$(dependencyPair_, packagePair_, $task) {
180
+ if(((packagePair_.group_ !== dependencyPair_.group_) || (packagePair_.name_ !== dependencyPair_.name_))) {
181
+ ff_core_Core.panic_(((("Dependency declaration and package declaration disagree on package name: " + ff_compiler_Syntax.PackagePair_groupName(dependencyPair_, ":")) + " vs. ") + ff_compiler_Syntax.PackagePair_groupName(packagePair_, ":")))
182
+ }
183
+ }
184
+
185
+ export async function internalExtractTarGz_$(tarGzPath_, path_, $task) {
186
186
 
187
187
  const tar = import$0
188
188
  await tar.extract({file: tarGzPath_, cwd: path_, strict: true})
189
-
190
- }
191
-
192
- export function Dependencies_loadPackageInfo(self_, packagePair_, path_) {
193
- const packageDirectory_ = ((ff_core_Path.Path_extension(path_) === ".ff")
194
- ? ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_))
195
- : path_);
196
- const sharedPackageFile_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(packageDirectory_, ".firefly"), "package.ff");
197
- const packageFile_ = (ff_core_Path.Path_exists(sharedPackageFile_, false, false, false)
198
- ? sharedPackageFile_
199
- : (function() {
200
- self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
201
- return path_
202
- })());
203
- const code_ = ff_core_Path.Path_readText(packageFile_);
204
- return ff_compiler_Dependencies.Dependencies_parsePackageFile(self_, packagePair_, ff_core_Path.Path_relativeTo(packageFile_, path_), code_)
205
- }
206
-
207
- export function Dependencies_parsePackageFile(self_, packagePair_, fileName_, code_) {
208
- const tokens_ = ff_compiler_Tokenizer.tokenize_(fileName_, code_, ff_core_Option.None(), true);
209
- const parser_ = ff_compiler_Parser.make_(packagePair_, fileName_, tokens_, false, ff_compiler_LspHook.disabled_());
210
- const info_ = ff_compiler_Parser.Parser_parsePackageInfo(parser_);
211
- return ff_compiler_Dependencies.Dependencies_addCoreDependencyIfMissing(self_, info_)
212
- }
213
-
214
- export function Dependencies_addCoreDependencyIfMissing(self_, info_) {
215
- if(ff_core_List.List_any(info_.dependencies_, ((d_) => {
216
- return ((d_.packagePair_.group_ === "ff") && (d_.packagePair_.name_ === "core"))
217
- }))) {
218
- return info_
219
- } else {
220
- const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(info_.package_.at_, 0, 0, 0), ff_compiler_Syntax.Trusted(), info_.package_.targets_);
221
- {
222
- const _1 = info_;
223
- {
224
- const _c = _1;
225
- return ff_compiler_Syntax.PackageInfo(_c.package_, ff_core_List.Link(coreDependency_, info_.dependencies_), _c.includes_)
226
- return
227
- }
228
- }
229
- }
230
- }
231
-
232
- export function Dependencies_processPackageInfo(self_, packageInfo_) {
233
- self_.packages_ = ff_core_Map.Map_add(self_.packages_, packageInfo_.package_.packagePair_, packageInfo_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
234
- return ff_core_List.List_filter(packageInfo_.dependencies_, ((_w1) => {
235
- return (!ff_core_Map.Map_contains(self_.packages_, _w1.packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))
236
- }))
237
- }
238
-
239
- export function Dependencies_fetchDependency(self_, path_, httpClient_, dependency_) {
240
- const location_ = ff_compiler_Workspace.Workspace_findPackageLocation(self_.workspace_, dependency_.packagePair_, dependency_.version_);
241
- if((ff_core_String.String_contains(location_, ":") && (!ff_core_String.String_startsWith(ff_core_String.String_dropFirst(location_, 1), ":", 0)))) {
242
- if((ff_core_String.String_startsWith(location_, "http://", 0) || ff_core_String.String_startsWith(location_, "https://", 0))) {
243
- const packagePair_ = dependency_.packagePair_;
244
- const directory_ = (ff_core_Path.Path_isDirectory(path_)
245
- ? path_
246
- : ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)));
247
- const dependenciesPath_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(directory_, ".firefly"), "dependencies");
248
- const dependencyPath_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(dependenciesPath_, packagePair_.group_), packagePair_.name_);
249
- const tarGzPath_ = ff_core_Path.Path_slash(dependenciesPath_, ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_));
250
- const donePath_ = ff_core_Path.Path_slash(dependenciesPath_, (ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_) + ".done"));
251
- if((!ff_core_Path.Path_exists(donePath_, false, false, false))) {
252
- ff_core_Log.trace_(("Fetching " + location_));
253
- const response_ = ff_core_HttpClient.HttpClient_fetch(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false);
254
- if((!ff_core_HttpClient.FetchResponse_ok(response_))) {
255
- ff_core_Core.panic_(("Could not download dependency: " + location_))
256
- };
257
- const buffer_ = ff_core_HttpClient.FetchResponse_readBuffer(response_);
258
- if(ff_core_Path.Path_exists(dependencyPath_, false, false, false)) {
259
- ff_core_Path.Path_delete(dependencyPath_, 0, 100)
260
- };
261
- ff_core_Path.Path_createDirectory(dependencyPath_, true);
262
- ff_core_Path.Path_writeStream(tarGzPath_, ff_core_List.List_toStream(ff_core_List.Link(buffer_, ff_core_List.Empty()), false), false);
263
- ff_compiler_Dependencies.internalExtractTarGz_(tarGzPath_, dependencyPath_);
264
- ff_core_Path.Path_renameTo(tarGzPath_, donePath_)
265
- };
266
- return dependencyPath_
267
- } else {
268
- return ff_core_Core.panic_(("Loading packages by this protocol is not supported: " + location_))
269
- }
270
- } else {
271
- return ff_core_Path.Path_path(path_, location_)
272
- }
273
- }
274
-
275
- export function Dependencies_processDependencies(self_, path_, httpClient_, dependencies_) {
276
- const packageInfos_ = ff_core_List.List_map(dependencies_, ((dependency_) => {
277
- const dependencyPath_ = ff_compiler_Dependencies.Dependencies_fetchDependency(self_, path_, httpClient_, dependency_);
278
- self_.packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, dependency_.packagePair_, dependencyPath_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
279
- const packageInfo_ = ff_compiler_Dependencies.Dependencies_loadPackageInfo(self_, dependency_.packagePair_, dependencyPath_);
280
- ff_compiler_Dependencies.checkPackagePairs_(dependency_.packagePair_, packageInfo_.package_.packagePair_);
281
- return packageInfo_
282
- }));
283
- const newDependencies_ = ff_core_List.List_flatMap(packageInfos_, ((_w1) => {
284
- return ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, _w1)
285
- }));
286
- if(ff_core_Equal.notEquals_(newDependencies_, ff_core_List.Empty(), ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
287
- ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, httpClient_, newDependencies_)
288
- }
289
- }
290
-
291
- export async function Dependencies_loadPackageInfo$(self_, packagePair_, path_, $task) {
292
- const packageDirectory_ = (((await ff_core_Path.Path_extension$(path_, $task)) === ".ff")
293
- ? ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task)))
294
- : path_);
295
- const sharedPackageFile_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(packageDirectory_, ".firefly", $task)), "package.ff", $task));
296
- const packageFile_ = ((await ff_core_Path.Path_exists$(sharedPackageFile_, false, false, false, $task))
297
- ? sharedPackageFile_
298
- : (await (async function() {
299
- self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
300
- return path_
301
- })()));
302
- const code_ = (await ff_core_Path.Path_readText$(packageFile_, $task));
303
- return (await ff_compiler_Dependencies.Dependencies_parsePackageFile$(self_, packagePair_, (await ff_core_Path.Path_relativeTo$(packageFile_, path_, $task)), code_, $task))
304
- }
305
-
306
- export async function Dependencies_parsePackageFile$(self_, packagePair_, fileName_, code_, $task) {
307
- const tokens_ = ff_compiler_Tokenizer.tokenize_(fileName_, code_, ff_core_Option.None(), true);
308
- const parser_ = ff_compiler_Parser.make_(packagePair_, fileName_, tokens_, false, ff_compiler_LspHook.disabled_());
309
- const info_ = ff_compiler_Parser.Parser_parsePackageInfo(parser_);
310
- return (await ff_compiler_Dependencies.Dependencies_addCoreDependencyIfMissing$(self_, info_, $task))
311
- }
312
-
313
- export async function Dependencies_addCoreDependencyIfMissing$(self_, info_, $task) {
314
- if(ff_core_List.List_any(info_.dependencies_, ((d_) => {
315
- return ((d_.packagePair_.group_ === "ff") && (d_.packagePair_.name_ === "core"))
316
- }))) {
317
- return info_
318
- } else {
319
- const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(info_.package_.at_, 0, 0, 0), ff_compiler_Syntax.Trusted(), info_.package_.targets_);
320
- {
321
- const _1 = info_;
322
- {
323
- const _c = _1;
324
- return ff_compiler_Syntax.PackageInfo(_c.package_, ff_core_List.Link(coreDependency_, info_.dependencies_), _c.includes_)
325
- return
326
- }
327
- }
328
- }
329
- }
330
-
331
- export async function Dependencies_processPackageInfo$(self_, packageInfo_, $task) {
332
- self_.packages_ = ff_core_Map.Map_add(self_.packages_, packageInfo_.package_.packagePair_, packageInfo_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
333
- return ff_core_List.List_filter(packageInfo_.dependencies_, ((_w1) => {
334
- return (!ff_core_Map.Map_contains(self_.packages_, _w1.packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))
335
- }))
336
- }
337
-
338
- export async function Dependencies_fetchDependency$(self_, path_, httpClient_, dependency_, $task) {
339
- const location_ = ff_compiler_Workspace.Workspace_findPackageLocation(self_.workspace_, dependency_.packagePair_, dependency_.version_);
340
- if((ff_core_String.String_contains(location_, ":") && (!ff_core_String.String_startsWith(ff_core_String.String_dropFirst(location_, 1), ":", 0)))) {
341
- if((ff_core_String.String_startsWith(location_, "http://", 0) || ff_core_String.String_startsWith(location_, "https://", 0))) {
342
- const packagePair_ = dependency_.packagePair_;
343
- const directory_ = ((await ff_core_Path.Path_isDirectory$(path_, $task))
344
- ? path_
345
- : ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))));
346
- const dependenciesPath_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(directory_, ".firefly", $task)), "dependencies", $task));
347
- const dependencyPath_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(dependenciesPath_, packagePair_.group_, $task)), packagePair_.name_, $task));
348
- const tarGzPath_ = (await ff_core_Path.Path_slash$(dependenciesPath_, ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_), $task));
349
- const donePath_ = (await ff_core_Path.Path_slash$(dependenciesPath_, (ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_) + ".done"), $task));
350
- if((!(await ff_core_Path.Path_exists$(donePath_, false, false, false, $task)))) {
351
- ff_core_Log.trace_(("Fetching " + location_));
352
- const response_ = (await ff_core_HttpClient.HttpClient_fetch$(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false, $task));
353
- if((!(await ff_core_HttpClient.FetchResponse_ok$(response_, $task)))) {
354
- ff_core_Core.panic_(("Could not download dependency: " + location_))
355
- };
356
- const buffer_ = (await ff_core_HttpClient.FetchResponse_readBuffer$(response_, $task));
357
- if((await ff_core_Path.Path_exists$(dependencyPath_, false, false, false, $task))) {
358
- (await ff_core_Path.Path_delete$(dependencyPath_, 0, 100, $task))
359
- };
360
- (await ff_core_Path.Path_createDirectory$(dependencyPath_, true, $task));
361
- (await ff_core_Path.Path_writeStream$(tarGzPath_, (await ff_core_List.List_toStream$(ff_core_List.Link(buffer_, ff_core_List.Empty()), false, $task)), false, $task));
362
- (await ff_compiler_Dependencies.internalExtractTarGz_$(tarGzPath_, dependencyPath_, $task));
363
- (await ff_core_Path.Path_renameTo$(tarGzPath_, donePath_, $task))
364
- };
365
- return dependencyPath_
366
- } else {
367
- return ff_core_Core.panic_(("Loading packages by this protocol is not supported: " + location_))
368
- }
369
- } else {
370
- return (await ff_core_Path.Path_path$(path_, location_, $task))
371
- }
372
- }
373
-
374
- export async function Dependencies_processDependencies$(self_, path_, httpClient_, dependencies_, $task) {
375
- const packageInfos_ = (await ff_core_List.List_map$(dependencies_, (async (dependency_, $task) => {
376
- const dependencyPath_ = (await ff_compiler_Dependencies.Dependencies_fetchDependency$(self_, path_, httpClient_, dependency_, $task));
377
- self_.packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, dependency_.packagePair_, dependencyPath_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
378
- const packageInfo_ = (await ff_compiler_Dependencies.Dependencies_loadPackageInfo$(self_, dependency_.packagePair_, dependencyPath_, $task));
379
- ff_compiler_Dependencies.checkPackagePairs_(dependency_.packagePair_, packageInfo_.package_.packagePair_);
380
- return packageInfo_
381
- }), $task));
382
- const newDependencies_ = (await ff_core_List.List_flatMap$(packageInfos_, (async (_w1, $task) => {
383
- return (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, _w1, $task))
384
- }), $task));
385
- if(ff_core_Equal.notEquals_(newDependencies_, ff_core_List.Empty(), ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
386
- (await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, httpClient_, newDependencies_, $task))
387
- }
388
- }
389
-
390
-
391
-
392
-
189
+
190
+ }
191
+
192
+ export function Dependencies_loadPackageInfo(self_, packagePair_, path_) {
193
+ const packageDirectory_ = ((ff_core_Path.Path_extension(path_) === ".ff")
194
+ ? ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_))
195
+ : path_);
196
+ const sharedPackageFile_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(packageDirectory_, ".firefly"), "package.ff");
197
+ const packageFile_ = (ff_core_Path.Path_exists(sharedPackageFile_, false, false, false)
198
+ ? sharedPackageFile_
199
+ : (function() {
200
+ self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
201
+ return path_
202
+ })());
203
+ const code_ = ff_core_Path.Path_readText(packageFile_);
204
+ return ff_compiler_Dependencies.Dependencies_parsePackageFile(self_, packagePair_, ff_core_Path.Path_relativeTo(packageFile_, path_), code_)
205
+ }
206
+
207
+ export function Dependencies_parsePackageFile(self_, packagePair_, fileName_, code_) {
208
+ const tokens_ = ff_compiler_Tokenizer.tokenize_(fileName_, code_, ff_core_Option.None(), true);
209
+ const parser_ = ff_compiler_Parser.make_(packagePair_, fileName_, tokens_, false, ff_compiler_LspHook.disabled_());
210
+ const info_ = ff_compiler_Parser.Parser_parsePackageInfo(parser_);
211
+ return ff_compiler_Dependencies.Dependencies_addCoreDependencyIfMissing(self_, info_)
212
+ }
213
+
214
+ export function Dependencies_addCoreDependencyIfMissing(self_, info_) {
215
+ if(ff_core_List.List_any(info_.dependencies_, ((d_) => {
216
+ return ((d_.packagePair_.group_ === "ff") && (d_.packagePair_.name_ === "core"))
217
+ }))) {
218
+ return info_
219
+ } else {
220
+ const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(info_.package_.at_, 0, 0, 0), ff_compiler_Syntax.Trusted(), info_.package_.targets_);
221
+ {
222
+ const _1 = info_;
223
+ {
224
+ const _c = _1;
225
+ return ff_compiler_Syntax.PackageInfo(_c.package_, ff_core_List.Link(coreDependency_, info_.dependencies_), _c.includes_)
226
+ return
227
+ }
228
+ }
229
+ }
230
+ }
231
+
232
+ export function Dependencies_processPackageInfo(self_, packageInfo_) {
233
+ self_.packages_ = ff_core_Map.Map_add(self_.packages_, packageInfo_.package_.packagePair_, packageInfo_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
234
+ return ff_core_List.List_filter(packageInfo_.dependencies_, ((_w1) => {
235
+ return (!ff_core_Map.Map_contains(self_.packages_, _w1.packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))
236
+ }))
237
+ }
238
+
239
+ export function Dependencies_fetchDependency(self_, path_, httpClient_, dependency_) {
240
+ const location_ = ff_compiler_Workspace.Workspace_findPackageLocation(self_.workspace_, dependency_.packagePair_, dependency_.version_);
241
+ if((ff_core_String.String_contains(location_, ":") && (!ff_core_String.String_startsWith(ff_core_String.String_dropFirst(location_, 1), ":", 0)))) {
242
+ if((ff_core_String.String_startsWith(location_, "http://", 0) || ff_core_String.String_startsWith(location_, "https://", 0))) {
243
+ const packagePair_ = dependency_.packagePair_;
244
+ const directory_ = (ff_core_Path.Path_isDirectory(path_)
245
+ ? path_
246
+ : ff_core_Option.Option_grab(ff_core_Path.Path_parent(path_)));
247
+ const dependenciesPath_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(directory_, ".firefly"), "dependencies");
248
+ const dependencyPath_ = ff_core_Path.Path_slash(ff_core_Path.Path_slash(dependenciesPath_, packagePair_.group_), packagePair_.name_);
249
+ const tarGzPath_ = ff_core_Path.Path_slash(dependenciesPath_, ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_));
250
+ const donePath_ = ff_core_Path.Path_slash(dependenciesPath_, (ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_) + ".done"));
251
+ if((!ff_core_Path.Path_exists(donePath_, false, false, false))) {
252
+ ff_core_Log.trace_(("Fetching " + location_));
253
+ const response_ = ff_core_HttpClient.HttpClient_fetch(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false);
254
+ if((!ff_core_HttpClient.FetchResponse_ok(response_))) {
255
+ ff_core_Core.panic_(("Could not download dependency: " + location_))
256
+ };
257
+ const buffer_ = ff_core_HttpClient.FetchResponse_readBuffer(response_);
258
+ if(ff_core_Path.Path_exists(dependencyPath_, false, false, false)) {
259
+ ff_core_Path.Path_delete(dependencyPath_, 0, 100)
260
+ };
261
+ ff_core_Path.Path_createDirectory(dependencyPath_, true);
262
+ ff_core_Path.Path_writeStream(tarGzPath_, ff_core_List.List_toStream(ff_core_List.Link(buffer_, ff_core_List.Empty()), false), false);
263
+ ff_compiler_Dependencies.internalExtractTarGz_(tarGzPath_, dependencyPath_);
264
+ ff_core_Path.Path_renameTo(tarGzPath_, donePath_)
265
+ };
266
+ return dependencyPath_
267
+ } else {
268
+ return ff_core_Core.panic_(("Loading packages by this protocol is not supported: " + location_))
269
+ }
270
+ } else {
271
+ return ff_core_Path.Path_path(path_, location_)
272
+ }
273
+ }
274
+
275
+ export function Dependencies_processDependencies(self_, path_, httpClient_, dependencies_) {
276
+ const packageInfos_ = ff_core_List.List_map(dependencies_, ((dependency_) => {
277
+ const dependencyPath_ = ff_compiler_Dependencies.Dependencies_fetchDependency(self_, path_, httpClient_, dependency_);
278
+ self_.packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, dependency_.packagePair_, dependencyPath_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
279
+ const packageInfo_ = ff_compiler_Dependencies.Dependencies_loadPackageInfo(self_, dependency_.packagePair_, dependencyPath_);
280
+ ff_compiler_Dependencies.checkPackagePairs_(dependency_.packagePair_, packageInfo_.package_.packagePair_);
281
+ return packageInfo_
282
+ }));
283
+ const newDependencies_ = ff_core_List.List_flatMap(packageInfos_, ((_w1) => {
284
+ return ff_compiler_Dependencies.Dependencies_processPackageInfo(self_, _w1)
285
+ }));
286
+ if(ff_core_Equal.notEquals_(newDependencies_, ff_core_List.Empty(), ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
287
+ ff_compiler_Dependencies.Dependencies_processDependencies(self_, path_, httpClient_, newDependencies_)
288
+ }
289
+ }
290
+
291
+ export async function Dependencies_loadPackageInfo$(self_, packagePair_, path_, $task) {
292
+ const packageDirectory_ = (((await ff_core_Path.Path_extension$(path_, $task)) === ".ff")
293
+ ? ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task)))
294
+ : path_);
295
+ const sharedPackageFile_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(packageDirectory_, ".firefly", $task)), "package.ff", $task));
296
+ const packageFile_ = ((await ff_core_Path.Path_exists$(sharedPackageFile_, false, false, false, $task))
297
+ ? sharedPackageFile_
298
+ : (await (async function() {
299
+ self_.singleFilePackages_ = ff_core_Set.Set_add(self_.singleFilePackages_, packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
300
+ return path_
301
+ })()));
302
+ const code_ = (await ff_core_Path.Path_readText$(packageFile_, $task));
303
+ return (await ff_compiler_Dependencies.Dependencies_parsePackageFile$(self_, packagePair_, (await ff_core_Path.Path_relativeTo$(packageFile_, path_, $task)), code_, $task))
304
+ }
305
+
306
+ export async function Dependencies_parsePackageFile$(self_, packagePair_, fileName_, code_, $task) {
307
+ const tokens_ = ff_compiler_Tokenizer.tokenize_(fileName_, code_, ff_core_Option.None(), true);
308
+ const parser_ = ff_compiler_Parser.make_(packagePair_, fileName_, tokens_, false, ff_compiler_LspHook.disabled_());
309
+ const info_ = ff_compiler_Parser.Parser_parsePackageInfo(parser_);
310
+ return (await ff_compiler_Dependencies.Dependencies_addCoreDependencyIfMissing$(self_, info_, $task))
311
+ }
312
+
313
+ export async function Dependencies_addCoreDependencyIfMissing$(self_, info_, $task) {
314
+ if(ff_core_List.List_any(info_.dependencies_, ((d_) => {
315
+ return ((d_.packagePair_.group_ === "ff") && (d_.packagePair_.name_ === "core"))
316
+ }))) {
317
+ return info_
318
+ } else {
319
+ const coreDependency_ = ff_compiler_Syntax.DDependency(info_.package_.at_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(info_.package_.at_, 0, 0, 0), ff_compiler_Syntax.Trusted(), info_.package_.targets_);
320
+ {
321
+ const _1 = info_;
322
+ {
323
+ const _c = _1;
324
+ return ff_compiler_Syntax.PackageInfo(_c.package_, ff_core_List.Link(coreDependency_, info_.dependencies_), _c.includes_)
325
+ return
326
+ }
327
+ }
328
+ }
329
+ }
330
+
331
+ export async function Dependencies_processPackageInfo$(self_, packageInfo_, $task) {
332
+ self_.packages_ = ff_core_Map.Map_add(self_.packages_, packageInfo_.package_.packagePair_, packageInfo_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
333
+ return ff_core_List.List_filter(packageInfo_.dependencies_, ((_w1) => {
334
+ return (!ff_core_Map.Map_contains(self_.packages_, _w1.packagePair_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair))
335
+ }))
336
+ }
337
+
338
+ export async function Dependencies_fetchDependency$(self_, path_, httpClient_, dependency_, $task) {
339
+ const location_ = ff_compiler_Workspace.Workspace_findPackageLocation(self_.workspace_, dependency_.packagePair_, dependency_.version_);
340
+ if((ff_core_String.String_contains(location_, ":") && (!ff_core_String.String_startsWith(ff_core_String.String_dropFirst(location_, 1), ":", 0)))) {
341
+ if((ff_core_String.String_startsWith(location_, "http://", 0) || ff_core_String.String_startsWith(location_, "https://", 0))) {
342
+ const packagePair_ = dependency_.packagePair_;
343
+ const directory_ = ((await ff_core_Path.Path_isDirectory$(path_, $task))
344
+ ? path_
345
+ : ff_core_Option.Option_grab((await ff_core_Path.Path_parent$(path_, $task))));
346
+ const dependenciesPath_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(directory_, ".firefly", $task)), "dependencies", $task));
347
+ const dependencyPath_ = (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(dependenciesPath_, packagePair_.group_, $task)), packagePair_.name_, $task));
348
+ const tarGzPath_ = (await ff_core_Path.Path_slash$(dependenciesPath_, ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_), $task));
349
+ const donePath_ = (await ff_core_Path.Path_slash$(dependenciesPath_, (ff_compiler_Workspace.tarGzName_(packagePair_, dependency_.version_) + ".done"), $task));
350
+ if((!(await ff_core_Path.Path_exists$(donePath_, false, false, false, $task)))) {
351
+ ff_core_Log.trace_(("Fetching " + location_));
352
+ const response_ = (await ff_core_HttpClient.HttpClient_fetch$(httpClient_, location_, "GET", ff_core_HttpClient.emptyList_, ff_core_Option.None(), ff_core_HttpClient.RedirectFollow(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), ff_core_Option.None(), false, $task));
353
+ if((!(await ff_core_HttpClient.FetchResponse_ok$(response_, $task)))) {
354
+ ff_core_Core.panic_(("Could not download dependency: " + location_))
355
+ };
356
+ const buffer_ = (await ff_core_HttpClient.FetchResponse_readBuffer$(response_, $task));
357
+ if((await ff_core_Path.Path_exists$(dependencyPath_, false, false, false, $task))) {
358
+ (await ff_core_Path.Path_delete$(dependencyPath_, 0, 100, $task))
359
+ };
360
+ (await ff_core_Path.Path_createDirectory$(dependencyPath_, true, $task));
361
+ (await ff_core_Path.Path_writeStream$(tarGzPath_, (await ff_core_List.List_toStream$(ff_core_List.Link(buffer_, ff_core_List.Empty()), false, $task)), false, $task));
362
+ (await ff_compiler_Dependencies.internalExtractTarGz_$(tarGzPath_, dependencyPath_, $task));
363
+ (await ff_core_Path.Path_renameTo$(tarGzPath_, donePath_, $task))
364
+ };
365
+ return dependencyPath_
366
+ } else {
367
+ return ff_core_Core.panic_(("Loading packages by this protocol is not supported: " + location_))
368
+ }
369
+ } else {
370
+ return (await ff_core_Path.Path_path$(path_, location_, $task))
371
+ }
372
+ }
373
+
374
+ export async function Dependencies_processDependencies$(self_, path_, httpClient_, dependencies_, $task) {
375
+ const packageInfos_ = (await ff_core_List.List_map$(dependencies_, (async (dependency_, $task) => {
376
+ const dependencyPath_ = (await ff_compiler_Dependencies.Dependencies_fetchDependency$(self_, path_, httpClient_, dependency_, $task));
377
+ self_.packagePaths_ = ff_core_Map.Map_add(self_.packagePaths_, dependency_.packagePair_, dependencyPath_, ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair);
378
+ const packageInfo_ = (await ff_compiler_Dependencies.Dependencies_loadPackageInfo$(self_, dependency_.packagePair_, dependencyPath_, $task));
379
+ ff_compiler_Dependencies.checkPackagePairs_(dependency_.packagePair_, packageInfo_.package_.packagePair_);
380
+ return packageInfo_
381
+ }), $task));
382
+ const newDependencies_ = (await ff_core_List.List_flatMap$(packageInfos_, (async (_w1, $task) => {
383
+ return (await ff_compiler_Dependencies.Dependencies_processPackageInfo$(self_, _w1, $task))
384
+ }), $task));
385
+ if(ff_core_Equal.notEquals_(newDependencies_, ff_core_List.Empty(), ff_core_List.ff_core_Equal_Equal$ff_core_List_List(ff_compiler_Syntax.ff_core_Equal_Equal$ff_compiler_Syntax_DDependency))) {
386
+ (await ff_compiler_Dependencies.Dependencies_processDependencies$(self_, path_, httpClient_, newDependencies_, $task))
387
+ }
388
+ }
389
+
390
+
391
+
392
+