firefly-compiler 0.4.40 → 0.4.48

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 (109) hide show
  1. package/.hintrc +4 -4
  2. package/.vscode/settings.json +4 -4
  3. package/bin/Release.ff +136 -71
  4. package/bin/firefly.mjs +1 -1
  5. package/compiler/Builder.ff +257 -257
  6. package/compiler/Compiler.ff +227 -227
  7. package/compiler/Dependencies.ff +186 -186
  8. package/compiler/DependencyLock.ff +17 -17
  9. package/compiler/JsEmitter.ff +946 -946
  10. package/compiler/LspHook.ff +202 -202
  11. package/compiler/ModuleCache.ff +178 -178
  12. package/compiler/Workspace.ff +88 -88
  13. package/core/.firefly/include/package-lock.json +394 -394
  14. package/core/.firefly/include/package.json +5 -5
  15. package/core/.firefly/include/prepare.sh +1 -1
  16. package/core/.firefly/package.ff +2 -2
  17. package/core/Array.ff +265 -265
  18. package/core/Atomic.ff +64 -64
  19. package/core/Box.ff +7 -7
  20. package/core/BrowserSystem.ff +40 -40
  21. package/core/BuildSystem.ff +148 -148
  22. package/core/Crypto.ff +96 -102
  23. package/core/Equal.ff +36 -36
  24. package/core/HttpClient.ff +87 -87
  25. package/core/JsSystem.ff +69 -69
  26. package/core/Json.ff +434 -434
  27. package/core/List.ff +486 -415
  28. package/core/Lock.ff +144 -144
  29. package/core/NodeSystem.ff +189 -189
  30. package/core/Ordering.ff +161 -161
  31. package/core/Path.ff +401 -401
  32. package/core/Random.ff +134 -134
  33. package/core/RbMap.ff +216 -216
  34. package/core/Show.ff +43 -43
  35. package/core/SourceLocation.ff +68 -68
  36. package/core/Task.ff +141 -141
  37. package/experimental/benchmarks/ListGrab.ff +23 -23
  38. package/experimental/benchmarks/ListGrab.java +55 -55
  39. package/experimental/benchmarks/Pyrotek45.ff +30 -30
  40. package/experimental/benchmarks/Pyrotek45.java +64 -64
  41. package/experimental/bidirectional/Bidi.ff +88 -88
  42. package/experimental/random/Index.ff +53 -53
  43. package/experimental/random/Process.ff +120 -120
  44. package/experimental/random/Scrape.ff +51 -51
  45. package/experimental/random/Symbols.ff +73 -73
  46. package/experimental/random/Tensor.ff +52 -52
  47. package/experimental/random/Units.ff +36 -36
  48. package/experimental/s3/S3TestAuthorizationHeader.ff +38 -38
  49. package/experimental/s3/S3TestPut.ff +15 -15
  50. package/experimental/tests/TestJson.ff +26 -26
  51. package/firefly.sh +0 -0
  52. package/fireflysite/Main.ff +13 -13
  53. package/lsp/.firefly/package.ff +1 -1
  54. package/lsp/CompletionHandler.ff +808 -811
  55. package/lsp/Handler.ff +714 -714
  56. package/lsp/HoverHandler.ff +79 -79
  57. package/lsp/LanguageServer.ff +272 -272
  58. package/lsp/SignatureHelpHandler.ff +55 -55
  59. package/lsp/SymbolHandler.ff +181 -181
  60. package/lsp/TestReferences.ff +16 -16
  61. package/lsp/TestReferencesCase.ff +7 -7
  62. package/lsp/stderr.txt +1 -1
  63. package/lsp/stdin.txt +10 -10
  64. package/lsp/stdout.txt +40 -40
  65. package/lux/.firefly/package.ff +1 -1
  66. package/lux/Css.ff +648 -648
  67. package/lux/CssTest.ff +48 -48
  68. package/lux/Lux.ff +487 -487
  69. package/lux/LuxEvent.ff +116 -116
  70. package/lux/Main.ff +128 -128
  71. package/lux/Main2.ff +144 -144
  72. package/output/js/ff/compiler/Builder.mjs +43 -43
  73. package/output/js/ff/compiler/Dependencies.mjs +3 -3
  74. package/output/js/ff/core/Array.mjs +59 -59
  75. package/output/js/ff/core/Atomic.mjs +36 -36
  76. package/output/js/ff/core/BrowserSystem.mjs +11 -11
  77. package/output/js/ff/core/BuildSystem.mjs +30 -30
  78. package/output/js/ff/core/Crypto.mjs +58 -62
  79. package/output/js/ff/core/HttpClient.mjs +24 -24
  80. package/output/js/ff/core/Json.mjs +147 -147
  81. package/output/js/ff/core/List.mjs +196 -50
  82. package/output/js/ff/core/Lock.mjs +97 -97
  83. package/output/js/ff/core/NodeSystem.mjs +77 -77
  84. package/output/js/ff/core/Ordering.mjs +8 -8
  85. package/output/js/ff/core/Path.mjs +231 -231
  86. package/output/js/ff/core/Random.mjs +56 -56
  87. package/output/js/ff/core/Task.mjs +31 -31
  88. package/package.json +29 -29
  89. package/rpc/.firefly/package.ff +1 -1
  90. package/rpc/Rpc.ff +69 -69
  91. package/s3/.firefly/package.ff +1 -1
  92. package/s3/S3.ff +93 -93
  93. package/unsafejs/UnsafeJs.ff +19 -19
  94. package/vscode/LICENSE.txt +21 -21
  95. package/vscode/Prepublish.ff +15 -15
  96. package/vscode/README.md +16 -16
  97. package/vscode/client/package.json +22 -22
  98. package/vscode/client/src/extension.ts +104 -104
  99. package/vscode/icons/firefly-icon.svg +10 -10
  100. package/vscode/language-configuration.json +61 -61
  101. package/vscode/package-lock.json +3623 -3623
  102. package/vscode/package.json +160 -160
  103. package/vscode/snippets.json +241 -241
  104. package/webserver/.firefly/include/package-lock.json +16 -16
  105. package/webserver/.firefly/include/package.json +5 -5
  106. package/webserver/.firefly/package.ff +2 -2
  107. package/webserver/WebServer.ff +685 -685
  108. package/websocket/.firefly/package.ff +1 -1
  109. package/websocket/WebSocket.ff +131 -131
