firefly-compiler 0.4.60 → 0.4.61

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/bin/Release.ff CHANGED
@@ -22,13 +22,13 @@ release(
22
22
  }
23
23
  requireNpmLoggedIn(system, system.path(".."))
24
24
  requireVsceLoggedIn(system, system.path("../vscode"))
25
- runSuccessful(system, "node", ".exe", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
26
- runSuccessful(system, "node", ".exe", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
27
- runSuccessful(system, "node", ".exe", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
25
+ runSuccessful(system, "node", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
26
+ runSuccessful(system, "node", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
27
+ runSuccessful(system, "node", ["output/js/ff/compiler/Main.mjs", "bootstrap"], system.path(".."))
28
28
  let version = bumpMinorVersion(system, system.path("../package.json"))
29
29
  bumpMinorVersion(system, system.path("../vscode/package.json"))
30
- runSuccessful(system, "npm", ".cmd", ["publish"], system.path(".."))
31
- runSuccessful(system, "vsce", ".cmd", ["publish"], system.path("../vscode"))
30
+ runSuccessful(system, "npm", ["publish"], system.path(".."))
31
+ runSuccessful(system, "vsce", ["publish"], system.path("../vscode"))
32
32
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "compiler")
33
33
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "core")
34
34
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "lux")
@@ -37,8 +37,8 @@ release(
37
37
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "s3")
38
38
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "unsafejs")
39
39
  releaseFireflyPackage(system, accessKeyId, secretAccessKey, "webserver")
40
- runSuccessful(system, "git", ".exe", ["commit", "-a", "-m", "Autorelease " + version], system.path(".."))
41
- runSuccessful(system, "git", ".exe", ["push"], system.path(".."))
40
+ runSuccessful(system, "git", ["commit", "-a", "-m", "Autorelease " + version], system.path(".."))
41
+ runSuccessful(system, "git", ["push"], system.path(".."))
42
42
  }
43
43
 
44
44
  releaseFireflyPackage(
@@ -71,7 +71,7 @@ releaseFireflyPackage(
71
71
  }
72
72
 
73
73
  requireNpmLoggedIn(system: NodeSystem, workingDirectory: Path) {
74
- let out = run(system, "npm", ".cmd", ["whoami"], workingDirectory)
74
+ let out = run(system, "npm", ["whoami"], workingDirectory)
75
75
  if(out.exitCode != 0) {
76
76
  system.writeErrorLine("")
77
77
  system.writeErrorLine("You are not logged into npm")
@@ -81,7 +81,7 @@ requireNpmLoggedIn(system: NodeSystem, workingDirectory: Path) {
81
81
  }
82
82
 
83
83
  requireVsceLoggedIn(system: NodeSystem, workingDirectory: Path) {
84
- let out = runSuccessful(system, "vsce", ".cmd", ["ls-publishers"], workingDirectory)
84
+ let out = runSuccessful(system, "vsce", ["ls-publishers"], workingDirectory)
85
85
  if(!out.toString().lines().any {_ == "firefly-team"}) {
86
86
  system.writeErrorLine("")
87
87
  system.writeErrorLine("You are not logged into vsce")
@@ -92,14 +92,14 @@ requireVsceLoggedIn(system: NodeSystem, workingDirectory: Path) {
92
92
  }
93
93
  }
94
94
 
95
- run(system: NodeSystem, command: String, windowsExtension: String, arguments: List[String], workingDirectory: Path): ProcessResult {
95
+ run(system: NodeSystem, command: String, arguments: List[String], workingDirectory: Path): ProcessResult {
96
96
  system.writeLine("")
97
97
  system.writeLine(command + " " + arguments.join(" "))
98
- system.execute(command, arguments, workingDirectory = Some(workingDirectory), windowsExtension = windowsExtension)
98
+ system.execute(command, arguments, workingDirectory = Some(workingDirectory))
99
99
  }
100
100
 
101
- runSuccessful(system: NodeSystem, command: String, windowsExtension: String, arguments: List[String], workingDirectory: Path): Buffer {
102
- let out = run(system, command, windowsExtension, arguments, workingDirectory)
101
+ runSuccessful(system: NodeSystem, command: String, arguments: List[String], workingDirectory: Path): Buffer {
102
+ let out = run(system, command, arguments, workingDirectory)
103
103
  if(out.exitCode != 0) {
104
104
  system.writeBuffer(out.standardOut)
105
105
  system.writeErrorBuffer(out.standardError)
@@ -97,6 +97,34 @@ extend self: NodeSystem {
97
97
  }
98
98
  return ff_core_List.List_toMap(result, ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String);
99
99
  """
100
+
101
+ which(
102
+ command: String
103
+ workingDirectory: Option[Path] = None
104
+ environment: Option[Map[String, String]] = None
105
+ ): Option[String] {
106
+ let out = if(internalIsWindows()) {
107
+ self.execute(
108
+ "cmd.exe",
109
+ ["/c", "where", command],
110
+ workingDirectory = workingDirectory
111
+ environment = environment
112
+ windowsWhich = False
113
+ )
114
+ } else {
115
+ self.execute(
116
+ "which",
117
+ [command],
118
+ workingDirectory = workingDirectory
119
+ environment = environment
120
+ windowsWhich = False
121
+ )
122
+ }
123
+ out.standardOut.toString().lines().filter {line =>
124
+ out.exitCode == 0 &&
125
+ (!internalIsWindows() || line.split('\\').last().any {_.contains(".")})
126
+ }.first()
127
+ }
100
128
 
101
129
  execute(
102
130
  command: String
@@ -106,7 +134,7 @@ extend self: NodeSystem {
106
134
  environment: Option[Map[String, String]] = None
107
135
  maxBuffer: Int = 16777216
108
136
  killSignal: Int = 9
109
- windowsExtension: String = ""
137
+ windowsWhich: Bool = True
110
138
  ): ProcessResult
111
139
  target node async """
112
140
  import * as childProcess from 'node:child_process';
@@ -118,7 +146,11 @@ extend self: NodeSystem {
118
146
  ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String
119
147
  );
120
148
  }
121
- if(process.platform === 'win32') command_ += windowsExtension_;
149
+ if(windowsWhich_ && process.platform === 'win32') {
150
+ command_ =
151
+ (await NodeSystem_which$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
152
+ command_;
153
+ }
122
154
  const newProcess = childProcess.spawn(command_, arguments_, {
123
155
  cwd: workingDirectory_.value_,
124
156
  windowsHide: true,
@@ -196,3 +228,8 @@ internalFindCommand(out: String): String {
196
228
  l.endsWith(".exe") || l.endsWith(".cmd") || l.endsWith(".bat") || l.endsWith(".com")
197
229
  }.else {""}
198
230
  }
231
+
232
+ internalIsWindows(): Bool
233
+ target node sync """
234
+ return process.platform === 'win32';
235
+ """
@@ -136,6 +136,12 @@ return ""
136
136
  }))
137
137
  }
138
138
 
139
+ export function internalIsWindows_() {
140
+
141
+ return process.platform === 'win32';
142
+
143
+ }
144
+
139
145
  export async function internalAssets_$(system_, $task) {
140
146
  return system_.assets_
141
147
  }
@@ -166,6 +172,10 @@ return ""
166
172
  }))
167
173
  }
168
174
 
175
+ export async function internalIsWindows_$($task) {
176
+ throw new Error('Function internalIsWindows is missing on this target in async context.');
177
+ }
178
+
169
179
  export function NodeSystem_arguments(self_) {
170
180
  throw new Error('Function NodeSystem_arguments is missing on this target in sync context.');
171
181
  }
@@ -262,7 +272,18 @@ export function NodeSystem_environment(self_) {
262
272
  throw new Error('Function NodeSystem_environment is missing on this target in sync context.');
263
273
  }
264
274
 
265
- export function NodeSystem_execute(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsExtension_ = "") {
275
+ export function NodeSystem_which(self_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None()) {
276
+ const out_ = (ff_core_NodeSystem.internalIsWindows_()
277
+ ? ff_core_NodeSystem.NodeSystem_execute(self_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false)
278
+ : ff_core_NodeSystem.NodeSystem_execute(self_, "which", [command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false));
279
+ return ff_core_List.List_first(ff_core_List.List_filter(ff_core_String.String_lines(ff_core_Buffer.Buffer_toString(out_.standardOut_, "utf8")), ((line_) => {
280
+ return ((out_.exitCode_ === 0) && ((!ff_core_NodeSystem.internalIsWindows_()) || ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
281
+ return ff_core_String.String_contains(_w1, ".")
282
+ }))))
283
+ })))
284
+ }
285
+
286
+ export function NodeSystem_execute(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsWhich_ = true) {
266
287
  throw new Error('Function NodeSystem_execute is missing on this target in sync context.');
267
288
  }
