firefly-compiler 0.4.64 → 0.4.66

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
@@ -70,8 +70,8 @@ releaseFireflyPackage(
70
70
  )
71
71
  }
72
72
 
73
- requireNpmLoggedIn(system: NodeSystem, workingDirectory: Path) {
74
- let out = run(system, "npm", ["whoami"], workingDirectory)
73
+ requireNpmLoggedIn(system: NodeSystem, directory: Path) {
74
+ let out = run(system, "npm", ["whoami"], directory)
75
75
  if(out.exitCode != 0) {
76
76
  system.writeErrorLine("")
77
77
  system.writeErrorLine("You are not logged into npm")
@@ -80,8 +80,8 @@ requireNpmLoggedIn(system: NodeSystem, workingDirectory: Path) {
80
80
  }
81
81
  }
82
82
 
83
- requireVsceLoggedIn(system: NodeSystem, workingDirectory: Path) {
84
- let out = runSuccessful(system, "vsce", ["ls-publishers"], workingDirectory)
83
+ requireVsceLoggedIn(system: NodeSystem, directory: Path) {
84
+ let out = runSuccessful(system, "vsce", ["ls-publishers"], directory)
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, arguments: List[String], workingDirectory: Path): ProcessResult {
95
+ run(system: NodeSystem, command: String, arguments: List[String], directory: Path): ProcessResult {
96
96
  system.writeLine("")
97
97
  system.writeLine(command + " " + arguments.join(" "))
98
- system.execute(command, arguments, workingDirectory = Some(workingDirectory))
98
+ system.execute(command, arguments, directory = Some(directory))
99
99
  }
100
100
 
101
- runSuccessful(system: NodeSystem, command: String, arguments: List[String], workingDirectory: Path): Buffer {
102
- let out = run(system, command, arguments, workingDirectory)
101
+ runSuccessful(system: NodeSystem, command: String, arguments: List[String], directory: Path): Buffer {
102
+ let out = run(system, command, arguments, directory)
103
103
  if(out.exitCode != 0) {
104
104
  system.writeBuffer(out.standardOut)
105
105
  system.writeErrorBuffer(out.standardError)
@@ -102,7 +102,7 @@ extend self: NodeSystem {
102
102
  command: String
103
103
  arguments: List[String]
104
104
  standardIn: Buffer = Buffer.new(0)
105
- workingDirectory: Option[Path] = None
105
+ directory: Option[Path] = None
106
106
  environment: Option[Map[String, String]] = None
107
107
  maxBuffer: Int = 16777216
108
108
  killSignal: Int = 9
@@ -121,11 +121,11 @@ extend self: NodeSystem {
121
121
  if(windowsWhere_ && process.platform === 'win32') {
122
122
  const cmd = process.env.ComSpec || "cmd.exe";
123
123
  command_ = (
124
- await internalWindowsWhere_$(self_, cmd, command_, workingDirectory_, environment_, $task)
124
+ await internalWindowsWhere_$(self_, cmd, command_, directory_, environment_, $task)
125
125
  ).value_ || command_;
126
126
  }
127
127
  const newProcess = childProcess.spawn(command_, arguments_, {
128
- cwd: workingDirectory_.value_,
128
+ cwd: directory_.value_,
129
129
  windowsHide: true,
130
130
  signal: $task.controller.signal,
131
131
  killSignal: killSignal_,
@@ -195,25 +195,18 @@ internalProcessError(problem: String): Error {
195
195
  } grab()
196
196
  }
197
197
 
198
- internalFindCommand(out: String): String {
199
- out.lines().find {line =>
200
- let l = line.lower()
201
- l.endsWith(".exe") || l.endsWith(".cmd") || l.endsWith(".bat") || l.endsWith(".com")
202
- }.else {""}
203
- }
204
-
205
198
  internalWindowsWhere(
206
199
  system: NodeSystem
207
200
  cmd: String
208
201
  command: String
209
- workingDirectory: Option[Path] = None
202
+ directory: Option[Path] = None
210
203
  environment: Option[Map[String, String]] = None
211
204
  ): Option[String] {
212
205
  if(!command.all {c => c.isAsciiLetterOrDigit() || c == '_' || c == '-'}) {None} else:
213
206
  let out = system.execute(
214
207
  cmd,
215
208
  ["/c", "where", command],
216
- workingDirectory = workingDirectory
209
+ directory = directory
217
210
  environment = environment
218
211
  windowsWhere = False
219
212
  )
package/core/Random.ff CHANGED
@@ -3,21 +3,21 @@ class Random {}
3
3
  // Using Alea PRNG by Johannes Baagøe <baagoe@baagoe.com>, 2010
4
4
  // Typical use: Random.seedInstant(system.task().now())
5
5
 
6
- seedInt(seed: Int): Random {
7
- seedFloat(seed.toFloat())
6
+ newFromInt(seed: Int): Random {
7
+ newFromFloat(seed.toFloat())
8
8
  }
9
9
 
10
- seedFloat(seed: Float): Random {
10
+ newFromFloat(seed: Float): Random {
11
11
  let buffer = Buffer.new(8)
12
12
  buffer.setFloat64(0, seed)
13
- seedBuffer(buffer)
13
+ newFromBuffer(buffer)
14
14
  }
15
15
 
16
- seedInstant(seed: Instant): Random {
17
- seedFloat(seed.since1970.seconds)
16
+ newFromInstant(seed: Instant): Random {
17
+ newFromFloat(seed.since1970.seconds)
18
18
  }
19
19
 
20
- seedBuffer(buffer: Buffer): Random
20
+ newFromBuffer(buffer: Buffer): Random
21
21
  target js sync """
22
22
  var n = 0xefc8249d;
23
23
  function mash(data) {
@@ -353,8 +353,8 @@ makeCompletion(
353
353
  let beforeAfter = memberScheme.signature.parameters.first().map {
354
354
  Pair(unification.substitute(_.valueType).show([]) + ".", "")
355
355
  }.else {Pair("", "")}
356
- beforeAfter.first +
357
356
  if(memberScheme.isMutable) {"mutable "} else {""} +
357
+ beforeAfter.first +
358
358
  unqualifiedName + generics +
359
359
  ": " + returnType.show([]) +
360
360
  beforeAfter.second
@@ -127,22 +127,13 @@ return error_
127
127
  })))
128
128
  }
129
129
 
130
- export function internalFindCommand_(out_) {
131
- return ff_core_Option.Option_else(ff_core_List.List_find(ff_core_String.String_lines(out_), ((line_) => {
132
- const l_ = ff_core_String.String_lower(line_);
133
- return (((ff_core_String.String_endsWith(l_, ".exe") || ff_core_String.String_endsWith(l_, ".cmd")) || ff_core_String.String_endsWith(l_, ".bat")) || ff_core_String.String_endsWith(l_, ".com"))
134
- })), (() => {
135
- return ""
136
- }))
137
- }
138
-
139
- export function internalWindowsWhere_(system_, cmd_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None()) {
130
+ export function internalWindowsWhere_(system_, cmd_, command_, directory_ = ff_core_Option.None(), environment_ = ff_core_Option.None()) {
140
131
  if((!ff_core_String.String_all(command_, ((c_) => {
141
132
  return ((ff_core_Char.Char_isAsciiLetterOrDigit(c_) || (c_ === 95)) || (c_ === 45))
142
133
  })))) {
143
134
  return ff_core_Option.None()
144
135
  } 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);
136
+ const out_ = ff_core_NodeSystem.NodeSystem_execute(system_, cmd_, ["/c", "where", command_], ff_core_Buffer.new_(0, false), directory_, environment_, 16777216, 9, false);
146
137
  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
138
  return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
148
139
  return ff_core_String.String_contains(_w1, ".")
@@ -172,22 +163,13 @@ return error_
172
163
  })))
173
164
  }
174
165
 
175
- export async function internalFindCommand_$(out_, $task) {
176
- return ff_core_Option.Option_else(ff_core_List.List_find(ff_core_String.String_lines(out_), ((line_) => {
177
- const l_ = ff_core_String.String_lower(line_);
178
- return (((ff_core_String.String_endsWith(l_, ".exe") || ff_core_String.String_endsWith(l_, ".cmd")) || ff_core_String.String_endsWith(l_, ".bat")) || ff_core_String.String_endsWith(l_, ".com"))
179
- })), (() => {
180
- return ""
181
- }))
182
- }
183
-
184
- export async function internalWindowsWhere_$(system_, cmd_, command_, workingDirectory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), $task) {
166
+ export async function internalWindowsWhere_$(system_, cmd_, command_, directory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), $task) {
185
167
  if((!ff_core_String.String_all(command_, ((c_) => {
186
168
  return ((ff_core_Char.Char_isAsciiLetterOrDigit(c_) || (c_ === 95)) || (c_ === 45))
187
169
  })))) {
188
170
  return ff_core_Option.None()
189
171
  } 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));
172
+ const out_ = (await ff_core_NodeSystem.NodeSystem_execute$(system_, cmd_, ["/c", "where", command_], ff_core_Buffer.new_(0, false), directory_, environment_, 16777216, 9, false, $task));
191
173
  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
174
  return ((out_.exitCode_ === 0) && ff_core_Option.Option_any(ff_core_List.List_last(ff_core_String.String_split(line_, 92)), ((_w1) => {
193
175
  return ff_core_String.String_contains(_w1, ".")
@@ -292,7 +274,7 @@ export function NodeSystem_environment(self_) {
292
274
  throw new Error('Function NodeSystem_environment is missing on this target in sync context.');
293
275
  }
294
276
 
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) {
277
+ export function NodeSystem_execute(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), directory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsWhere_ = true) {
296
278
  throw new Error('Function NodeSystem_execute is missing on this target in sync context.');
297
279
  }
298
280
 
@@ -406,7 +388,7 @@ export async function NodeSystem_environment$(self_, $task) {
406
388
 
407
389
  }
408
390
 
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) {
391
+ export async function NodeSystem_execute$(self_, command_, arguments_, standardIn_ = ff_core_Buffer.new_(0), directory_ = ff_core_Option.None(), environment_ = ff_core_Option.None(), maxBuffer_ = 16777216, killSignal_ = 9, windowsWhere_ = true, $task) {
410
392
 
411
393
  const childProcess = import$3;
412
394
  const environment = environment_.value_ !== void 0 ? {} : process.env;
@@ -420,11 +402,11 @@ export async function NodeSystem_execute$(self_, command_, arguments_, standardI
420
402
  if(windowsWhere_ && process.platform === 'win32') {
421
403
  const cmd = process.env.ComSpec || "cmd.exe";
422
404
  command_ = (
423
- await internalWindowsWhere_$(self_, cmd, command_, workingDirectory_, environment_, $task)
405
+ await internalWindowsWhere_$(self_, cmd, command_, directory_, environment_, $task)
424
406
  ).value_ || command_;
425
407
  }
426
408
  const newProcess = childProcess.spawn(command_, arguments_, {
427
- cwd: workingDirectory_.value_,
409
+ cwd: directory_.value_,
428
410
  windowsHide: true,
429
411
  signal: $task.controller.signal,
430
412
  killSignal: killSignal_,
@@ -95,21 +95,21 @@ import * as ff_core_Unit from "../../ff/core/Unit.mjs"
95
95
 
96
96
 
97
97
 
98
- export function seedInt_(seed_) {
99
- return ff_core_Random.seedFloat_(ff_core_Int.Int_toFloat(seed_))
98
+ export function newFromInt_(seed_) {
99
+ return ff_core_Random.newFromFloat_(ff_core_Int.Int_toFloat(seed_))
100
100
  }
101
101
 
102
- export function seedFloat_(seed_) {
102
+ export function newFromFloat_(seed_) {
103
103
  const buffer_ = ff_core_Buffer.new_(8, false);
104
104
  ff_core_Buffer.Buffer_setFloat64(buffer_, 0, seed_, true);
105
- return ff_core_Random.seedBuffer_(buffer_)
105
+ return ff_core_Random.newFromBuffer_(buffer_)
106
106
  }
107
107
 
108
- export function seedInstant_(seed_) {
109
- return ff_core_Random.seedFloat_(seed_)
108
+ export function newFromInstant_(seed_) {
109
+ return ff_core_Random.newFromFloat_(seed_)
110
110
  }
111
111
 
112
- export function seedBuffer_(buffer_) {
112
+ export function newFromBuffer_(buffer_) {
113
113
 
114
114
  var n = 0xefc8249d;
115
115
  function mash(data) {
@@ -143,22 +143,22 @@ export function seedBuffer_(buffer_) {
143
143
 
144
144
  }
145
145
 
146
- export async function seedInt_$(seed_, $task) {
147
- return ff_core_Random.seedFloat_(ff_core_Int.Int_toFloat(seed_))
146
+ export async function newFromInt_$(seed_, $task) {
147
+ return ff_core_Random.newFromFloat_(ff_core_Int.Int_toFloat(seed_))
148
148
  }
149
149
 
150
- export async function seedFloat_$(seed_, $task) {
150
+ export async function newFromFloat_$(seed_, $task) {
151
151
  const buffer_ = ff_core_Buffer.new_(8, false);
152
152
  ff_core_Buffer.Buffer_setFloat64(buffer_, 0, seed_, true);
153
- return ff_core_Random.seedBuffer_(buffer_)
153
+ return ff_core_Random.newFromBuffer_(buffer_)
154
154
  }
155
155
 
156
- export async function seedInstant_$(seed_, $task) {
157
- return ff_core_Random.seedFloat_(seed_)
156
+ export async function newFromInstant_$(seed_, $task) {
157
+ return ff_core_Random.newFromFloat_(seed_)
158
158
  }
159
159
 
160
- export async function seedBuffer_$(buffer_, $task) {
161
- throw new Error('Function seedBuffer is missing on this target in async context.');
160
+ export async function newFromBuffer_$(buffer_, $task) {
161
+ throw new Error('Function newFromBuffer is missing on this target in async context.');
162
162
  }
163
163
 
164
164
  export function Random_copy(self_) {
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.64",
7
+ "version": "0.4.66",
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.64",
7
+ "version": "0.4.66",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/Ahnfelt/firefly-boot"