@@ -96,71 +96,71 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
96
96
 
97
97
 
98
98
  export function read_(json_) {
99
-
100
- try {
101
- return ff_core_Option.Some(JSON.parse(json_));
102
- } catch(e) {
103
- return ff_core_Option.None();
104
- }
99
+
100
+ try {
101
+ return ff_core_Option.Some(JSON.parse(json_));
102
+ } catch(e) {
103
+ return ff_core_Option.None();
104
+ }
105
105
 
106
106
  }
107
107
 
108
108
  export function string_(json_) {
109
-
110
- return json_;
109
+
110
+ return json_;
111
111
 
112
112
  }
113
113
 
114
114
  export function int_(json_) {
115
-
116
- return json_;
115
+
116
+ return json_;
117
117
 
118
118
  }
119
119
 
120
120
  export function float_(json_) {
121
-
122
- return json_;
121
+
122
+ return json_;
123
123
 
124
124
  }
125
125
 
126
126
  export function bool_(json_) {
127
-
128
- return json_;
127
+
128
+ return json_;
129
129
 
130
130
  }
131
131
 
132
132
  export function null_() {
133
-
134
- return null;
133
+
134
+ return null;
135
135
 
136
136
  }
137
137
 
138
138
  export function array_(json_) {
139
-
140
- return json_;
139
+
140
+ return json_;
141
141
 
142
142
  }
143
143
 
144
144
  export function object_() {
145
-
146
- return {};
145
+
146
+ return {};
147
147
 
148
148
  }
149
149
 
150
150
  export function fields_(body_) {
151
-
152
- const result = {};
153
- body_((k, v) => {result[k] = v});
154
- return result;
151
+
152
+ const result = {};
153
+ body_((k, v) => {result[k] = v});
154
+ return result;
155
155
 
156
156
  }
157
157
 
158
158
  export function internalWith_(self_, field_, value_) {
159
-
160
- if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
161
- throw new Error('Not an object: ' + JSON.stringify(self_));
162
- }
163
- return {...self_, [field_]: value_};
159
+
160
+ if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
161
+ throw new Error('Not an object: ' + JSON.stringify(self_));
162
+ }
163
+ return {...self_, [field_]: value_};
164
164
 
165
165
  }
166
166
 
@@ -173,69 +173,69 @@ for(const [key, value] of Object.entries(self_)) if(!body_(key, value)) break
173
173
  }
174
174
 
