firefly-compiler 0.5.50 → 0.5.52

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 (132) hide show
  1. package/bin/Release.ff +3 -3
  2. package/bin/firefly.mjs +1 -1
  3. package/compiler/Builder.ff +11 -5
  4. package/compiler/Compiler.ff +14 -3
  5. package/compiler/JsEmitter.ff +6 -11
  6. package/compiler/Main.ff +10 -15
  7. package/compiler/ModuleCache.ff +2 -1
  8. package/core/Buffer.ff +26 -4
  9. package/core/BuildSystem.ff +49 -46
  10. package/core/JsValue.ff +5 -0
  11. package/experimental/date/Date.ff +604 -0
  12. package/experimental/date/Main.ff +51 -0
  13. package/experimental/random/AsciiBuffer.ff +15 -0
  14. package/experimental/rhymeapp/Main.ff +2 -3
  15. package/experimental/site/Main.ff +2 -2
  16. package/experimental/site2/Main.ff +2 -2
  17. package/firefly.sh +1 -1
  18. package/fireflysite/CommunityOverview.ff +3 -3
  19. package/fireflysite/CountingButtonDemo.ff +3 -3
  20. package/fireflysite/ExamplesOverview.ff +3 -12
  21. package/fireflysite/FrontPage.ff +3 -3
  22. package/fireflysite/GettingStarted.ff +3 -3
  23. package/fireflysite/Guide.ff +7 -187
  24. package/fireflysite/Html.ff +66 -0
  25. package/fireflysite/Main.ff +13 -77
  26. package/fireflysite/MatchingPasswordsDemo.ff +3 -3
  27. package/fireflysite/Menu.ff +59 -0
  28. package/fireflysite/PackagesOverview.ff +3 -3
  29. package/fireflysite/PostgresqlDemo.ff +3 -3
  30. package/fireflysite/RouteFront.ff +30 -0
  31. package/fireflysite/RouteNonMarkdown.ff +48 -0
  32. package/fireflysite/RouteReference.ff +40 -0
  33. package/fireflysite/Router.ff +33 -0
  34. package/fireflysite/Website.ff +133 -0
  35. package/fireflysite/assets/markdown/reference/{FunctionsAndMethods.md → functions-and-methods.md} +1 -1
  36. package/fireflysite/assets/markdown/reference/{StatementsAndExpressions.md → statements-and-expressions.md} +0 -1
  37. package/fireflysite/assets/markdown/reference/{StructuredConcurrency.md → structured-concurrency.md} +0 -1
  38. package/fireflysite/assets/markdown/reference.md +3 -0
  39. package/graph/.firefly/package.ff +1 -0
  40. package/graph/Graph.ff +79 -0
  41. package/lsp/CompletionHandler.ff +2 -2
  42. package/lux/CssTest.ff +2 -2
  43. package/lux/Main.ff +2 -2
  44. package/lux/Main2.ff +2 -2
  45. package/output/js/ff/compiler/Builder.mjs +44 -12
  46. package/output/js/ff/compiler/Compiler.mjs +28 -10
  47. package/output/js/ff/compiler/Dependencies.mjs +0 -2
  48. package/output/js/ff/compiler/DependencyLock.mjs +0 -2
  49. package/output/js/ff/compiler/Deriver.mjs +0 -2
  50. package/output/js/ff/compiler/Dictionaries.mjs +0 -2
  51. package/output/js/ff/compiler/Environment.mjs +0 -2
  52. package/output/js/ff/compiler/Inference.mjs +0 -2
  53. package/output/js/ff/compiler/JsEmitter.mjs +12 -30
  54. package/output/js/ff/compiler/JsImporter.mjs +0 -2
  55. package/output/js/ff/compiler/LspHook.mjs +0 -2
  56. package/output/js/ff/compiler/Main.mjs +24 -47
  57. package/output/js/ff/compiler/Main.run.mjs +25 -0
  58. package/output/js/ff/compiler/ModuleCache.mjs +4 -6
  59. package/output/js/ff/compiler/Parser.mjs +0 -2
  60. package/output/js/ff/compiler/Patterns.mjs +0 -2
  61. package/output/js/ff/compiler/Resolver.mjs +0 -2
  62. package/output/js/ff/compiler/Substitution.mjs +0 -2
  63. package/output/js/ff/compiler/Syntax.mjs +0 -2
  64. package/output/js/ff/compiler/Token.mjs +0 -2
  65. package/output/js/ff/compiler/Tokenizer.mjs +0 -2
  66. package/output/js/ff/compiler/Unification.mjs +0 -2
  67. package/output/js/ff/compiler/Wildcards.mjs +0 -2
  68. package/output/js/ff/compiler/Workspace.mjs +0 -2
  69. package/output/js/ff/core/Any.mjs +0 -2
  70. package/output/js/ff/core/Array.mjs +0 -2
  71. package/output/js/ff/core/AssetSystem.mjs +0 -2
  72. package/output/js/ff/core/Atomic.mjs +0 -2
  73. package/output/js/ff/core/Bool.mjs +0 -2
  74. package/output/js/ff/core/BrowserSystem.mjs +0 -2
  75. package/output/js/ff/core/Buffer.mjs +50 -10
  76. package/output/js/ff/core/BuildSystem.mjs +92 -72
  77. package/output/js/ff/core/Channel.mjs +0 -2
  78. package/output/js/ff/core/Char.mjs +0 -2
  79. package/output/js/ff/core/Core.mjs +0 -2
  80. package/output/js/ff/core/Crypto.mjs +0 -2
  81. package/output/js/ff/core/Date.mjs +0 -2
  82. package/output/js/ff/core/Duration.mjs +0 -2
  83. package/output/js/ff/core/Equal.mjs +0 -2
  84. package/output/js/ff/core/Error.mjs +0 -2
  85. package/output/js/ff/core/FileHandle.mjs +0 -2
  86. package/output/js/ff/core/Float.mjs +0 -2
  87. package/output/js/ff/core/HttpClient.mjs +0 -2
  88. package/output/js/ff/core/Int.mjs +0 -2
  89. package/output/js/ff/core/IntMap.mjs +0 -2
  90. package/output/js/ff/core/Js.mjs +0 -2
  91. package/output/js/ff/core/JsSystem.mjs +0 -2
  92. package/output/js/ff/core/JsValue.mjs +8 -2
  93. package/output/js/ff/core/Json.mjs +0 -2
  94. package/output/js/ff/core/List.mjs +0 -2
  95. package/output/js/ff/core/Lock.mjs +0 -2
  96. package/output/js/ff/core/Log.mjs +0 -2
  97. package/output/js/ff/core/Map.mjs +0 -2
  98. package/output/js/ff/core/NodeSystem.mjs +0 -2
  99. package/output/js/ff/core/Nothing.mjs +0 -2
  100. package/output/js/ff/core/Option.mjs +0 -2
  101. package/output/js/ff/core/Ordering.mjs +0 -2
  102. package/output/js/ff/core/Pair.mjs +0 -2
  103. package/output/js/ff/core/Path.mjs +0 -2
  104. package/output/js/ff/core/Queue.mjs +0 -2
  105. package/output/js/ff/core/Random.mjs +0 -2
  106. package/output/js/ff/core/RbMap.mjs +0 -2
  107. package/output/js/ff/core/Serializable.mjs +0 -2
  108. package/output/js/ff/core/Set.mjs +0 -2
  109. package/output/js/ff/core/Show.mjs +0 -2
  110. package/output/js/ff/core/SourceLocation.mjs +0 -2
  111. package/output/js/ff/core/Stream.mjs +0 -2
  112. package/output/js/ff/core/String.mjs +0 -2
  113. package/output/js/ff/core/StringMap.mjs +0 -2
  114. package/output/js/ff/core/Task.mjs +0 -2
  115. package/output/js/ff/core/Try.mjs +0 -2
  116. package/output/js/ff/core/Unit.mjs +0 -2
  117. package/package.json +1 -1
  118. package/vscode/client/src/extension.ts +1 -1
  119. package/vscode/package.json +1 -1
  120. package/vscode/snippets.json +2 -2
  121. package/webserver/WebRoute.ff +51 -14
  122. package/fireflysite/ReferenceAll.ff +0 -18
  123. /package/fireflysite/assets/markdown/reference/{BaseTypes.md → base-types.md} +0 -0
  124. /package/fireflysite/assets/markdown/reference/{EmittedJavascript.md → emitted-javascript.md} +0 -0
  125. /package/fireflysite/assets/markdown/reference/{Exceptions.md → exceptions.md} +0 -0
  126. /package/fireflysite/assets/markdown/reference/{JavascriptInterop.md → javascript-interop.md} +0 -0
  127. /package/fireflysite/assets/markdown/reference/{ModulesAndPackages.md → modules-and-packages.md} +0 -0
  128. /package/fireflysite/assets/markdown/reference/{PatternMatching.md → pattern-matching.md} +0 -0
  129. /package/fireflysite/assets/markdown/reference/{TraitsAndInstances.md → traits-and-instances.md} +0 -0
  130. /package/fireflysite/assets/markdown/reference/{UserDefinedTypes.md → user-defined-types.md} +0 -0
  131. /package/fireflysite/assets/markdown/scratch/{ControlFlow.md → control-flow.md} +0 -0
  132. /package/fireflysite/assets/markdown/{reference/OldStructuredConcurrency.md → scratch/old-structured-concurrency.md} +0 -0
