firefly-compiler 0.4.62 → 0.4.64
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 +17 -30
- package/output/js/ff/core/NodeSystem.mjs +27 -28
- package/package.json +1 -1
- package/vscode/package.json +1 -1
package/core/NodeSystem.ff
CHANGED
|
@@ -106,7 +106,7 @@ extend self: NodeSystem {
|
|
|
106
106
|
environment: Option[Map[String, String]] = None
|
|
107
107
|
maxBuffer: Int = 16777216
|
|
108
108
|
killSignal: Int = 9
|
|
109
|
-
|
|
109
|
+
windowsWhere: Bool = True
|
|
110
110
|
): ProcessResult
|
|
111
111
|
target node async """
|
|
112
112
|
import * as childProcess from 'node:child_process';
|
|
@@ -118,10 +118,11 @@ extend self: NodeSystem {
|
|
|
118
118
|
ff_core_Ordering.ff_core_Ordering_Order$ff_core_String_String
|
|
119
119
|
);
|
|
120
120
|
}
|
|
121
|
-
if(
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
command_
|
|
121
|
+
if(windowsWhere_ && process.platform === 'win32') {
|
|
122
|
+
const cmd = process.env.ComSpec || "cmd.exe";
|
|
123
|
+
command_ = (
|
|
124
|
+
await internalWindowsWhere_$(self_, cmd, command_, workingDirectory_, environment_, $task)
|
|
125
|
+
).value_ || command_;
|
|
125
126
|
}
|
|
126
127
|
const newProcess = childProcess.spawn(command_, arguments_, {
|
|
127
128
|
cwd: workingDirectory_.value_,
|
|
@@ -201,36 +202,22 @@ internalFindCommand(out: String): String {
|
|
|
201
202
|
}.else {""}
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
|
|
205
|
-
target node sync """
|
|
206
|
-
return process.platform === 'win32';
|
|
207
|
-
"""
|
|
208
|
-
|
|
209
|
-
internalWhich(
|
|
205
|
+
internalWindowsWhere(
|
|
210
206
|
system: NodeSystem
|
|
207
|
+
cmd: String
|
|
211
208
|
command: String
|
|
212
209
|
workingDirectory: Option[Path] = None
|
|
213
210
|
environment: Option[Map[String, String]] = None
|
|
214
211
|
): Option[String] {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
} else {
|
|
224
|
-
system.execute(
|
|
225
|
-
"which",
|
|
226
|
-
[command],
|
|
227
|
-
workingDirectory = workingDirectory
|
|
228
|
-
environment = environment
|
|
229
|
-
windowsWhich = False
|
|
230
|
-
)
|
|
231
|
-
}
|
|
212
|
+
if(!command.all {c => c.isAsciiLetterOrDigit() || c == '_' || c == '-'}) {None} else:
|
|
213
|
+
let out = system.execute(
|
|
214
|
+
cmd,
|
|
215
|
+
["/c", "where", command],
|
|
216
|
+
workingDirectory = workingDirectory
|
|
217
|
+
environment = environment
|
|
218
|
+
windowsWhere = False
|
|
219
|
+
)
|
|
232
220
|
out.standardOut.toString().lines().filter {line =>
|
|
233
|
-
out.exitCode == 0 &&
|
|
234
|
-
(!internalIsWindows() || line.split('\\').last().any {_.contains(".")})
|
|
221
|
+
out.exitCode == 0 && line.split('\\').last().any {_.contains(".")}
|
|
235
222
|
}.first()
|
|
236
223
|
}
|
|
@@ -136,22 +136,20 @@ return ""
|
|
|
136
136
|
}))
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
export function
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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));
|
|
139
|
+
export function internalWindowsWhere_(system_, cmd_, 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_, ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false);
|
|
149
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_) => {
|
|
150
|
-
return ((out_.exitCode_ === 0) &&
|
|
147
|
+
return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
|
|
151
148
|
return ff_core_String.String_contains(_w1, ".")
|
|
152
|
-
})))
|
|
149
|
+
})))
|
|
153
150
|
})))
|
|
154
151
|
}
|
|
152
|
+
}
|
|
155
153
|
|
|
156
154
|
export async function internalAssets_$(system_, $task) {
|
|
157
155
|
return system_.assets_
|
|
@@ -183,19 +181,19 @@ return ""
|
|
|
183
181
|
}))
|
|
184
182
|
}
|
|
185
183
|
|
|
186
|
-
export async function
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
: (await ff_core_NodeSystem.NodeSystem_execute$(system_, "which", [command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task)));
|
|
184
|
+
export async function internalWindowsWhere_$(system_, cmd_, 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_, ["/c", "where", command_], ff_core_Buffer.new_(0, false), workingDirectory_, environment_, 16777216, 9, false, $task));
|
|
194
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_) => {
|
|
195
|
-
return ((out_.exitCode_ === 0) &&
|
|
192
|
+
return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
|
|
196
193
|
return ff_core_String.String_contains(_w1, ".")
|
|
197
|
-
}))))
|
|
198
194
|
})))
|
|
195
|
+
})))
|
|
196
|
+
}
|
|
199
197
|
}
|
|
200
198
|
|
|
201
199
|
export function NodeSystem_arguments(self_) {
|
|
@@ -294,7 +292,7 @@ export function NodeSystem_environment(self_) {
|
|
|
294
292
|
throw new Error('Function NodeSystem_environment is missing on this target in sync context.');
|
|
295
293
|
}
|
|
296
294
|
|
|
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,
|
|
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) {
|
|
298
296
|
throw new Error('Function NodeSystem_execute is missing on this target in sync context.');
|
|
299
297
|
}
|
|
300
298
|
|
|
@@ -408,7 +406,7 @@ export async function NodeSystem_environment$(self_, $task) {
|
|
|
408
406
|
|
|
409
407
|
}
|
|
410
408
|
|
|
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,
|
|
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,10 +417,11 @@ 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(
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
command_
|
|
420
|
+
if(windowsWhere_ && process.platform === 'win32') {
|
|
421
|
+
const cmd = process.env.ComSpec || "cmd.exe";
|
|
422
|
+
command_ = (
|
|
423
|
+
await internalWindowsWhere_$(self_, cmd, command_, workingDirectory_, environment_, $task)
|
|
424
|
+
).value_ || command_;
|
|
426
425
|
}
|
|
427
426
|
const newProcess = childProcess.spawn(command_, arguments_, {
|
|
428
427
|
cwd: workingDirectory_.value_,
|
package/package.json
CHANGED