firefly-compiler 0.5.3 → 0.5.5

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 (87) hide show
  1. package/bin/Release.ff +0 -1
  2. package/compiler/Compiler.ff +1 -0
  3. package/compiler/JsEmitter.ff +22 -7
  4. package/compiler/Parser.ff +9 -1
  5. package/compiler/Tokenizer.ff +8 -0
  6. package/{unsafejs → core}/UnsafeJs.ff +20 -0
  7. package/fireflysite/Guide.ff +2 -1
  8. package/fireflysite/Test.ff +10 -0
  9. package/fireflysite/assets/markdown/reference/FunctionsAndMethods.md +37 -9
  10. package/fireflysite/assets/markdown/reference/JavascriptInterop.md +23 -7
  11. package/output/js/ff/compiler/Builder.mjs +2 -0
  12. package/output/js/ff/compiler/Compiler.mjs +3 -1
  13. package/output/js/ff/compiler/Dependencies.mjs +2 -0
  14. package/output/js/ff/compiler/DependencyLock.mjs +2 -0
  15. package/output/js/ff/compiler/Deriver.mjs +2 -0
  16. package/output/js/ff/compiler/Dictionaries.mjs +2 -0
  17. package/output/js/ff/compiler/Environment.mjs +2 -0
  18. package/output/js/ff/compiler/Inference.mjs +2 -0
  19. package/output/js/ff/compiler/JsEmitter.mjs +108 -16
  20. package/output/js/ff/compiler/JsImporter.mjs +2 -0
  21. package/output/js/ff/compiler/LspHook.mjs +2 -0
  22. package/output/js/ff/compiler/Main.mjs +2 -0
  23. package/output/js/ff/compiler/ModuleCache.mjs +2 -0
  24. package/output/js/ff/compiler/Parser.mjs +20 -2
  25. package/output/js/ff/compiler/Patterns.mjs +2 -0
  26. package/output/js/ff/compiler/Resolver.mjs +2 -0
  27. package/output/js/ff/compiler/Substitution.mjs +2 -0
  28. package/output/js/ff/compiler/Syntax.mjs +2 -0
  29. package/output/js/ff/compiler/Token.mjs +2 -0
  30. package/output/js/ff/compiler/Tokenizer.mjs +8 -0
  31. package/output/js/ff/compiler/Unification.mjs +2 -0
  32. package/output/js/ff/compiler/Wildcards.mjs +2 -0
  33. package/output/js/ff/compiler/Workspace.mjs +2 -0
  34. package/output/js/ff/core/Any.mjs +2 -0
  35. package/output/js/ff/core/Array.mjs +2 -0
  36. package/output/js/ff/core/AssetSystem.mjs +2 -0
  37. package/output/js/ff/core/Atomic.mjs +2 -0
  38. package/output/js/ff/core/Bool.mjs +2 -0
  39. package/output/js/ff/core/BrowserSystem.mjs +2 -0
  40. package/output/js/ff/core/Buffer.mjs +2 -0
  41. package/output/js/ff/core/BuildSystem.mjs +2 -0
  42. package/output/js/ff/core/Channel.mjs +2 -0
  43. package/output/js/ff/core/Char.mjs +2 -0
  44. package/output/js/ff/core/Core.mjs +2 -0
  45. package/output/js/ff/core/Crypto.mjs +2 -0
  46. package/output/js/ff/core/Duration.mjs +2 -0
  47. package/output/js/ff/core/Equal.mjs +2 -0
  48. package/output/js/ff/core/Error.mjs +2 -0
  49. package/output/js/ff/core/FileHandle.mjs +2 -0
  50. package/output/js/ff/core/Float.mjs +2 -0
  51. package/output/js/ff/core/HttpClient.mjs +2 -0
  52. package/output/js/ff/core/Instant.mjs +2 -0
  53. package/output/js/ff/core/Int.mjs +2 -0
  54. package/output/js/ff/core/IntMap.mjs +2 -0
  55. package/output/js/ff/core/JsSystem.mjs +2 -0
  56. package/output/js/ff/core/JsValue.mjs +2 -0
  57. package/output/js/ff/core/Json.mjs +2 -0
  58. package/output/js/ff/core/List.mjs +2 -0
  59. package/output/js/ff/core/Lock.mjs +2 -0
  60. package/output/js/ff/core/Log.mjs +2 -0
  61. package/output/js/ff/core/Map.mjs +2 -0
  62. package/output/js/ff/core/NodeSystem.mjs +2 -0
  63. package/output/js/ff/core/Nothing.mjs +2 -0
  64. package/output/js/ff/core/Option.mjs +2 -0
  65. package/output/js/ff/core/Ordering.mjs +2 -0
  66. package/output/js/ff/core/Pair.mjs +2 -0
  67. package/output/js/ff/core/Path.mjs +2 -0
  68. package/output/js/ff/core/Random.mjs +2 -0
  69. package/output/js/ff/core/RbMap.mjs +2 -0
  70. package/output/js/ff/core/Serializable.mjs +2 -0
  71. package/output/js/ff/core/Set.mjs +2 -0
  72. package/output/js/ff/core/Show.mjs +2 -0
  73. package/output/js/ff/core/SourceLocation.mjs +2 -0
  74. package/output/js/ff/core/Stream.mjs +2 -0
  75. package/output/js/ff/core/String.mjs +2 -0
  76. package/output/js/ff/core/StringMap.mjs +2 -0
  77. package/output/js/ff/core/Task.mjs +2 -0
  78. package/output/js/ff/core/Try.mjs +2 -0
  79. package/output/js/ff/core/Unit.mjs +2 -0
  80. package/output/js/ff/core/UnsafeJs.mjs +191 -0
  81. package/package.json +1 -1
  82. package/postgresql/.firefly/package.ff +0 -1
  83. package/postgresql/Pg.ff +0 -2
  84. package/vscode/package.json +1 -1
  85. package/compression/.firefly/package.ff +0 -1
  86. package/compression/Compression.ff +0 -55
  87. package/unsafejs/.firefly/package.ff +0 -1