@@ -881,5 +881,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
881
881
  }
882
882
  }
883
883
  };
884
-
885
-
@@ -4006,5 +4006,3 @@ return instantiated_
4006
4006
  }
4007
4007
 
4008
4008
 
4009
-
4010
-
@@ -665,9 +665,7 @@ return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_
665
665
  return ff_compiler_JsEmitter.JsEmitter_emitExtendsDefinition(self_, _w1)
666
666
  })), ff_core_List.List_map(module_.instances_, ((_w1) => {
667
667
  return ff_compiler_JsEmitter.JsEmitter_emitInstanceDefinition(self_, _w1)
668
- })), (self_.isMainModule_
669
- ? ff_compiler_JsEmitter.JsEmitter_emitRun(self_, module_.functions_, packagePair_, ((packagePair_.group_ === "ff") && (packagePair_.name_ === "compiler")))
670
- : [])];
668
+ }))];
671
669
  const ignoreJsImports_ = (((ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable()) && (packagePair_.group_ === "ff")) && (packagePair_.name_ === "core"))
672
670
  ? ["esbuild"]
673
671
  : []);
@@ -686,7 +684,7 @@ self_.emittingAsync_ = false
686
684
  }
687
685
  }
688
686
 
689
- export function JsEmitter_emitRun(self_, functions_, mainPackagePair_, bootstrapping_) {
687
+ export function JsEmitter_emitRun(self_, moduleName_, functions_, mainPackagePair_, bootstrapping_) {
690
688
  const buildMainFunction_ = ff_core_Option.Option_filter(ff_core_List.List_find(functions_, ((_w1) => {
691
689
  return (_w1.signature_.name_ === "buildMain")
692
690
  })), ((_) => {
@@ -706,7 +704,9 @@ return (_w1.signature_.name_ === "main")
706
704
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_map(mainFunction_, ((_w1) => {
707
705
  return _w1.signature_.name_
708
706
  })), ((mainName_) => {
709
- return [ff_core_List.List_join(["export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
707
+ return [ff_core_List.List_join([...ff_core_Option.Option_toList(ff_core_Option.Option_map(buildMainFunction_, ((buildMain_) => {
708
+ return (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(buildMain_.signature_.name_)) + "$} from './") + moduleName_) + ".mjs'")
709
+ }))), (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(mainName_)) + "$} from './") + moduleName_) + ".mjs'"), "export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
710
710
  ? ["let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)"]
711
711
  : []), "let system = {", "task_: $task,", "array_: arguments_,", "fireflyPath_: fireflyPath_,", (((("mainPackagePair_: {group_: \"" + mainPackagePair_.group_) + "\", name_: \"") + mainPackagePair_.name_) + "\"},"), (("executableMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable())
712
712
  ? "true"
@@ -719,7 +719,7 @@ return [ff_core_List.List_join(["export async function $run$(fireflyPath_, argum
719
719
  : []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
720
720
  ? ["await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"]
721
721
  : []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
722
- ? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
722
+ ? ["$task.controller_.abort()", "clearInterval(interval)"]
723
723
  : []), "}", "}", ...(((_1) => {
724
724
  if(_1.EmitBrowser) {
725
725
  return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
@@ -1181,14 +1181,6 @@ const effect_ = _1.effect_;
1181
1181
  const typeArguments_ = _1.typeArguments_;
1182
1182
  const arguments_ = _1.arguments_;
1183
1183
  const dictionaries_ = _1.dictionaries_;
1184
- if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
1185
- if((!ff_core_Option.Option_contains((arguments_[0] ?? ff_core_List.List_grab(arguments_, 0)).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
1186
- ff_core_Log.debug_(("Wrong arguments for bundleForBrowser: " + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String)).show_(ff_core_List.List_map(arguments_, ((_w1) => {
1187
- return _w1.name_
1188
- })))));
1189
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
1190
- }
1191
- };
1192
1184
  {
1193
1185
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
1194
1186
  if(_1.length === 0) {
@@ -3191,9 +3183,7 @@ return ("export " + ff_compiler_JsEmitter.JsEmitter_emitFunctionDefinition(self_
3191
3183
  return ff_compiler_JsEmitter.JsEmitter_emitExtendsDefinition(self_, _w1)
3192
3184
  })), ff_core_List.List_map(module_.instances_, ((_w1) => {
3193
3185
  return ff_compiler_JsEmitter.JsEmitter_emitInstanceDefinition(self_, _w1)
3194
- })), (self_.isMainModule_
3195
- ? ff_compiler_JsEmitter.JsEmitter_emitRun(self_, module_.functions_, packagePair_, ((packagePair_.group_ === "ff") && (packagePair_.name_ === "compiler")))
3196
- : [])];
3186
+ }))];
3197
3187
  const ignoreJsImports_ = (((ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable()) && (packagePair_.group_ === "ff")) && (packagePair_.name_ === "core"))
3198
3188
  ? ["esbuild"]
3199
3189
  : []);
@@ -3212,7 +3202,7 @@ self_.emittingAsync_ = false
3212
3202
  }
3213
3203
  }
3214
3204
 
3215
- export async function JsEmitter_emitRun$(self_, functions_, mainPackagePair_, bootstrapping_, $task) {
3205
+ export async function JsEmitter_emitRun$(self_, moduleName_, functions_, mainPackagePair_, bootstrapping_, $task) {
3216
3206
  const buildMainFunction_ = ff_core_Option.Option_filter(ff_core_List.List_find(functions_, ((_w1) => {
3217
3207
  return (_w1.signature_.name_ === "buildMain")
3218
3208
  })), ((_) => {
@@ -3232,7 +3222,9 @@ return (_w1.signature_.name_ === "main")
3232
3222
  return ff_core_Option.Option_else(ff_core_Option.Option_map(ff_core_Option.Option_map(mainFunction_, ((_w1) => {
3233
3223
  return _w1.signature_.name_
3234
3224
  })), ((mainName_) => {
3235
- return [ff_core_List.List_join(["export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
3225
+ return [ff_core_List.List_join([...ff_core_Option.Option_toList(ff_core_Option.Option_map(buildMainFunction_, ((buildMain_) => {
3226
+ return (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(buildMain_.signature_.name_)) + "$} from './") + moduleName_) + ".mjs'")
3227
+ }))), (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(mainName_)) + "$} from './") + moduleName_) + ".mjs'"), "export async function $run$(fireflyPath_, arguments_) {", "Error.stackTraceLimit = 50", "const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
3236
3228
  ? ["let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)"]
3237
3229
  : []), "let system = {", "task_: $task,", "array_: arguments_,", "fireflyPath_: fireflyPath_,", (((("mainPackagePair_: {group_: \"" + mainPackagePair_.group_) + "\", name_: \"") + mainPackagePair_.name_) + "\"},"), (("executableMode_: " + (ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitExecutable())
3238
3230
  ? "true"
@@ -3245,7 +3237,7 @@ return [ff_core_List.List_join(["export async function $run$(fireflyPath_, argum
3245
3237
  : []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
3246
3238
  ? ["await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"]
3247
3239
  : []), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
3248
- ? ["ff_core_Task.Task_abort$($task)", "clearInterval(interval)"]
3240
+ ? ["$task.controller_.abort()", "clearInterval(interval)"]
3249
3241
  : []), "}", "}", ...(((_1) => {
3250
3242
  if(_1.EmitBrowser) {
3251
3243
  return ["queueMicrotask(async () => {", "await $run$(null, [])", "})"]
@@ -3707,14 +3699,6 @@ const effect_ = _1.effect_;
3707
3699
  const typeArguments_ = _1.typeArguments_;
3708
3700
  const arguments_ = _1.arguments_;
3709
3701
  const dictionaries_ = _1.dictionaries_;
3710
- if(ff_core_String.String_contains(name_, "bundleForBrowser")) {
3711
- if((!ff_core_Option.Option_contains((arguments_[0] ?? ff_core_List.List_grab(arguments_, 0)).name_, "system", ff_core_Equal.ff_core_Equal_Equal$ff_core_String_String))) {
3712
- ff_core_Log.debug_(("Wrong arguments for bundleForBrowser: " + ff_core_Show.ff_core_Show_Show$ff_core_List_List(ff_core_Option.ff_core_Show_Show$ff_core_Option_Option(ff_core_Show.ff_core_Show_Show$ff_core_String_String)).show_(ff_core_List.List_map(arguments_, ((_w1) => {
3713
- return _w1.name_
3714
- })))));
3715
- throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Core.GrabException(), ff_core_Core.ff_core_Any_HasAnyTag$ff_core_Core_GrabException)})
3716
- }
3717
- };
3718
3702
  {
3719
3703
  const _1 = ff_compiler_JsEmitter.detectIfElse_(term_);
3720
3704
  if(_1.length === 0) {
@@ -6119,5 +6103,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
6119
6103
  }
6120
6104
  }
6121
6105
  };
6122
-
6123
-
@@ -256,5 +256,3 @@ return
256
256
  }
257
257
 
258
258
 
259
-
260
-
@@ -1196,5 +1196,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
1196
1196
  }
1197
1197
  }
1198
1198
  };
1199
-
1200
-
@@ -183,7 +183,7 @@ return "browser"
183
183
  return "executable"
184
184
  }
185
185
  }))(emitTarget_);
186
- ff_compiler_Builder.build_(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
186
+ ff_compiler_Builder.build_(system_, emitTarget_, mainPackagePair_, [mainFile_], (((_c) => {
187
187
  return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
188
188
  }))(resolvedDependencies_), compilerModulePath_, ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "temporary"), ff_core_Path.Path_path(ff_core_Path.Path_path(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly"), "output"), targetName_), false, ff_compiler_ModuleCache.new_(0))
189
189
  }
@@ -196,7 +196,7 @@ const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSyst
196
196
  ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
197
197
  const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
198
198
  buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_);
199
- if((!ff_compiler_Main.importAndRun_(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_))) {
199
+ if((!ff_compiler_Main.importAndRun_(system_, fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_))) {
200
200
  const at_ = ff_compiler_Syntax.Location(ff_core_Path.Path_absolute(ff_core_NodeSystem.NodeSystem_path(system_, (mainFile_ + ".ff"))), 1, 1);
201
201
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "This module does not contain a 'nodeMain' function"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
202
202
  }
@@ -219,7 +219,7 @@ const localMainFile_ = ff_core_Path.Path_base(ff_core_NodeSystem.NodeSystem_path
219
219
  buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_);
220
220
  buildScript_(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_);
221
221
  ff_compiler_Main.bundleForPkg_(system_, resolvedDependencies_.mainPackagePair_, localMainFile_);
222
- ff_compiler_Main.importAndRun_(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, [])
222
+ ff_compiler_Main.importAndRun_(system_, fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, [])
223
223
  return
224
224
  }
225
225
  if(command_a.CheckCommand) {
@@ -233,7 +233,7 @@ return
233
233
  if(command_a.BootstrapCommand) {
234
234
  const workingDirectory_ = ff_core_NodeSystem.NodeSystem_path(system_, ".");
235
235
  const fakeLocation_ = ff_compiler_Syntax.Location("<core>", 0, 0);
236
- ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_Path.Path_slash(workingDirectory_, "compiler")), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(workingDirectory_, "core"))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "temporary"), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "js"), true, ff_compiler_ModuleCache.new_(0))
236
+ ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), ["Main"], ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_Path.Path_slash(workingDirectory_, "compiler")), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_core_Path.Path_slash(workingDirectory_, "core"))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "temporary"), ff_core_Path.Path_slash(ff_core_Path.Path_slash(workingDirectory_, "output"), "js"), true, ff_compiler_ModuleCache.new_(0))
237
237
  return
238
238
  }
239
239
  {
@@ -434,21 +434,22 @@ export function bundleForBrowser_(system_, packagePair_, mainFile_) {
434
434
  const prefix_ = ".firefly/output/browser/";
435
435
  const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
436
436
  const file_ = (prefix_ + "Main.bundle.js");
437
- const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, ff_core_NodeSystem.NodeSystem_path(system_, mainFile_), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap([ff_core_Pair.Pair("/", (() => {
438
- return ff_core_Path.Path_readStream(ff_core_NodeSystem.NodeSystem_path(system_, "."))
439
- }))], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
440
- ff_core_BuildSystem.internalCallEsBuild_(browserCode_, mainJsFile_, file_, true, true)
437
+ ff_core_BuildSystem.internalCallEsBuild_(system_, mainJsFile_, file_, true, true)
441
438
  }
442
439
 
443
- export function importAndRun_(fireflyPath_, target_, packagePair_, mainFile_, arguments_) {
440
+ export function importAndRun_(system_, fireflyPath_, target_, packagePair_, mainFile_, arguments_) {
444
441
  const process_ = import("process");
445
442
  const cwd_ = process_.cwd();
446
443
  const workingDirectory_ = ((cwd_.indexOf(":") === 1)
447
444
  ? ("file:///" + cwd_)
448
445
  : cwd_);
449
446
  const packagePath_ = ((packagePair_.group_ + "/") + packagePair_.name_);
450
- const main_ = import((((((((workingDirectory_ + "/.firefly/output/") + target_) + "/") + packagePath_) + "/") + mainFile_) + ".mjs"));
451
- if(((typeof main_["$run$"]) !== "undefined")) {
447
+ const runFile_ = (((((((workingDirectory_ + "/.firefly/output/") + target_) + "/") + packagePath_) + "/") + mainFile_) + ".run.mjs");
448
+ const runFilePath_ = (ff_core_String.String_contains(runFile_, "://")
449
+ ? ff_core_NodeSystem.NodeSystem_pathFromUrl(system_, runFile_)
450
+ : ff_core_NodeSystem.NodeSystem_path(system_, runFile_));
451
+ if(ff_core_Path.Path_exists(runFilePath_, false, false, false)) {
452
+ const main_ = import(runFile_);
452
453
  main_["$run$"](fireflyPath_.absolutePath_, arguments_);
453
454
  return true
454
455
  } else {
@@ -581,7 +582,7 @@ return "browser"
581
582
  return "executable"
582
583
  }
583
584
  }))(emitTarget_);
584
- (await ff_compiler_Builder.build_$(system_, emitTarget_, mainPackagePair_, mainFile_, (((_c) => {
585
+ (await ff_compiler_Builder.build_$(system_, emitTarget_, mainPackagePair_, [mainFile_], (((_c) => {
585
586
  return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
586
587
  }))(resolvedDependencies_), compilerModulePath_, (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "temporary", $task)), (await ff_core_Path.Path_path$((await ff_core_Path.Path_path$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly", $task)), "output", $task)), targetName_, $task)), false, ff_compiler_ModuleCache.new_(0), $task))
587
588
  }
@@ -594,7 +595,7 @@ const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await f
594
595
  (await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
595
596
  const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
596
597
  (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitNode(), resolvedDependencies_, $task));
597
- if((!(await ff_compiler_Main.importAndRun_$(fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task)))) {
598
+ if((!(await ff_compiler_Main.importAndRun_$(system_, fireflyPath_, "node", resolvedDependencies_.mainPackagePair_, localMainFile_, arguments_, $task)))) {
598
599
  const at_ = ff_compiler_Syntax.Location((await ff_core_Path.Path_absolute$((await ff_core_NodeSystem.NodeSystem_path$(system_, (mainFile_ + ".ff"), $task)), $task)), 1, 1);
599
600
  throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_compiler_Syntax.CompileError(at_, "This module does not contain a 'nodeMain' function"), ff_compiler_Syntax.ff_core_Any_HasAnyTag$ff_compiler_Syntax_CompileError)})
600
601
  }
@@ -617,7 +618,7 @@ const localMainFile_ = (await ff_core_Path.Path_base$((await ff_core_NodeSystem.
617
618
  (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBuild(), resolvedDependencies_, $task));
618
619
  (await buildScript_$(localMainFile_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitExecutable(), resolvedDependencies_, $task));
619
620
  (await ff_compiler_Main.bundleForPkg_$(system_, resolvedDependencies_.mainPackagePair_, localMainFile_, $task));
620
- (await ff_compiler_Main.importAndRun_$(fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, [], $task))
621
+ (await ff_compiler_Main.importAndRun_$(system_, fireflyPath_, "build", resolvedDependencies_.mainPackagePair_, localMainFile_, [], $task))
621
622
  return
622
623
  }
623
624
  if(command_a.CheckCommand) {
@@ -631,7 +632,7 @@ return
631
632
  if(command_a.BootstrapCommand) {
632
633
  const workingDirectory_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task));
633
634
  const fakeLocation_ = ff_compiler_Syntax.Location("<core>", 0, 0);
634
- (await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), "Main", ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), (await ff_core_Path.Path_slash$(workingDirectory_, "compiler", $task))), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(workingDirectory_, "core", $task)))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "js", $task)), true, ff_compiler_ModuleCache.new_(0), $task))
635
+ (await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitNode(), ff_compiler_Syntax.PackagePair("ff", "compiler"), ["Main"], ff_compiler_Dependencies.ResolvedDependencies(ff_compiler_Syntax.PackagePair("ff", "compiler"), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.PackageInfo(ff_compiler_Syntax.DPackage(fakeLocation_, ff_compiler_Syntax.PackagePair("ff", "core"), ff_compiler_Syntax.Version(fakeLocation_, 0, 0, 0), ff_compiler_Syntax.TargetNames(true, false)), [], [ff_compiler_Syntax.DInclude(fakeLocation_, "node_modules")]))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toMap([ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "compiler"), (await ff_core_Path.Path_slash$(workingDirectory_, "compiler", $task))), ff_core_Pair.Pair(ff_compiler_Syntax.PackagePair("ff", "core"), (await ff_core_Path.Path_slash$(workingDirectory_, "core", $task)))], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair), ff_core_List.List_toSet([], ff_compiler_Syntax.ff_core_Ordering_Order$ff_compiler_Syntax_PackagePair)), ff_core_Option.None(), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "temporary", $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(workingDirectory_, "output", $task)), "js", $task)), true, ff_compiler_ModuleCache.new_(0), $task))
635
636
  return
