@andersbakken/fisk 4.0.27 → 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
  /**
@@ -3599,28 +3589,26 @@ var mktemp_1 = {
3599
3589
  function untarFile(archive, file) {
3600
3590
  return new Promise((resolve, reject) => {
3601
3591
  mktemp_1.createDir("/tmp/fisk_env_infoXXXX").then((tmpdir) => {
3602
- console.log("fucker", tmpdir);
3603
3592
  child_process__default["default"].exec(`tar -zxf "${archive}" ${file}`, { cwd: tmpdir }, (err) => {
3604
3593
  if (err) {
3605
- // try {
3606
- // fs.removeSync(tmpdir);
3607
- // } catch (e) {
3608
- // console.error("Got an error removing the temp dir", tmpdir);
3609
- // }
3610
- console.log("rejecting fucker", tmpdir, err);
3594
+ try {
3595
+ fs$5.removeSync(tmpdir);
3596
+ }
3597
+ catch (e) {
3598
+ console.error("Got an error removing the temp dir", tmpdir);
3599
+ }
3611
3600
  reject(err);
3612
3601
  return;
3613
3602
  }
3614
- 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) => {
3615
3604
  try {
3616
- console.log("removing fucker", tmpdir);
3617
3605
  fs$5.removeSync(tmpdir);
3618
3606
  }
3619
3607
  catch (e) {
3620
3608
  console.error("Got an error removing the temp dir", tmpdir);
3621
3609
  }
3622
- if (err) {
3623
- reject(err);
3610
+ if (error) {
3611
+ reject(error);
3624
3612
  }
3625
3613
  else {
3626
3614
  resolve(data);
@@ -3636,6 +3624,12 @@ class Environments {
3636
3624
  this._data = {};
3637
3625
  this._links = {};
3638
3626
  }
3627
+ get environments() {
3628
+ return this._data;
3629
+ }
3630
+ get path() {
3631
+ return this._path || "";
3632
+ }
3639
3633
  load(db, p) {
3640
3634
  this._db = db;
3641
3635
  return db.get("links").then((l) => {
@@ -3782,12 +3776,6 @@ class Environments {
3782
3776
  }
3783
3777
  return this.syncLinks();
3784
3778
  }
3785
- get environments() {
3786
- return this._data;
3787
- }
3788
- get path() {
3789
- return this._path || "";
3790
- }
3791
3779
  environment(hash) {
3792
3780
  if (!(hash in this._data)) {
3793
3781
  return undefined;
@@ -3825,14 +3813,15 @@ Environments.instance = new Environments();
3825
3813
 
3826
3814
  class NodeData {
3827
3815
  constructor(size, maxSize, sha1s) {
3828
- this.sha1s = sha1s;
3829
3816
  this.size = size;
3830
3817
  this.maxSize = maxSize;
3818
+ this.sha1s = sha1s;
3831
3819
  }
3832
3820
  }
3833
3821
 
3834
3822
  class SHA1Data {
3835
3823
  constructor(fileSize, node) {
3824
+ this.fileSize = fileSize;
3836
3825
  this.fileSize = fileSize;
3837
3826
  this.nodes = [node];
3838
3827
  }
@@ -4069,7 +4058,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4069
4058
  return;
4070
4059
  }
4071
4060
  this.byNode.delete(node);
4072
- nodeData.sha1s.forEach((sha1) => removeFromSHA1Map(this.bySHA1, sha1, node));
4061
+ nodeData.sha1s.forEach((sha1) => {
4062
+ removeFromSHA1Map(this.bySHA1, sha1, node);
4063
+ });
4073
4064
  }
4074
4065
  dump(query) {
4075
4066
  if ("clear" in query) {
@@ -4140,17 +4131,17 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4140
4131
  if (this.byNode.size >= 2) {
4141
4132
  // let max = 1;
4142
4133
  let roundRobinIndex = 0;
4143
- const processObject = (sha1, value) => {
4134
+ const processObject = (sha, value) => {
4144
4135
  if (max !== undefined && max <= 0) {
4145
4136
  return;
4146
4137
  }
4147
4138
  const needed = Math.min(redundancy + 1 - value.nodes.length, this.byNode.size - 1);
4148
4139
  if (needed > 0) {
4149
- const needed = redundancy + 1 - value.nodes.length;
4140
+ const needed2 = redundancy + 1 - value.nodes.length;
4150
4141
  // console.log("should distribute", key, "to", needed, "nodes");
4151
4142
  let firstIdx;
4152
4143
  let found = 0;
4153
- while (found < needed) {
4144
+ while (found < needed2) {
4154
4145
  if (++nodeIdx === nodes.length) {
4155
4146
  nodeIdx = 0;
4156
4147
  }
@@ -4184,7 +4175,7 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4184
4175
  ++found;
4185
4176
  data.available -= value.fileSize;
4186
4177
  const src = value.nodes[roundRobinIndex++ % value.nodes.length];
4187
- data.objects.push({ source: src.ip + ":" + src.port, sha1: sha1 });
4178
+ data.objects.push({ source: src.ip + ":" + src.port, sha1: sha });
4188
4179
  if (max !== undefined && !--max) {
4189
4180
  break;
4190
4181
  }
@@ -4202,7 +4193,9 @@ class ObjectCacheManager extends require$$0__default$2["default"] {
4202
4193
  }
4203
4194
  }
4204
4195
  else {
4205
- this.bySHA1.forEach((value, key) => processObject(key, value));
4196
+ this.bySHA1.forEach((value, key) => {
4197
+ processObject(key, value);
4198
+ });
4206
4199
  }
4207
4200
  }
4208
4201
  commands.forEach((value, key) => {
@@ -4338,11 +4331,11 @@ class Peak {
4338
4331
  class Client extends require$$0__default$2["default"] {
4339
4332
  constructor(type, ws, ip, option) {
4340
4333
  super();
4341
- this.created = new Date();
4342
4334
  this.type = type;
4343
4335
  this.ws = ws;
4344
4336
  this.ip = ip;
4345
4337
  this.option = option;
4338
+ this.created = new Date();
4346
4339
  this.hostname = "";
4347
4340
  this.name = "";
4348
4341
  this.npmVersion = "";
@@ -4408,7 +4401,7 @@ class Client extends require$$0__default$2["default"] {
4408
4401
 
4409
4402
  class Builder extends Client {
4410
4403
  constructor(ws, ip, option) {
4411
- super(0 /* Builder */, ws, ip, option);
4404
+ super(0 /* ClientType.Builder */, ws, ip, option);
4412
4405
  this.jobsPerformed = 0;
