@andersbakken/fisk 4.0.28 → 4.0.29

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.
@@ -88,20 +88,10 @@ class Database {
88
88
  records = {};
89
89
  }
90
90
  records[key] = value;
91
- fs__default["default"].writeFile(this.path + ".tmp", JSON.stringify(records) + "\n", (err) => {
92
- if (err) {
93
- reject(err);
94
- }
95
- else {
96
- fs__default["default"].rename(this.path + ".tmp", this.path, (err) => {
97
- if (err) {
98
- reject(new Error(`Failed to rename ${this.path}.tmp to ${this.path} ${err}`));
99
- }
100
- else {
101
- resolve();
102
- }
103
- });
104
- }
91
+ fs__default["default"].writeFile(this.path + ".tmp", JSON.stringify(records) + "\n", () => {
92
+ fs__default["default"].rename(this.path + ".tmp", this.path, () => {
93
+ resolve();
94
+ });
105
95
  this.finishedOperation();
106
96
  });
107
97
  })
@@ -139,9 +129,9 @@ class Database {
139
129
  try {
140
130
  resolve(JSON.parse(data));
141
131
  }
142
- catch (err) {
132
+ catch (error) {
143
133
  fs__default["default"].renameSync(this.path, this.path + ".error");
144
- reject(new Error(`Failed to parse JSON from file: ${this.path} ${err}`));
134
+ reject(new Error(`Failed to parse JSON from file: ${this.path} ${error.message}`));
145
135
  }
146
136
  }
147
137
  }
@@ -205,12 +195,12 @@ class Environment {
205
195
  }
206
196
  console.log("Created environment", JSON.stringify(this), originalPath);
207
197
  }
208
- toString() {
209
- return JSON.stringify(this, null, 4);
210
- }
211
198
  get file() {
212
199
  return `${this.hash}_${this.system}.tar.gz`;
213
200
  }