636
637
  }
637
638
  {
@@ -832,21 +833,22 @@ export async function bundleForBrowser_$(system_, packagePair_, mainFile_, $task
832
833
  const prefix_ = ".firefly/output/browser/";
833
834
  const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
834
835
  const file_ = (prefix_ + "Main.bundle.js");
835
- const browserCode_ = ff_core_BuildSystem.BrowserCode(packagePair_.group_, packagePair_.name_, (await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), ff_core_AssetSystem.AssetSystem(ff_core_List.List_toMap([ff_core_Pair.Pair("/", (async ($task) => {
836
- return (await ff_core_Path.Path_readStream$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task))
837
- }))], ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)));
838
- (await ff_core_BuildSystem.internalCallEsBuild_$(browserCode_, mainJsFile_, file_, true, true, $task))
836
+ (await ff_core_BuildSystem.internalCallEsBuild_$(system_, mainJsFile_, file_, true, true, $task))
839
837
  }
840
838
 
841
- export async function importAndRun_$(fireflyPath_, target_, packagePair_, mainFile_, arguments_, $task) {
839
+ export async function importAndRun_$(system_, fireflyPath_, target_, packagePair_, mainFile_, arguments_, $task) {
842
840
  const process_ = (await import("process"));
843
841
  const cwd_ = process_.cwd();
844
842
  const workingDirectory_ = ((cwd_.indexOf(":") === 1)
845
843
  ? ("file:///" + cwd_)
846
844
  : cwd_);
847
845
  const packagePath_ = ((packagePair_.group_ + "/") + packagePair_.name_);
848
- const main_ = (await import((((((((workingDirectory_ + "/.firefly/output/") + target_) + "/") + packagePath_) + "/") + mainFile_) + ".mjs")));
849
- if(((typeof main_["$run$"]) !== "undefined")) {
846
+ const runFile_ = (((((((workingDirectory_ + "/.firefly/output/") + target_) + "/") + packagePath_) + "/") + mainFile_) + ".run.mjs");
847
+ const runFilePath_ = (ff_core_String.String_contains(runFile_, "://")
848
+ ? (await ff_core_NodeSystem.NodeSystem_pathFromUrl$(system_, runFile_, $task))
849
+ : (await ff_core_NodeSystem.NodeSystem_path$(system_, runFile_, $task)));
850
+ if((await ff_core_Path.Path_exists$(runFilePath_, false, false, false, $task))) {
851
+ const main_ = (await import(runFile_));
850
852
  main_["$run$"](fireflyPath_.absolutePath_, arguments_);
851
853
  return true
852
854
  } else {
@@ -1621,28 +1623,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
1621
1623
  }
1622
1624
  }
1623
1625
  };
1624
-
1625
- export async function $run$(fireflyPath_, arguments_) {
1626
- Error.stackTraceLimit = 50
1627
- const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}
1628
- let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)
1629
- let system = {
1630
- task_: $task,
1631
- array_: arguments_,
1632
- fireflyPath_: fireflyPath_,
1633
- mainPackagePair_: {group_: "ff", name_: "compiler"},
1634
- executableMode_: false,
1635
- buildMode_: false
1636
- }
1637
- try {
1638
- await main_$(system, $task)
1639
- } finally {
1640
- ff_core_Task.Task_abort$($task)
1641
- clearInterval(interval)
1642
- }
1643
- }
1644
- import * as path from 'node:path'
1645
- queueMicrotask(async () => {
1646
- let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))
1647
- await $run$(fireflyPath_, process.argv.slice(2))
1648
- })
@@ -0,0 +1,25 @@
1
+ import {main_$} from './Main.mjs'
2
+ export async function $run$(fireflyPath_, arguments_) {
3
+ Error.stackTraceLimit = 50
4
+ const $task = {controller_: new AbortController(), subtasks_: new Set(), promise_: new Promise(() => {}), started_: performance.now() * 0.001}
5
+ let interval = setInterval(() => {}, 24 * 60 * 60 * 1000)
6
+ let system = {
7
+ task_: $task,
8
+ array_: arguments_,
9
+ fireflyPath_: fireflyPath_,
10
+ mainPackagePair_: {group_: "ff", name_: "compiler"},
11
+ executableMode_: false,
12
+ buildMode_: false
13
+ }
14
+ try {
15
+ await main_$(system, $task)
16
+ } finally {
17
+ $task.controller_.abort()
18
+ clearInterval(interval)
19
+ }
20
+ }
21
+ import * as path from 'node:path'
22
+ queueMicrotask(async () => {
23
+ let fireflyPath_ = path.dirname(path.dirname(path.dirname(path.dirname(path.dirname(process.argv[1])))))
24
+ await $run$(fireflyPath_, process.argv.slice(2))
25
+ })
@@ -313,9 +313,9 @@ return result_
313
313
  }))