@@ -0,0 +1,191 @@
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_Crypto from "../../ff/core/Crypto.mjs"
26
+
27
+ import * as ff_core_Duration from "../../ff/core/Duration.mjs"
28
+
29
+ import * as ff_core_Equal from "../../ff/core/Equal.mjs"
30
+
31
+ import * as ff_core_Error from "../../ff/core/Error.mjs"
32
+
33
+ import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
34
+
35
+ import * as ff_core_Float from "../../ff/core/Float.mjs"
36
+
37
+ import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
38
+
39
+ import * as ff_core_Instant from "../../ff/core/Instant.mjs"
40
+
41
+ import * as ff_core_Int from "../../ff/core/Int.mjs"
42
+
43
+ import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
44
+
45
+ import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
46
+
47
+ import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
48
+
49
+ import * as ff_core_Json from "../../ff/core/Json.mjs"
50
+
51
+ import * as ff_core_List from "../../ff/core/List.mjs"
52
+
53
+ import * as ff_core_Lock from "../../ff/core/Lock.mjs"
54
+
55
+ import * as ff_core_Log from "../../ff/core/Log.mjs"
56
+
57
+ import * as ff_core_Map from "../../ff/core/Map.mjs"
58
+
59
+ import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
60
+
61
+ import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
62
+
63
+ import * as ff_core_Option from "../../ff/core/Option.mjs"
64
+
65
+ import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
66
+
67
+ import * as ff_core_Pair from "../../ff/core/Pair.mjs"
68
+
69
+ import * as ff_core_Path from "../../ff/core/Path.mjs"
70
+
71
+ import * as ff_core_Random from "../../ff/core/Random.mjs"
72
+
73
+ import * as ff_core_Serializable from "../../ff/core/Serializable.mjs"
74
+
75
+ import * as ff_core_Set from "../../ff/core/Set.mjs"
76
+
77
+ import * as ff_core_Show from "../../ff/core/Show.mjs"
78
+
79
+ import * as ff_core_SourceLocation from "../../ff/core/SourceLocation.mjs"
80
+
81
+ import * as ff_core_Stream from "../../ff/core/Stream.mjs"
82
+
83
+ import * as ff_core_String from "../../ff/core/String.mjs"
84
+
85
+ import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
86
+
87
+ import * as ff_core_Task from "../../ff/core/Task.mjs"
88
+
89
+ import * as ff_core_Try from "../../ff/core/Try.mjs"
90
+
91
+ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
92
+
93
+ import * as ff_core_UnsafeJs from "../../ff/core/UnsafeJs.mjs"
94
+
95
+
96
+
97
+
98
+
99
+ export function jsSystem_() {
100
+ return typeof globalThis !== 'undefined' ? globalThis : window
101
+ }
102
+
103
+ export function import_(module_) {
104
+ throw Error('Dynamic JS imports are not currently supported.')
105
+ }
106
+
107
+ export function await_(body_) {
108
+ return body_()
109
+ }
110
+
111
+ export function throwIfCancelled_() {
112
+
113
+ }
114
+
115
+ export function cancelled_() {
116
+ return false
117
+ }
118
+
119
+ export function inAsync_() {
120
+ return false
121
+ }
122
+
123
+ export function inBrowser_() {
124
+ return false
125
+ }
126
+
127
+ export function inNode_() {
128
+ return false
129
+ }
130
+
131
+ export function inBuild_() {
132
+ return false
133
+ }
134
+
135
+ export function value_(value_) {
136
+ return value_
137
+ }
138
+
139
+ export function fromValue_(value_) {
140
+ return value_
141
+ }
142
+
143
+ export async function jsSystem_$($task) {
144
+ return typeof globalThis !== 'undefined' ? globalThis : window
145
+ }
146
+
147
+ export async function import_$(module_, $task) {
148
+ throw new Error('Function import is missing on this target in async context.');
149
+ }
150
+
151
+ export async function await_$(body_, $task) {
152
+ throw new Error('Function await is missing on this target in async context.');
153
+ }
154
+
155
+ export async function throwIfCancelled_$($task) {
156
+ throw new Error('Function throwIfCancelled is missing on this target in async context.');
157
+ }
158
+
159
+ export async function cancelled_$($task) {
160
+ throw new Error('Function cancelled is missing on this target in async context.');
161
+ }
162
+
163
+ export async function inAsync_$($task) {
164
+ throw new Error('Function inAsync is missing on this target in async context.');
165
+ }
166
+
167
+ export async function inBrowser_$($task) {
168
+ throw new Error('Function inBrowser is missing on this target in async context.');
169
+ }
170
+
171
+ export async function inNode_$($task) {
172
+ throw new Error('Function inNode is missing on this target in async context.');
173
+ }
174
+
175
+ export async function inBuild_$($task) {
176
+ throw new Error('Function inBuild is missing on this target in async context.');
177
+ }
178
+
179
+ export async function value_$(value_, $task) {
180
+ throw new Error('Function value is missing on this target in async context.');
181
+ }
182
+
183
+ export async function fromValue_$(value_, $task) {
184
+ throw new Error('Function fromValue is missing on this target in async context.');
185
+ }
186
+
187
+
188
+
189
+
190
+
191
+
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.3",
7
+ "version": "0.5.5",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -1,3 +1,2 @@
1
1
  package ff:postgresql:0.0.0