201
+ toString() {
202
+ return JSON.stringify(this, null, 4);
203
+ }
214
204
  canRun(system) {
215
205
  switch (system) {
216
206
  case "Linux i686":
@@ -3239,9 +3229,9 @@ var fs$5 = libExports$1;
3239
3229
 
3240
3230
  class File {
3241
3231
  constructor(path, hash) {
3242
- this._fd = fs$5.openSync(path, "w");
3243
3232
  this.path = path;
3244
3233
  this.hash = hash;
3234
+ this._fd = fs$5.openSync(path, "w");
3245
3235
  this.system = undefined;
3246
3236
  this._writing = false;
3247
3237
  this.originalPath = undefined;
@@ -3320,12 +3310,18 @@ class Links {
3320
3310
  constructor() {
3321
3311
  this._targets = {};
3322
3312
  }
3323
- toString() {
3324
- return JSON.stringify(this, null, 4);
3325
- }
3326
3313
  get targets() {
3327
3314
  return this._targets;
3328
3315
  }
3316
+ get targetHashes() {
3317
+ return Object.keys(this._targets);
3318
+ }
3319
+ get size() {
3320
+ return Object.keys(this._targets).length;
3321
+ }
3322
+ toString() {
3323
+ return JSON.stringify(this, null, 4);
3324
+ }
3329
3325
  toObject() {
3330
3326
  return this._targets;
3331
3327
  }
@@ -3346,12 +3342,6 @@ class Links {
3346
3342
  unset(targetHash) {
3347
3343
  delete this._targets[targetHash];
3348
3344
  }
3349
- get targetHashes() {
3350
- return Object.keys(this._targets);
3351
- }
3352
- get size() {
3353
- return Object.keys(this._targets).length;
3354
- }
3355
3345
  }
3356
3346
 
3357
3347
  /**
@@ -3610,15 +3600,15 @@ function untarFile(archive, file) {
3610
3600
  reject(err);
3611
3601
  return;
3612
3602
  }
3613
- fs$5.readFile(path__default["default"].join(tmpdir, file), "utf8", (err, data) => {
3603
+ fs$5.readFile(path__default["default"].join(tmpdir, file), "utf8", (error, data) => {
3614
3604
  try {
3615
3605
  fs$5.removeSync(tmpdir);
3616
3606
  }
3617
3607
  catch (e) {
3618
3608
  console.error("Got an error removing the temp dir", tmpdir);
3619
3609
  }
3620
- if (err) {
3621
- reject(err);
3610
+ if (error) {
3611
+ reject(error);
3622
3612
  }
3623
3613
  else {
3624
3614
  resolve(data);
@@ -3634,6 +3624,12 @@ class Environments {
3634
3624
  this._data = {};
3635
3625
  this._links = {};
3636
3626
  }
3627
+ get environments() {
3628
+ return this._data;
3629
+ }
3630
+ get path() {
3631
+ return this._path || "";
3632
+ }
3637
3633
  load(db, p) {
3638
3634
  this._db = db;
3639
3635
  return db.get("links").then((l) => {
@@ -3780,12 +3776,6 @@ class Environments {
3780
3776
  }
3781
3777
  return this.syncLinks();
3782
3778
  }
3783
- get environments() {
3784
- return this._data;
3785
- }
3786
- get path() {
3787
- return this._path || "";
3788
- }
3789
3779
  environment(hash) {
3790
3780
  if (!(hash in this._data)) {
3791
3781
  return undefined;
@@ -3823,14 +3813,15 @@ Environments.instance = new Environments();
3823
3813
 
3824
3814
  class NodeData {
3825
3815
  constructor(size, maxSize, sha1s) {
3826
- this.sha1s = sha1s;
3827
3816
  this.size = size;
3828
3817
  this.maxSize = maxSize;
3818
+ this.sha1s = sha1s;
3829
3819
  }
3830
3820
  }
3831
3821
 
3832
3822
  class SHA1Data {
3833
3823
  constructor(fileSize, node) {
3824
+ this.fileSize = fileSize;
3834
3825
  this.fileSize = fileSize;
3835
3826
  this.nodes = [node];
3836
3827
  }
@@ -4067,7 +4058,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4067
4058
  return;
4068
4059
  }
4069
4060
  this.byNode.delete(node);
4070
- nodeData.sha1s.forEach((sha1) => removeFromSHA1Map(this.bySHA1, sha1, node));
4061
+ nodeData.sha1s.forEach((sha1) => {
4062
+ removeFromSHA1Map(this.bySHA1, sha1, node);
4063
+ });
4071
4064
  }
4072
4065
  dump(query) {
4073
4066
  if ("clear" in query) {
@@ -4138,17 +4131,17 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4138
4131
  if (this.byNode.size >= 2) {
4139
4132
  // let max = 1;
4140
4133
  let roundRobinIndex = 0;
4141
- const processObject = (sha1, value) => {
4134
+ const processObject = (sha, value) => {
4142
4135
  if (max !== undefined && max <= 0) {
4143
4136
  return;
4144
4137
  }
4145
4138
  const needed = Math.min(redundancy + 1 - value.nodes.length, this.byNode.size - 1);
4146
4139
  if (needed > 0) {
4147
- const needed = redundancy + 1 - value.nodes.length;
4140
+ const needed2 = redundancy + 1 - value.nodes.length;
4148
4141
  // console.log("should distribute", key, "to", needed, "nodes");
4149
4142
  let firstIdx;
4150
4143
  let found = 0;
4151
- while (found < needed) {
4144
+ while (found < needed2) {
4152
4145
  if (++nodeIdx === nodes.length) {
4153
4146
  nodeIdx = 0;
4154
4147
  }
@@ -4182,7 +4175,7 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4182
4175
  ++found;
4183
4176
  data.available -= value.fileSize;
4184
4177
  const src = value.nodes[roundRobinIndex++ % value.nodes.length];
4185
- data.objects.push({ source: src.ip + ":" + src.port, sha1: sha1 });
4178
+ data.objects.push({ source: src.ip + ":" + src.port, sha1: sha });
4186
4179
  if (max !== undefined && !--max) {
4187
4180
  break;
4188
4181
  }
@@ -4200,7 +4193,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4200
4193
  }
4201
4194
  }
4202
4195
  else {
4203
- this.bySHA1.forEach((value, key) => processObject(key, value));
4196
+ this.bySHA1.forEach((value, key) => {
4197
+ processObject(key, value);
4198
+ });
4204
4199
  }
4205
4200
  }
4206
4201
  commands.forEach((value, key) => {
@@ -4336,11 +4331,11 @@ class Peak {
4336
4331
  class Client extends require$$0__default$2["default"] {
4337
4332
  constructor(type, ws, ip, option) {
4338
4333
  super();
4339
- this.created = new Date();
4340
4334
  this.type = type;
4341
4335
  this.ws = ws;
4342
4336
  this.ip = ip;
4343
4337
  this.option = option;
4338
+ this.created = new Date();
4344
4339
  this.hostname = "";
4345
4340
  this.name = "";
4346
4341
  this.npmVersion = "";
@@ -4406,7 +4401,7 @@ class Client extends require$$0__default$2["default"] {
4406
4401
 
4407
4402
  class Builder extends Client {
4408
4403
  constructor(ws, ip, option) {
4409
- super(0 /* Builder */, ws, ip, option);
4404
+ super(0 /* ClientType.Builder */, ws, ip, option);
4410
4405
  this.jobsPerformed = 0;
4411
4406
  this.totalCompileSpeed = 0;
4412
4407
  this.totalUploadSpeed = 0;
@@ -4422,7 +4417,7 @@ class Builder extends Client {
4422
4417
 
4423
4418
  class Compile extends Client {
4424
4419
  constructor(ws, ip, environment, sourceFile, sha1, option) {
4425
- super(1 /* Compile */, ws, ip, option);
4420
+ super(1 /* ClientType.Compile */, ws, ip, option);
4426
4421
  this.environment = environment;
4427
4422
  this.sourceFile = sourceFile;
4428
4423
  this.sha1 = sha1;
@@ -10827,7 +10822,7 @@ function requireHttpErrors () {
10827
10822
  }
10828
10823
 
10829
10824
  var srcExports = {};
10830
- var src$1 = {
10825
+ var src = {
10831
10826
  get exports(){ return srcExports; },
10832
10827
  set exports(v){ srcExports = v; },
10833
10828
  };
@@ -11680,18 +11675,18 @@ function requireNode () {
11680
11675
  * treat as a browser.
11681
11676
  */
11682
11677
 
11683
- var hasRequiredSrc$1;
11678
+ var hasRequiredSrc;
11684
11679
 
11685
- function requireSrc$1 () {
11686
- if (hasRequiredSrc$1) return srcExports;
11687
- hasRequiredSrc$1 = 1;
11680
+ function requireSrc () {
11681
+ if (hasRequiredSrc) return srcExports;
11682
+ hasRequiredSrc = 1;
11688
11683
  (function (module) {
11689
11684
  if (typeof process !== 'undefined' && process.type === 'renderer') {
11690
11685
  module.exports = requireBrowser();
11691
11686
  } else {
11692
11687
  module.exports = requireNode();
11693
11688
  }
11694
- } (src$1));
11689
+ } (src));
11695
11690
  return srcExports;
11696
11691
  }
11697
11692
 
@@ -35511,7 +35506,7 @@ function requireJson () {
35511
35506
  var bytes = bytesExports;
35512
35507
  var contentType = requireContentType();
35513
35508
  var createError = requireHttpErrors();
35514
- var debug = requireSrc$1()('body-parser:json');
35509
+ var debug = requireSrc()('body-parser:json');
35515
35510
  var read = requireRead();
35516
35511
  var typeis = requireTypeIs();
35517
35512
 
@@ -35751,7 +35746,7 @@ function requireRaw () {
35751
35746
  */
35752
35747
 
35753
35748
  var bytes = bytesExports;
35754
- var debug = requireSrc$1()('body-parser:raw');
35749
+ var debug = requireSrc()('body-parser:raw');
35755
35750
  var read = requireRead();
35756
35751
  var typeis = requireTypeIs();
35757
35752
 
@@ -35861,7 +35856,7 @@ function requireText () {
35861
35856
 
35862
35857
  var bytes = bytesExports;
35863
35858
  var contentType = requireContentType();
35864
- var debug = requireSrc$1()('body-parser:text');
35859
+ var debug = requireSrc()('body-parser:text');
35865
35860
  var read = requireRead();
35866
35861
  var typeis = requireTypeIs();
35867
35862
 
@@ -36042,6 +36037,25 @@ function requireHasSymbols () {
36042
36037
  return hasSymbols;
36043
36038
  }
36044
36039
 
36040
+ var hasProto;
36041
+ var hasRequiredHasProto;
36042
+
36043
+ function requireHasProto () {
36044
+ if (hasRequiredHasProto) return hasProto;
36045
+ hasRequiredHasProto = 1;
36046
+
36047
+ var test = {
36048
+ foo: {}
36049
+ };
36050
+
36051
+ var $Object = Object;
36052
+
36053
+ hasProto = function hasProto() {
36054
+ return { __proto__: test }.foo === test.foo && !({ __proto__: null } instanceof $Object);
36055
+ };
36056
+ return hasProto;
36057
+ }
36058
+
36045
36059
  var implementation;
36046
36060
  var hasRequiredImplementation;
36047
36061
 
@@ -36052,43 +36066,75 @@ function requireImplementation () {
36052
36066
  /* eslint no-invalid-this: 1 */
36053
36067
 
36054
36068
  var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
36055
- var slice = Array.prototype.slice;
36056
36069
  var toStr = Object.prototype.toString;
36070
+ var max = Math.max;
36057
36071
  var funcType = '[object Function]';
36058
36072
 
36073
+ var concatty = function concatty(a, b) {
36074
+ var arr = [];
36075
+
36076
+ for (var i = 0; i < a.length; i += 1) {
36077
+ arr[i] = a[i];
36078
+ }
36079
+ for (var j = 0; j < b.length; j += 1) {
36080
+ arr[j + a.length] = b[j];
36081
+ }
36082
+
36083
+ return arr;
36084
+ };
36085
+
36086
+ var slicy = function slicy(arrLike, offset) {
36087
+ var arr = [];
36088
+ for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
36089
+ arr[j] = arrLike[i];
36090
+ }
36091
+ return arr;
36092
+ };
36093
+
36094
+ var joiny = function (arr, joiner) {
36095
+ var str = '';
36096
+ for (var i = 0; i < arr.length; i += 1) {
36097
+ str += arr[i];
36098
+ if (i + 1 < arr.length) {
36099
+ str += joiner;
36100
+ }
36101
+ }
36102
+ return str;
36103
+ };
36104
+
36059
36105
  implementation = function bind(that) {
36060
36106
  var target = this;
36061
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
36107
+ if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
36062
36108
  throw new TypeError(ERROR_MESSAGE + target);
36063
36109
  }
36064
- var args = slice.call(arguments, 1);
36110
+ var args = slicy(arguments, 1);
36065
36111
 
36066
36112
  var bound;
36067
36113
  var binder = function () {
36068
36114
  if (this instanceof bound) {
36069
36115
  var result = target.apply(
36070
36116
  this,
36071
- args.concat(slice.call(arguments))
36117
+ concatty(args, arguments)
36072
36118
  );
36073
36119
  if (Object(result) === result) {
36074
36120
  return result;
36075
36121
  }
36076
36122
  return this;
36077
- } else {
36078
- return target.apply(
36079
- that,
36080
- args.concat(slice.call(arguments))
36081
- );
36082
36123
  }
36124
+ return target.apply(
36125
+ that,
36126
+ concatty(args, arguments)
36127
+ );
36128
+
36083
36129
  };
36084
36130
 
36085
- var boundLength = Math.max(0, target.length - args.length);
36131
+ var boundLength = max(0, target.length - args.length);
36086
36132
  var boundArgs = [];
36087
36133
  for (var i = 0; i < boundLength; i++) {
36088
- boundArgs.push('$' + i);
36134
+ boundArgs[i] = '$' + i;
36089
36135
  }
36090
36136
 
36091
- bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
36137
+ bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
36092
36138
 
36093
36139
  if (target.prototype) {
36094
36140
  var Empty = function Empty() {};
@@ -36115,17 +36161,20 @@ function requireFunctionBind () {
36115
36161
  return functionBind;
36116
36162
  }
36117
36163
 
36118
- var src;
36119
- var hasRequiredSrc;
36164
+ var hasown;
36165
+ var hasRequiredHasown;
36120
36166
 
36121
- function requireSrc () {
36122
- if (hasRequiredSrc) return src;
36123
- hasRequiredSrc = 1;
36167
+ function requireHasown () {
36168
+ if (hasRequiredHasown) return hasown;
36169
+ hasRequiredHasown = 1;
36124
36170
 
36171
+ var call = Function.prototype.call;
36172
+ var $hasOwn = Object.prototype.hasOwnProperty;
36125
36173
  var bind = requireFunctionBind();
36126
36174
 
36127
- src = bind.call(Function.call, Object.prototype.hasOwnProperty);
36128
- return src;
36175
+ /** @type {(o: {}, p: PropertyKey) => p is keyof o} */
36176
+ hasown = bind.call(call, $hasOwn);
36177
+ return hasown;
36129
36178
  }
36130
36179
 
36131
36180
  var getIntrinsic;
@@ -36178,18 +36227,23 @@ function requireGetIntrinsic () {
36178
36227
  : throwTypeError;
36179
36228
 
36180
36229
  var hasSymbols = requireHasSymbols()();
36230
+ var hasProto = requireHasProto()();
36181
36231
 
36182
- var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
36232
+ var getProto = Object.getPrototypeOf || (
36233
+ hasProto
36234
+ ? function (x) { return x.__proto__; } // eslint-disable-line no-proto
36235
+ : null
36236
+ );
36183
36237
 
36184
36238
  var needsEval = {};
36185
36239
 
36186
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
36240
+ var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
36187
36241
 
36188
36242
  var INTRINSICS = {
36189
36243
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
36190
36244
  '%Array%': Array,
36191
36245
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
36192
- '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
36246
+ '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
36193
36247
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
36194
36248
  '%AsyncFunction%': needsEval,
36195
36249
  '%AsyncGenerator%': needsEval,
@@ -36219,10 +36273,10 @@ function requireGetIntrinsic () {
36219
36273
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
36220
36274
  '%isFinite%': isFinite,
36221
36275
  '%isNaN%': isNaN,
36222
- '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
36276
+ '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
36223
36277
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
36224
36278
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
36225
- '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
36279
+ '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
36226
36280
  '%Math%': Math,
36227
36281
  '%Number%': Number,
36228
36282
  '%Object%': Object,
@@ -36235,10 +36289,10 @@ function requireGetIntrinsic () {
36235
36289
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
36236
36290
  '%RegExp%': RegExp,
36237
36291
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
36238
- '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
36292
+ '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
36239
36293
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
36240
36294
  '%String%': String,
36241
- '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
36295
+ '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
36242
36296
  '%Symbol%': hasSymbols ? Symbol : undefined$1,
36243
36297
  '%SyntaxError%': $SyntaxError,
36244
36298
  '%ThrowTypeError%': ThrowTypeError,
@@ -36254,12 +36308,14 @@ function requireGetIntrinsic () {
36254
36308
  '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
36255
36309
  };
36256
36310
 
36257
- try {
36258
- null.error; // eslint-disable-line no-unused-expressions
36259
- } catch (e) {
36260
- // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
36261
- var errorProto = getProto(getProto(e));
36262
- INTRINSICS['%Error.prototype%'] = errorProto;
36311
+ if (getProto) {
36312
+ try {
36313
+ null.error; // eslint-disable-line no-unused-expressions
36314
+ } catch (e) {
36315
+ // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
36316
+ var errorProto = getProto(getProto(e));
36317
+ INTRINSICS['%Error.prototype%'] = errorProto;
36318
+ }
36263
36319
  }
36264
36320
 
36265
36321
  var doEval = function doEval(name) {
@@ -36277,7 +36333,7 @@ function requireGetIntrinsic () {
36277
36333
  }
36278
36334
  } else if (name === '%AsyncIteratorPrototype%') {
36279
36335
  var gen = doEval('%AsyncGenerator%');
36280
- if (gen) {
36336
+ if (gen && getProto) {
36281
36337
  value = getProto(gen.prototype);
36282
36338
  }
36283
36339
  }
@@ -36342,7 +36398,7 @@ function requireGetIntrinsic () {
36342
36398
  };
36343
36399
 
36344
36400
  var bind = requireFunctionBind();
36345
- var hasOwn = requireSrc();
36401
+ var hasOwn = requireHasown();
36346
36402
  var $concat = bind.call(Function.call, Array.prototype.concat);
36347
36403
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
36348
36404
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -36486,6 +36542,196 @@ var callBind = {
36486
36542
  set exports(v){ callBindExports = v; },
36487
36543
  };
36488
36544
 
36545
+ var hasPropertyDescriptors_1;
36546
+ var hasRequiredHasPropertyDescriptors;
36547
+
36548
+ function requireHasPropertyDescriptors () {
36549
+ if (hasRequiredHasPropertyDescriptors) return hasPropertyDescriptors_1;
36550
+ hasRequiredHasPropertyDescriptors = 1;
36551
+
36552
+ var GetIntrinsic = requireGetIntrinsic();
36553
+
36554
+ var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
36555
+
36556
+ var hasPropertyDescriptors = function hasPropertyDescriptors() {
36557
+ if ($defineProperty) {
36558
+ try {
36559
+ $defineProperty({}, 'a', { value: 1 });
36560
+ return true;
36561
+ } catch (e) {
36562
+ // IE 8 has a broken defineProperty
36563
+ return false;
36564
+ }
36565
+ }
36566
+ return false;
36567
+ };
36568
+
36569
+ hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
36570
+ // node v0.6 has a bug where array lengths can be Set but not Defined
36571
+ if (!hasPropertyDescriptors()) {
36572
+ return null;
36573
+ }
36574
+ try {
36575
+ return $defineProperty([], 'length', { value: 1 }).length !== 1;
36576
+ } catch (e) {
36577
+ // In Firefox 4-22, defining length on an array throws an exception.
36578
+ return true;
36579
+ }
36580
+ };
36581
+
36582
+ hasPropertyDescriptors_1 = hasPropertyDescriptors;
36583
+ return hasPropertyDescriptors_1;
36584
+ }
36585
+
36586
+ var gopd;
36587
+ var hasRequiredGopd;
36588
+
36589
+ function requireGopd () {
36590
+ if (hasRequiredGopd) return gopd;
36591
+ hasRequiredGopd = 1;
36592
+
36593
+ var GetIntrinsic = requireGetIntrinsic();
36594
+
36595
+ var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
36596
+
36597
+ if ($gOPD) {
36598
+ try {
36599
+ $gOPD([], 'length');
36600
+ } catch (e) {
36601
+ // IE 8 has a broken gOPD
36602
+ $gOPD = null;
36603
+ }
36604
+ }
36605
+
36606
+ gopd = $gOPD;
36607
+ return gopd;
36608
+ }
36609
+
36610
+ var defineDataProperty;
36611
+ var hasRequiredDefineDataProperty;
36612
+
36613
+ function requireDefineDataProperty () {
36614
+ if (hasRequiredDefineDataProperty) return defineDataProperty;
36615
+ hasRequiredDefineDataProperty = 1;
36616
+
36617
+ var hasPropertyDescriptors = requireHasPropertyDescriptors()();
36618
+
36619
+ var GetIntrinsic = requireGetIntrinsic();
36620
+
36621
+ var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
36622
+ if ($defineProperty) {
36623
+ try {
36624
+ $defineProperty({}, 'a', { value: 1 });
36625
+ } catch (e) {
36626
+ // IE 8 has a broken defineProperty
36627
+ $defineProperty = false;
36628
+ }
36629
+ }
36630
+
36631
+ var $SyntaxError = GetIntrinsic('%SyntaxError%');
36632
+ var $TypeError = GetIntrinsic('%TypeError%');
36633
+
36634
+ var gopd = requireGopd();
36635
+
36636
+ /** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
36637
+ defineDataProperty = function defineDataProperty(
36638
+ obj,
36639
+ property,
36640
+ value
36641
+ ) {
36642
+ if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
36643
+ throw new $TypeError('`obj` must be an object or a function`');
36644
+ }
36645
+ if (typeof property !== 'string' && typeof property !== 'symbol') {
36646
+ throw new $TypeError('`property` must be a string or a symbol`');
36647
+ }
36648
+ if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
36649
+ throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
36650
+ }
36651
+ if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
36652
+ throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
36653
+ }
36654
+ if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
36655
+ throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
36656
+ }
36657
+ if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
36658
+ throw new $TypeError('`loose`, if provided, must be a boolean');
36659
+ }
36660
+
36661
+ var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
36662
+ var nonWritable = arguments.length > 4 ? arguments[4] : null;
36663
+ var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
36664
+ var loose = arguments.length > 6 ? arguments[6] : false;
36665
+
36666
+ /* @type {false | TypedPropertyDescriptor<unknown>} */
36667
+ var desc = !!gopd && gopd(obj, property);
36668
+
36669
+ if ($defineProperty) {
36670
+ $defineProperty(obj, property, {
36671
+ configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
36672
+ enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
36673
+ value: value,
36674
+ writable: nonWritable === null && desc ? desc.writable : !nonWritable
36675
+ });
36676
+ } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
36677
+ // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
36678
+ obj[property] = value; // eslint-disable-line no-param-reassign
36679
+ } else {
36680
+ throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
36681
+ }
36682
+ };
36683
+ return defineDataProperty;
36684
+ }
36685
+
36686
+ var setFunctionLength;
36687
+ var hasRequiredSetFunctionLength;
36688
+
36689
+ function requireSetFunctionLength () {
36690
+ if (hasRequiredSetFunctionLength) return setFunctionLength;
36691
+ hasRequiredSetFunctionLength = 1;
36692
+
36693
+ var GetIntrinsic = requireGetIntrinsic();
36694
+ var define = requireDefineDataProperty();
36695
+ var hasDescriptors = requireHasPropertyDescriptors()();
36696
+ var gOPD = requireGopd();
36697
+
36698
+ var $TypeError = GetIntrinsic('%TypeError%');
36699
+ var $floor = GetIntrinsic('%Math.floor%');
36700
+
36701
+ setFunctionLength = function setFunctionLength(fn, length) {
36702
+ if (typeof fn !== 'function') {
36703
+ throw new $TypeError('`fn` is not a function');
36704
+ }
36705
+ if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
36706
+ throw new $TypeError('`length` must be a positive 32-bit integer');
36707
+ }
36708
+
36709
+ var loose = arguments.length > 2 && !!arguments[2];
36710
+
36711
+ var functionLengthIsConfigurable = true;
36712
+ var functionLengthIsWritable = true;
36713
+ if ('length' in fn && gOPD) {
36714
+ var desc = gOPD(fn, 'length');
36715
+ if (desc && !desc.configurable) {
36716
+ functionLengthIsConfigurable = false;
36717
+ }
36718
+ if (desc && !desc.writable) {
36719
+ functionLengthIsWritable = false;
36720
+ }
36721
+ }
36722
+
36723
+ if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
36724
+ if (hasDescriptors) {
36725
+ define(fn, 'length', length, true, true);
36726
+ } else {
36727
+ define(fn, 'length', length);
36728
+ }
36729
+ }
36730
+ return fn;
36731
+ };
36732
+ return setFunctionLength;
36733
+ }
36734
+
36489
36735
  var hasRequiredCallBind;
36490
36736
 
36491
36737
  function requireCallBind () {
@@ -36495,12 +36741,13 @@ function requireCallBind () {
36495
36741
 
36496
36742
  var bind = requireFunctionBind();
36497
36743
  var GetIntrinsic = requireGetIntrinsic();
36744
+ var setFunctionLength = requireSetFunctionLength();
36498
36745
 
36746
+ var $TypeError = GetIntrinsic('%TypeError%');
36499
36747
  var $apply = GetIntrinsic('%Function.prototype.apply%');
36500
36748
  var $call = GetIntrinsic('%Function.prototype.call%');
36501
36749
  var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
36502
36750
 
36503
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
36504
36751
  var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
36505
36752
  var $max = GetIntrinsic('%Math.max%');
36506
36753
 
@@ -36514,19 +36761,15 @@ function requireCallBind () {
36514
36761
  }
36515
36762
 
36516
36763
  module.exports = function callBind(originalFunction) {
36517
- var func = $reflectApply(bind, $call, arguments);
36518
- if ($gOPD && $defineProperty) {
36519
- var desc = $gOPD(func, 'length');
36520
- if (desc.configurable) {
36521
- // original length, plus the receiver, minus any additional arguments (after the receiver)
36522
- $defineProperty(
36523
- func,
36524
- 'length',
36525
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
36526
- );
36527
- }
36764
+ if (typeof originalFunction !== 'function') {
36765
+ throw new $TypeError('a function is required');
36528
36766
  }
36529
- return func;
36767
+ var func = $reflectApply(bind, $call, arguments);
36768
+ return setFunctionLength(
36769
+ func,
36770
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
36771
+ true
36772
+ );
36530
36773
  };
36531
36774
 
36532
36775
  var applyBind = function applyBind() {
@@ -36822,6 +37065,14 @@ function requireObjectInspect () {
36822
37065
  if (isString(obj)) {
36823
37066
  return markBoxed(inspect(String(obj)));
36824
37067
  }
37068
+ // note: in IE 8, sometimes `global !== window` but both are the prototypes of each other
37069
+ /* eslint-env browser */
37070
+ if (typeof window !== 'undefined' && obj === window) {
37071
+ return '{ [object Window] }';
37072
+ }
37073
+ if (obj === commonjsGlobal) {
37074
+ return '{ [object globalThis] }';
37075
+ }
36825
37076
  if (!isDate(obj) && !isRegExp(obj)) {
36826
37077
  var ys = arrObjKeys(obj, inspect);
36827
37078
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
@@ -38169,7 +38420,7 @@ function requireUrlencoded () {
38169
38420
  var bytes = bytesExports;
38170
38421
  var contentType = requireContentType();
38171
38422
  var createError = requireHttpErrors();
38172
- var debug = requireSrc$1()('body-parser:urlencoded');
38423
+ var debug = requireSrc()('body-parser:urlencoded');
38173
38424
  var deprecate = depd_1('body-parser');
38174
38425
  var read = requireRead();
38175
38426
  var typeis = requireTypeIs();
@@ -38984,7 +39235,7 @@ function fresh$3 (url, parsedUrl) {
38984
39235
  * @private
38985
39236
  */
38986
39237
 
38987
- var debug$5 = requireSrc$1()('finalhandler');
39238
+ var debug$5 = requireSrc()('finalhandler');
38988
39239
  var encodeUrl$2 = encodeurl;
38989
39240
  var escapeHtml$2 = escapeHtml_1;
38990
39241
  var onFinished$2 = requireOnFinished();
@@ -39521,7 +39772,7 @@ function pathtoRegexp(path, keys, options) {
39521
39772
  */
39522
39773
 
39523
39774
  var pathRegexp = pathToRegexp;
39524
- var debug$4 = requireSrc$1()('express:router:layer');
39775
+ var debug$4 = requireSrc()('express:router:layer');
39525
39776
 
39526
39777
  /**
39527
39778
  * Module variables.
@@ -39768,7 +40019,7 @@ function getBasicNodeMethods() {
39768
40019
  * @private
39769
40020
  */
39770
40021
 
39771
- var debug$3 = requireSrc$1()('express:router:route');
40022
+ var debug$3 = requireSrc()('express:router:route');
39772
40023
  var flatten$1 = arrayFlatten_1;
39773
40024
  var Layer$1 = layer;
39774
40025
  var methods$1 = methods$2;
@@ -40028,7 +40279,7 @@ var Route = route;
40028
40279
  var Layer = layer;
40029
40280
  var methods = methods$2;
40030
40281
  var mixin = utilsMergeExports;
40031
- var debug$2 = requireSrc$1()('express:router');
40282
+ var debug$2 = requireSrc()('express:router');
40032
40283
  var deprecate$3 = depd_1('express');
40033
40284
  var flatten = arrayFlatten_1;
40034
40285
  var parseUrl = parseurlExports;
@@ -40794,7 +41045,7 @@ function requireQuery () {
40794
41045
  * @private
40795
41046
  */
40796
41047
 
40797
- var debug$1 = requireSrc$1()('express:view');
41048
+ var debug$1 = requireSrc()('express:view');
40798
41049
  var path$3 = path__default["default"];
40799
41050
  var fs$3 = fs__default["default"];
40800
41051
 
@@ -44979,7 +45230,7 @@ function sortByRangeStart (a, b) {
44979
45230
  */
44980
45231
 
44981
45232
  var createError$1 = requireHttpErrors();
44982
- var debug = requireSrc$1()('send');
45233
+ var debug = requireSrc()('send');
44983
45234
  var deprecate$2 = depd_1('send');
44984
45235
  var destroy = requireDestroy();
44985
45236
  var encodeUrl$1 = encodeurl;
@@ -47529,7 +47780,7 @@ function trustSingle (subnet) {
47529
47780
  var methods = methods$2;
47530
47781
  var middleware = init;
47531
47782
  var query = requireQuery();
47532
- var debug = requireSrc$1()('express:application');
47783
+ var debug = requireSrc()('express:application');
47533
47784
  var View = view;
47534
47785
  var http = require$$2__default["default"];
47535
47786
  var compileETag = utils.compileETag;
@@ -51886,6 +52137,9 @@ class Server extends require$$0__default$2["default"] {
51886
52137
  this.nonces = new WeakMap();
51887
52138
  this.baseUrl = `http://localhost:${this.option.int("port", 8097)}`;
51888
52139
  }
52140
+ get express() {
52141
+ return this.app;
52142
+ }
51889
52143
  listen() {
51890
52144
  return new Promise((resolve) => {
51891
52145
  this.app = express();
@@ -51943,9 +52197,6 @@ class Server extends require$$0__default$2["default"] {
51943
52197
  });
51944
52198
  });
51945
52199
  }
51946
- get express() {
51947
- return this.app;
51948
- }
51949
52200
  _handleCompile(req, ws, ip) {
51950
52201
  // look at headers
51951
52202
  if (!("x-fisk-environments" in req.headers)) {
@@ -52151,6 +52402,7 @@ class Server extends require$$0__default$2["default"] {
52151
52402
  else {
52152
52403
  console.error("Bad message without type", json);
52153
52404
  }
52405
+ break;
52154
52406
  }
52155
52407
  case "object":
52156
52408
  if (msg instanceof Buffer) {
@@ -52204,11 +52456,11 @@ class Server extends require$$0__default$2["default"] {
52204
52456
  this._handleBuilder(req, client);
52205
52457
  break;
52206
52458
  case "/monitor":
52207
- client = new Client(3 /* Monitor */, ws, ip);
52459
+ client = new Client(3 /* ClientType.Monitor */, ws, ip);
52208
52460
  this._handleMonitor(req, client);
52209
52461
  break;
52210
52462
  case "/client_verify":
52211
- client = new Client(4 /* ClientVerify */, ws, ip);
52463
+ client = new Client(4 /* ClientType.ClientVerify */, ws, ip);
52212
52464
  this._handleClientVerify(req, client);
52213
52465
  break;
52214
52466
  default:
@@ -53739,7 +53991,7 @@ const clientMinimumVersion = "3.4.96";
53739
53991
  const serverStartTime = Date.now();
53740
53992
  process.on("unhandledRejection", (reason, p) => {
53741
53993
  console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
53742
- addLogFile({ source: "no source file", ip: "self", contents: `reason: ${reason.stack} p: ${p}\n` });
53994
+ addLogFile({ source: "no source file", ip: "self", contents: `reason: ${reason.stack} promise` });
53743
53995
  // process.exit();
53744
53996
  });
53745
53997
  process.on("uncaughtException", (err) => {
@@ -53835,7 +54087,9 @@ function jobStartedOrScheduled(type, job) {
53835
54087
  if (monitorsLog) {
53836
54088
  console.log("send to monitors", info);
53837
54089
  }
53838
- monitors.forEach((monitor) => monitor.send(info));
54090
+ monitors.forEach((monitor) => {
54091
+ monitor.send(info);
54092
+ });
53839
54093
  }
53840
54094
  }
53841
54095
  function cacheHit(builder, message) {
@@ -53873,7 +54127,9 @@ function cacheHit(builder, message) {
53873
54127
  console.log("send to monitors", info);
53874
54128
  }
53875
54129
  // console.log("sending info", info);
53876
- monitors.forEach((monitor) => monitor.send(info));
54130
+ monitors.forEach((monitor) => {
54131
+ monitor.send(info);
54132
+ });
53877
54133
  }
53878
54134
  }
53879
54135
  function jobFinished(builder, job) {
@@ -53900,7 +54156,9 @@ function jobFinished(builder, job) {
53900
54156
  if (monitorsLog) {
53901
54157
  console.log("send to monitors", info);
53902
54158
  }
53903
- monitors.forEach((monitor) => monitor.send(info));
54159
+ monitors.forEach((monitor) => {
54160
+ monitor.send(info);
54161
+ });
53904
54162
  }
53905
54163
  }
53906
54164
  function builderKey(ip, port) {
@@ -53953,9 +54211,13 @@ function onObjectCacheCleared() {
53953
54211
  jobsScheduled = 0;
53954
54212
  jobsFinished = 0;
53955
54213
  const msg = { type: "clearObjectCache" };
53956
- forEachBuilder((builder) => builder.send(msg));
54214
+ forEachBuilder((builder) => {
54215
+ builder.send(msg);
54216
+ });
53957
54217
  const info = statsMessage();
53958
- monitors.forEach((monitor) => monitor.send(info));
54218
+ monitors.forEach((monitor) => {
54219
+ monitor.send(info);
54220
+ });
53959
54221
  }
53960
54222
  function setObjectCacheEnabled(on) {
53961
54223
  if (on && !objectCache) {
@@ -54099,8 +54361,8 @@ function environmentsInfo() {
54099
54361
  const max = option("max-environment-size");
54100
54362
  ret.maxSizeBytes = max ? bytesExports.parse(String(max)) || 0 : 0;
54101
54363
  let usedSizeBytes = 0;
54102
- for (const hash in Environments.instance.environments) {
54103
- const env = Environments.instance.environments[hash];
54364
+ for (const hsh in Environments.instance.environments) {
54365
+ const env = Environments.instance.environments[hsh];
54104
54366
  if (env.size) {
54105
54367
  usedSizeBytes += env.size;
54106
54368
  }
@@ -54122,8 +54384,8 @@ server.on("listen", (app) => {
54122
54384
  app.get("/builders", (req, res) => {
54123
54385
  const ret = [];
54124
54386
  const now = Date.now();
54125
- for (const builderKey in builders) {
54126
- const s = builders[builderKey];
54387
+ for (const bKey in builders) {
54388
+ const s = builders[bKey];
54127
54389
  ret.push({
54128
54390
  ip: s.ip,
54129
54391
  name: s.name,
@@ -54221,9 +54483,9 @@ server.on("listen", (app) => {
54221
54483
  }
54222
54484
  });
54223
54485
  app.get("/environment/*", (req, res) => {
54224
- const hash = req.path.substr(13);
54225
- const env = Environments.instance.environment(hash);
54226
- console.log("got env request", hash, env);
54486
+ const h = req.path.substr(13);
54487
+ const env = Environments.instance.environment(h);
54488
+ console.log("got env request", h, env);
54227
54489
  if (!env) {
54228
54490
  res.sendStatus(404);
54229
54491
  return;
@@ -54319,7 +54581,9 @@ function updateLogFilesToMonitors() {
54319
54581
  }
54320
54582
  const msg = { type: "logFiles", files: files || [] };
54321
54583
  // console.log("sending files", msg);
54322
- monitors.forEach((monitor) => monitor.send(msg));
54584
+ monitors.forEach((monitor) => {
54585
+ monitor.send(msg);
54586
+ });
54323
54587
  });
54324
54588
  }
54325
54589
  }
@@ -54330,9 +54594,9 @@ function clearLogFiles() {
54330
54594
  return;
54331
54595
  }
54332
54596
  for (const file of files) {
54333
- fs$5.unlink(path__default["default"].join(logFileDir, file), (err) => {
54334
- if (err) {
54335
- console.log("failed to remove file", path__default["default"].join(logFileDir, file), err);
54597
+ fs$5.unlink(path__default["default"].join(logFileDir, file), (error) => {
54598
+ if (error) {
54599
+ console.log("failed to remove file", path__default["default"].join(logFileDir, file), error);
54336
54600
  }
54337
54601
  });
54338
54602
  }
@@ -54433,8 +54697,12 @@ server.on("builder", (builder) => {
54433
54697
  ++jobsStarted;
54434
54698
  jobStartedOrScheduled("jobStarted", job);
54435
54699
  });
54436
- builder.on("jobFinished", (job) => jobFinished(builder, job));
54437
- builder.on("cacheHit", (job) => cacheHit(builder, job));
54700
+ builder.on("jobFinished", (job) => {
54701
+ jobFinished(builder, job);
54702
+ });
54703
+ builder.on("cacheHit", (job) => {
54704
+ cacheHit(builder, job);
54705
+ });
54438
54706
  builder.on("jobAborted", (job) => {
54439
54707
  console.log(`builder: ${builder.ip}:${builder.port} aborted a job`, job);
54440
54708
  if (monitors.length) {
@@ -54442,7 +54710,9 @@ server.on("builder", (builder) => {
54442
54710
  type: "jobAborted",
54443
54711
  id: job.id
54444
54712
  };
54445
- monitors.forEach((monitor) => monitor.send(info));
54713
+ monitors.forEach((monitor) => {
54714
+ monitor.send(info);
54715
+ });
54446
54716
  }
54447
54717
  });
54448
54718
  });
@@ -54466,21 +54736,21 @@ function requestEnvironment(compile) {
54466
54736
  compile.close();
54467
54737
  return;
54468
54738
  }
54469
- const hash = environment.hash;
54470
- compile.on("uploadEnvironmentData", (environment) => {
54739
+ const hsh = environment.hash;
54740
+ compile.on("uploadEnvironmentData", (env) => {
54471
54741
  if (!file) {
54472
54742
  console.error("no pending file");
54473
54743
  compile.send({ error: "no pending file" });
54474
54744
  compile.close();
54475
54745
  return;
54476
54746
  }
54477
- if (environment.last) {
54747
+ if (env.last) {
54478
54748
  gotLast = true;
54479
- console.log("Got environmentdata message", environment.data.length, environment.last);
54749
+ console.log("Got environmentdata message", env.data.length, env.last);
54480
54750
  }
54481
- file.save(environment.data)
54751
+ file.save(env.data)
54482
54752
  .then(() => {
54483
- if (environment.last) {
54753
+ if (env.last) {
54484
54754
  assert__default["default"](file);
54485
54755
  file.close();
54486
54756
  compile.close();
@@ -54489,16 +54759,15 @@ function requestEnvironment(compile) {
54489
54759
  return undefined;
54490
54760
  })
54491
54761
  .then(() => {
54492
- if (environment.last) {
54762
+ if (env.last) {
54493
54763
  file = undefined;
54494
54764
  // send any new environments to builders
54495
- delete pendingEnvironments[hash];
54496
- return purgeEnvironmentsToMaxSize();
54765
+ delete pendingEnvironments[hsh];
54766
+ purgeEnvironmentsToMaxSize();
54497
54767
  }
54498
- return undefined;
54499
54768
  })
54500
54769
  .then(() => {
54501
- if (environment.last) {
54770
+ if (env.last) {
54502
54771
  syncEnvironments();
54503
54772
  }
54504
54773
  })
@@ -54556,17 +54825,17 @@ server.on("compile", (compile) => {
54556
54825
  ++jobsFailed;
54557
54826
  return;
54558
54827
  }
54559
- function score(s) {
54828
+ const score = (s) => {
54560
54829
  const available = Math.min(4, s.slots - s.activeClients);
54561
54830
  return available * (1 - s.load);
54562
- }
54831
+ };
54563
54832
  let builder;
54564
54833
  let bestScore = Number.MIN_SAFE_INTEGER;
54565
54834
  let env;
54566
54835
  // console.log("got usableEnvs", usableEnvs);
54567
54836
  // ### should have a function match(s) that checks for env, score and compile.builder etc
54568
54837
  let foundInCache = false;
54569
- function filterBuilder(s) {
54838
+ const filterBuilder = (s) => {
54570
54839
  if (compile.builder && compile.builder !== s.ip && compile.builder !== s.name) {
54571
54840
  return false;
54572
54841
  }
@@ -54578,7 +54847,7 @@ server.on("compile", (compile) => {
54578
54847
  }
54579
54848
  }
54580
54849
  return true;
54581
- }
54850
+ };
54582
54851
  if (objectCache && compile.sha1) {
54583
54852
  const data = objectCache.get(compile.sha1);
54584
54853
  if (data) {
@@ -54653,7 +54922,9 @@ server.on("compile", (compile) => {
54653
54922
  });
54654
54923
  if (peakInfo && monitors.length) {
54655
54924
  const info = statsMessage();
54656
- monitors.forEach((monitor) => monitor.send(info));
54925
+ monitors.forEach((monitor) => {
54926
+ monitor.send(info);
54927
+ });
54657
54928
  }
54658
54929
  ++builder.activeClients;
54659
54930
  ++builder.jobsScheduled;
@@ -54708,19 +54979,19 @@ function writeConfiguration(change) {
54708
54979
  }
54709
54980
  function hash(password, salt) {
54710
54981
  return new Promise((resolve, reject) => {
54711
- crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err, hash) => {
54982
+ crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err, hsh) => {
54712
54983
  if (err) {
54713
54984
  reject(err);
54714
54985
  }
54715
54986
  else {
54716
- resolve(hash);
54987
+ resolve(hsh);
54717
54988
  }
54718
54989
  });
54719
54990
  });
54720
54991
  }
54721
- function randomBytes(bytes) {
54992
+ function randomBytes(byteLength) {
54722
54993
  return new Promise((resolve, reject) => {
54723
- crypto__default["default"].randomBytes(bytes, (err, result) => {
54994
+ crypto__default["default"].randomBytes(byteLength, (err, result) => {
54724
54995
  if (err) {
54725
54996
  reject(new Error(`Failed to random bytes ${err}`));
54726
54997
  }
@@ -54751,13 +55022,13 @@ server.on("monitor", (client) => {
54751
55022
  console.log("Got monitor", client.ip, client.hostname);
54752
55023
  }
54753
55024
  monitors.push(client);
54754
- function remove() {
55025
+ const remove = () => {
54755
55026
  const idx = monitors.indexOf(client);
54756
55027
  if (idx !== -1) {
54757
55028
  monitors.splice(idx, 1);
54758
55029
  }
54759
55030
  client.removeAllListeners();
54760
- }
55031
+ };
54761
55032
  let user;
54762
55033
  client.on("message", (messageText) => {
54763
55034
  var _a, _b, _c, _d;
@@ -54826,13 +55097,17 @@ server.on("monitor", (client) => {
54826
55097
  .link((_a = message.srcHash) !== null && _a !== void 0 ? _a : "", (_b = message.targetHash) !== null && _b !== void 0 ? _b : "", (_c = message.arguments) !== null && _c !== void 0 ? _c : [], (_d = message.blacklist) !== null && _d !== void 0 ? _d : [])
54827
55098
  .then(() => {
54828
55099
  const info = { type: "listEnvironments", environments: environmentsInfo() };
54829
- monitors.forEach((monitor) => monitor.send(info));
55100
+ monitors.forEach((monitor) => {
55101
+ monitor.send(info);
55102
+ });
54830
55103
  });
54831
55104
  break;
54832
55105
  case "unlinkEnvironments":
54833
55106
  Environments.instance.unlink(message.srcHash, message.targetHash).then(() => {
54834
55107
  const info = { type: "listEnvironments", environments: environmentsInfo() };
54835
- monitors.forEach((monitor) => monitor.send(info));
55108
+ monitors.forEach((monitor) => {
55109
+ monitor.send(info);
55110
+ });
54836
55111
  });
54837
55112
  break;
54838
55113
  case "listUsers": {
@@ -54933,9 +55208,9 @@ server.on("monitor", (client) => {
54933
55208
  }
54934
55209
  }
54935
55210
  else {
54936
- return hash(message.password || "", Buffer.from(users[message.user].salt, "base64")).then((hash) => {
55211
+ return hash(message.password || "", Buffer.from(users[message.user].salt, "base64")).then((hsh) => {
54937
55212
  var _a;
54938
- if (((_a = users[message.user || ""]) === null || _a === void 0 ? void 0 : _a.hash) !== hash.toString("base64")) {
55213
+ if (((_a = users[message.user || ""]) === null || _a === void 0 ? void 0 : _a.hash) !== hsh.toString("base64")) {
54939
55214
  throw new Error(`Wrong password ${message.user}`);
54940
55215
  }
54941
55216
  });
@@ -54995,8 +55270,8 @@ server.on("monitor", (client) => {
54995
55270
  };
54996
55271
  return hash(message.password || "", salt);
54997
55272
  })
54998
- .then((hash) => {
54999
- users[message.user || ""].hash = hash.toString("base64");
55273
+ .then((hsh) => {
55274
+ users[message.user || ""].hash = hsh.toString("base64");
55000
55275
  return randomBytes(256);
55001
55276
  })
55002
55277
  .then((cookie) => {