175
175
  export function internalEquals_(a_, b_) {
176
-
177
- if(a_ === b_) {
178
- return true;
179
- } else if(Array.isArray(a_) || Array.isArray(b_)) {
180
- if(!Array.isArray(a_) || !Array.isArray(b_)) return false;
181
- if(a_.length !== b_.length) return false;
182
- for(let i = 0; i < a_.length; i++) {
183
- if(!internalEquals_(a_[i], b_[i])) return false;
184
- }
185
- return true;
186
- } else if(typeof a_ === 'object' && typeof b_ === 'object' && a_ !== null && b_ !== null) {
187
- const aKeys = Object.keys(a_);
188
- const bKeys = Object.keys(b_);
189
- if(aKeys.length !== bKeys.length) return false;
190
- for(const key of aKeys) {
191
- if(!Object.hasOwn(b_, key) || !internalEquals_(a_[key], b_[key])) return false;
192
- }
193
- return true;
194
- } else {
195
- return false;
196
- }
176
+
177
+ if(a_ === b_) {
178
+ return true;
179
+ } else if(Array.isArray(a_) || Array.isArray(b_)) {
180
+ if(!Array.isArray(a_) || !Array.isArray(b_)) return false;
181
+ if(a_.length !== b_.length) return false;
182
+ for(let i = 0; i < a_.length; i++) {
183
+ if(!internalEquals_(a_[i], b_[i])) return false;
184
+ }
185
+ return true;
186
+ } else if(typeof a_ === 'object' && typeof b_ === 'object' && a_ !== null && b_ !== null) {
187
+ const aKeys = Object.keys(a_);
188
+ const bKeys = Object.keys(b_);
189
+ if(aKeys.length !== bKeys.length) return false;
190
+ for(const key of aKeys) {
191
+ if(!Object.hasOwn(b_, key) || !internalEquals_(a_[key], b_[key])) return false;
192
+ }
193
+ return true;
194
+ } else {
195
+ return false;
196
+ }
197
197
 
198
198
  }
199
199
 
200
200
  export function internalCompare_(a_, b_) {
201
-
202
- if(a_ === b_) {
203
- return 0;
204
- } else if (a_ === null || b_ === null) {
205
- return a_ === null ? -1 : 1;
206
- } else if (typeof a_ === 'boolean' || typeof b_ === 'boolean') {
207
- if(typeof b_ !== 'boolean') return -1;
208
- if(typeof a_ !== 'boolean') return 1;
209
- return a_ < b_ ? -1 : 1;
210
- } else if (typeof a_ === 'number' || typeof b_ === 'number') {
211
- if(typeof b_ !== 'number') return -1;
212
- if(typeof a_ !== 'number') return 1;
213
- if(isNaN(a_)) return isNaN(b_) ? 0 : -1;
214
- if(isNaN(b_)) return 1;
215
- return a_ < b_ ? -1 : 1;
216
- } else if (typeof a_ === 'string' || typeof b_ === 'string') {
217
- if(typeof b_ !== 'string') return -1;
218
- if(typeof a_ !== 'string') return 1;
219
- return a_.localeCompare(b_, 'en');
220
- } else if(Array.isArray(a_) || Array.isArray(b_)) {
221
- if(!Array.isArray(a_) || !Array.isArray(b_)) return a_ < b_ ? -1 : 1;
222
- const length = Math.min(a_.length, b_.length);
223
- for(let i = 0; i < length; i++) {
224
- const cmp = internalCompare_(a_[i], b_[i]);
225
- if(cmp !== 0) return cmp;
226
- }
227
- return a_.length - b_.length;
228
- } else {
229
- const aKeys = Object.keys(a_).sort();
230
- const bKeys = Object.keys(b_).sort();
231
- const keyResult = internalCompare_(aKeys, bKeys);
232
- if(keyResult !== 0) return keyResult;
233
- for(const key of aKeys) {
234
- const result = internalCompare_(a_[key], b_[key]);
235
- if(result !== 0) return result;
236
- }
237
- return 0;
238
- }
201
+
202
+ if(a_ === b_) {
203
+ return 0;
204
+ } else if (a_ === null || b_ === null) {
205
+ return a_ === null ? -1 : 1;
206
+ } else if (typeof a_ === 'boolean' || typeof b_ === 'boolean') {
207
+ if(typeof b_ !== 'boolean') return -1;
208
+ if(typeof a_ !== 'boolean') return 1;
209
+ return a_ < b_ ? -1 : 1;
210
+ } else if (typeof a_ === 'number' || typeof b_ === 'number') {
211
+ if(typeof b_ !== 'number') return -1;
212
+ if(typeof a_ !== 'number') return 1;
213
+ if(isNaN(a_)) return isNaN(b_) ? 0 : -1;
214
+ if(isNaN(b_)) return 1;
215
+ return a_ < b_ ? -1 : 1;
216
+ } else if (typeof a_ === 'string' || typeof b_ === 'string') {
217
+ if(typeof b_ !== 'string') return -1;
218
+ if(typeof a_ !== 'string') return 1;
219
+ return a_.localeCompare(b_, 'en');
220
+ } else if(Array.isArray(a_) || Array.isArray(b_)) {
221
+ if(!Array.isArray(a_) || !Array.isArray(b_)) return a_ < b_ ? -1 : 1;
222
+ const length = Math.min(a_.length, b_.length);
223
+ for(let i = 0; i < length; i++) {
224
+ const cmp = internalCompare_(a_[i], b_[i]);
225
+ if(cmp !== 0) return cmp;
226
+ }
227
+ return a_.length - b_.length;
228
+ } else {
229
+ const aKeys = Object.keys(a_).sort();
230
+ const bKeys = Object.keys(b_).sort();
231
+ const keyResult = internalCompare_(aKeys, bKeys);
232
+ if(keyResult !== 0) return keyResult;
233
+ for(const key of aKeys) {
234
+ const result = internalCompare_(a_[key], b_[key]);
235
+ if(result !== 0) return result;
236
+ }
237
+ return 0;
238
+ }
239
239
 
240
240
  }
