firefly-compiler 0.4.61 → 0.4.62
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/core/NodeSystem.ff +31 -30
- package/output/js/ff/core/NodeSystem.mjs +23 -23
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/core/NodeSystem.ff
CHANGED
|
@@ -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
|
|
@@ -148,7 +120,7 @@ extend self: NodeSystem {
|
|
|
148
120
|
}
|
|
149
121
|
if(windowsWhich_ && process.platform === 'win32') {
|
|
150
122
|
command_ =
|
|
151
|
-
(await
|
|
123
|
+
(await internalWhich_$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
|
|
152
124
|
command_;
|
|
153
125
|
}
|
|
154
126
|
const newProcess = childProcess.spawn(command_, arguments_, {
|
|
@@ -232,4 +204,33 @@ internalFindCommand(out: String): String {
|
|
|
232
204
|
internalIsWindows(): Bool
|
|
233
205
|
target node sync """
|
|
234
206
|
return process.platform === 'win32';
|
|
235
|
-
"""
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
internalWhich(
|
|
210
|
+
system: NodeSystem
|
|
211
|
+
command: String
|
|
212
|
+
workingDirectory: Option[Path] = None
|
|
213
|
+
environment: Option[Map[String, String]] = None
|
|
214
|
+
): Option[String] {
|
|
215
|
+
let out = if(internalIsWindows()) {
|
|
216
|
+
system.execute(
|
|
217
|
+
"cmd.exe",
|
|
218
|
+
["/c", "where", command],
|
|
219
|
+
workingDirectory = workingDirectory
|
|
220
|
+
environment = environment
|
|
221
|
+
windowsWhich = False
|
|
222
|
+
)
|
|
223
|
+
} else {
|
|
224
|
+
system.execute(
|
|
225
|
+
"which",
|
|
226
|
+
[command],
|
|
227
|
+
workingDirectory = workingDirectory
|
|
228
|
+
environment = environment
|
|
229
|
+
windowsWhich = False
|
|
230
|
+
)
|
|
231
|
+
}
|
|
232
|
+
out.standardOut.toString().lines().filter {line =>
|
|
233
|
+
out.exitCode == 0 &&
|
|
234
|
+
(!internalIsWindows() || line.split('\\').last().any {_.contains(".")})
|
|
235
|
+
}.first()
|
|
236
|
+
}
|
|
@@ -142,6 +142,17 @@ export function internalIsWindows_() {
|
|
|
142
142
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
+
export function internalWhich_(system_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None()) {
|
|
146
|
+
const out_ = (ff_core_NodeSystem.internalIsWindows_()
|
|
147
|
+
? ff_core_NodeSystem.NodeSystem_execute(system_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false)
|
|
148
|
+
: ff_core_NodeSystem.NodeSystem_execute(system_, "which", [command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false));
|
|
149
|
+
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_) => {
|
|
150
|
+
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) => {
|
|
151
|
+
return ff_core_String.String_contains(_w1, ".")
|
|
152
|
+
}))))
|
|
153
|
+
})))
|
|
154
|
+
}
|
|
155
|
+
|
|
145
156
|
export async function internalAssets_$(system_, $task) {
|
|
146
157
|
return system_.assets_
|
|
147
158
|
}
|
|
@@ -176,6 +187,17 @@ export async function internalIsWindows_$($task) {
|
|
|
176
187
|
throw new Error('Function internalIsWindows is missing on this target in async context.');
|
|
177
188
|
}
|
|
178
189
|
|
|
190
|
+
export async function internalWhich_$(system_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), $task) {
|
|
191
|
+
const out_ = (ff_core_NodeSystem.internalIsWindows_()
|
|
192
|
+
? (await ff_core_NodeSystem.NodeSystem_execute$(system_, "cmd.exe", ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task))
|
|
193
|
+
: (await ff_core_NodeSystem.NodeSystem_execute$(system_, "which", [command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task)));
|
|
194
|
+
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_) => {
|
|
195
|
+
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) => {
|
|
196
|
+
return ff_core_String.String_contains(_w1, ".")
|
|
197
|
+
}))))
|
|
198
|
+
})))
|
|
199
|
+
}
|
|
200
|
+
|
|
179
201
|
export function NodeSystem_arguments(self_) {
|
|
180
202
|
throw new Error('Function NodeSystem_arguments is missing on this target in sync context.');
|
|
181
203
|
}
|
|
@@ -272,17 +294,6 @@ export function NodeSystem_environment(self_) {
|
|
|
272
294
|
throw new Error('Function NodeSystem_environment is missing on this target in sync context.');
|
|
273
295
|
}
|
|
274
296
|
|
|
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
297
|
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) {
|
|
287
298
|
throw new Error('Function NodeSystem_execute is missing on this target in sync context.');
|
|
288
299
|
}
|
|
@@ -397,17 +408,6 @@ export async function NodeSystem_environment$(self_, $task) {
|
|
|
397
408
|
|
|
398
409
|
}
|
|
399
410
|
|
|
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
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) {
|
|
412
412
|
|
|
413
413
|
const childProcess = import$3;
|
|
@@ -421,7 +421,7 @@ export async function NodeSystem_execute$(self_, command_, arguments_, standardI
|
|
|
421
421
|
}
|
|
422
422
|
if(windowsWhich_ && process.platform === 'win32') {
|
|
423
423
|
command_ =
|
|
424
|
-
(await
|
|
424
|
+
(await internalWhich_$(self_, command_, workingDirectory_, environment_, $task)).value_ ||
|
|
425
425
|
command_;
|
|
426
426
|
}
|
|
427
427
|
const newProcess = childProcess.spawn(command_, arguments_, {
|
package/package.json
CHANGED