firefly-compiler 0.4.61 → 0.4.63

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.
@@ -97,34 +97,6 @@ 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
- }
128
100
 
129
101
  execute(
130
102
  command: String
@@ -134,7 +106,7 @@ extend self: NodeSystem {
134
106
  environment: Option[Map[String, String]] = None
135
107
  maxBuffer: Int = 16777216
136
108
  killSignal: Int = 9
137
- windowsWhich: Bool = True
109
+ windowsWhere: Bool = True
138
110
  ): ProcessResult
139
111
  target node async """
140
112
  import * as childProcess from 'node:child_process';
@@ -146,9 +118,9 @@ extend self: NodeSystem {
146
118
  ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String
147
119
  );
148
120
  }
149
- if(windowsWhich_ && process.platform === 'win32') {
121
+ if(windowsWhere_ && process.platform === 'win32') {
150
122
  command_ =
151
- (await NodeSystem_which$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
123
+ (await internalWindowsWhere_$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
152
124
  command_;
153
125
  }
154
126
  const newProcess = childProcess.spawn(command_, arguments_, {
@@ -229,7 +201,21 @@ internalFindCommand(out: String): String {
229
201
  }.else {""}
230
202
  }
231
203
 
232
- internalIsWindows(): Bool
233
- target node sync """
234
- return process.platform === 'win32';
235
- """
204
+ internalWindowsWhere(
205
+ system: NodeSystem
206
+ command: String
207
+ workingDirectory: Option[Path] = None
208
+ environment: Option[Map[String, String]] = None
209
+ ): Option[String] {
210
+ if(!command.all {c => c.isAsciiLetterOrDigit() || c == '_' || c == '-'}) {None} else:
211
+ let out = system.execute(
212
+ "cmd.exe",
213
+ ["/c", "where", command],
214
+ workingDirectory = workingDirectory
215
+ environment = environment
216
+ windowsWhere = False
217
+ )
218
+ out.standardOut.toString().lines().filter {line =>
219
+ out.exitCode == 0 && line.split('\\').last().any {_.contains(".")}
220
+ }.first()
221
+ }
@@ -136,10 +136,19 @@ return ""
136
136
  }))
137
137
  }
138
138
 
139
- export function internalIsWindows_() {
140
-
141
- return process.platform === 'win32';
142
-
139
+ export function internalWindowsWhere_(system_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None()) {
140
+ if((!ff_core_String.String_all(command_, ((c_) => {
141
+ return ((ff_core_Char.Char_isAsciiLetterOrDigit(c_) || (c_ === 95)) || (c_ === 45))
142
+ })))) {
143
+ return ff_core_Option.None()
144
+ } else {
145
+ const out_ = ff_core_NodeSystem.NodeSystem_execute(system_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false);
146
+ 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_) => {
147
+ return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
148
+ return ff_core_String.String_contains(_w1, ".")
149
+ })))
150
+ })))
151
+ }
143
152
  }
144
153
 
145
154
  export async function internalAssets_$(system_, $task) {
@@ -172,8 +181,19 @@ return ""
172
181
  }))
173
182
  }
174
183
 
175
- export async function internalIsWindows_$($task) {
176
- throw new Error('Function internalIsWindows is missing on this target in async context.');
184
+ export async function internalWindowsWhere_$(system_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), $task) {
185
+ if((!ff_core_String.String_all(command_, ((c_) => {
186
+ return ((ff_core_Char.Char_isAsciiLetterOrDigit(c_) || (c_ === 95)) || (c_ === 45))
187
+ })))) {
188
+ return ff_core_Option.None()
189
+ } else {
190
+ const out_ = (await ff_core_NodeSystem.NodeSystem_execute$(system_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task));
191
+ 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_) => {
192
+ return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
193
+ return ff_core_String.String_contains(_w1, ".")
194
+ })))
195
+ })))
196
+ }
177
197
  }
178
198
 
179
199
  export function NodeSystem_arguments(self_) {
@@ -272,18 +292,7 @@ export function NodeSystem_environment(self_) {
272
292
  throw new Error('Function NodeSystem_environment is missing on this target in sync context.');
273
293
  }
274
294
 
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) {
295
+ 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, windowsWhere_ = true) {
287
296
  throw new Error('Function NodeSystem_execute is missing on this target in sync context.');
288
297
  }
289
298
 
@@ -397,18 +406,7 @@ export async function NodeSystem_environment$(self_, $task) {
397
406
 
398
407
  }
399
408
 
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) {
409
+ 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, windowsWhere_ = true, $task) {
412
410
 
413
411
  const childProcess = import$3;
414
412
  const environment = environment_.value_ !== void 0 ? {} : process.env;
@@ -419,9 +417,9 @@ export async function NodeSystem_execute$(self_, command_, arguments_, standardI
419
417
  ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String
420
418
  );
421
419
  }
422
- if(windowsWhich_ && process.platform === 'win32') {
420
+ if(windowsWhere_ && process.platform === 'win32') {
423
421
  command_ =
424
- (await NodeSystem_which$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
422
+ (await internalWindowsWhere_$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
425
423
  command_;
426
424
  }
427
425
  const newProcess = childProcess.spawn(command_, arguments_, {
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.61",
7
+ "version": "0.4.63",
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.61",
7
+ "version": "0.4.63",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"