firefly-compiler 0.5.72 → 0.5.74
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/Main.ff +14 -7
- package/core/BuildSystem.ff +0 -21
- package/output/js/ff/compiler/Main.mjs +14 -14
- package/output/js/ff/core/BuildSystem.mjs +0 -10
- package/package.json +1 -1
- package/vscode/client/src/extension.ts +13 -0
- package/vscode/package.json +1 -1
- package/vscode/syntaxes/firefly.tmLanguage.json +1 -1
package/compiler/Main.ff
CHANGED
|
@@ -87,8 +87,9 @@ main(system: NodeSystem): Unit {
|
|
|
87
87
|
)
|
|
88
88
|
prepareFireflyDirectory(system.path("."))
|
|
89
89
|
let mainPath = system.path(mainFile)
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
let moduleKey =
|
|
91
|
+
buildScript(mainPath, resolvedDependencies.mainPackagePair, EmitBrowser, resolvedDependencies)
|
|
92
|
+
bundleForBrowser(system, resolvedDependencies.mainPackagePair, moduleKey)
|
|
92
93
|
|
|
93
94
|
| BuildCommand(mainFile) =>
|
|
94
95
|
let resolvedDependencies = Dependencies.process(
|
|
@@ -257,11 +258,17 @@ bundleForPkg(system: NodeSystem, packagePair: PackagePair, mainFile: String) {
|
|
|
257
258
|
BuildSystem.internalNodeCallEsBuild(system, mainJsFile, outputPath = file, minify = False)
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
bundleForBrowser(system: NodeSystem, packagePair: PackagePair,
|
|
261
|
-
let
|
|
262
|
-
let
|
|
263
|
-
let
|
|
264
|
-
BuildSystem.
|
|
261
|
+
bundleForBrowser(system: NodeSystem, packagePair: PackagePair, moduleKey: ModuleKey) {
|
|
262
|
+
let packagePath = moduleKey.packagePair.groupName("/")
|
|
263
|
+
let outputPath = system.path(".firefly/output/browser/" + packagePath + "/")
|
|
264
|
+
let runFile = outputPath.slash(moduleKey.importName() + ".run.mjs")
|
|
265
|
+
BuildSystem.internalBrowserCallEsBuild(
|
|
266
|
+
system!?
|
|
267
|
+
[runFile.absolute()]
|
|
268
|
+
outputPath.absolute()
|
|
269
|
+
minify = True
|
|
270
|
+
sourceMap = True
|
|
271
|
+
)
|
|
265
272
|
}
|
|
266
273
|
|
|
267
274
|
importAndRun(
|
package/core/BuildSystem.ff
CHANGED
|
@@ -53,27 +53,6 @@ extend self: BuildSystem {
|
|
|
53
53
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
// TODO: Remove
|
|
57
|
-
internalCallEsBuild(
|
|
58
|
-
self: NodeSystem
|
|
59
|
-
mainJsFile: String
|
|
60
|
-
outputPath: String
|
|
61
|
-
minify: Bool
|
|
62
|
-
sourceMap: Bool
|
|
63
|
-
): Unit {
|
|
64
|
-
let esbuild = Js.import("esbuild")
|
|
65
|
-
esbuild->build(Js->(
|
|
66
|
-
stdin = Js->(contents = "import {$run$} from './" + mainJsFile + "';", resolveDir = ".")
|
|
67
|
-
bundle = True
|
|
68
|
-
minify = minify
|
|
69
|
-
sourcemap = sourceMap
|
|
70
|
-
platform = "browser"
|
|
71
|
-
target = "es2017"
|
|
72
|
-
external = ["../../../node_modules/*"] // TODO
|
|
73
|
-
outfile = outputPath
|
|
74
|
-
))
|
|
75
|
-
}
|
|
76
|
-
|
|
77
56
|
internalBrowserCallEsBuild(
|
|
78
57
|
self: BuildSystem
|
|
79
58
|
mainJsFiles: List[String]
|
|
@@ -211,8 +211,8 @@ const mainFile_ = command_a.mainPath_;
|
|
|
211
211
|
const resolvedDependencies_ = ff_compiler_Dependencies.process_(ff_core_NodeSystem.NodeSystem_httpClient(system_), ff_compiler_DependencyLock.new_(ff_core_NodeSystem.NodeSystem_mainTask(system_)), ff_core_NodeSystem.NodeSystem_path(system_, mainFile_));
|
|
212
212
|
ff_compiler_Main.prepareFireflyDirectory_(ff_core_NodeSystem.NodeSystem_path(system_, "."));
|
|
213
213
|
const mainPath_ = ff_core_NodeSystem.NodeSystem_path(system_, mainFile_);
|
|
214
|
-
buildScript_(mainPath_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_);
|
|
215
|
-
ff_compiler_Main.bundleForBrowser_(system_, resolvedDependencies_.mainPackagePair_,
|
|
214
|
+
const moduleKey_ = buildScript_(mainPath_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_);
|
|
215
|
+
ff_compiler_Main.bundleForBrowser_(system_, resolvedDependencies_.mainPackagePair_, moduleKey_)
|
|
216
216
|
return
|
|
217
217
|
}
|
|
218
218
|
if(command_a.BuildCommand) {
|
|
@@ -435,11 +435,11 @@ const file_ = (prefix_ + "Main.bundle.js");
|
|
|
435
435
|
ff_core_BuildSystem.internalNodeCallEsBuild_(system_, mainJsFile_, file_, false)
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
-
export function bundleForBrowser_(system_, packagePair_,
|
|
439
|
-
const
|
|
440
|
-
const
|
|
441
|
-
const
|
|
442
|
-
ff_core_BuildSystem.
|
|
438
|
+
export function bundleForBrowser_(system_, packagePair_, moduleKey_) {
|
|
439
|
+
const packagePath_ = ff_compiler_Syntax.PackagePair_groupName(moduleKey_.packagePair_, "/");
|
|
440
|
+
const outputPath_ = ff_core_NodeSystem.NodeSystem_path(system_, ((".firefly/output/browser/" + packagePath_) + "/"));
|
|
441
|
+
const runFile_ = ff_core_Path.Path_slash(outputPath_, (ff_compiler_Syntax.ModuleKey_importName(moduleKey_) + ".run.mjs"));
|
|
442
|
+
ff_core_BuildSystem.internalBrowserCallEsBuild_(system_, [ff_core_Path.Path_absolute(runFile_)], ff_core_Path.Path_absolute(outputPath_), true, true)
|
|
443
443
|
}
|
|
444
444
|
|
|
445
445
|
export function importAndRun_(system_, fireflyPath_, target_, moduleKey_, arguments_) {
|
|
@@ -615,8 +615,8 @@ const mainFile_ = command_a.mainPath_;
|
|
|
615
615
|
const resolvedDependencies_ = (await ff_compiler_Dependencies.process_$((await ff_core_NodeSystem.NodeSystem_httpClient$(system_, $task)), (await ff_compiler_DependencyLock.new_$((await ff_core_NodeSystem.NodeSystem_mainTask$(system_, $task)), $task)), (await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task)), $task));
|
|
616
616
|
(await ff_compiler_Main.prepareFireflyDirectory_$((await ff_core_NodeSystem.NodeSystem_path$(system_, ".", $task)), $task));
|
|
617
617
|
const mainPath_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, mainFile_, $task));
|
|
618
|
-
(await buildScript_$(mainPath_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_, $task));
|
|
619
|
-
(await ff_compiler_Main.bundleForBrowser_$(system_, resolvedDependencies_.mainPackagePair_,
|
|
618
|
+
const moduleKey_ = (await buildScript_$(mainPath_, resolvedDependencies_.mainPackagePair_, ff_compiler_JsEmitter.EmitBrowser(), resolvedDependencies_, $task));
|
|
619
|
+
(await ff_compiler_Main.bundleForBrowser_$(system_, resolvedDependencies_.mainPackagePair_, moduleKey_, $task))
|
|
620
620
|
return
|
|
621
621
|
}
|
|
622
622
|
if(command_a.BuildCommand) {
|
|
@@ -839,11 +839,11 @@ const file_ = (prefix_ + "Main.bundle.js");
|
|
|
839
839
|
(await ff_core_BuildSystem.internalNodeCallEsBuild_$(system_, mainJsFile_, file_, false, $task))
|
|
840
840
|
}
|
|
841
841
|
|
|
842
|
-
export async function bundleForBrowser_$(system_, packagePair_,
|
|
843
|
-
const
|
|
844
|
-
const
|
|
845
|
-
const
|
|
846
|
-
(await
|
|
842
|
+
export async function bundleForBrowser_$(system_, packagePair_, moduleKey_, $task) {
|
|
843
|
+
const packagePath_ = ff_compiler_Syntax.PackagePair_groupName(moduleKey_.packagePair_, "/");
|
|
844
|
+
const outputPath_ = (await ff_core_NodeSystem.NodeSystem_path$(system_, ((".firefly/output/browser/" + packagePath_) + "/"), $task));
|
|
845
|
+
const runFile_ = (await ff_core_Path.Path_slash$(outputPath_, (ff_compiler_Syntax.ModuleKey_importName(moduleKey_) + ".run.mjs"), $task));
|
|
846
|
+
ff_core_BuildSystem.internalBrowserCallEsBuild_(system_, [(await ff_core_Path.Path_absolute$(runFile_, $task))], (await ff_core_Path.Path_absolute$(outputPath_, $task)), true, true)
|
|
847
847
|
}
|
|
848
848
|
|
|
849
849
|
export async function importAndRun_$(system_, fireflyPath_, target_, moduleKey_, arguments_, $task) {
|
|
@@ -101,11 +101,6 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
|
|
104
|
-
export function internalCallEsBuild_(self_, mainJsFile_, outputPath_, minify_, sourceMap_) {
|
|
105
|
-
const esbuild_ = import$0;
|
|
106
|
-
esbuild_.build({stdin: {contents: (("import {$run$} from './" + mainJsFile_) + "';"), resolveDir: "."}, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", external: ["../../../node_modules/*"], outfile: outputPath_})
|
|
107
|
-
}
|
|
108
|
-
|
|
109
104
|
export function internalBrowserCallEsBuild_(self_, mainJsFiles_, outputPath_, minify_, sourceMap_) {
|
|
110
105
|
const esbuild_ = import$0;
|
|
111
106
|
esbuild_.build({entryPoints: mainJsFiles_, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", outdir: outputPath_, outExtension: {[".js"]: ".bundle.js"}})
|
|
@@ -156,11 +151,6 @@ export function internalMainPackagePair_(buildSystem_) {
|
|
|
156
151
|
return ff_core_Pair.Pair(buildSystem_["mainPackagePair_"]["group_"], buildSystem_["mainPackagePair_"]["name_"])
|
|
157
152
|
}
|
|
158
153
|
|
|
159
|
-
export async function internalCallEsBuild_$(self_, mainJsFile_, outputPath_, minify_, sourceMap_, $task) {
|
|
160
|
-
const esbuild_ = import$0;
|
|
161
|
-
esbuild_.build({stdin: {contents: (("import {$run$} from './" + mainJsFile_) + "';"), resolveDir: "."}, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", external: ["../../../node_modules/*"], outfile: outputPath_})
|
|
162
|
-
}
|
|
163
|
-
|
|
164
154
|
export async function internalBrowserCallEsBuild_$(self_, mainJsFiles_, outputPath_, minify_, sourceMap_, $task) {
|
|
165
155
|
const esbuild_ = import$0;
|
|
166
156
|
(await esbuild_.build({entryPoints: mainJsFiles_, bundle: true, minify: minify_, sourcemap: sourceMap_, platform: "browser", target: "es2017", outdir: outputPath_, outExtension: {[".js"]: ".bundle.js"}}))
|
package/package.json
CHANGED
|
@@ -94,6 +94,19 @@ export function activate(context: vscode.ExtensionContext) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
}));
|
|
97
|
+
|
|
98
|
+
const decorationProvider: vscode.FileDecorationProvider = {
|
|
99
|
+
provideFileDecoration(uri: vscode.Uri): vscode.FileDecoration | undefined {
|
|
100
|
+
if(fs.existsSync(path.join(uri.fsPath, '.firefly/package.ff'))) {
|
|
101
|
+
return {
|
|
102
|
+
tooltip: 'Firefly package folder',
|
|
103
|
+
color: new vscode.ThemeColor('charts.blue'),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
context.subscriptions.push(vscode.window.registerFileDecorationProvider(decorationProvider));
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
export function deactivate(): Thenable<void> | undefined {
|
package/vscode/package.json
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
]},
|
|
32
32
|
"keyword": {
|
|
33
33
|
"name": "keyword.declaration.firefly",
|
|
34
|
-
"match": "\\b(data|class|capability|import|from|dependency|package|include|extend|tailcall|function|let|mutable|firefly|trait|instance|newtype|
|
|
34
|
+
"match": "\\b(data|class|capability|import|from|dependency|package|include|extend|tailcall|function|let|mutable|firefly|trait|instance|newtype|safe|unsafe|trust|target|private|protected|public|export|local|internal|opaque)\\b(?=[ ]*[A-Za-z0-9\"'])"
|
|
35
35
|
},
|
|
36
36
|
"spread": {
|
|
37
37
|
"name": "punctuation.spread.firefly",
|