firefly-compiler 0.5.82 → 0.5.84
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/JsEmitter.ff +1 -1
- package/compiler/Main.ff +13 -9
- package/core/BuildSystem.ff +2 -2
- package/experimental/docker/Dockerfile +17 -0
- package/experimental/docker/Main.ff +3 -0
- package/fireflysite/.dockerignore +10 -0
- package/fireflysite/Dockerfile +18 -0
- package/fireflysite/Main.ff +1 -0
- package/output/js/ff/compiler/JsEmitter.mjs +2 -2
- package/output/js/ff/compiler/JsEmitter.mjs.map +2 -2
- package/output/js/ff/compiler/Main.mjs +16 -18
- package/output/js/ff/compiler/Main.mjs.map +7 -9
- package/output/js/ff/core/BuildSystem.mjs +2 -2
- package/output/js/ff/core/BuildSystem.mjs.map +3 -3
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/compiler/JsEmitter.ff
CHANGED
|
@@ -229,7 +229,7 @@ extend self: JsEmitter {
|
|
|
229
229
|
"await " + mainName + "_$(system, $task)"
|
|
230
230
|
]} else {[]}
|
|
231
231
|
...if(self.emitTarget == EmitBuild) {[
|
|
232
|
-
"await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"
|
|
232
|
+
// "await $firefly_compiler.internalCreateExecutable_$(system, '.firefly/output/executable/Main.bundle.js', '.firefly/output', ['host'], system.assets_, $task)"
|
|
233
233
|
]} else {[]}
|
|
234
234
|
...if(!willRunOnNode) {[]} else {[
|
|
235
235
|
"} catch(error) {"
|
package/compiler/Main.ff
CHANGED
|
@@ -63,13 +63,12 @@ main(system: NodeSystem): Unit {
|
|
|
63
63
|
let resolvedDependencies = Dependencies.process(
|
|
64
64
|
system.httpClient()
|
|
65
65
|
DependencyLock.new(system.mainTask())
|
|
66
|
-
system.path(mainFile
|
|
66
|
+
system.path(mainFile)
|
|
67
67
|
)
|
|
68
68
|
prepareFireflyDirectory(system.path("."))
|
|
69
69
|
let mainPath = system.path(mainFile)
|
|
70
|
-
let moduleKey = buildScript(system, mainPath, resolvedDependencies.mainPackagePair,
|
|
71
|
-
|
|
72
|
-
bundleForPkg(system, resolvedDependencies.mainPackagePair, mainPath.base())
|
|
70
|
+
let moduleKey = buildScript(system, mainPath, resolvedDependencies.mainPackagePair, EmitExecutable, resolvedDependencies)
|
|
71
|
+
bundleForExecutable(system, resolvedDependencies.mainPackagePair, moduleKey)
|
|
73
72
|
importAndRun(system, fireflyPath, "build", moduleKey, [])
|
|
74
73
|
|
|
75
74
|
| CheckCommand(filePath) =>
|
|
@@ -276,11 +275,16 @@ parseCommandLine(arguments: List[String]): MainCommand {
|
|
|
276
275
|
| [s, ...] => throw(CommandLineError("Unknown command '" + s + "'" + usageString))
|
|
277
276
|
}
|
|
278
277
|
|
|
279
|
-
|
|
280
|
-
let
|
|
281
|
-
let
|
|
282
|
-
let
|
|
283
|
-
BuildSystem.internalNodeCallEsBuild(
|
|
278
|
+
bundleForExecutable(system: NodeSystem, packagePair: PackagePair, moduleKey: ModuleKey) {
|
|
279
|
+
let packagePath = moduleKey.packagePair.groupName("/")
|
|
280
|
+
let outputPath = system.path(".firefly/output/executable/" + packagePath + "/")
|
|
281
|
+
let runFile = outputPath.slash(moduleKey.importName() + ".run.mjs")
|
|
282
|
+
BuildSystem.internalNodeCallEsBuild(
|
|
283
|
+
system,
|
|
284
|
+
runFile.absolute(),
|
|
285
|
+
outputPath.absolute(),
|
|
286
|
+
minify = True
|
|
287
|
+
)
|
|
284
288
|
}
|
|
285
289
|
|
|
286
290
|
bundleForBrowser(system: NodeSystem, packagePair: PackagePair, moduleKey: ModuleKey) {
|
package/core/BuildSystem.ff
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
FROM node:24
|
|
2
|
+
RUN mkdir /home/node/app && chown -R node:node /home/node/app
|
|
3
|
+
RUN mkdir /home/node/firefly && chown -R node:node /home/node/firefly
|
|
4
|
+
# COPY package*.json ./
|
|
5
|
+
USER node
|
|
6
|
+
WORKDIR /home/node/firefly
|
|
7
|
+
RUN npm install firefly-compiler
|
|
8
|
+
WORKDIR /home/node/app
|
|
9
|
+
COPY --chown=node:node . .
|
|
10
|
+
# This fetches Firefly packages but we should also do their npm install --no-bin-links
|
|
11
|
+
RUN [ "/home/node/firefly/node_modules/.bin/firefly", "check", "Main.ff" ]
|
|
12
|
+
EXPOSE 8080
|
|
13
|
+
ENTRYPOINT [ "/home/node/firefly/node_modules/.bin/firefly", "Main.ff" ]
|
|
14
|
+
|
|
15
|
+
# Test it with
|
|
16
|
+
# podman build -t my-image .
|
|
17
|
+
# podman run -it --name my-container my-image
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
FROM node:22
|
|
2
|
+
# See https://cheatsheetseries.owasp.org/cheatsheets/NodeJS_Docker_Cheat_Sheet.html
|
|
3
|
+
RUN apt update
|
|
4
|
+
RUN apt install dumb-init
|
|
5
|
+
USER node
|
|
6
|
+
RUN mkdir /home/node/app
|
|
7
|
+
RUN mkdir /home/node/firefly
|
|
8
|
+
WORKDIR /home/node/firefly
|
|
9
|
+
RUN npm install firefly-compiler
|
|
10
|
+
WORKDIR /home/node/app
|
|
11
|
+
COPY --chown=node:node . .
|
|
12
|
+
RUN [ "/home/node/firefly/node_modules/.bin/firefly", "build", "Main.ff" ]
|
|
13
|
+
EXPOSE 8080
|
|
14
|
+
ENTRYPOINT [ "dumb-init", "node", "--harmony-temporal", ".firefly/output/executable/Main.bundle.js", "0.0.0.0", "8080" ]
|
|
15
|
+
|
|
16
|
+
# Test it with
|
|
17
|
+
# podman build -t fireflysite .
|
|
18
|
+
# podman run -p 8080:8080 --rm -it fireflysite
|
package/fireflysite/Main.ff
CHANGED
|
@@ -18,6 +18,7 @@ nodeMain(system: NodeSystem): Unit {
|
|
|
18
18
|
let handlers = WebRouteHandler(Array.new())
|
|
19
19
|
Router.handlers(handlers)
|
|
20
20
|
let cacheSalt = system.crypto().randomBuffer(16)
|
|
21
|
+
Log.debug("Starting server on " + host + ":" + port)
|
|
21
22
|
WebServer.new(system, host, port).listen {request =>
|
|
22
23
|
let path = request.readPath()
|
|
23
24
|
let segments = path.split('/').filter {s => s != "" && s != "." && s != ".."}
|
|
@@ -825,7 +825,7 @@ return (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(buildMain_.signatur
|
|
|
825
825
|
: []), ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
826
826
|
? [(("await " + mainName_) + "_$(system, $task)")]
|
|
827
827
|
: []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
828
|
-
? [
|
|
828
|
+
? []
|
|
829
829
|
: []), ...((!willRunOnNode_)
|
|
830
830
|
? []
|
|
831
831
|
: ["} catch(error) {", "console.error(ff_core_Error.Error_stack(error))", "process.exit(1)"]), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
@@ -4439,7 +4439,7 @@ return (((("import {" + ff_compiler_JsEmitter.escapeKeyword_(buildMain_.signatur
|
|
|
4439
4439
|
: []), ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|
|
4440
4440
|
? [(("await " + mainName_) + "_$(system, $task)")]
|
|
4441
4441
|
: []), ...(ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget.equals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBuild())
|
|
4442
|
-
? [
|
|
4442
|
+
? []
|
|
4443
4443
|
: []), ...((!willRunOnNode_)
|
|
4444
4444
|
? []
|
|
4445
4445
|
: ["} catch(error) {", "console.error(ff_core_Error.Error_stack(error))", "process.exit(1)"]), "} finally {", ...(ff_core_Equal.notEquals_(self_.emitTarget_, ff_compiler_JsEmitter.EmitBrowser(), ff_compiler_JsEmitter.ff_core_Equal_Equal$ff_compiler_JsEmitter_EmitTarget)
|