268
289
 
@@ -376,7 +397,18 @@ export async function NodeSystem_environment$(self_, $task) {
376
397
 
377
398
  }
378
399
 
379
- export async function NodeSystem_execute$(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsExtension_ = "", $task) {
400
+ export async function NodeSystem_which$(self_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), $task) {
401
+ const out_ = (ff_core_NodeSystem.internalIsWindows_()
402
+ ? (await ff_core_NodeSystem.NodeSystem_execute$(self_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task))
403
+ : (await ff_core_NodeSystem.NodeSystem_execute$(self_, "which", [command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task)));
404
+ return ff_core_List.List_first(ff_core_List.List_filter(ff_core_String.String_lines(ff_core_Buffer.Buffer_toString(out_.standardOut_, "utf8")), ((line_) => {
405
+ return ((out_.exitCode_ === 0) && ((!ff_core_NodeSystem.internalIsWindows_()) || ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
406
+ return ff_core_String.String_contains(_w1, ".")
407
+ }))))
408
+ })))
409
+ }
410
+
411
+ export async function NodeSystem_execute$(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsWhich_ = true, $task) {
380
412
 
381
413
  const childProcess = import$3;
382
414
  const environment = environment_.value_ !== void 0 ? {} : process.env;
@@ -387,7 +419,11 @@ export async function NodeSystem_execute$(self_, command_, arguments_, standardI
387
419
  ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String
388
420
  );
389
421
  }
390
- if(process.platform === 'win32') command_ += windowsExtension_;
422
+ if(windowsWhich_ && process.platform === 'win32') {
423
+ command_ =
424
+ (await NodeSystem_which$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
425
+ command_;
426
+ }
391
427
  const newProcess = childProcess.spawn(command_, arguments_, {
392
428
  cwd: workingDirectory_.value_,
393
429
  windowsHide: true,
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.4.60",
7
+ "version": "0.4.61",
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.4.60",
7
+ "version": "0.4.61",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"