firefly-compiler 0.6.19 → 0.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiler/Bridge.ff +80 -0
- package/compiler/Builder.ff +0 -4
- package/compiler/Compiler.ff +0 -4
- package/compiler/DevelopMode.ff +14 -2
- package/compiler/JsEmitter.ff +0 -4
- package/compiler/Main.ff +5 -8
- package/core/BuildSystem.ff +48 -92
- package/fireflysite/Html.ff +67 -28
- package/lux/Lux.ff +63 -46
- package/output/js/ff/compiler/Bridge.mjs +157 -0
- package/output/js/ff/compiler/Bridge.mjs.map +47 -0
- package/output/js/ff/compiler/Builder.mjs +8 -8
- package/output/js/ff/compiler/Builder.mjs.map +2 -3
- package/output/js/ff/compiler/Compiler.mjs +8 -12
- package/output/js/ff/compiler/Compiler.mjs.map +3 -4
- package/output/js/ff/compiler/DevelopMode.mjs +28 -4
- package/output/js/ff/compiler/DevelopMode.mjs.map +8 -3
- package/output/js/ff/compiler/JsEmitter.mjs +8 -12
- package/output/js/ff/compiler/JsEmitter.mjs.map +3 -4
- package/output/js/ff/compiler/Main.mjs +12 -14
- package/output/js/ff/compiler/Main.mjs.map +5 -6
- package/output/js/ff/core/BuildSystem.mjs +76 -72
- package/output/js/ff/core/BuildSystem.mjs.map +30 -38
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/lux/Lux.ff
CHANGED
|
@@ -5,6 +5,7 @@ import Css
|
|
|
5
5
|
capability Lux(
|
|
6
6
|
document: LuxDocument
|
|
7
7
|
jsSystem: JsSystem
|
|
8
|
+
browserSystem: Option[BrowserSystem]
|
|
8
9
|
mutable dry: Option[Array[DryNode]]
|
|
9
10
|
mutable cssClasses: StringMap[CssClass]
|
|
10
11
|
renderLock: Lock
|
|
@@ -31,27 +32,29 @@ class LuxDocument(document: JsValue)
|
|
|
31
32
|
|
|
32
33
|
data LuxInvaldNameException(name: String)
|
|
33
34
|
|
|
34
|
-
capability
|
|
35
|
-
mutable
|
|
36
|
-
mutable cancel: () => Unit
|
|
37
|
-
mutable
|
|
38
|
-
mutable
|
|
39
|
-
mutable
|
|
35
|
+
capability LuxJob[I, O](
|
|
36
|
+
mutable rerun: I => Unit
|
|
37
|
+
mutable cancel: () => Unit
|
|
38
|
+
mutable cleanups: Int
|
|
39
|
+
mutable result: Option[O]
|
|
40
|
+
mutable running: Bool
|
|
41
|
+
mutable error: Bool
|
|
42
|
+
mutable internalEffect: (BrowserSystem, I) => O
|
|
40
43
|
mutable internalInput: Option[I]
|
|
41
44
|
)
|
|
42
45
|
|
|
43
|
-
extend self[I: Equal, O]:
|
|
44
|
-
|
|
46
|
+
extend self[I: Equal, O]: LuxJob[I, O] {
|
|
47
|
+
run(input: I) {
|
|
45
48
|
if(!self.internalInput.contains(input)) {
|
|
46
|
-
self.
|
|
49
|
+
self.rerun(input)
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
extend self[I, O]:
|
|
54
|
+
extend self[I, O]: LuxJob[I, O] {
|
|
52
55
|
retry() {
|
|
53
56
|
self.internalInput.each {input =>
|
|
54
|
-
self.
|
|
57
|
+
self.rerun(input)
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
}
|
|
@@ -59,11 +62,12 @@ extend self[I, O]: LuxEffect[I, O] {
|
|
|
59
62
|
class DryNode {
|
|
60
63
|
DryElement(tagName: String, attributes: StringMap[String], children: Array[DryNode])
|
|
61
64
|
DryFragment(children: Array[DryNode])
|
|
65
|
+
DryStyleTags()
|
|
62
66
|
DryText(text: String)
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
extend self: DryNode {
|
|
66
|
-
toHtml(): String {
|
|
70
|
+
toHtml(styleTags: String): String {
|
|
67
71
|
// https://www.w3.org/TR/xml/ - wrt. checkXmmlName, we only accept the ASCII subset
|
|
68
72
|
function checkXmlName(name: String): String {
|
|
69
73
|
if(name.size() == 0) {throw(LuxInvaldNameException(name))}
|
|
@@ -90,6 +94,8 @@ extend self: DryNode {
|
|
|
90
94
|
"<" + checkXmlName(tagName) + attributeHtml + ">" + childrenHtml + endHtml
|
|
91
95
|
| DryFragment(children) =>
|
|
92
96
|
children.toList().map {toHtml(_)}.join()
|
|
97
|
+
| DryStyleTags =>
|
|
98
|
+
styleTags
|
|
93
99
|
| DryText(text) =>
|
|
94
100
|
escapeText(text)
|
|
95
101
|
}
|
|
@@ -338,7 +344,6 @@ extend self: Lux {
|
|
|
338
344
|
if(hook.dry()) {body(callback)} else:
|
|
339
345
|
hook.setValue(callback)
|
|
340
346
|
body {a1 =>
|
|
341
|
-
Log.debug(hook.luxCopy.element.box.element?)
|
|
342
347
|
let latestCallback = hook.grabValue()
|
|
343
348
|
self.renderLock.do {
|
|
344
349
|
latestCallback(a1)
|
|
@@ -407,47 +412,56 @@ extend self: Lux {
|
|
|
407
412
|
hook.setCleanup {subtask.abort()}
|
|
408
413
|
}
|
|
409
414
|
|
|
410
|
-
|
|
415
|
+
useJob[I, O](effect: (BrowserSystem, I) => O, body: LuxJob[I, O] => Unit) {
|
|
411
416
|
self.useState(False): flip, setFlip =>
|
|
412
417
|
self.useCallback1 {_ => setFlip(!flip)}: update =>
|
|
413
418
|
self.useHook: hook =>
|
|
414
|
-
let
|
|
419
|
+
let luxJob = if(!hook.dry() && hook.hasValue()) {
|
|
415
420
|
hook.grabValue()
|
|
416
421
|
} else {
|
|
417
|
-
let
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
422
|
+
let luxJob = LuxJob({_ => }, {}, 0, None, False, False, effect, None)
|
|
423
|
+
luxJob.cancel = {
|
|
424
|
+
if(!hook.dry()) {hook.cleanup()}
|
|
425
|
+
luxJob.running = False
|
|
426
|
+
luxJob.error = False
|
|
421
427
|
if(!hook.dry()):
|
|
422
|
-
hook.cleanup()
|
|
423
428
|
update(Unit)
|
|
424
429
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
430
|
+
luxJob.rerun = {input =>
|
|
431
|
+
if(!hook.dry()) {hook.cleanup()}
|
|
432
|
+
luxJob.running = True
|
|
433
|
+
luxJob.error = False
|
|
434
|
+
luxJob.internalInput = Some(input)
|
|
429
435
|
if(!hook.dry()):
|
|
430
|
-
hook.cleanup()
|
|
431
436
|
update(Unit)
|
|
437
|
+
let cleanups = luxJob.cleanups
|
|
432
438
|
let subtask = hook.luxCopy.task.spawn {task =>
|
|
433
439
|
try {
|
|
434
|
-
let newResult =
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
440
|
+
let newResult = luxJob.internalEffect(hook.luxCopy.browserSystem.grab(), input)
|
|
441
|
+
if(cleanups == luxJob.cleanups) {
|
|
442
|
+
luxJob.running = False
|
|
443
|
+
luxJob.error = False
|
|
444
|
+
luxJob.result = Some(newResult)
|
|
445
|
+
update(Unit)
|
|
446
|
+
}
|
|
439
447
|
} catchAny {error =>
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
448
|
+
if(cleanups == luxJob.cleanups) {
|
|
449
|
+
luxJob.running = False
|
|
450
|
+
luxJob.error = error.name() != "AbortError"
|
|
451
|
+
update(Unit)
|
|
452
|
+
}
|
|
443
453
|
}
|
|
444
454
|
}
|
|
445
|
-
hook.setCleanup {
|
|
455
|
+
hook.setCleanup {
|
|
456
|
+
luxJob.cleanups += 1
|
|
457
|
+
subtask.abort()
|
|
458
|
+
}
|
|
446
459
|
}
|
|
447
|
-
if(!hook.dry()) {hook.setValue(
|
|
448
|
-
|
|
460
|
+
if(!hook.dry()) {hook.setValue(luxJob)}
|
|
461
|
+
luxJob
|
|
449
462
|
}
|
|
450
|
-
|
|
463
|
+
luxJob.internalEffect = effect
|
|
464
|
+
body(luxJob)
|
|
451
465
|
}
|
|
452
466
|
|
|
453
467
|
useWebSocket(
|
|
@@ -529,7 +543,7 @@ extend self[T]: LuxHook[T] {
|
|
|
529
543
|
let key = "_lux$C" + self.luxCopy.depth
|
|
530
544
|
let cleanupFunction = self.luxCopy.element.box.element.get(key)
|
|
531
545
|
self.luxCopy.element.box.element.set(key, {}!)
|
|
532
|
-
cleanupFunction?()
|
|
546
|
+
Js.await(cleanupFunction?())
|
|
533
547
|
}
|
|
534
548
|
}
|
|
535
549
|
|
|
@@ -696,6 +710,7 @@ render(browserSystem: BrowserSystem, element: JsValue, body: Lux => Unit) {
|
|
|
696
710
|
}
|
|
697
711
|
let lux = Lux(
|
|
698
712
|
jsSystem = browserSystem.js()
|
|
713
|
+
browserSystem = Some(browserSystem)
|
|
699
714
|
renderLock = browserSystem.mainTask().lock()
|
|
700
715
|
dry = None
|
|
701
716
|
cssClasses = staticCssClasses
|
|
@@ -720,27 +735,29 @@ renderById(browserSystem: BrowserSystem, id: String, body: Lux => Unit) {
|
|
|
720
735
|
render(browserSystem, element, body)
|
|
721
736
|
}
|
|
722
737
|
|
|
723
|
-
renderToString(
|
|
738
|
+
renderToString(body: (Lux, () => Unit) => Unit): Pair[String, String] {
|
|
724
739
|
let children = [].toArray()
|
|
725
740
|
let lux = Lux(
|
|
726
|
-
jsSystem =
|
|
727
|
-
|
|
741
|
+
jsSystem = Js.jsSystem()
|
|
742
|
+
browserSystem = None
|
|
743
|
+
renderLock = Js.null()?
|
|
728
744
|
dry = Some(children)
|
|
729
745
|
cssClasses = StringMap.new()
|
|
730
|
-
task =
|
|
746
|
+
task = Js.null()?
|
|
731
747
|
depth = 0
|
|
732
|
-
document = LuxDocument(
|
|
733
|
-
element = LuxElement(LuxElementBox(
|
|
748
|
+
document = LuxDocument(Js.null())
|
|
749
|
+
element = LuxElement(LuxElementBox(Js.null()), 0, keepChildren = False)
|
|
734
750
|
keys = None
|
|
735
751
|
key = ""
|
|
736
752
|
attributes = None
|
|
737
753
|
texts = Array.new()
|
|
738
754
|
renderQueue = Array.new()
|
|
739
755
|
)
|
|
740
|
-
|
|
756
|
+
let insertStyleTags = {lux.dry.each {_.push(DryStyleTags)}}
|
|
757
|
+
body(lux, insertStyleTags)
|
|
741
758
|
patchText(lux)
|
|
742
759
|
let styleTags = lux.cssClasses.values().map {c =>
|
|
743
760
|
"<style lux-class=\"" + c.name() + "\">" + c.show() + "</style>"
|
|
744
761
|
}.join()
|
|
745
|
-
Pair(children.toList().map {_.toHtml()}.join(), styleTags)
|
|
762
|
+
Pair(children.toList().map {_.toHtml(styleTags)}.join(), styleTags)
|
|
746
763
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as ff_compiler_Bridge from "../../ff/compiler/Bridge.mjs"
|
|
2
|
+
|
|
3
|
+
import * as ff_compiler_Builder from "../../ff/compiler/Builder.mjs"
|
|
4
|
+
|
|
5
|
+
import * as ff_compiler_ModuleCache from "../../ff/compiler/ModuleCache.mjs"
|
|
6
|
+
|
|
7
|
+
import * as ff_core_Any from "../../ff/core/Any.mjs"
|
|
8
|
+
|
|
9
|
+
import * as ff_core_Array from "../../ff/core/Array.mjs"
|
|
10
|
+
|
|
11
|
+
import * as ff_core_AssetSystem from "../../ff/core/AssetSystem.mjs"
|
|
12
|
+
|
|
13
|
+
import * as ff_core_Atomic from "../../ff/core/Atomic.mjs"
|
|
14
|
+
|
|
15
|
+
import * as ff_core_Bool from "../../ff/core/Bool.mjs"
|
|
16
|
+
|
|
17
|
+
import * as ff_core_BrowserSystem from "../../ff/core/BrowserSystem.mjs"
|
|
18
|
+
|
|
19
|
+
import * as ff_core_Buffer from "../../ff/core/Buffer.mjs"
|
|
20
|
+
|
|
21
|
+
import * as ff_core_BuildSystem from "../../ff/core/BuildSystem.mjs"
|
|
22
|
+
|
|
23
|
+
import * as ff_core_Channel from "../../ff/core/Channel.mjs"
|
|
24
|
+
|
|
25
|
+
import * as ff_core_Char from "../../ff/core/Char.mjs"
|
|
26
|
+
|
|
27
|
+
import * as ff_core_Core from "../../ff/core/Core.mjs"
|
|
28
|
+
|
|
29
|
+
import * as ff_core_Crypto from "../../ff/core/Crypto.mjs"
|
|
30
|
+
|
|
31
|
+
import * as ff_core_Date from "../../ff/core/Date.mjs"
|
|
32
|
+
|
|
33
|
+
import * as ff_core_Duration from "../../ff/core/Duration.mjs"
|
|
34
|
+
|
|
35
|
+
import * as ff_core_Equal from "../../ff/core/Equal.mjs"
|
|
36
|
+
|
|
37
|
+
import * as ff_core_Error from "../../ff/core/Error.mjs"
|
|
38
|
+
|
|
39
|
+
import * as ff_core_FileHandle from "../../ff/core/FileHandle.mjs"
|
|
40
|
+
|
|
41
|
+
import * as ff_core_Float from "../../ff/core/Float.mjs"
|
|
42
|
+
|
|
43
|
+
import * as ff_core_HttpClient from "../../ff/core/HttpClient.mjs"
|
|
44
|
+
|
|
45
|
+
import * as ff_core_Int from "../../ff/core/Int.mjs"
|
|
46
|
+
|
|
47
|
+
import * as ff_core_IntMap from "../../ff/core/IntMap.mjs"
|
|
48
|
+
|
|
49
|
+
import * as ff_core_Js from "../../ff/core/Js.mjs"
|
|
50
|
+
|
|
51
|
+
import * as ff_core_JsSystem from "../../ff/core/JsSystem.mjs"
|
|
52
|
+
|
|
53
|
+
import * as ff_core_JsValue from "../../ff/core/JsValue.mjs"
|
|
54
|
+
|
|
55
|
+
import * as ff_core_Json from "../../ff/core/Json.mjs"
|
|
56
|
+
|
|
57
|
+
import * as ff_core_List from "../../ff/core/List.mjs"
|
|
58
|
+
|
|
59
|
+
import * as ff_core_Lock from "../../ff/core/Lock.mjs"
|
|
60
|
+
|
|
61
|
+
import * as ff_core_Log from "../../ff/core/Log.mjs"
|
|
62
|
+
|
|
63
|
+
import * as ff_core_Map from "../../ff/core/Map.mjs"
|
|
64
|
+
|
|
65
|
+
import * as ff_core_NodeSystem from "../../ff/core/NodeSystem.mjs"
|
|
66
|
+
|
|
67
|
+
import * as ff_core_Nothing from "../../ff/core/Nothing.mjs"
|
|
68
|
+
|
|
69
|
+
import * as ff_core_Option from "../../ff/core/Option.mjs"
|
|
70
|
+
|
|
71
|
+
import * as ff_core_Ordering from "../../ff/core/Ordering.mjs"
|
|
72
|
+
|
|
73
|
+
import * as ff_core_Pair from "../../ff/core/Pair.mjs"
|
|
74
|
+
|
|
75
|
+
import * as ff_core_Path from "../../ff/core/Path.mjs"
|
|
76
|
+
|
|
77
|
+
import * as ff_core_Queue from "../../ff/core/Queue.mjs"
|
|
78
|
+
|
|
79
|
+
import * as ff_core_Random from "../../ff/core/Random.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_Stream from "../../ff/core/Stream.mjs"
|
|
90
|
+
|
|
91
|
+
import * as ff_core_String from "../../ff/core/String.mjs"
|
|
92
|
+
|
|
93
|
+
import * as ff_core_StringMap from "../../ff/core/StringMap.mjs"
|
|
94
|
+
|
|
95
|
+
import * as ff_core_Task from "../../ff/core/Task.mjs"
|
|
96
|
+
|
|
97
|
+
import * as ff_core_Try from "../../ff/core/Try.mjs"
|
|
98
|
+
|
|
99
|
+
import * as import$0 from 'esbuild';
|
|
100
|
+
import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
101
|
+
|
|
102
|
+
export function setGlobalBridge_(nodeSystem_) {
|
|
103
|
+
ff_core_JsSystem.JsSystem_globalThis(globalThis)["$firefly_bridge"] = ff_core_BuildSystem.BuildSystemBridge(((_w1, _w2) => {
|
|
104
|
+
ff_compiler_Bridge.internalCompile_(nodeSystem_, _w1, _w2)
|
|
105
|
+
}), ((_w1, _w2, _w3, _w4) => {
|
|
106
|
+
ff_compiler_Bridge.callEsBuildForBrowser_(nodeSystem_, _w1, _w2, _w3, _w4)
|
|
107
|
+
}))
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function internalCompile_(nodeSystem_, mainFiles_, target_) {
|
|
111
|
+
ff_compiler_Builder.buildViaBuildSystem_(nodeSystem_, ff_core_NodeSystem.NodeSystem_path(nodeSystem_, nodeSystem_["fireflyPath_"]), mainFiles_, target_, ff_compiler_ModuleCache.new_(0), false)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export function callEsBuildForBrowser_(nodeSystem_, mainJsFiles_, outputPath_, minify_, sourceMap_) {
|
|
115
|
+
const esbuild_ = import$0;
|
|
116
|
+
esbuild_.build({entryPoints: mainJsFiles_, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", outdir: outputPath_, outExtension: {[".js"]: ".bundle.js"}})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function callEsBuildForNode_(self_, mainJsFile_, outputPath_, minify_) {
|
|
120
|
+
const esbuild_ = import$0;
|
|
121
|
+
esbuild_.build({entryPoints: [mainJsFile_], bundle: true, minify: minify_, sourcemap: true, platform: "node", target: "es2017", external: ["esbuild", "uws.js"], loader: {[".node"]: "copy"}, outdir: outputPath_})
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export function callEsBuildContextForNode_(self_, mainJsFile_, outputPath_, minify_) {
|
|
125
|
+
const esbuild_ = import$0;
|
|
126
|
+
return esbuild_.context({entryPoints: [mainJsFile_], bundle: true, minify: minify_, sourcemap: true, platform: "node", target: "es2017", external: ["esbuild", "uws.js"], loader: {[".node"]: "copy"}, outfile: outputPath_})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function setGlobalBridge_$(nodeSystem_, $task) {
|
|
130
|
+
ff_core_JsSystem.JsSystem_globalThis(globalThis)["$firefly_bridge"] = ff_core_BuildSystem.BuildSystemBridge((async (_w1, _w2, $task) => {
|
|
131
|
+
(await ff_compiler_Bridge.internalCompile_$(nodeSystem_, _w1, _w2, $task))
|
|
132
|
+
}), (async (_w1, _w2, _w3, _w4, $task) => {
|
|
133
|
+
(await ff_compiler_Bridge.callEsBuildForBrowser_$(nodeSystem_, _w1, _w2, _w3, _w4, $task))
|
|
134
|
+
}))
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export async function internalCompile_$(nodeSystem_, mainFiles_, target_, $task) {
|
|
138
|
+
(await ff_compiler_Builder.buildViaBuildSystem_$(nodeSystem_, (await ff_core_NodeSystem.NodeSystem_path$(nodeSystem_, nodeSystem_["fireflyPath_"], $task)), mainFiles_, target_, ff_compiler_ModuleCache.new_(0), false, $task))
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function callEsBuildForBrowser_$(nodeSystem_, mainJsFiles_, outputPath_, minify_, sourceMap_, $task) {
|
|
142
|
+
const esbuild_ = import$0;
|
|
143
|
+
(await esbuild_.build({entryPoints: mainJsFiles_, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", outdir: outputPath_, outExtension: {[".js"]: ".bundle.js"}}))
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export async function callEsBuildForNode_$(self_, mainJsFile_, outputPath_, minify_, $task) {
|
|
147
|
+
const esbuild_ = import$0;
|
|
148
|
+
(await esbuild_.build({entryPoints: [mainJsFile_], bundle: true, minify: minify_, sourcemap: true, platform: "node", target: "es2017", external: ["esbuild", "uws.js"], loader: {[".node"]: "copy"}, outdir: outputPath_}))
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export async function callEsBuildContextForNode_$(self_, mainJsFile_, outputPath_, minify_, $task) {
|
|
152
|
+
const esbuild_ = import$0;
|
|
153
|
+
return (await esbuild_.context({entryPoints: [mainJsFile_], bundle: true, minify: minify_, sourcemap: true, platform: "node", target: "es2017", external: ["esbuild", "uws.js"], loader: {[".node"]: "copy"}, outfile: outputPath_}))
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=Bridge.mjs.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": [
|
|
4
|
+
"../../../../compiler/Bridge.ff"
|
|
5
|
+
],
|
|
6
|
+
"sourcesContent": [
|
|
7
|
+
"import Builder\r\nimport ModuleCache\r\n\r\nsetGlobalBridge(nodeSystem: NodeSystem) {\r\n // To avoid having the generated code for buildMain depend on the Firefly compiler,\r\n // we provide the bridge through a global symbol that is read by BuildSystem.internalBridge.\r\n nodeSystem.js().globalThis()->\"$firefly_bridge\" = BuildSystemBridge(\r\n internalCompile = {internalCompile(nodeSystem, _, _)}\r\n internalBrowserCallEsBuild = {callEsBuildForBrowser(nodeSystem, _, _, _, _)}\r\n )!\r\n}\r\n\r\ninternalCompile(nodeSystem: NodeSystem, mainFiles: List[Path], target: String): Unit {\r\n Builder.buildViaBuildSystem(\r\n nodeSystem\r\n nodeSystem.path(nodeSystem!->\"fireflyPath_\"?)\r\n mainFiles\r\n target\r\n )\r\n}\r\n\r\ncallEsBuildForBrowser(\r\n nodeSystem: NodeSystem\r\n mainJsFiles: List[String]\r\n outputPath: String\r\n minify: Bool\r\n sourceMap: Bool\r\n): Unit {\r\n let esbuild = Js.import(\"esbuild\")\r\n Js.await(esbuild->build(Js->(\r\n entryPoints = mainJsFiles\r\n bundle = True\r\n minify = minify\r\n sourcemap = sourceMap\r\n platform = \"browser\"\r\n target = \"es2017\"\r\n outdir = outputPath\r\n outExtension = Js.object().with(\".js\", \".bundle.js\")\r\n )))\r\n}\r\n\r\ncallEsBuildForNode(\r\n self: NodeSystem\r\n mainJsFile: String\r\n outputPath: String\r\n minify: Bool\r\n): Unit {\r\n let esbuild = Js.import(\"esbuild\")\r\n Js.await(esbuild->build(Js->(\r\n entryPoints = [mainJsFile]\r\n bundle = True\r\n minify = minify\r\n sourcemap = True\r\n platform = \"node\"\r\n target = \"es2017\"\r\n external = [\"esbuild\", \"uws.js\"]\r\n loader = Js.object().with(\".node\", \"copy\")\r\n outdir = outputPath\r\n )))\r\n}\r\n\r\ncallEsBuildContextForNode(\r\n self: NodeSystem\r\n mainJsFile: String\r\n outputPath: String\r\n minify: Bool\r\n): JsValue {\r\n let esbuild = Js.import(\"esbuild\")\r\n Js.await(esbuild->context(Js->(\r\n entryPoints = [mainJsFile]\r\n bundle = True\r\n minify = minify\r\n sourcemap = True\r\n platform = \"node\"\r\n target = \"es2017\"\r\n external = [\"esbuild\", \"uws.js\"]\r\n loader = Js.object().with(\".node\", \"copy\")\r\n outfile = outputPath\r\n ))) \r\n}\r\n"
|
|
8
|
+
],
|
|
9
|
+
"names": [
|
|
10
|
+
"setGlobalBridge",
|
|
11
|
+
"nodeSystem",
|
|
12
|
+
"globalThis",
|
|
13
|
+
"BuildSystemBridge",
|
|
14
|
+
"w1",
|
|
15
|
+
"w2",
|
|
16
|
+
"internalCompile",
|
|
17
|
+
"w3",
|
|
18
|
+
"w4",
|
|
19
|
+
"callEsBuildForBrowser",
|
|
20
|
+
"mainFiles",
|
|
21
|
+
"target",
|
|
22
|
+
"buildViaBuildSystem",
|
|
23
|
+
"path",
|
|
24
|
+
"new",
|
|
25
|
+
"mainJsFiles",
|
|
26
|
+
"outputPath",
|
|
27
|
+
"minify",
|
|
28
|
+
"sourceMap",
|
|
29
|
+
"esbuild",
|
|
30
|
+
"build",
|
|
31
|
+
"entryPoints",
|
|
32
|
+
"bundle",
|
|
33
|
+
"sourcemap",
|
|
34
|
+
"platform",
|
|
35
|
+
"outdir",
|
|
36
|
+
"outExtension",
|
|
37
|
+
"callEsBuildForNode",
|
|
38
|
+
"self",
|
|
39
|
+
"mainJsFile",
|
|
40
|
+
"external",
|
|
41
|
+
"loader",
|
|
42
|
+
"callEsBuildContextForNode",
|
|
43
|
+
"context",
|
|
44
|
+
"outfile"
|
|
45
|
+
],
|
|
46
|
+
"mappings": "A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;A;;;A;;A,OAGA,SAAAA,gBAAA,CAAgBC,WAAhB,CAAA;A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C,EACd,AAAAP,MAFsB,EAEb,I,EACT,AAAAL,MAHsB,EAGbA,O,EACT,AAAAM,SAJsB,EAIV,I,EACZ,AAAAC,QALsB,EAKX,M,EACX,AAAAb,MANsB,EAMb,Q,EACT,AAAAmB,QAPsB,EAOX,CAAC,S,EAAW,QAAZ,C,EACX,AAAAC,MARsB,EAQV,CAAc,CAAA,OAAA,CAAd,EAAuB,MAAvB,C,EACZ,AAAAG,OATsB,EASZlB,WATY,CAAjB,CAAN;AAPP"
|
|
47
|
+
}
|
|
@@ -121,9 +121,9 @@ export function PackageFiles(root_, packageFile_, files_) {
|
|
|
121
121
|
return {root_, packageFile_, files_};
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export function build_(system_, emitTarget_, mainModules_, resolvedDependencies_,
|
|
124
|
+
export function build_(system_, emitTarget_, mainModules_, resolvedDependencies_, jsOutputPath_, printMeasurements_, moduleCache_) {
|
|
125
125
|
ff_core_Path.Path_createDirectory(jsOutputPath_, true);
|
|
126
|
-
const compiler_ = ff_compiler_Compiler.new_(emitTarget_, ff_core_NodeSystem.NodeSystem_mainTask(system_),
|
|
126
|
+
const compiler_ = ff_compiler_Compiler.new_(emitTarget_, ff_core_NodeSystem.NodeSystem_mainTask(system_), jsOutputPath_, resolvedDependencies_, ff_core_Map.new_(), moduleCache_, ff_compiler_LspHook.disabled_());
|
|
127
127
|
for(let for_a = mainModules_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
128
128
|
const moduleKey_ = for_a[for_i];
|
|
129
129
|
ff_compiler_Compiler.Compiler_emit(compiler_, moduleKey_, true)
|
|
@@ -191,7 +191,7 @@ ff_core_Core.panic_("buildViaBuildSystem is currently limited to browser target
|
|
|
191
191
|
};
|
|
192
192
|
ff_compiler_Builder.build_(system_, ff_compiler_JsEmitter.EmitBrowser(), mainModuleKeys_, (((_c) => {
|
|
193
193
|
return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
|
|
194
|
-
}))(resolvedDependencies_),
|
|
194
|
+
}))(resolvedDependencies_), ff_core_Path.Path_slash(ff_core_NodeSystem.NodeSystem_path(system_, ".firefly/output"), target_), printMeasurements_, moduleCache_)
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
export function check_(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, dependencyLock_, newVersion_, lspHook_, infer_) {
|
|
@@ -242,7 +242,7 @@ const fixedResolvedDependencies_ = (((_c) => {
|
|
|
242
242
|
return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
|
|
243
243
|
}))(resolvedDependencies_);
|
|
244
244
|
const newCache_ = ff_compiler_ModuleCache.ModuleCache_without(cache_, newVersion_, path_);
|
|
245
|
-
const compiler_ = ff_compiler_Compiler.new_(ff_compiler_JsEmitter.EmitNode(), ff_core_NodeSystem.NodeSystem_mainTask(system_),
|
|
245
|
+
const compiler_ = ff_compiler_Compiler.new_(ff_compiler_JsEmitter.EmitNode(), ff_core_NodeSystem.NodeSystem_mainTask(system_), ff_core_Path.Path_slash(ff_core_Path.Path_slash(package_.root_, ".firefly"), "temporary"), fixedResolvedDependencies_, virtualFiles_, newCache_, lspHook_);
|
|
246
246
|
for(let for_a = package_.files_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
247
247
|
const file_ = for_a[for_i];
|
|
248
248
|
const packagePair_ = resolvedDependencies_.mainPackagePair_;
|
|
@@ -375,9 +375,9 @@ const pkg_ = null;
|
|
|
375
375
|
pkg_.exec([packageFile_.absolutePath_, "--out-path", outputPath_.absolutePath_, "--target", ff_core_List.List_join(targets_, ",")])
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
export async function build_$(system_, emitTarget_, mainModules_, resolvedDependencies_,
|
|
378
|
+
export async function build_$(system_, emitTarget_, mainModules_, resolvedDependencies_, jsOutputPath_, printMeasurements_, moduleCache_, $task) {
|
|
379
379
|
(await ff_core_Path.Path_createDirectory$(jsOutputPath_, true, $task));
|
|
380
|
-
const compiler_ = (await ff_compiler_Compiler.new_$(emitTarget_, (await ff_core_NodeSystem.NodeSystem_mainTask$(system_, $task)),
|
|
380
|
+
const compiler_ = (await ff_compiler_Compiler.new_$(emitTarget_, (await ff_core_NodeSystem.NodeSystem_mainTask$(system_, $task)), jsOutputPath_, resolvedDependencies_, ff_core_Map.new_(), moduleCache_, ff_compiler_LspHook.disabled_(), $task));
|
|
381
381
|
for(let for_a = mainModules_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
382
382
|
const moduleKey_ = for_a[for_i];
|
|
383
383
|
(await ff_compiler_Compiler.Compiler_emit$(compiler_, moduleKey_, true, $task))
|
|
@@ -445,7 +445,7 @@ ff_core_Core.panic_("buildViaBuildSystem is currently limited to browser target
|
|
|
445
445
|
};
|
|
446
446
|
(await ff_compiler_Builder.build_$(system_, ff_compiler_JsEmitter.EmitBrowser(), mainModuleKeys_, (((_c) => {
|
|
447
447
|
return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
|
|
448
|
-
}))(resolvedDependencies_),
|
|
448
|
+
}))(resolvedDependencies_), (await ff_core_Path.Path_slash$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".firefly/output", $task)), target_, $task)), printMeasurements_, moduleCache_, $task))
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
export async function check_$(system_, fireflyPath_, path_, mustContain_, skipFiles_, virtualFiles_, cache_, dependencyLock_, newVersion_, lspHook_, infer_, $task) {
|
|
@@ -496,7 +496,7 @@ const fixedResolvedDependencies_ = (((_c) => {
|
|
|
496
496
|
return ff_compiler_Dependencies.ResolvedDependencies(_c.mainPackagePair_, _c.packages_, fixedPackagePaths_, _c.singleFilePackages_)
|
|
497
497
|
}))(resolvedDependencies_);
|
|
498
498
|
const newCache_ = (await ff_compiler_ModuleCache.ModuleCache_without$(cache_, newVersion_, path_, $task));
|
|
499
|
-
const compiler_ = (await ff_compiler_Compiler.new_$(ff_compiler_JsEmitter.EmitNode(), (await ff_core_NodeSystem.NodeSystem_mainTask$(system_, $task)),
|
|
499
|
+
const compiler_ = (await ff_compiler_Compiler.new_$(ff_compiler_JsEmitter.EmitNode(), (await ff_core_NodeSystem.NodeSystem_mainTask$(system_, $task)), (await ff_core_Path.Path_slash$((await ff_core_Path.Path_slash$(package_.root_, ".firefly", $task)), "temporary", $task)), fixedResolvedDependencies_, virtualFiles_, newCache_, lspHook_, $task));
|
|
500
500
|
for(let for_a = package_.files_, for_i = 0, for_l = for_a.length; for_i < for_l; for_i++) {
|
|
501
501
|
const file_ = for_a[for_i];
|
|
502
502
|
const packagePair_ = resolvedDependencies_.mainPackagePair_;
|