firefly-compiler 0.5.72 → 0.5.73

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(
@@ -0,0 +1,3 @@
1
+ browserMain(system: BrowserSystem) {
2
+ system.js()->document->title = "Hello!"
3
+ }
@@ -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) {
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.73",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"
@@ -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.73",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"