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 CHANGED
@@ -87,8 +87,9 @@ main(system: NodeSystem): Unit {
87
87
  )
88
88
  prepareFireflyDirectory(system.path("."))
89
89
  let mainPath = system.path(mainFile)
90
- buildScript(mainPath, resolvedDependencies.mainPackagePair, EmitBrowser, resolvedDependencies)
91
- bundleForBrowser(system, resolvedDependencies.mainPackagePair, mainPath.base())
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, mainFile: String) {
261
- let prefix = ".firefly/output/browser/"
262
- let mainJsFile = prefix + packagePair.groupName("/") + "/" + mainFile + ".mjs"
263
- let file = prefix + "Main.bundle.js"
264
- BuildSystem.internalCallEsBuild(system, mainJsFile, outputPath = file, minify = True, sourceMap = True)
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(
@@ -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_, ff_core_Path.Path_base(mainPath_))
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_, mainFile_) {
439
- const prefix_ = ".firefly/output/browser/";
440
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
441
- const file_ = (prefix_ + "Main.bundle.js");
442
- ff_core_BuildSystem.internalCallEsBuild_(system_, mainJsFile_, file_, true, true)
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_, (await ff_core_Path.Path_base$(mainPath_, $task)), $task))
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_, mainFile_, $task) {
843
- const prefix_ = ".firefly/output/browser/";
844
- const mainJsFile_ = ((((prefix_ + ff_compiler_Syntax.PackagePair_groupName(packagePair_, "/")) + "/") + mainFile_) + ".mjs");
845
- const file_ = (prefix_ + "Main.bundle.js");
846
- (await ff_core_BuildSystem.internalCallEsBuild_$(system_, mainJsFile_, file_, true, true, $task))
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
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly compiler",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.72",
7
+ "version": "0.5.74",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -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 {
@@ -4,7 +4,7 @@
4
4
  "description": "Firefly language support",
5
5
  "author": "Firefly team",
6
6
  "license": "MIT",
7
- "version": "0.5.72",
7
+ "version": "0.5.74",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -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|private|safe|unsafe|trust|target)\\b(?=[ ]*[A-Za-z0-9\"'])"
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",