4413
4406
  this.totalCompileSpeed = 0;
4414
4407
  this.totalUploadSpeed = 0;
@@ -4424,7 +4417,7 @@ class Builder extends Client {
4424
4417
 
4425
4418
  class Compile extends Client {
4426
4419
  constructor(ws, ip, environment, sourceFile, sha1, option) {
4427
- super(1 /* Compile */, ws, ip, option);
4420
+ super(1 /* ClientType.Compile */, ws, ip, option);
4428
4421
  this.environment = environment;
4429
4422
  this.sourceFile = sourceFile;
4430
4423
  this.sha1 = sha1;
@@ -10829,7 +10822,7 @@ function requireHttpErrors () {
10829
10822
  }
10830
10823
 
10831
10824
  var srcExports = {};
10832
- var src$1 = {
10825
+ var src = {
10833
10826
  get exports(){ return srcExports; },
10834
10827
  set exports(v){ srcExports = v; },
10835
10828
  };
@@ -11682,18 +11675,18 @@ function requireNode () {
11682
11675
  * treat as a browser.
11683
11676
  */
11684
11677
 
11685
- var hasRequiredSrc$1;
11678
+ var hasRequiredSrc;
11686
11679
 
11687
- function requireSrc$1 () {
11688
- if (hasRequiredSrc$1) return srcExports;
11689
- hasRequiredSrc$1 = 1;
11680
+ function requireSrc () {
11681
+ if (hasRequiredSrc) return srcExports;
11682
+ hasRequiredSrc = 1;
11690
11683
  (function (module) {
11691
11684
  if (typeof process !== 'undefined' && process.type === 'renderer') {
11692
11685
  module.exports = requireBrowser();
11693
11686
  } else {
11694
11687
  module.exports = requireNode();
11695
11688
  }
11696
- } (src$1));
11689
+ } (src));
11697
11690
  return srcExports;
11698
11691
  }
11699
11692
 
@@ -35513,7 +35506,7 @@ function requireJson () {
35513
35506
  var bytes = bytesExports;
35514
35507
  var contentType = requireContentType();
35515
35508
  var createError = requireHttpErrors();
35516
- var debug = requireSrc$1()('body-parser:json');
35509
+ var debug = requireSrc()('body-parser:json');
35517
35510
  var read = requireRead();
35518
35511
  var typeis = requireTypeIs();
35519
35512
 
@@ -35753,7 +35746,7 @@ function requireRaw () {
35753
35746
  */
35754
35747
 
35755
35748
  var bytes = bytesExports;
35756
- var debug = requireSrc$1()('body-parser:raw');
35749
+ var debug = requireSrc()('body-parser:raw');
35757
35750
  var read = requireRead();
35758
35751
  var typeis = requireTypeIs();
35759
35752
 
@@ -35863,7 +35856,7 @@ function requireText () {
35863
35856
 
35864
35857
  var bytes = bytesExports;
35865
35858
  var contentType = requireContentType();
35866
- var debug = requireSrc$1()('body-parser:text');
35859
+ var debug = requireSrc()('body-parser:text');
35867
35860
  var read = requireRead();
35868
35861
  var typeis = requireTypeIs();
35869
35862
 
@@ -36044,6 +36037,25 @@ function requireHasSymbols () {
36044
36037
  return hasSymbols;
36045
36038
  }
36046
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
+
36047
36059
  var implementation;
36048
36060
  var hasRequiredImplementation;
36049
36061
 
@@ -36054,43 +36066,75 @@ function requireImplementation () {
36054
36066
  /* eslint no-invalid-this: 1 */
36055
36067
 
36056
36068
  var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
36057
- var slice = Array.prototype.slice;
36058
36069
  var toStr = Object.prototype.toString;
36070
+ var max = Math.max;
36059
36071
  var funcType = '[object Function]';
36060
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
+
36061
36105
  implementation = function bind(that) {
36062
36106
  var target = this;
36063
- if (typeof target !== 'function' || toStr.call(target) !== funcType) {
36107
+ if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
36064
36108
  throw new TypeError(ERROR_MESSAGE + target);
36065
36109
  }
36066
- var args = slice.call(arguments, 1);
36110
+ var args = slicy(arguments, 1);
36067
36111
 
36068
36112
  var bound;
36069
36113
  var binder = function () {
36070
36114
  if (this instanceof bound) {
36071
36115
  var result = target.apply(
36072
36116
  this,
36073
- args.concat(slice.call(arguments))
36117
+ concatty(args, arguments)
36074
36118
  );
36075
36119
  if (Object(result) === result) {
36076
36120
  return result;
36077
36121
  }
36078
36122
  return this;
36079
- } else {
36080
- return target.apply(
36081
- that,
36082
- args.concat(slice.call(arguments))
36083
- );
36084
36123
  }
36124
+ return target.apply(
36125
+ that,
36126
+ concatty(args, arguments)
36127
+ );
36128
+
36085
36129
  };
36086
36130
 
36087
- var boundLength = Math.max(0, target.length - args.length);
36131
+ var boundLength = max(0, target.length - args.length);
36088
36132
  var boundArgs = [];
36089
36133
  for (var i = 0; i < boundLength; i++) {
36090
- boundArgs.push('$' + i);
36134
+ boundArgs[i] = '$' + i;
36091
36135
  }
36092
36136
 
36093
- 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);
36094
36138
 
36095
36139
  if (target.prototype) {
36096
36140
  var Empty = function Empty() {};
@@ -36117,17 +36161,20 @@ function requireFunctionBind () {
36117
36161
  return functionBind;
36118
36162
  }
36119
36163
 
36120
- var src;
36121
- var hasRequiredSrc;
36164
+ var hasown;
36165
+ var hasRequiredHasown;
36122
36166
 
36123
- function requireSrc () {
36124
- if (hasRequiredSrc) return src;
36125
- hasRequiredSrc = 1;
36167
+ function requireHasown () {
36168
+ if (hasRequiredHasown) return hasown;
36169
+ hasRequiredHasown = 1;
36126
36170
 
36171
+ var call = Function.prototype.call;
36172
+ var $hasOwn = Object.prototype.hasOwnProperty;
36127
36173
  var bind = requireFunctionBind();
36128
36174
 
36129
- src = bind.call(Function.call, Object.prototype.hasOwnProperty);
36130
- return src;
36175
+ /** @type {(o: {}, p: PropertyKey) => p is keyof o} */
36176
+ hasown = bind.call(call, $hasOwn);
36177
+ return hasown;
36131
36178
  }
36132
36179
 
36133
36180
  var getIntrinsic;
@@ -36180,18 +36227,23 @@ function requireGetIntrinsic () {
36180
36227
  : throwTypeError;
36181
36228
 
36182
36229
  var hasSymbols = requireHasSymbols()();
36230
+ var hasProto = requireHasProto()();
36183
36231
 
36184
- 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
+ );
36185
36237
 
36186
36238
  var needsEval = {};
36187
36239
 
36188
- var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
36240
+ var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined$1 : getProto(Uint8Array);
36189
36241
 
36190
36242
  var INTRINSICS = {
36191
36243
  '%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
36192
36244
  '%Array%': Array,
36193
36245
  '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
36194
- '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined$1,
36246
+ '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
36195
36247
  '%AsyncFromSyncIteratorPrototype%': undefined$1,
36196
36248
  '%AsyncFunction%': needsEval,
36197
36249
  '%AsyncGenerator%': needsEval,
@@ -36221,10 +36273,10 @@ function requireGetIntrinsic () {
36221
36273
  '%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
36222
36274
  '%isFinite%': isFinite,
36223
36275
  '%isNaN%': isNaN,
36224
- '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
36276
+ '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
36225
36277
  '%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
36226
36278
  '%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
36227
- '%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]()),
36228
36280
  '%Math%': Math,
36229
36281
  '%Number%': Number,
36230
36282
  '%Object%': Object,
@@ -36237,10 +36289,10 @@ function requireGetIntrinsic () {
36237
36289
  '%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
36238
36290
  '%RegExp%': RegExp,
36239
36291
  '%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
36240
- '%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]()),
36241
36293
  '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
36242
36294
  '%String%': String,
36243
- '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined$1,
36295
+ '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined$1,
36244
36296
  '%Symbol%': hasSymbols ? Symbol : undefined$1,
36245
36297
  '%SyntaxError%': $SyntaxError,
36246
36298
  '%ThrowTypeError%': ThrowTypeError,
@@ -36256,12 +36308,14 @@ function requireGetIntrinsic () {
36256
36308
  '%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
36257
36309
  };
36258
36310
 
36259
- try {
36260
- null.error; // eslint-disable-line no-unused-expressions
36261
- } catch (e) {
36262
- // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
36263
- var errorProto = getProto(getProto(e));
36264
- 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
+ }
36265
36319
  }
36266
36320
 
36267
36321
  var doEval = function doEval(name) {
@@ -36279,7 +36333,7 @@ function requireGetIntrinsic () {
36279
36333
  }
36280
36334
  } else if (name === '%AsyncIteratorPrototype%') {
36281
36335
  var gen = doEval('%AsyncGenerator%');
36282
- if (gen) {
36336
+ if (gen && getProto) {
36283
36337
  value = getProto(gen.prototype);
36284
36338
  }
36285
36339
  }
@@ -36344,7 +36398,7 @@ function requireGetIntrinsic () {
36344
36398
  };
36345
36399
 
36346
36400
  var bind = requireFunctionBind();
36347
- var hasOwn = requireSrc();
36401
+ var hasOwn = requireHasown();
36348
36402
  var $concat = bind.call(Function.call, Array.prototype.concat);
36349
36403
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
36350
36404
  var $replace = bind.call(Function.call, String.prototype.replace);
@@ -36488,6 +36542,196 @@ var callBind = {
36488
36542
  set exports(v){ callBindExports = v; },
36489
36543
  };
36490
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
+
36491
36735
  var hasRequiredCallBind;
36492
36736
 
36493
36737
  function requireCallBind () {
@@ -36497,12 +36741,13 @@ function requireCallBind () {
36497
36741
 
36498
36742
  var bind = requireFunctionBind();
36499
36743
  var GetIntrinsic = requireGetIntrinsic();
36744
+ var setFunctionLength = requireSetFunctionLength();
36500
36745
 
36746
+ var $TypeError = GetIntrinsic('%TypeError%');
36501
36747
  var $apply = GetIntrinsic('%Function.prototype.apply%');
36502
36748
  var $call = GetIntrinsic('%Function.prototype.call%');
36503
36749
  var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
36504
36750
 
36505
- var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
36506
36751
  var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
36507
36752
  var $max = GetIntrinsic('%Math.max%');
36508
36753
 
@@ -36516,19 +36761,15 @@ function requireCallBind () {
36516
36761
  }
36517
36762
 
36518
36763
  module.exports = function callBind(originalFunction) {
36519
- var func = $reflectApply(bind, $call, arguments);
36520
- if ($gOPD && $defineProperty) {
36521
- var desc = $gOPD(func, 'length');
36522
- if (desc.configurable) {
36523
- // original length, plus the receiver, minus any additional arguments (after the receiver)
36524
- $defineProperty(
36525
- func,
36526
- 'length',
36527
- { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
36528
- );
36529
- }
36764
+ if (typeof originalFunction !== 'function') {
36765
+ throw new $TypeError('a function is required');
36530
36766
  }
36531
- 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
+ );
36532
36773
  };
36533
36774
 
36534
36775
  var applyBind = function applyBind() {
@@ -36824,6 +37065,14 @@ function requireObjectInspect () {
36824
37065
  if (isString(obj)) {
36825
37066
  return markBoxed(inspect(String(obj)));
36826
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
+ }
36827
37076
  if (!isDate(obj) && !isRegExp(obj)) {
36828
37077
  var ys = arrObjKeys(obj, inspect);
36829
37078
  var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
@@ -38171,7 +38420,7 @@ function requireUrlencoded () {
38171
38420
  var bytes = bytesExports;
38172
38421
  var contentType = requireContentType();
38173
38422
  var createError = requireHttpErrors();
38174
- var debug = requireSrc$1()('body-parser:urlencoded');
38423
+ var debug = requireSrc()('body-parser:urlencoded');
38175
38424
  var deprecate = depd_1('body-parser');
38176
38425
  var read = requireRead();
38177
38426
  var typeis = requireTypeIs();
@@ -38986,7 +39235,7 @@ function fresh$3 (url, parsedUrl) {
38986
39235
  * @private
38987
39236
  */
38988
39237
 
38989
- var debug$5 = requireSrc$1()('finalhandler');
39238
+ var debug$5 = requireSrc()('finalhandler');
38990
39239
  var encodeUrl$2 = encodeurl;
38991
39240
  var escapeHtml$2 = escapeHtml_1;
38992
39241
  var onFinished$2 = requireOnFinished();
@@ -39523,7 +39772,7 @@ function pathtoRegexp(path, keys, options) {
39523
39772
  */
39524
39773
 
39525
39774
  var pathRegexp = pathToRegexp;
39526
- var debug$4 = requireSrc$1()('express:router:layer');
39775
+ var debug$4 = requireSrc()('express:router:layer');
39527
39776
 
39528
39777
  /**
39529
39778
  * Module variables.
@@ -39770,7 +40019,7 @@ function getBasicNodeMethods() {
39770
40019
  * @private
39771
40020
  */
39772
40021
 
39773
- var debug$3 = requireSrc$1()('express:router:route');
40022
+ var debug$3 = requireSrc()('express:router:route');
39774
40023
  var flatten$1 = arrayFlatten_1;
39775
40024
  var Layer$1 = layer;
39776
40025
  var methods$1 = methods$2;
@@ -40030,7 +40279,7 @@ var Route = route;
40030
40279
  var Layer = layer;
40031
40280
  var methods = methods$2;
40032
40281
  var mixin = utilsMergeExports;
40033
- var debug$2 = requireSrc$1()('express:router');
40282
+ var debug$2 = requireSrc()('express:router');
40034
40283
  var deprecate$3 = depd_1('express');
40035
40284
  var flatten = arrayFlatten_1;
40036
40285
  var parseUrl = parseurlExports;
@@ -40796,7 +41045,7 @@ function requireQuery () {
40796
41045
  * @private
40797
41046
  */
40798
41047
 
40799
- var debug$1 = requireSrc$1()('express:view');
41048
+ var debug$1 = requireSrc()('express:view');
40800
41049
  var path$3 = path__default["default"];
40801
41050
  var fs$3 = fs__default["default"];
40802
41051
 
@@ -44981,7 +45230,7 @@ function sortByRangeStart (a, b) {
44981
45230
  */
44982
45231
 
44983
45232
  var createError$1 = requireHttpErrors();
44984
- var debug = requireSrc$1()('send');
45233
+ var debug = requireSrc()('send');
44985
45234
  var deprecate$2 = depd_1('send');
44986
45235
  var destroy = requireDestroy();
44987
45236
  var encodeUrl$1 = encodeurl;
@@ -47531,7 +47780,7 @@ function trustSingle (subnet) {
47531
47780
  var methods = methods$2;
47532
47781
  var middleware = init;
47533
47782
  var query = requireQuery();
47534
- var debug = requireSrc$1()('express:application');
47783
+ var debug = requireSrc()('express:application');
47535
47784
  var View = view;
47536
47785
  var http = require$$2__default["default"];
47537
47786
  var compileETag = utils.compileETag;
@@ -51888,6 +52137,9 @@ class Server extends require$$0__default$2["default"] {
51888
52137
  this.nonces = new WeakMap();
51889
52138
  this.baseUrl = `http://localhost:${this.option.int("port", 8097)}`;
51890
52139
  }
52140
+ get express() {
52141
+ return this.app;
52142
+ }
51891
52143
  listen() {
51892
52144
  return new Promise((resolve) => {
51893
52145
  this.app = express();
@@ -51945,9 +52197,6 @@ class Server extends require$$0__default$2["default"] {
51945
52197
  });
51946
52198
  });
51947
52199
  }
51948
- get express() {
51949
- return this.app;
51950
- }
51951
52200
  _handleCompile(req, ws, ip) {
51952
52201
  // look at headers
51953
52202
  if (!("x-fisk-environments" in req.headers)) {
@@ -52153,6 +52402,7 @@ class Server extends require$$0__default$2["default"] {
52153
52402
  else {
52154
52403
  console.error("Bad message without type", json);
52155
52404
  }
52405
+ break;
52156
52406
  }
52157
52407
  case "object":
52158
52408
  if (msg instanceof Buffer) {
@@ -52206,11 +52456,11 @@ class Server extends require$$0__default$2["default"] {
52206
52456
  this._handleBuilder(req, client);
52207
52457
  break;
52208
52458
  case "/monitor":
52209
- client = new Client(3 /* Monitor */, ws, ip);
52459
+ client = new Client(3 /* ClientType.Monitor */, ws, ip);
52210
52460
  this._handleMonitor(req, client);
52211
52461
  break;
52212
52462
  case "/client_verify":
52213
- client = new Client(4 /* ClientVerify */, ws, ip);
52463
+ client = new Client(4 /* ClientType.ClientVerify */, ws, ip);
52214
52464
  this._handleClientVerify(req, client);
52215
52465
  break;
52216
52466
  default:
@@ -53741,7 +53991,7 @@ const clientMinimumVersion = "3.4.96";
53741
53991
  const serverStartTime = Date.now();
53742
53992
  process.on("unhandledRejection", (reason, p) => {
53743
53993
  console.error("Unhandled Rejection at: Promise", p, "reason:", reason === null || reason === void 0 ? void 0 : reason.stack);
53744
- 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` });
53745
53995
  // process.exit();
53746
53996
  });
53747
53997
  process.on("uncaughtException", (err) => {
@@ -53837,7 +54087,9 @@ function jobStartedOrScheduled(type, job) {
53837
54087
  if (monitorsLog) {
53838
54088
  console.log("send to monitors", info);
53839
54089
  }
53840
- monitors.forEach((monitor) => monitor.send(info));
54090
+ monitors.forEach((monitor) => {
54091
+ monitor.send(info);
54092
+ });
53841
54093
  }
53842
54094
  }
53843
54095
  function cacheHit(builder, message) {
@@ -53875,7 +54127,9 @@ function cacheHit(builder, message) {
53875
54127
  console.log("send to monitors", info);
53876
54128
  }
53877
54129
  // console.log("sending info", info);
53878
- monitors.forEach((monitor) => monitor.send(info));
54130
+ monitors.forEach((monitor) => {
54131
+ monitor.send(info);
54132
+ });
53879
54133
  }
53880
54134
  }
53881
54135
  function jobFinished(builder, job) {
@@ -53902,7 +54156,9 @@ function jobFinished(builder, job) {
53902
54156
  if (monitorsLog) {
53903
54157
  console.log("send to monitors", info);
53904
54158
  }
53905
- monitors.forEach((monitor) => monitor.send(info));
54159
+ monitors.forEach((monitor) => {
54160
+ monitor.send(info);
54161
+ });
53906
54162
  }
53907
54163
  }
53908
54164
  function builderKey(ip, port) {
@@ -53955,9 +54211,13 @@ function onObjectCacheCleared() {
53955
54211
  jobsScheduled = 0;
53956
54212
  jobsFinished = 0;
53957
54213
  const msg = { type: "clearObjectCache" };
53958
- forEachBuilder((builder) => builder.send(msg));
54214
+ forEachBuilder((builder) => {
54215
+ builder.send(msg);
54216
+ });
53959
54217
  const info = statsMessage();
53960
- monitors.forEach((monitor) => monitor.send(info));
54218
+ monitors.forEach((monitor) => {
54219
+ monitor.send(info);
54220
+ });
53961
54221
  }
53962
54222
  function setObjectCacheEnabled(on) {
53963
54223
  if (on && !objectCache) {
@@ -54101,8 +54361,8 @@ function environmentsInfo() {
54101
54361
  const max = option("max-environment-size");
54102
54362
  ret.maxSizeBytes = max ? bytesExports.parse(String(max)) || 0 : 0;
54103
54363
  let usedSizeBytes = 0;
54104
- for (const hash in Environments.instance.environments) {
54105
- const env = Environments.instance.environments[hash];
54364
+ for (const hsh in Environments.instance.environments) {
54365
+ const env = Environments.instance.environments[hsh];
54106
54366
  if (env.size) {
54107
54367
  usedSizeBytes += env.size;
54108
54368
  }
@@ -54124,8 +54384,8 @@ server.on("listen", (app) => {
54124
54384
  app.get("/builders", (req, res) => {
54125
54385
  const ret = [];
54126
54386
  const now = Date.now();
54127
- for (const builderKey in builders) {
54128
- const s = builders[builderKey];
54387
+ for (const bKey in builders) {
54388
+ const s = builders[bKey];
54129
54389
  ret.push({
54130
54390
  ip: s.ip,
54131
54391
  name: s.name,
@@ -54223,9 +54483,9 @@ server.on("listen", (app) => {
54223
54483
  }
54224
54484
  });
54225
54485
  app.get("/environment/*", (req, res) => {
54226
- const hash = req.path.substr(13);
54227
- const env = Environments.instance.environment(hash);
54228
- 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);
54229
54489
  if (!env) {
54230
54490
  res.sendStatus(404);
54231
54491
  return;
@@ -54321,7 +54581,9 @@ function updateLogFilesToMonitors() {
54321
54581
  }
54322
54582
  const msg = { type: "logFiles", files: files || [] };
54323
54583
  // console.log("sending files", msg);
54324
- monitors.forEach((monitor) => monitor.send(msg));
54584
+ monitors.forEach((monitor) => {
54585
+ monitor.send(msg);
54586
+ });
54325
54587
  });
54326
54588
  }
54327
54589
  }
@@ -54332,9 +54594,9 @@ function clearLogFiles() {
54332
54594
  return;
54333
54595
  }
54334
54596
  for (const file of files) {
54335
- fs$5.unlink(path__default["default"].join(logFileDir, file), (err) => {
54336
- if (err) {
54337
- 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);
54338
54600
  }
54339
54601
  });
54340
54602
  }
@@ -54435,8 +54697,12 @@ server.on("builder", (builder) => {
54435
54697
  ++jobsStarted;
54436
54698
  jobStartedOrScheduled("jobStarted", job);
54437
54699
  });
54438
- builder.on("jobFinished", (job) => jobFinished(builder, job));
54439
- 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
+ });
54440
54706
  builder.on("jobAborted", (job) => {
54441
54707
  console.log(`builder: ${builder.ip}:${builder.port} aborted a job`, job);
54442
54708
  if (monitors.length) {
@@ -54444,7 +54710,9 @@ server.on("builder", (builder) => {
54444
54710
  type: "jobAborted",
54445
54711
  id: job.id
54446
54712
  };
54447
- monitors.forEach((monitor) => monitor.send(info));
54713
+ monitors.forEach((monitor) => {
54714
+ monitor.send(info);
54715
+ });
54448
54716
  }
54449
54717
  });
54450
54718
  });
@@ -54468,21 +54736,21 @@ function requestEnvironment(compile) {
54468
54736
  compile.close();
54469
54737
  return;
54470
54738
  }
54471
- const hash = environment.hash;
54472
- compile.on("uploadEnvironmentData", (environment) => {
54739
+ const hsh = environment.hash;
54740
+ compile.on("uploadEnvironmentData", (env) => {
54473
54741
  if (!file) {
54474
54742
  console.error("no pending file");
54475
54743
  compile.send({ error: "no pending file" });
54476
54744
  compile.close();
54477
54745
  return;
54478
54746
  }
54479
- if (environment.last) {
54747
+ if (env.last) {
54480
54748
  gotLast = true;
54481
- console.log("Got environmentdata message", environment.data.length, environment.last);
54749
+ console.log("Got environmentdata message", env.data.length, env.last);
54482
54750
  }
54483
- file.save(environment.data)
54751
+ file.save(env.data)
54484
54752
  .then(() => {
54485
- if (environment.last) {
54753
+ if (env.last) {
54486
54754
  assert__default["default"](file);
54487
54755
  file.close();
54488
54756
  compile.close();
@@ -54491,16 +54759,15 @@ function requestEnvironment(compile) {
54491
54759
  return undefined;
54492
54760
  })
54493
54761
  .then(() => {
54494
- if (environment.last) {
54762
+ if (env.last) {
54495
54763
  file = undefined;
54496
54764
  // send any new environments to builders
54497
- delete pendingEnvironments[hash];
54498
- return purgeEnvironmentsToMaxSize();
54765
+ delete pendingEnvironments[hsh];
54766
+ purgeEnvironmentsToMaxSize();
54499
54767
  }
54500
- return undefined;
54501
54768
  })
54502
54769
  .then(() => {
54503
- if (environment.last) {
54770
+ if (env.last) {
54504
54771
  syncEnvironments();
54505
54772
  }
54506
54773
  })
@@ -54558,17 +54825,17 @@ server.on("compile", (compile) => {
54558
54825
  ++jobsFailed;
54559
54826
  return;
54560
54827
  }
54561
- function score(s) {
54828
+ const score = (s) => {
54562
54829
  const available = Math.min(4, s.slots - s.activeClients);
54563
54830
  return available * (1 - s.load);
54564
- }
54831
+ };
54565
54832
  let builder;
54566
54833
  let bestScore = Number.MIN_SAFE_INTEGER;
54567
54834
  let env;
54568
54835
  // console.log("got usableEnvs", usableEnvs);
54569
54836
  // ### should have a function match(s) that checks for env, score and compile.builder etc
54570
54837
  let foundInCache = false;
54571
- function filterBuilder(s) {
54838
+ const filterBuilder = (s) => {
54572
54839
  if (compile.builder && compile.builder !== s.ip && compile.builder !== s.name) {
54573
54840
  return false;
54574
54841
  }
@@ -54580,7 +54847,7 @@ server.on("compile", (compile) => {
54580
54847
  }
54581
54848
  }
54582
54849
  return true;
54583
- }
54850
+ };
54584
54851
  if (objectCache && compile.sha1) {
54585
54852
  const data = objectCache.get(compile.sha1);
54586
54853
  if (data) {
@@ -54655,7 +54922,9 @@ server.on("compile", (compile) => {
54655
54922
  });
54656
54923
  if (peakInfo && monitors.length) {
54657
54924
  const info = statsMessage();
54658
- monitors.forEach((monitor) => monitor.send(info));
54925
+ monitors.forEach((monitor) => {
54926
+ monitor.send(info);
54927
+ });
54659
54928
  }
54660
54929
  ++builder.activeClients;
54661
54930
  ++builder.jobsScheduled;
@@ -54710,19 +54979,19 @@ function writeConfiguration(change) {
54710
54979
  }
54711
54980
  function hash(password, salt) {
54712
54981
  return new Promise((resolve, reject) => {
54713
- crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err, hash) => {
54982
+ crypto__default["default"].pbkdf2(password, salt, 12000, 256, "sha512", (err, hsh) => {
54714
54983
  if (err) {
54715
54984
  reject(err);
54716
54985
  }
54717
54986
  else {
54718
- resolve(hash);
54987
+ resolve(hsh);
54719
54988
  }
54720
54989
  });
54721
54990
  });
54722
54991
  }
54723
- function randomBytes(bytes) {
54992
+ function randomBytes(byteLength) {
54724
54993
  return new Promise((resolve, reject) => {
54725
- crypto__default["default"].randomBytes(bytes, (err, result) => {
54994
+ crypto__default["default"].randomBytes(byteLength, (err, result) => {
54726
54995
  if (err) {
54727
54996
  reject(new Error(`Failed to random bytes ${err}`));
54728
54997
  }
@@ -54753,13 +55022,13 @@ server.on("monitor", (client) => {
54753
55022
  console.log("Got monitor", client.ip, client.hostname);
54754
55023
  }
54755
55024
  monitors.push(client);
54756
- function remove() {
55025
+ const remove = () => {
54757
55026
  const idx = monitors.indexOf(client);
54758
55027
  if (idx !== -1) {
54759
55028
  monitors.splice(idx, 1);
54760
55029
  }
54761
55030
  client.removeAllListeners();
54762
- }
55031
+ };
54763
55032
  let user;
54764
55033
  client.on("message", (messageText) => {
54765
55034
  var _a, _b, _c, _d;
@@ -54828,13 +55097,17 @@ server.on("monitor", (client) => {
54828
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 : [])
54829
55098
  .then(() => {
54830
55099
  const info = { type: "listEnvironments", environments: environmentsInfo() };
54831
- monitors.forEach((monitor) => monitor.send(info));
55100
+ monitors.forEach((monitor) => {
55101
+ monitor.send(info);
55102
+ });
54832
55103
  });
54833
55104
  break;
54834
55105
  case "unlinkEnvironments":
54835
55106
  Environments.instance.unlink(message.srcHash, message.targetHash).then(() => {
54836
55107
  const info = { type: "listEnvironments", environments: environmentsInfo() };
54837
- monitors.forEach((monitor) => monitor.send(info));
55108
+ monitors.forEach((monitor) => {
55109
+ monitor.send(info);
55110
+ });
54838
55111
  });
54839
55112
  break;
54840
55113
  case "listUsers": {
@@ -54935,9 +55208,9 @@ server.on("monitor", (client) => {
54935
55208
  }
54936
55209
  }
54937
55210
  else {
54938
- 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) => {
54939
55212
  var _a;
54940
- 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")) {
54941
55214
  throw new Error(`Wrong password ${message.user}`);
54942
55215
  }
54943
55216
  });
@@ -54997,8 +55270,8 @@ server.on("monitor", (client) => {
54997
55270
  };
54998
55271
  return hash(message.password || "", salt);
54999
55272
  })
55000
- .then((hash) => {
55001
- users[message.user || ""].hash = hash.toString("base64");
55273
+ .then((hsh) => {
55274
+ users[message.user || ""].hash = hsh.toString("base64");
55002
55275
  return randomBytes(256);
55003
55276
  })
55004
55277
  .then((cookie) => {