241
241
 
@@ -272,10 +272,10 @@ throw new Error('Function object is missing on this target in async context.');
272
272
  }
273
273
 
274
274
  export async function fields_$(body_, $task) {
275
-
276
- const result = {};
277
- await body_((k, v) => {result[k] = v}, $task);
278
- return result;
275
+
276
+ const result = {};
277
+ await body_((k, v) => {result[k] = v}, $task);
278
+ return result;
279
279
 
280
280
  }
281
281
 
@@ -300,8 +300,8 @@ throw new Error('Function internalCompare is missing on this target in async con
300
300
  }
301
301
 
302
302
  export function Json_write(self_, indentation_ = ff_core_Option.None()) {
303
-
304
- return JSON.stringify(self_, null, indentation_.value_);
303
+
304
+ return JSON.stringify(self_, null, indentation_.value_);
305
305
 
306
306
  }
307
307
 
@@ -310,50 +310,50 @@ return ff_core_Json.internalWith_(self_, field_, ff_core_Json_JsonLike$T.toJson_
310
310
  }
311
311
 
312
312
  export function Json_merge(self_, that_) {
313
-
314
- if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
315
- throw new Error('Not an object: ' + JSON.stringify(self_));
316
- }
317
- if(typeof that_ !== 'object' || that_ === null || Array.isArray(that_)) {
318
- throw new Error('Not an object: ' + JSON.stringify(that_));
319
- }
320
- return {...self_, ...that_};
313
+
314
+ if(typeof self_ !== 'object' || self_ === null || Array.isArray(self_)) {
315
+ throw new Error('Not an object: ' + JSON.stringify(self_));
316
+ }
317
+ if(typeof that_ !== 'object' || that_ === null || Array.isArray(that_)) {
318
+ throw new Error('Not an object: ' + JSON.stringify(that_));
319
+ }
320
+ return {...self_, ...that_};
321
321
 
322
322
  }
323
323
 
324
324
  export function Json_grabString(self_) {
325
-
326
- if(typeof self_ !== 'string') throw new Error('Not a string: ' + JSON.stringify(self_));
327
- return self_;
325
+
326
+ if(typeof self_ !== 'string') throw new Error('Not a string: ' + JSON.stringify(self_));
327
+ return self_;
328
328
 
329
329
  }
330
330
 
331
331
  export function Json_grabInt(self_) {
332
-
333
- if(!Number.isSafeInteger(self_)) throw new Error('Not an int: ' + JSON.stringify(self_));
334
- return Math.trunc(self_);
332
+
333
+ if(!Number.isSafeInteger(self_)) throw new Error('Not an int: ' + JSON.stringify(self_));
334
+ return Math.trunc(self_);
335
335
 
336
336
  }
337
337
 