2
- dependency ff:unsafejs:0.0.0
3
2
  include "node_modules"
package/postgresql/Pg.ff CHANGED
@@ -1,5 +1,3 @@
1
- import UnsafeJs from ff:unsafejs
2
-
3
1
  capability PgPool(jsValue: JsValue)
4
2
  capability PgConnection(jsValue: JsValue)
5
3
  capability PgRow(jsValue: JsValue) // TODO: Should be a sync class, make deriver not touch those
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.3",
7
+ "version": "0.5.5",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -1 +0,0 @@
1
- dependency ff:unsafejs:0.0.0
@@ -1,55 +0,0 @@
1
- import UnsafeJs from ff:unsafejs
2
-
3
- capability Compression {}
4
-
5
- extend self: Compression {
6
-
7
- compressBrotli(uncompressed: Buffer, level: Int = 4): Buffer {
8
- internalCompress(self, "brotli", level, uncompressed)
9
- }
10
-
11
- decompressBrotli(compressed: Buffer): Buffer {
12
-
13
- }
14
-
15
- compressGzip(uncompressed: Buffer, level: Int = 6): Buffer {
16
- internalCompress(self, "gzip", level, uncompressed)
17
- }
18
-
19
- decompressGzip(compressed: Buffer): Buffer {
20
-
21
- }
22
-
23
- compressDeflate(uncompressed: Buffer, level: Int = 6): Buffer {
24
- internalCompress(self, "deflate", level, uncompressed)
25
- }
26
-
27
- decompressDeflate(compressed: Buffer): Buffer {
28
-
29
- }
30
-
31
- }
32
-
33
- newForBrowserSystem(browserSystem: BrowserSystem): Compression
34
- target js async "return globalThis"
35
-
36
- newForNodeSystem(nodeSystem: NodeSystem): Compression
37
- target js async "return globalThis"
38
-
39
- internalCompress(compression: Compression, algorithm: String, level: Int, buffer: Buffer): Buffer {
40
- let js = UnsafeJs.jsSystem()
41
- let dataView = js.value(buffer)
42
- let uint8Array = js->Uint8Array->(dataView->buffer, dataView->byteOffset, dataView->byteLength)
43
- let stream = js->ReadableStream->(js->(
44
- start = js->{controller =>
45
- controller->enqueue(uint8Array)
46
- controller->close()
47
- }
48
- ))
49
- let ds = js->DecompressionStream->(algorithm)
50
- let decompressedStream = stream->pipeThrough(ds)
51
- let response = UnsafeJs.await {js->Response->(decompressedStream)}
52
- let decompressedData = UnsafeJs.await {response->arrayBuffer()}
53
- js->DataView->(decompressedData).grabBuffer()
54
- }
55
-
@@ -1 +0,0 @@
1
- package ff:unsafejs:0.0.0