314
314
  }
315
315
 
316
- export function ModuleCache_cacheEmittedModule(self_, packagePaths_, packagePair_, moduleName_, body_) {
316
+ export function ModuleCache_cacheEmittedModule(self_, packagePaths_, packagePair_, moduleName_, isMainModule_, body_) {
317
317
  const path_ = ff_compiler_ModuleCache.modulePath_(packagePaths_, packagePair_, moduleName_);
318
- if((!ff_core_Map.Map_contains(self_.emittedModules_, ff_core_Path.Path_absolute(path_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) {
318
+ if((isMainModule_ || (!ff_core_Map.Map_contains(self_.emittedModules_, ff_core_Path.Path_absolute(path_), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))) {
319
319
  self_.emittedModules_ = ff_core_Map.Map_add(self_.emittedModules_, ff_core_Path.Path_absolute(path_), self_.version_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
320
320
  try {
321
321
  body_(path_)
@@ -486,9 +486,9 @@ return result_
486
486
  }), $task))
487
487
  }
488
488
 
489
- export async function ModuleCache_cacheEmittedModule$(self_, packagePaths_, packagePair_, moduleName_, body_, $task) {
489
+ export async function ModuleCache_cacheEmittedModule$(self_, packagePaths_, packagePair_, moduleName_, isMainModule_, body_, $task) {
490
490
  const path_ = (await ff_compiler_ModuleCache.modulePath_$(packagePaths_, packagePair_, moduleName_, $task));
491
- if((!ff_core_Map.Map_contains(self_.emittedModules_, (await ff_core_Path.Path_absolute$(path_, $task)), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String))) {
491
+ if((isMainModule_ || (!ff_core_Map.Map_contains(self_.emittedModules_, (await ff_core_Path.Path_absolute$(path_, $task)), ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String)))) {
492
492
  self_.emittedModules_ = ff_core_Map.Map_add(self_.emittedModules_, (await ff_core_Path.Path_absolute$(path_, $task)), self_.version_, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
493
493
  try {
494
494
  (await body_(path_, $task))
@@ -500,5 +500,3 @@ ff_core_Error.Error_rethrow(error_)
500
500
  }
501
501
 
502
502
 
503
-
504
-
@@ -3284,5 +3284,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
3284
3284
  }
3285
3285
  }
3286
3286
  };
3287
-
3288
-
@@ -769,5 +769,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
769
769
  }
770
770
  }
771
771
  };
772
-
773
-
@@ -2315,5 +2315,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
2315
2315
  }
2316
2316
  }
2317
2317
  };
2318
-
2319
-
@@ -988,5 +988,3 @@ return ff_core_Map.Map_contains(self_.substitution_, index_, ff_core_Ordering.ff
988
988
  }
989
989
 
990
990
 
991
-
992
-
@@ -9529,5 +9529,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
9529
9529
  }