338
338
  export function Json_grabFloat(self_) {
339
-
340
- if(typeof self_ !== 'number') throw new Error('Not a float: ' + JSON.stringify(self_));
341
- return self_;
339
+
340
+ if(typeof self_ !== 'number') throw new Error('Not a float: ' + JSON.stringify(self_));
341
+ return self_;
342
342
 
343
343
  }
344
344
 
345
345
  export function Json_grabBool(self_) {
346
-
347
- if(self_ === true) return true;
348
- if(self_ === false) return false;
349
- throw new Error('Not a bool: ' + JSON.stringify(self_));
346
+
347
+ if(self_ === true) return true;
348
+ if(self_ === false) return false;
349
+ throw new Error('Not a bool: ' + JSON.stringify(self_));
350
350
 
351
351
  }
352
352
 
353
353
  export function Json_grabArray(self_) {
354
-
355
- if(!Array.isArray(self_)) throw new Error('Not an array: ' + JSON.stringify(self_));
356
- return self_;
354
+
355
+ if(!Array.isArray(self_)) throw new Error('Not an array: ' + JSON.stringify(self_));
356
+ return self_;
357
357
 
358
358
  }
359
359
 
@@ -402,83 +402,83 @@ return ff_core_Option.Some(ff_core_Json.Json_grabMap(self_))
402
402
  }
403
403
 
404
404
  export function Json_isString(self_) {
405
-
406
- return typeof self_ === 'string';
405
+
406
+ return typeof self_ === 'string';
407
407
 
408
408
  }
409
409
 
410
410
  export function Json_isInt(self_) {
411
-
412
- return Number.isSafeInteger(self_);
411
+
412
+ return Number.isSafeInteger(self_);
413
413
 
414
414
  }
415
415
 
416
416
  export function Json_isFloat(self_) {
417
-
418
- return typeof self_ === 'number';
417
+
418
+ return typeof self_ === 'number';
419
419
 
420
420
  }
421
421
 
422
422
  export function Json_isBool(self_) {
423
-
424
- return typeof self_ === 'boolean';
423
+
424
+ return typeof self_ === 'boolean';
425
425
 
426
426
  }
427
427
 
428
428
  export function Json_isArray(self_) {
429
-
430
- return Array.isArray(self_);
429
+
430
+ return Array.isArray(self_);
431
431
 
432
432
  }
433
433
 
434
434
  export function Json_isObject(self_) {
435
-
436
- return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_);
435
+
436
+ return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_);
437
437
 
438
438
  }
439
439
 
440
440
  export function Json_isNull(self_) {
441
-
442
- return self_ === null;
441
+
442
+ return self_ === null;
443
443
 
444
444
  }
445
445
 
446
446
  export function Json_field(self_, key_) {
447
-
448
- return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
449
- ? self_[key_] : null;
447
+
448
+ return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
449
+ ? self_[key_] : null;
450
450
 
451
451
  }
452
452
 
453
453
  export function Json_index(self_, key_) {
454
-
455
- return typeof self_ === 'array' ? self_[key] ?? null : null;
454
+
455
+ return typeof self_ === 'array' ? self_[key] ?? null : null;
456
456
 
457
457
  }
458
458
 
459
459
  export function Json_hasField(self_, key_) {
460
-
461
- return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_);
460
+
461
+ return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_);
462
462
 
463
463
  }
464
464
 
465
465
  export function Json_getField(self_, key_) {
466
-
467
- return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
468
- ? ff_core_Option.Some(self_[key_]) : ff_core_Option.None();
466
+
467
+ return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_) && Object.hasOwn(self_, key_)
468
+ ? ff_core_Option.Some(self_[key_]) : ff_core_Option.None();
469
469
 
470
470
  }
471
471
 
472
472
  export function Json_getIndex(self_, key_) {
473
-
474
- return typeof self_ === 'array' ? ff_core_Option.Some(self_[key_] ?? null) : ff_core_Option.None();
473
+
474
+ return typeof self_ === 'array' ? ff_core_Option.Some(self_[key_] ?? null) : ff_core_Option.None();
475
475
 
476
476
  }
477
477
 
478
478
  export function Json_getFields(self_) {
479
-
480
- return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_)
481
- ? ff_core_Option.Some(Object.keys(self_)) : ff_core_Option.None();
479
+
480
+ return typeof self_ === 'object' && self_ !== null && !Array.isArray(self_)
481
+ ? ff_core_Option.Some(Object.keys(self_)) : ff_core_Option.None();
482
482
 
483
483
  }
484
484