9530
9530
  }
9531
9531
  };
9532
-
9533
-
@@ -2260,5 +2260,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
2260
2260
  }
2261
2261
  }
2262
2262
  };
2263
-
2264
-
@@ -633,5 +633,3 @@ return ff_core_Array.Array_drain(tokens_)
633
633
 
634
634
 
635
635
 
636
-
637
-
@@ -1418,5 +1418,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
1418
1418
  }
1419
1419
  }
1420
1420
  };
1421
-
1422
-
@@ -524,5 +524,3 @@ return term_
524
524
  }
525
525
 
526
526
 
527
-
528
-
@@ -611,5 +611,3 @@ throw Object.assign(new Error(), {ffException: ff_core_Any.toAny_(ff_core_Serial
611
611
  }
612
612
  }
613
613
  };
614
-
615
-
@@ -143,5 +143,3 @@ return self_
143
143
  }
144
144
 
145
145
 
146
-
147
-
@@ -707,5 +707,3 @@ array_.array.push("].toArray()");
707
707
  return ff_core_Array.Array_join(array_, "")
708
708
  }
709
709
  }}
710
-
711
-
@@ -266,5 +266,3 @@ return (await ff_core_Stream.Stream_toString$((await ff_core_AssetSystem.AssetSy
266
266
  }
267
267
 
268
268
 
269
-
270
-
@@ -222,5 +222,3 @@ return true
222
222
  }
223
223
 
224
224
 
225
-
226
-
@@ -142,5 +142,3 @@ async anyTag_$($task) {
142
142
  return ff_core_Any.internalAnyTag_((("ff:core/Bool.Bool" + "[") + "]"))
143
143
  }
144
144
  };
145
-
146
-
@@ -212,5 +212,3 @@ return ff_core_Option.Some(location.hash.slice(1))
212
212
  }
213
213
 
214
214
 
215
-
216
-
@@ -106,7 +106,7 @@ return (new DataView((shared_
106
106
  }
107
107
 
108
108
  export function fromByteList_(array_) {
109
- return (new DataView(Uint8Array(array_).buffer))
109
+ return (new DataView((new Uint8Array(array_)).buffer))
110
110
  }
111
111
 
112
112
  export function fromBufferList_(array_) {
@@ -140,11 +140,20 @@ return (new DataView(arrayBuffer_))
140
140
  export function fromBase64_(base64_) {
141
141
  const binaryString_ = atob(base64_);
142
142
  const bytes_ = Uint8Array.from(binaryString_, ((char_) => {
143
- return char_.charCodeAt(0)
143
+ return char_.codePointAt(0)
144
144
  }));
145
145
  return (new DataView(bytes_.buffer))
146
146
  }
147
147
 
148
+ export function fromLetter16_(letters_) {
149
+ const buffer_ = ff_core_Buffer.new_((letters_.length >>> 1), false);
150
+ for(let for_i = 0, for_e = ff_core_Buffer.Buffer_size(buffer_); for_i < for_e; for_i++) {
151
+ const i_ = for_i;
152
+ ff_core_Buffer.Buffer_setUint8(buffer_, i_, ff_core_Int.Int_bitOr(ff_core_Int.Int_bitLeft(((ff_core_String.String_grab(letters_, ff_core_Int.Int_bitLeft(i_, 1)) & 0x1f) - 0x8), 4), ((ff_core_String.String_grab(letters_, ff_core_Int.Int_bitOr(ff_core_Int.Int_bitLeft(i_, 1), 1)) & 0x1f) - 0x8)))
153
+ };
154
+ return buffer_
155
+ }
156
+
148
157
  export async function new_$(size_, shared_ = false, $task) {
149
158
  return (new DataView((shared_
150
159
  ? (new SharedArrayBuffer(size_))
@@ -152,7 +161,7 @@ return (new DataView((shared_
152
161
  }
153
162
 
154
163
  export async function fromByteList_$(array_, $task) {
155
- return (new DataView(Uint8Array(array_).buffer))
164
+ return (new DataView((new Uint8Array(array_)).buffer))
156
165
  }
157
166
 
158
167
  export async function fromBufferList_$(array_, $task) {
@@ -186,11 +195,20 @@ return (new DataView(arrayBuffer_))
186
195
  export async function fromBase64_$(base64_, $task) {
187
196
  const binaryString_ = atob(base64_);
188
197
  const bytes_ = Uint8Array.from(binaryString_, ((char_) => {
189
- return char_.charCodeAt(0)
198
+ return char_.codePointAt(0)
190
199
  }));
191
200
  return (new DataView(bytes_.buffer))
192
201
  }
193
202
 
203
+ export async function fromLetter16_$(letters_, $task) {
204
+ const buffer_ = ff_core_Buffer.new_((letters_.length >>> 1), false);
205
+ for(let for_i = 0, for_e = ff_core_Buffer.Buffer_size(buffer_); for_i < for_e; for_i++) {
206
+ const i_ = for_i;
207
+ ff_core_Buffer.Buffer_setUint8(buffer_, i_, ff_core_Int.Int_bitOr(ff_core_Int.Int_bitLeft(((ff_core_String.String_grab(letters_, ff_core_Int.Int_bitLeft(i_, 1)) & 0x1f) - 0x8), 4), ((ff_core_String.String_grab(letters_, ff_core_Int.Int_bitOr(ff_core_Int.Int_bitLeft(i_, 1), 1)) & 0x1f) - 0x8)))
208
+ };
209
+ return buffer_
210
+ }
211
+
194
212
  export function Buffer_grabUint64(self_, byteOffset_, littleEndian_ = true) {
195
213
  const high_ = self_.getUint32((byteOffset_ + (littleEndian_
196
214
  ? 4
@@ -333,7 +351,7 @@ TextDecoder.ffSingleton.decode(self_)
333
351
  return (new TextDecoder()).decode(self_)
334
352
  }
335
353
 
336
- export function Buffer_toByteArray(self_) {
354
+ export function Buffer_toByteList(self_) {
337
355
  return [...(new Uint8Array(self_.buffer, self_.byteOffset, self_.byteLength))]
338
356
  }
339
357
 
@@ -348,10 +366,22 @@ return hex_
348
366
 
349
367
  export function Buffer_toBase64(self_) {
350
368
  const view_ = (new Uint8Array(self_.buffer, self_.byteOffset, self_.byteLength));
351
- const binaryString_ = (new TextDecoder("latin1")).decode(view_);
369
+ const binaryString_ = Array.from(view_, ((byte_) => {
370
+ return String.fromCodePoint(byte_)
371
+ })).join("");
352
372
  return btoa(binaryString_)
353
373
  }
354
374
 
375
+ export function Buffer_toLetter16(self_) {
376
+ const result_ = ff_core_Buffer.new_(ff_core_Int.Int_bitLeft(ff_core_Buffer.Buffer_size(self_), 1), false);
377
+ for(let for_i = 0, for_e = ff_core_Buffer.Buffer_size(self_); for_i < for_e; for_i++) {
378
+ const i_ = for_i;
379
+ const b_ = ff_core_Buffer.Buffer_grabUint8(self_, i_);
380
+ ff_core_Buffer.Buffer_setUint16(result_, ff_core_Int.Int_bitLeft(i_, 1), ff_core_Int.Int_bitOr((((b_ >>> 4) & 0xf) + 0x68), ff_core_Int.Int_bitLeft(((b_ & 0xf) + 0x68), 8)), true)
381
+ };
382
+ return ff_core_Buffer.Buffer_toString(result_, "utf8")
383
+ }
384
+
355
385
  export async function Buffer_grabUint64$(self_, byteOffset_, littleEndian_ = true, $task) {
356
386
  const high_ = self_.getUint32((byteOffset_ + (littleEndian_
357
387
  ? 4
@@ -494,7 +524,7 @@ TextDecoder.ffSingleton.decode(self_)
494
524
  return (new TextDecoder()).decode(self_)
495
525
  }
496
526
 
497
- export async function Buffer_toByteArray$(self_, $task) {
527
+ export async function Buffer_toByteList$(self_, $task) {
498
528
  return [...(new Uint8Array(self_.buffer, self_.byteOffset, self_.byteLength))]
499
529
  }
500
530
 
@@ -509,10 +539,22 @@ return hex_
509
539
 
510
540
  export async function Buffer_toBase64$(self_, $task) {
511
541
  const view_ = (new Uint8Array(self_.buffer, self_.byteOffset, self_.byteLength));
512
- const binaryString_ = (new TextDecoder("latin1")).decode(view_);
542
+ const binaryString_ = Array.from(view_, ((byte_) => {
543
+ return String.fromCodePoint(byte_)
544
+ })).join("");
513
545
  return btoa(binaryString_)
514
546
  }
515
547
 
548
+ export async function Buffer_toLetter16$(self_, $task) {
549
+ const result_ = ff_core_Buffer.new_(ff_core_Int.Int_bitLeft(ff_core_Buffer.Buffer_size(self_), 1), false);
550
+ for(let for_i = 0, for_e = ff_core_Buffer.Buffer_size(self_); for_i < for_e; for_i++) {
551
+ const i_ = for_i;
552
+ const b_ = ff_core_Buffer.Buffer_grabUint8(self_, i_);
553
+ ff_core_Buffer.Buffer_setUint16(result_, ff_core_Int.Int_bitLeft(i_, 1), ff_core_Int.Int_bitOr((((b_ >>> 4) & 0xf) + 0x68), ff_core_Int.Int_bitLeft(((b_ & 0xf) + 0x68), 8)), true)
554
+ };
555
+ return ff_core_Buffer.Buffer_toString(result_, "utf8")
556
+ }
557
+
516
558
  export const ff_core_Show_Show$ff_core_Buffer_Buffer = {
517
559
  show_(value_) {
518
560
  return ((`Buffer.fromHex("` + ff_core_Buffer.Buffer_toHex(value_)) + `")`)
@@ -623,5 +665,3 @@ return ordering_
623
665
  }
624
666
  }
625
667
  };
626
-
627
-