@zhuixin/engine 0.2.1 → 0.2.3

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.
Files changed (2) hide show
  1. package/dist/engine-main.js +656 -340
  2. package/package.json +3 -3
@@ -363,25 +363,25 @@ var require_utils = __commonJS({
363
363
  }
364
364
  mkdirSync(folder);
365
365
  };
366
- Utils.prototype.writeFileTo = function(path8, content, overwrite, attr) {
366
+ Utils.prototype.writeFileTo = function(path9, content, overwrite, attr) {
367
367
  const self = this;
368
- if (self.fs.existsSync(path8)) {
368
+ if (self.fs.existsSync(path9)) {
369
369
  if (!overwrite) return false;
370
- var stat = self.fs.statSync(path8);
370
+ var stat = self.fs.statSync(path9);
371
371
  if (stat.isDirectory()) {
372
372
  return false;
373
373
  }
374
374
  }
375
- var folder = pth.dirname(path8);
375
+ var folder = pth.dirname(path9);
376
376
  if (!self.fs.existsSync(folder)) {
377
377
  self.makeDir(folder);
378
378
  }
379
379
  var fd;
380
380
  try {
381
- fd = self.fs.openSync(path8, "w", 438);
381
+ fd = self.fs.openSync(path9, "w", 438);
382
382
  } catch (e) {
383
- self.fs.chmodSync(path8, 438);
384
- fd = self.fs.openSync(path8, "w", 438);
383
+ self.fs.chmodSync(path9, 438);
384
+ fd = self.fs.openSync(path9, "w", 438);
385
385
  }
386
386
  if (fd) {
387
387
  try {
@@ -390,31 +390,31 @@ var require_utils = __commonJS({
390
390
  self.fs.closeSync(fd);
391
391
  }
392
392
  }
393
- self.fs.chmodSync(path8, attr || 438);
393
+ self.fs.chmodSync(path9, attr || 438);
394
394
  return true;
395
395
  };
396
- Utils.prototype.writeFileToAsync = function(path8, content, overwrite, attr, callback) {
396
+ Utils.prototype.writeFileToAsync = function(path9, content, overwrite, attr, callback) {
397
397
  if (typeof attr === "function") {
398
398
  callback = attr;
399
399
  attr = void 0;
400
400
  }
401
401
  const self = this;
402
- self.fs.exists(path8, function(exist) {
402
+ self.fs.exists(path9, function(exist) {
403
403
  if (exist && !overwrite) return callback(false);
404
- self.fs.stat(path8, function(err, stat) {
404
+ self.fs.stat(path9, function(err, stat) {
405
405
  if (exist && stat.isDirectory()) {
406
406
  return callback(false);
407
407
  }
408
- var folder = pth.dirname(path8);
408
+ var folder = pth.dirname(path9);
409
409
  self.fs.exists(folder, function(exists) {
410
410
  if (!exists) self.makeDir(folder);
411
- self.fs.open(path8, "w", 438, function(err2, fd) {
411
+ self.fs.open(path9, "w", 438, function(err2, fd) {
412
412
  if (err2) {
413
- self.fs.chmod(path8, 438, function() {
414
- self.fs.open(path8, "w", 438, function(err3, fd2) {
413
+ self.fs.chmod(path9, 438, function() {
414
+ self.fs.open(path9, "w", 438, function(err3, fd2) {
415
415
  self.fs.write(fd2, content, 0, content.length, 0, function() {
416
416
  self.fs.close(fd2, function() {
417
- self.fs.chmod(path8, attr || 438, function() {
417
+ self.fs.chmod(path9, attr || 438, function() {
418
418
  callback(true);
419
419
  });
420
420
  });
@@ -424,13 +424,13 @@ var require_utils = __commonJS({
424
424
  } else if (fd) {
425
425
  self.fs.write(fd, content, 0, content.length, 0, function() {
426
426
  self.fs.close(fd, function() {
427
- self.fs.chmod(path8, attr || 438, function() {
427
+ self.fs.chmod(path9, attr || 438, function() {
428
428
  callback(true);
429
429
  });
430
430
  });
431
431
  });
432
432
  } else {
433
- self.fs.chmod(path8, attr || 438, function() {
433
+ self.fs.chmod(path9, attr || 438, function() {
434
434
  callback(true);
435
435
  });
436
436
  }
@@ -439,7 +439,7 @@ var require_utils = __commonJS({
439
439
  });
440
440
  });
441
441
  };
442
- Utils.prototype.findFiles = function(path8) {
442
+ Utils.prototype.findFiles = function(path9) {
443
443
  const self = this;
444
444
  function findSync(dir, pattern, recursive) {
445
445
  if (typeof pattern === "boolean") {
@@ -448,16 +448,16 @@ var require_utils = __commonJS({
448
448
  }
449
449
  let files = [];
450
450
  self.fs.readdirSync(dir).forEach(function(file) {
451
- const path9 = pth.join(dir, file);
452
- const stat = self.fs.statSync(path9);
453
- if (!pattern || pattern.test(path9)) {
454
- files.push(pth.normalize(path9) + (stat.isDirectory() ? self.sep : ""));
451
+ const path10 = pth.join(dir, file);
452
+ const stat = self.fs.statSync(path10);
453
+ if (!pattern || pattern.test(path10)) {
454
+ files.push(pth.normalize(path10) + (stat.isDirectory() ? self.sep : ""));
455
455
  }
456
- if (stat.isDirectory() && recursive) files = files.concat(findSync(path9, pattern, recursive));
456
+ if (stat.isDirectory() && recursive) files = files.concat(findSync(path10, pattern, recursive));
457
457
  });
458
458
  return files;
459
459
  }
460
- return findSync(path8, void 0, true);
460
+ return findSync(path9, void 0, true);
461
461
  };
462
462
  Utils.prototype.findFilesAsync = function(dir, cb) {
463
463
  const self = this;
@@ -512,14 +512,14 @@ var require_utils = __commonJS({
512
512
  return "UNSUPPORTED (" + method + ")";
513
513
  }
514
514
  };
515
- Utils.canonical = function(path8) {
516
- if (!path8) return "";
517
- const safeSuffix = pth.posix.normalize("/" + path8.split("\\").join("/"));
515
+ Utils.canonical = function(path9) {
516
+ if (!path9) return "";
517
+ const safeSuffix = pth.posix.normalize("/" + path9.split("\\").join("/"));
518
518
  return pth.join(".", safeSuffix);
519
519
  };
520
- Utils.zipnamefix = function(path8) {
521
- if (!path8) return "";
522
- const safeSuffix = pth.posix.normalize("/" + path8.split("\\").join("/"));
520
+ Utils.zipnamefix = function(path9) {
521
+ if (!path9) return "";
522
+ const safeSuffix = pth.posix.normalize("/" + path9.split("\\").join("/"));
523
523
  return pth.posix.join(".", safeSuffix);
524
524
  };
525
525
  Utils.findLast = function(arr, callback) {
@@ -536,9 +536,9 @@ var require_utils = __commonJS({
536
536
  prefix = pth.resolve(pth.normalize(prefix));
537
537
  var parts = name.split("/");
538
538
  for (var i = 0, l = parts.length; i < l; i++) {
539
- var path8 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
540
- if (path8 === prefix || path8.startsWith(prefix + pth.sep)) {
541
- return path8;
539
+ var path9 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
540
+ if (path9 === prefix || path9.startsWith(prefix + pth.sep)) {
541
+ return path9;
542
542
  }
543
543
  }
544
544
  return pth.normalize(pth.join(prefix, pth.basename(name)));
@@ -585,8 +585,8 @@ var require_fattr = __commonJS({
585
585
  "node_modules/.pnpm/adm-zip@0.5.18/node_modules/adm-zip/util/fattr.js"(exports2, module2) {
586
586
  "use strict";
587
587
  var pth = require("path");
588
- module2.exports = function(path8, { fs: fs9 }) {
589
- var _path = path8 || "", _obj = newAttr(), _stat = null;
588
+ module2.exports = function(path9, { fs: fs10 }) {
589
+ var _path = path9 || "", _obj = newAttr(), _stat = null;
590
590
  function newAttr() {
591
591
  return {
592
592
  directory: false,
@@ -597,8 +597,8 @@ var require_fattr = __commonJS({
597
597
  atime: 0
598
598
  };
599
599
  }
600
- if (_path && fs9.existsSync(_path)) {
601
- _stat = fs9.statSync(_path);
600
+ if (_path && fs10.existsSync(_path)) {
601
+ _stat = fs10.statSync(_path);
602
602
  _obj.directory = _stat.isDirectory();
603
603
  _obj.mtime = _stat.mtime;
604
604
  _obj.atime = _stat.atime;
@@ -5406,23 +5406,23 @@ var require_dom = __commonJS({
5406
5406
  substringData: function(offset, count) {
5407
5407
  return this.data.substring(offset, offset + count);
5408
5408
  },
5409
- appendData: function(text) {
5410
- text = this.data + text;
5411
- this.nodeValue = this.data = text;
5412
- this.length = text.length;
5409
+ appendData: function(text2) {
5410
+ text2 = this.data + text2;
5411
+ this.nodeValue = this.data = text2;
5412
+ this.length = text2.length;
5413
5413
  },
5414
- insertData: function(offset, text) {
5415
- this.replaceData(offset, 0, text);
5414
+ insertData: function(offset, text2) {
5415
+ this.replaceData(offset, 0, text2);
5416
5416
  },
5417
5417
  deleteData: function(offset, count) {
5418
5418
  this.replaceData(offset, count, "");
5419
5419
  },
5420
- replaceData: function(offset, count, text) {
5420
+ replaceData: function(offset, count, text2) {
5421
5421
  var start = this.data.substring(0, offset);
5422
5422
  var end = this.data.substring(offset + count);
5423
- text = start + text + end;
5424
- this.nodeValue = this.data = text;
5425
- this.length = text.length;
5423
+ text2 = start + text2 + end;
5424
+ this.nodeValue = this.data = text2;
5425
+ this.length = text2.length;
5426
5426
  }
5427
5427
  };
5428
5428
  _extends(CharacterData, Node);
@@ -5433,11 +5433,11 @@ var require_dom = __commonJS({
5433
5433
  nodeName: "#text",
5434
5434
  nodeType: TEXT_NODE,
5435
5435
  splitText: function(offset) {
5436
- var text = this.data;
5437
- var newText = text.substring(offset);
5438
- text = text.substring(0, offset);
5439
- this.data = this.nodeValue = text;
5440
- this.length = text.length;
5436
+ var text2 = this.data;
5437
+ var newText = text2.substring(offset);
5438
+ text2 = text2.substring(0, offset);
5439
+ this.data = this.nodeValue = text2;
5440
+ this.length = text2.length;
5441
5441
  var newNode = this.ownerDocument.createTextNode(newText);
5442
5442
  if (this.parentNode) {
5443
5443
  this.parentNode.insertBefore(newNode, this.nextSibling);
@@ -8232,12 +8232,12 @@ var require_sax = __commonJS({
8232
8232
  }
8233
8233
  if (!source.substring(start).match(/^\s*$/)) {
8234
8234
  var doc = domBuilder.doc;
8235
- var text = doc.createTextNode(source.substring(start));
8235
+ var text2 = doc.createTextNode(source.substring(start));
8236
8236
  if (doc.documentElement) {
8237
8237
  return errorHandler.error("Extra content at the end of the document");
8238
8238
  }
8239
- doc.appendChild(text);
8240
- domBuilder.currentElement = text;
8239
+ doc.appendChild(text2);
8240
+ domBuilder.currentElement = text2;
8241
8241
  }
8242
8242
  return;
8243
8243
  }
@@ -8622,11 +8622,11 @@ var require_sax = __commonJS({
8622
8622
  if (elEndStart < 0) {
8623
8623
  return elStartEnd + 1;
8624
8624
  }
8625
- var text = source.substring(elStartEnd + 1, elEndStart);
8625
+ var text2 = source.substring(elStartEnd + 1, elEndStart);
8626
8626
  if (isEscapableRaw) {
8627
- text = text.replace(ENTITY_REG, entityReplacer);
8627
+ text2 = text2.replace(ENTITY_REG, entityReplacer);
8628
8628
  }
8629
- domBuilder.characters(text, 0, text.length);
8629
+ domBuilder.characters(text2, 0, text2.length);
8630
8630
  return elEndStart;
8631
8631
  }
8632
8632
  return elStartEnd + 1;
@@ -8663,11 +8663,11 @@ var require_sax = __commonJS({
8663
8663
  function substringFromIndex() {
8664
8664
  return source.substring(index);
8665
8665
  }
8666
- function substringStartsWith(text) {
8667
- return source.substring(index, index + text.length) === text;
8666
+ function substringStartsWith(text2) {
8667
+ return source.substring(index, index + text2.length) === text2;
8668
8668
  }
8669
- function substringStartsWithCaseInsensitive(text) {
8670
- return source.substring(index, index + text.length).toUpperCase() === text.toUpperCase();
8669
+ function substringStartsWithCaseInsensitive(text2) {
8670
+ return source.substring(index, index + text2.length).toUpperCase() === text2.toUpperCase();
8671
8671
  }
8672
8672
  function getMatch(args) {
8673
8673
  var expr = g.reg("^", args);
@@ -9255,9 +9255,9 @@ var require_parse = __commonJS({
9255
9255
  doc.documentElement.nodeName === "plist",
9256
9256
  "malformed document. First element should be <plist>"
9257
9257
  );
9258
- var plist2 = parsePlistXML(doc.documentElement);
9259
- if (plist2.length == 1) plist2 = plist2[0];
9260
- return plist2;
9258
+ var plist3 = parsePlistXML(doc.documentElement);
9259
+ if (plist3.length == 1) plist3 = plist3[0];
9260
+ return plist3;
9261
9261
  }
9262
9262
  function parsePlistXML(node) {
9263
9263
  var i, new_obj, key, val, new_arr, res, counter, type;
@@ -10288,14 +10288,14 @@ var require_XMLCData = __commonJS({
10288
10288
  module2.exports = XMLCData = class XMLCData extends XMLCharacterData {
10289
10289
  // Initializes a new instance of `XMLCData`
10290
10290
  // `text` CDATA text
10291
- constructor(parent, text) {
10291
+ constructor(parent, text2) {
10292
10292
  super(parent);
10293
- if (text == null) {
10293
+ if (text2 == null) {
10294
10294
  throw new Error("Missing CDATA text. " + this.debugInfo());
10295
10295
  }
10296
10296
  this.name = "#cdata-section";
10297
10297
  this.type = NodeType.CData;
10298
- this.value = this.stringify.cdata(text);
10298
+ this.value = this.stringify.cdata(text2);
10299
10299
  }
10300
10300
  // Creates and returns a deep clone of `this`
10301
10301
  clone() {
@@ -10325,14 +10325,14 @@ var require_XMLComment = __commonJS({
10325
10325
  module2.exports = XMLComment = class XMLComment extends XMLCharacterData {
10326
10326
  // Initializes a new instance of `XMLComment`
10327
10327
  // `text` comment text
10328
- constructor(parent, text) {
10328
+ constructor(parent, text2) {
10329
10329
  super(parent);
10330
- if (text == null) {
10330
+ if (text2 == null) {
10331
10331
  throw new Error("Missing comment text. " + this.debugInfo());
10332
10332
  }
10333
10333
  this.name = "#comment";
10334
10334
  this.type = NodeType.Comment;
10335
- this.value = this.stringify.comment(text);
10335
+ this.value = this.stringify.comment(text2);
10336
10336
  }
10337
10337
  // Creates and returns a deep clone of `this`
10338
10338
  clone() {
@@ -10870,13 +10870,13 @@ var require_XMLRaw = __commonJS({
10870
10870
  module2.exports = XMLRaw = class XMLRaw extends XMLNode {
10871
10871
  // Initializes a new instance of `XMLRaw`
10872
10872
  // `text` raw text
10873
- constructor(parent, text) {
10873
+ constructor(parent, text2) {
10874
10874
  super(parent);
10875
- if (text == null) {
10875
+ if (text2 == null) {
10876
10876
  throw new Error("Missing raw text. " + this.debugInfo());
10877
10877
  }
10878
10878
  this.type = NodeType.Raw;
10879
- this.value = this.stringify.raw(text);
10879
+ this.value = this.stringify.raw(text2);
10880
10880
  }
10881
10881
  // Creates and returns a deep clone of `this`
10882
10882
  clone() {
@@ -10907,14 +10907,14 @@ var require_XMLText = __commonJS({
10907
10907
  class XMLText2 extends XMLCharacterData {
10908
10908
  // Initializes a new instance of `XMLText`
10909
10909
  // `text` element text
10910
- constructor(parent, text) {
10910
+ constructor(parent, text2) {
10911
10911
  super(parent);
10912
- if (text == null) {
10912
+ if (text2 == null) {
10913
10913
  throw new Error("Missing element text. " + this.debugInfo());
10914
10914
  }
10915
10915
  this.name = "#text";
10916
10916
  this.type = NodeType.Text;
10917
- this.value = this.stringify.text(text);
10917
+ this.value = this.stringify.text(text2);
10918
10918
  }
10919
10919
  // Creates and returns a deep clone of `this`
10920
10920
  clone() {
@@ -11176,18 +11176,18 @@ var require_XMLNode = __commonJS({
11176
11176
  // `name` node name or an object describing the XML tree
11177
11177
  // `attributes` an object containing name/value pairs of attributes
11178
11178
  // `text` element text
11179
- element(name, attributes, text) {
11179
+ element(name, attributes, text2) {
11180
11180
  var childNode, item, j, k, key, lastChild, len, len1, val;
11181
11181
  lastChild = null;
11182
- if (attributes === null && text == null) {
11183
- [attributes, text] = [{}, null];
11182
+ if (attributes === null && text2 == null) {
11183
+ [attributes, text2] = [{}, null];
11184
11184
  }
11185
11185
  if (attributes == null) {
11186
11186
  attributes = {};
11187
11187
  }
11188
11188
  attributes = getValue(attributes);
11189
11189
  if (!isObject(attributes)) {
11190
- [text, attributes] = [attributes, text];
11190
+ [text2, attributes] = [attributes, text2];
11191
11191
  }
11192
11192
  if (name != null) {
11193
11193
  name = getValue(name);
@@ -11232,21 +11232,21 @@ var require_XMLNode = __commonJS({
11232
11232
  lastChild = this.element(key, val);
11233
11233
  }
11234
11234
  }
11235
- } else if (!this.options.keepNullNodes && text === null) {
11235
+ } else if (!this.options.keepNullNodes && text2 === null) {
11236
11236
  lastChild = this.dummy();
11237
11237
  } else {
11238
11238
  if (!this.options.ignoreDecorators && this.stringify.convertTextKey && name.indexOf(this.stringify.convertTextKey) === 0) {
11239
- lastChild = this.text(text);
11239
+ lastChild = this.text(text2);
11240
11240
  } else if (!this.options.ignoreDecorators && this.stringify.convertCDataKey && name.indexOf(this.stringify.convertCDataKey) === 0) {
11241
- lastChild = this.cdata(text);
11241
+ lastChild = this.cdata(text2);
11242
11242
  } else if (!this.options.ignoreDecorators && this.stringify.convertCommentKey && name.indexOf(this.stringify.convertCommentKey) === 0) {
11243
- lastChild = this.comment(text);
11243
+ lastChild = this.comment(text2);
11244
11244
  } else if (!this.options.ignoreDecorators && this.stringify.convertRawKey && name.indexOf(this.stringify.convertRawKey) === 0) {
11245
- lastChild = this.raw(text);
11245
+ lastChild = this.raw(text2);
11246
11246
  } else if (!this.options.ignoreDecorators && this.stringify.convertPIKey && name.indexOf(this.stringify.convertPIKey) === 0) {
11247
- lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text);
11247
+ lastChild = this.instruction(name.substr(this.stringify.convertPIKey.length), text2);
11248
11248
  } else {
11249
- lastChild = this.node(name, attributes, text);
11249
+ lastChild = this.node(name, attributes, text2);
11250
11250
  }
11251
11251
  }
11252
11252
  if (lastChild == null) {
@@ -11258,7 +11258,7 @@ var require_XMLNode = __commonJS({
11258
11258
  // `name` node name or an object describing the XML tree
11259
11259
  // `attributes` an object containing name/value pairs of attributes
11260
11260
  // `text` element text
11261
- insertBefore(name, attributes, text) {
11261
+ insertBefore(name, attributes, text2) {
11262
11262
  var child, i, newChild, refChild, removed;
11263
11263
  if (name != null ? name.type : void 0) {
11264
11264
  newChild = name;
@@ -11279,7 +11279,7 @@ var require_XMLNode = __commonJS({
11279
11279
  }
11280
11280
  i = this.parent.children.indexOf(this);
11281
11281
  removed = this.parent.children.splice(i);
11282
- child = this.parent.element(name, attributes, text);
11282
+ child = this.parent.element(name, attributes, text2);
11283
11283
  Array.prototype.push.apply(this.parent.children, removed);
11284
11284
  return child;
11285
11285
  }
@@ -11288,14 +11288,14 @@ var require_XMLNode = __commonJS({
11288
11288
  // `name` node name or an object describing the XML tree
11289
11289
  // `attributes` an object containing name/value pairs of attributes
11290
11290
  // `text` element text
11291
- insertAfter(name, attributes, text) {
11291
+ insertAfter(name, attributes, text2) {
11292
11292
  var child, i, removed;
11293
11293
  if (this.isRoot) {
11294
11294
  throw new Error("Cannot insert elements at root level. " + this.debugInfo(name));
11295
11295
  }
11296
11296
  i = this.parent.children.indexOf(this);
11297
11297
  removed = this.parent.children.splice(i + 1);
11298
- child = this.parent.element(name, attributes, text);
11298
+ child = this.parent.element(name, attributes, text2);
11299
11299
  Array.prototype.push.apply(this.parent.children, removed);
11300
11300
  return child;
11301
11301
  }
@@ -11313,7 +11313,7 @@ var require_XMLNode = __commonJS({
11313
11313
  // `name` name of the node
11314
11314
  // `attributes` an object containing name/value pairs of attributes
11315
11315
  // `text` element text
11316
- node(name, attributes, text) {
11316
+ node(name, attributes, text2) {
11317
11317
  var child;
11318
11318
  if (name != null) {
11319
11319
  name = getValue(name);
@@ -11321,11 +11321,11 @@ var require_XMLNode = __commonJS({
11321
11321
  attributes || (attributes = {});
11322
11322
  attributes = getValue(attributes);
11323
11323
  if (!isObject(attributes)) {
11324
- [text, attributes] = [attributes, text];
11324
+ [text2, attributes] = [attributes, text2];
11325
11325
  }
11326
11326
  child = new XMLElement(this, name, attributes);
11327
- if (text != null) {
11328
- child.text(text);
11327
+ if (text2 != null) {
11328
+ child.text(text2);
11329
11329
  }
11330
11330
  this.children.push(child);
11331
11331
  return child;
@@ -11582,11 +11582,11 @@ var require_XMLNode = __commonJS({
11582
11582
  }
11583
11583
  }
11584
11584
  // Aliases
11585
- ele(name, attributes, text) {
11586
- return this.element(name, attributes, text);
11585
+ ele(name, attributes, text2) {
11586
+ return this.element(name, attributes, text2);
11587
11587
  }
11588
- nod(name, attributes, text) {
11589
- return this.node(name, attributes, text);
11588
+ nod(name, attributes, text2) {
11589
+ return this.node(name, attributes, text2);
11590
11590
  }
11591
11591
  txt(value) {
11592
11592
  return this.text(value);
@@ -11606,11 +11606,11 @@ var require_XMLNode = __commonJS({
11606
11606
  dec(version, encoding, standalone) {
11607
11607
  return this.declaration(version, encoding, standalone);
11608
11608
  }
11609
- e(name, attributes, text) {
11610
- return this.element(name, attributes, text);
11609
+ e(name, attributes, text2) {
11610
+ return this.element(name, attributes, text2);
11611
11611
  }
11612
- n(name, attributes, text) {
11613
- return this.node(name, attributes, text);
11612
+ n(name, attributes, text2) {
11613
+ return this.node(name, attributes, text2);
11614
11614
  }
11615
11615
  t(value) {
11616
11616
  return this.text(value);
@@ -12995,7 +12995,7 @@ var require_XMLDocumentCB = __commonJS({
12995
12995
  // `name` name of the node
12996
12996
  // `attributes` an object containing name/value pairs of attributes
12997
12997
  // `text` element text
12998
- node(name, attributes, text) {
12998
+ node(name, attributes, text2) {
12999
12999
  if (name == null) {
13000
13000
  throw new Error("Missing node name.");
13001
13001
  }
@@ -13009,14 +13009,14 @@ var require_XMLDocumentCB = __commonJS({
13009
13009
  }
13010
13010
  attributes = getValue(attributes);
13011
13011
  if (!isObject(attributes)) {
13012
- [text, attributes] = [attributes, text];
13012
+ [text2, attributes] = [attributes, text2];
13013
13013
  }
13014
13014
  this.currentNode = new XMLElement(this, name, attributes);
13015
13015
  this.currentNode.children = false;
13016
13016
  this.currentLevel++;
13017
13017
  this.openTags[this.currentLevel] = this.currentNode;
13018
- if (text != null) {
13019
- this.text(text);
13018
+ if (text2 != null) {
13019
+ this.text(text2);
13020
13020
  }
13021
13021
  return this;
13022
13022
  }
@@ -13025,7 +13025,7 @@ var require_XMLDocumentCB = __commonJS({
13025
13025
  // `name` name of the node
13026
13026
  // `attributes` an object containing name/value pairs of attributes
13027
13027
  // `text` element text
13028
- element(name, attributes, text) {
13028
+ element(name, attributes, text2) {
13029
13029
  var child, i, len, oldValidationFlag, ref, root;
13030
13030
  if (this.currentNode && this.currentNode.type === NodeType.DocType) {
13031
13031
  this.dtdElement(...arguments);
@@ -13045,7 +13045,7 @@ var require_XMLDocumentCB = __commonJS({
13045
13045
  }
13046
13046
  }
13047
13047
  } else {
13048
- this.node(name, attributes, text);
13048
+ this.node(name, attributes, text2);
13049
13049
  }
13050
13050
  }
13051
13051
  return this;
@@ -13356,8 +13356,8 @@ var require_XMLDocumentCB = __commonJS({
13356
13356
  ele() {
13357
13357
  return this.element(...arguments);
13358
13358
  }
13359
- nod(name, attributes, text) {
13360
- return this.node(name, attributes, text);
13359
+ nod(name, attributes, text2) {
13360
+ return this.node(name, attributes, text2);
13361
13361
  }
13362
13362
  txt(value) {
13363
13363
  return this.text(value);
@@ -13377,11 +13377,11 @@ var require_XMLDocumentCB = __commonJS({
13377
13377
  dtd(root, pubID, sysID) {
13378
13378
  return this.doctype(root, pubID, sysID);
13379
13379
  }
13380
- e(name, attributes, text) {
13381
- return this.element(name, attributes, text);
13380
+ e(name, attributes, text2) {
13381
+ return this.element(name, attributes, text2);
13382
13382
  }
13383
- n(name, attributes, text) {
13384
- return this.node(name, attributes, text);
13383
+ n(name, attributes, text2) {
13384
+ return this.node(name, attributes, text2);
13385
13385
  }
13386
13386
  t(value) {
13387
13387
  return this.text(value);
@@ -14770,14 +14770,14 @@ var require_BigInteger = __commonJS({
14770
14770
  }
14771
14771
  return low.add(Integer.fromArray(result, BASE, false));
14772
14772
  }
14773
- var parseBase = function(text, base, alphabet, caseSensitive) {
14773
+ var parseBase = function(text2, base, alphabet, caseSensitive) {
14774
14774
  alphabet = alphabet || DEFAULT_ALPHABET;
14775
- text = String(text);
14775
+ text2 = String(text2);
14776
14776
  if (!caseSensitive) {
14777
- text = text.toLowerCase();
14777
+ text2 = text2.toLowerCase();
14778
14778
  alphabet = alphabet.toLowerCase();
14779
14779
  }
14780
- var length = text.length;
14780
+ var length = text2.length;
14781
14781
  var i2;
14782
14782
  var absBase = Math.abs(base);
14783
14783
  var alphabetValues = {};
@@ -14785,7 +14785,7 @@ var require_BigInteger = __commonJS({
14785
14785
  alphabetValues[alphabet[i2]] = i2;
14786
14786
  }
14787
14787
  for (i2 = 0; i2 < length; i2++) {
14788
- var c = text[i2];
14788
+ var c = text2[i2];
14789
14789
  if (c === "-") continue;
14790
14790
  if (c in alphabetValues) {
14791
14791
  if (alphabetValues[c] >= absBase) {
@@ -14796,16 +14796,16 @@ var require_BigInteger = __commonJS({
14796
14796
  }
14797
14797
  base = parseValue(base);
14798
14798
  var digits = [];
14799
- var isNegative = text[0] === "-";
14800
- for (i2 = isNegative ? 1 : 0; i2 < text.length; i2++) {
14801
- var c = text[i2];
14799
+ var isNegative = text2[0] === "-";
14800
+ for (i2 = isNegative ? 1 : 0; i2 < text2.length; i2++) {
14801
+ var c = text2[i2];
14802
14802
  if (c in alphabetValues) digits.push(parseValue(alphabetValues[c]));
14803
14803
  else if (c === "<") {
14804
14804
  var start = i2;
14805
14805
  do {
14806
14806
  i2++;
14807
- } while (text[i2] !== ">" && i2 < text.length);
14808
- digits.push(parseValue(text.slice(start + 1, i2)));
14807
+ } while (text2[i2] !== ">" && i2 < text2.length);
14808
+ digits.push(parseValue(text2.slice(start + 1, i2)));
14809
14809
  } else throw new Error(c + " is not a valid character");
14810
14810
  }
14811
14811
  return parseBaseFromArray(digits, base, isNegative);
@@ -14937,15 +14937,15 @@ var require_BigInteger = __commonJS({
14937
14937
  if (exp[0] === "+") exp = exp.slice(1);
14938
14938
  exp = +exp;
14939
14939
  if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent.");
14940
- var text = split[0];
14941
- var decimalPlace = text.indexOf(".");
14940
+ var text2 = split[0];
14941
+ var decimalPlace = text2.indexOf(".");
14942
14942
  if (decimalPlace >= 0) {
14943
- exp -= text.length - decimalPlace - 1;
14944
- text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1);
14943
+ exp -= text2.length - decimalPlace - 1;
14944
+ text2 = text2.slice(0, decimalPlace) + text2.slice(decimalPlace + 1);
14945
14945
  }
14946
14946
  if (exp < 0) throw new Error("Cannot include negative exponent part for integers");
14947
- text += new Array(exp + 1).join("0");
14948
- v = text;
14947
+ text2 += new Array(exp + 1).join("0");
14948
+ v = text2;
14949
14949
  }
14950
14950
  var isValid2 = /^([0-9][0-9]*)$/.test(v);
14951
14951
  if (!isValid2) throw new Error("Invalid integer: " + v);
@@ -15019,7 +15019,7 @@ var require_BigInteger = __commonJS({
15019
15019
  var require_bplistParser = __commonJS({
15020
15020
  "node_modules/.pnpm/bplist-parser@0.3.2/node_modules/bplist-parser/bplistParser.js"(exports2) {
15021
15021
  "use strict";
15022
- var fs9 = require("fs");
15022
+ var fs10 = require("fs");
15023
15023
  var bigInt = require_BigInteger();
15024
15024
  var debug = false;
15025
15025
  exports2.maxObjectSize = 100 * 1e3 * 1e3;
@@ -15034,7 +15034,7 @@ var require_bplistParser = __commonJS({
15034
15034
  let err = null;
15035
15035
  let result;
15036
15036
  try {
15037
- result = parseBuffer(buffer);
15037
+ result = parseBuffer2(buffer);
15038
15038
  resolve(result);
15039
15039
  } catch (ex) {
15040
15040
  err = ex;
@@ -15046,7 +15046,7 @@ var require_bplistParser = __commonJS({
15046
15046
  if (Buffer.isBuffer(fileNameOrBuffer)) {
15047
15047
  return tryParseBuffer(fileNameOrBuffer);
15048
15048
  }
15049
- fs9.readFile(fileNameOrBuffer, function(err, data) {
15049
+ fs10.readFile(fileNameOrBuffer, function(err, data) {
15050
15050
  if (err) {
15051
15051
  reject(err);
15052
15052
  return callback(err);
@@ -15057,11 +15057,11 @@ var require_bplistParser = __commonJS({
15057
15057
  };
15058
15058
  exports2.parseFileSync = function(fileNameOrBuffer) {
15059
15059
  if (!Buffer.isBuffer(fileNameOrBuffer)) {
15060
- fileNameOrBuffer = fs9.readFileSync(fileNameOrBuffer);
15060
+ fileNameOrBuffer = fs10.readFileSync(fileNameOrBuffer);
15061
15061
  }
15062
- return parseBuffer(fileNameOrBuffer);
15062
+ return parseBuffer2(fileNameOrBuffer);
15063
15063
  };
15064
- var parseBuffer = exports2.parseBuffer = function(buffer) {
15064
+ var parseBuffer2 = exports2.parseBuffer = function(buffer) {
15065
15065
  const header = buffer.slice(0, "bplist".length).toString("utf8");
15066
15066
  if (header !== "bplist") {
15067
15067
  throw new Error("Invalid binary plist. Expected 'bplist' at offset 0.");
@@ -15347,8 +15347,8 @@ var require_bplistParser = __commonJS({
15347
15347
  });
15348
15348
 
15349
15349
  // src/engine-main.ts
15350
- var import_node_fs8 = __toESM(require("fs"));
15351
- var import_node_path7 = __toESM(require("path"));
15350
+ var import_node_fs9 = __toESM(require("fs"));
15351
+ var import_node_path8 = __toESM(require("path"));
15352
15352
  var import_node_readline = __toESM(require("readline"));
15353
15353
 
15354
15354
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
@@ -15829,8 +15829,8 @@ function getErrorMap() {
15829
15829
 
15830
15830
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
15831
15831
  var makeIssue = (params) => {
15832
- const { data, path: path8, errorMaps, issueData } = params;
15833
- const fullPath = [...path8, ...issueData.path || []];
15832
+ const { data, path: path9, errorMaps, issueData } = params;
15833
+ const fullPath = [...path9, ...issueData.path || []];
15834
15834
  const fullIssue = {
15835
15835
  ...issueData,
15836
15836
  path: fullPath
@@ -15946,11 +15946,11 @@ var errorUtil;
15946
15946
 
15947
15947
  // node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
15948
15948
  var ParseInputLazyPath = class {
15949
- constructor(parent, value, path8, key) {
15949
+ constructor(parent, value, path9, key) {
15950
15950
  this._cachedPath = [];
15951
15951
  this.parent = parent;
15952
15952
  this.data = value;
15953
- this._path = path8;
15953
+ this._path = path9;
15954
15954
  this._key = key;
15955
15955
  }
15956
15956
  get path() {
@@ -19392,10 +19392,11 @@ var coerce = {
19392
19392
  };
19393
19393
  var NEVER = INVALID;
19394
19394
 
19395
- // node_modules/.pnpm/@zhuixin+protocol@0.1.2/node_modules/@zhuixin/protocol/dist/index.js
19395
+ // node_modules/.pnpm/@zhuixin+protocol@0.2.4/node_modules/@zhuixin/protocol/dist/index.js
19396
19396
  var PROTOCOL_VERSION = "1";
19397
19397
  var engineCapabilities = [
19398
19398
  "inspect:ipa",
19399
+ "inspect:mac-app",
19399
19400
  "extract:app",
19400
19401
  "javascript:analyze",
19401
19402
  "native:inspect",
@@ -19449,6 +19450,15 @@ var DEFINITIONS = [
19449
19450
  requiresArtifact: true,
19450
19451
  builtIn: true
19451
19452
  },
19453
+ {
19454
+ id: "inspect:mac-app",
19455
+ label: "Inspect macOS app",
19456
+ description: "Contents/Info.plist, bundle layout, architectures, signature and entitlements.",
19457
+ targetPlatforms: ["macos"],
19458
+ packageFormats: ["app"],
19459
+ requiresArtifact: true,
19460
+ builtIn: true
19461
+ },
19452
19462
  {
19453
19463
  id: "extract:app",
19454
19464
  label: "Extract app",
@@ -19462,8 +19472,8 @@ var DEFINITIONS = [
19462
19472
  id: "javascript:analyze",
19463
19473
  label: "Analyze JS",
19464
19474
  description: "\u5BF9\u89E3\u5305\u5E94\u7528\u4E2D\u7684 uni-app / WebView \u4E1A\u52A1\u811A\u672C\u505A\u9759\u6001\u5206\u6790\u3002",
19465
- targetPlatforms: ["ios"],
19466
- packageFormats: ["ipa"],
19475
+ targetPlatforms: ["ios", "macos"],
19476
+ packageFormats: ["ipa", "app"],
19467
19477
  requiresArtifact: true,
19468
19478
  requiresRea: true
19469
19479
  },
@@ -19678,8 +19688,8 @@ function defaultWorkspaceRoot(hostPlatform, env) {
19678
19688
 
19679
19689
  // src/jobs/capability.ts
19680
19690
  var import_node_crypto = require("crypto");
19681
- var import_node_fs4 = __toESM(require("fs"));
19682
- var import_node_path4 = __toESM(require("path"));
19691
+ var import_node_fs5 = __toESM(require("fs"));
19692
+ var import_node_path5 = __toESM(require("path"));
19683
19693
 
19684
19694
  // src/errors.ts
19685
19695
  var CoreFailure = class extends Error {
@@ -19914,6 +19924,156 @@ async function inspectIpaFile(ipaPath) {
19914
19924
  };
19915
19925
  }
19916
19926
 
19927
+ // src/inspectors/macApp.ts
19928
+ var import_node_child_process = require("child_process");
19929
+ var import_node_fs4 = __toESM(require("fs"));
19930
+ var import_node_path3 = __toESM(require("path"));
19931
+ var import_node_util = require("util");
19932
+ var bplist = __toESM(require_bplistParser());
19933
+ var import_plist2 = __toESM(require_plist());
19934
+ var execFileAsync = (0, import_node_util.promisify)(import_node_child_process.execFile);
19935
+ function readPlist(filePath) {
19936
+ const buffer = import_node_fs4.default.readFileSync(filePath);
19937
+ if (buffer.subarray(0, 6).toString("utf8") === "bplist") {
19938
+ const [parsed] = bplist.parseBuffer(buffer);
19939
+ return parsed ?? {};
19940
+ }
19941
+ return import_plist2.default.parse(buffer.toString("utf8"));
19942
+ }
19943
+ function text(value) {
19944
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
19945
+ }
19946
+ function archName2(cpu, subtype) {
19947
+ if (cpu === 7) return "i386";
19948
+ if (cpu === 16777223) return "x86_64";
19949
+ if (cpu === 12) return "arm";
19950
+ if (cpu === 16777228) return (subtype & 16777215) === 2 ? "arm64e" : "arm64";
19951
+ return `cpu-${cpu.toString(16)}`;
19952
+ }
19953
+ function machOArchitectures(filePath) {
19954
+ const fd = import_node_fs4.default.openSync(filePath, "r");
19955
+ try {
19956
+ const head = Buffer.alloc(16);
19957
+ const read = import_node_fs4.default.readSync(fd, head, 0, head.length, 0);
19958
+ if (read < 12) return [];
19959
+ const be = head.readUInt32BE(0);
19960
+ if (be === 3405691582 || be === 3405691583) {
19961
+ const count = head.readUInt32BE(4);
19962
+ if (count <= 0 || count > 64) return [];
19963
+ const entrySize = be === 3405691583 ? 32 : 20;
19964
+ const table = Buffer.alloc(count * entrySize);
19965
+ import_node_fs4.default.readSync(fd, table, 0, table.length, 8);
19966
+ const result = [];
19967
+ for (let index = 0; index < count; index += 1) {
19968
+ const offset = index * entrySize;
19969
+ result.push(
19970
+ archName2(table.readUInt32BE(offset), table.readUInt32BE(offset + 4))
19971
+ );
19972
+ }
19973
+ return result;
19974
+ }
19975
+ const le = head.readUInt32LE(0);
19976
+ if (le === 4277009103 || le === 4277009102) {
19977
+ return [archName2(head.readUInt32LE(4), head.readUInt32LE(8))];
19978
+ }
19979
+ return [];
19980
+ } finally {
19981
+ import_node_fs4.default.closeSync(fd);
19982
+ }
19983
+ }
19984
+ async function readSignature(bundlePath, warnings) {
19985
+ if (process.platform !== "darwin") {
19986
+ warnings.push("Signature details require a macOS host.");
19987
+ return void 0;
19988
+ }
19989
+ try {
19990
+ const { stdout, stderr } = await execFileAsync(
19991
+ "codesign",
19992
+ ["-dv", "--entitlements", ":-", bundlePath],
19993
+ { timeout: 3e4, maxBuffer: 4 * 1024 * 1024 }
19994
+ );
19995
+ const details = `${stderr}`;
19996
+ const authority = [...details.matchAll(/^Authority=(.+)$/gm)].map(
19997
+ (match) => match[1].trim()
19998
+ );
19999
+ const team = /^TeamIdentifier=(.+)$/m.exec(details)?.[1]?.trim();
20000
+ const signed = /^CodeDirectory|^Signature=/m.test(details) || authority.length > 0;
20001
+ return {
20002
+ signed,
20003
+ authority: authority.length ? authority : void 0,
20004
+ teamIdentifier: team,
20005
+ entitlements: stdout.trim() || void 0
20006
+ };
20007
+ } catch (error) {
20008
+ const stderr = error.stderr ?? "";
20009
+ const signed = /^Signature=/m.test(stderr);
20010
+ if (!signed) warnings.push("No code signature could be read.");
20011
+ return { signed };
20012
+ }
20013
+ }
20014
+ async function inspectMacApp(bundlePath) {
20015
+ const warnings = [];
20016
+ const contents = import_node_path3.default.join(bundlePath, "Contents");
20017
+ const infoPath = import_node_path3.default.join(contents, "Info.plist");
20018
+ if (!import_node_fs4.default.existsSync(infoPath)) {
20019
+ throw new Error("Contents/Info.plist is missing.");
20020
+ }
20021
+ const info = readPlist(infoPath);
20022
+ const executableName = text(info.CFBundleExecutable);
20023
+ const macOsDir = import_node_path3.default.join(contents, "MacOS");
20024
+ const candidates = import_node_fs4.default.existsSync(macOsDir) ? import_node_fs4.default.readdirSync(macOsDir, { withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => entry.name) : [];
20025
+ const mainBinary = executableName && candidates.find((name) => name === executableName) || candidates[0];
20026
+ let mainExecutable;
20027
+ if (mainBinary) {
20028
+ const binaryPath = import_node_path3.default.join(macOsDir, mainBinary);
20029
+ const architectures = machOArchitectures(binaryPath);
20030
+ if (!architectures.length) warnings.push("Main executable is not a Mach-O binary.");
20031
+ mainExecutable = {
20032
+ path: import_node_path3.default.join("Contents", "MacOS", mainBinary),
20033
+ architectures,
20034
+ sizeBytes: import_node_fs4.default.statSync(binaryPath).size
20035
+ };
20036
+ } else {
20037
+ warnings.push("No executable found under Contents/MacOS.");
20038
+ }
20039
+ const topLevel = import_node_fs4.default.existsSync(contents) ? import_node_fs4.default.readdirSync(contents, { withFileTypes: true }).map((entry) => entry.name) : [];
20040
+ const frameworksDir = import_node_path3.default.join(contents, "Frameworks");
20041
+ const pluginsDir = import_node_path3.default.join(contents, "PlugIns");
20042
+ const resourcesDir = import_node_path3.default.join(contents, "Resources");
20043
+ const list = (dir) => import_node_fs4.default.existsSync(dir) ? import_node_fs4.default.readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() || entry.name.endsWith(".framework")).map((entry) => entry.name) : [];
20044
+ const countResources = (dir) => {
20045
+ if (!import_node_fs4.default.existsSync(dir)) return 0;
20046
+ let total = 0;
20047
+ for (const entry of import_node_fs4.default.readdirSync(dir, { withFileTypes: true })) {
20048
+ const full = import_node_path3.default.join(dir, entry.name);
20049
+ if (entry.isDirectory()) total += countResources(full);
20050
+ else total += 1;
20051
+ }
20052
+ return total;
20053
+ };
20054
+ return {
20055
+ kind: "mac-app",
20056
+ bundle: {
20057
+ path: bundlePath,
20058
+ identifier: text(info.CFBundleIdentifier),
20059
+ name: text(info.CFBundleDisplayName) ?? text(info.CFBundleName) ?? import_node_path3.default.basename(bundlePath, ".app"),
20060
+ version: text(info.CFBundleShortVersionString),
20061
+ build: text(info.CFBundleVersion),
20062
+ executable: executableName,
20063
+ minimumSystemVersion: text(info.LSMinimumSystemVersion)
20064
+ },
20065
+ layout: {
20066
+ topLevel,
20067
+ frameworks: list(frameworksDir),
20068
+ plugins: list(pluginsDir),
20069
+ resourceCount: countResources(resourcesDir)
20070
+ },
20071
+ mainExecutable,
20072
+ signature: await readSignature(bundlePath, warnings),
20073
+ warnings
20074
+ };
20075
+ }
20076
+
19917
20077
  // src/inspectors/report.ts
19918
20078
  function cell(value) {
19919
20079
  return String(value ?? "\u2014").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
@@ -19921,6 +20081,9 @@ function cell(value) {
19921
20081
  function inspectionValue(inspection, key) {
19922
20082
  return inspection && key in inspection ? inspection[key] : void 0;
19923
20083
  }
20084
+ function record(value) {
20085
+ return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
20086
+ }
19924
20087
  function collectEvidencePaths(jobs) {
19925
20088
  const paths = /* @__PURE__ */ new Set();
19926
20089
  for (const job of jobs) {
@@ -19932,6 +20095,72 @@ function collectEvidencePaths(jobs) {
19932
20095
  }
19933
20096
  return [...paths];
19934
20097
  }
20098
+ function renderMacAppInspection(lines, inspection, warnings) {
20099
+ const bundle = record(inspection.bundle) ?? {};
20100
+ const layout = record(inspection.layout) ?? {};
20101
+ const main = record(inspection.mainExecutable);
20102
+ const signature = record(inspection.signature);
20103
+ lines.push(
20104
+ "| Field | Value |",
20105
+ "| --- | --- |",
20106
+ `| Bundle ID | ${cell(bundle.identifier)} |`,
20107
+ `| Version | ${cell(bundle.version)} |`,
20108
+ `| Build | ${cell(bundle.build)} |`,
20109
+ `| Minimum system | ${cell(bundle.minimumSystemVersion)} |`,
20110
+ `| Bundle executable | ${cell(bundle.executable)} |`,
20111
+ `| Architectures | ${cell(
20112
+ Array.isArray(main?.architectures) ? main?.architectures.join(", ") : void 0
20113
+ )} |`,
20114
+ `| Frameworks | ${cell(
20115
+ Array.isArray(layout.frameworks) ? layout.frameworks.length : 0
20116
+ )} |`,
20117
+ `| Plug-ins | ${cell(Array.isArray(layout.plugins) ? layout.plugins.length : 0)} |`,
20118
+ `| Resources | ${cell(layout.resourceCount ?? 0)} files |`,
20119
+ `| Signed | ${cell(signature?.signed)} |`,
20120
+ `| Authority | ${cell(
20121
+ Array.isArray(signature?.authority) ? signature?.authority.join(", ") : void 0
20122
+ )} |`,
20123
+ ""
20124
+ );
20125
+ if (warnings.length > 0) {
20126
+ lines.push("### Inspection warnings", "");
20127
+ for (const warning of warnings) lines.push(`- ${warning}`);
20128
+ lines.push("");
20129
+ }
20130
+ }
20131
+ function renderIpaInspection(lines, inspection, warnings) {
20132
+ lines.push(
20133
+ "| Field | Value |",
20134
+ "| --- | --- |",
20135
+ `| Bundle ID | ${cell(inspectionValue(inspection, "bundleId"))} |`,
20136
+ `| Version | ${cell(inspectionValue(inspection, "version"))} |`,
20137
+ `| Build | ${cell(inspectionValue(inspection, "build"))} |`,
20138
+ `| Minimum OS | ${cell(inspectionValue(inspection, "minimumOs"))} |`,
20139
+ `| Bundle executable | ${cell(inspectionValue(inspection, "executable"))} |`,
20140
+ ""
20141
+ );
20142
+ const main = inspection.mainExecutable;
20143
+ if (main && typeof main === "object") {
20144
+ const record3 = main;
20145
+ const slices = Array.isArray(record3.slices) ? record3.slices : [];
20146
+ lines.push(
20147
+ "| Architecture | File type | cryptid | cryptoff | cryptsize |",
20148
+ "| --- | --- | --- | --- | --- |"
20149
+ );
20150
+ for (const item of slices) {
20151
+ const slice = item && typeof item === "object" ? item : {};
20152
+ lines.push(
20153
+ `| ${cell(slice.arch)} | ${cell(slice.filetype)} | ${cell(slice.cryptid)} | ${cell(slice.cryptoff)} | ${cell(slice.cryptsize)} |`
20154
+ );
20155
+ }
20156
+ lines.push("");
20157
+ }
20158
+ if (warnings.length > 0) {
20159
+ lines.push("### Inspection warnings", "");
20160
+ for (const warning of warnings) lines.push(`- ${warning}`);
20161
+ lines.push("");
20162
+ }
20163
+ }
19935
20164
  function renderReportMarkdown(input2) {
19936
20165
  const {
19937
20166
  target,
@@ -19946,19 +20175,19 @@ function renderReportMarkdown(input2) {
19946
20175
  const warnings = Array.isArray(inspection?.warnings) ? inspection.warnings.map(String) : [];
19947
20176
  const evidencePaths = collectEvidencePaths(jobs);
19948
20177
  const lines = [
19949
- `# ${target.name} \xB7 \u5206\u6790\u62A5\u544A`,
20178
+ `# ${target.name} \xB7 Analysis report`,
19950
20179
  "",
19951
- `- \u751F\u6210\u65F6\u95F4\uFF1A${generatedAt}`,
19952
- `- Host\uFF1A${hostPlatform}`,
19953
- `- Target \u5E73\u53F0\uFF1A${target.targetRef.platform}`,
19954
- `- \u6765\u6E90\uFF1A${target.targetRef.sourceId} / ${target.targetRef.sourceRef}`,
19955
- `- \u5206\u6790\u8FB9\u754C\uFF1A\u53EA\u6C47\u603B\u672C\u5730 artifact\u3001\u9759\u6001\u68C0\u67E5\u548C\u5DE5\u4F5C\u53F0\u4EFB\u52A1\u8BB0\u5F55\uFF1B\u4E0D\u4EE3\u8868\u76EE\u6807\u5E94\u7528\u7684\u5B9E\u9645\u8FD0\u884C\u884C\u4E3A\u3002`,
20180
+ `- Generated: ${generatedAt}`,
20181
+ `- Host: ${hostPlatform}`,
20182
+ `- Target platform: ${target.targetRef.platform}`,
20183
+ `- Source: ${target.targetRef.sourceId} / ${target.targetRef.sourceRef}`,
20184
+ "- Scope: this report summarizes the local artifact, static inspection and job records. It does not describe runtime behavior.",
19956
20185
  "",
19957
20186
  "## Target",
19958
20187
  "",
19959
- "| \u5B57\u6BB5 | \u503C |",
20188
+ "| Field | Value |",
19960
20189
  "| --- | --- |",
19961
- `| \u540D\u79F0 | ${cell(target.name)} |`,
20190
+ `| Name | ${cell(target.name)} |`,
19962
20191
  `| Publisher | ${cell(target.publisher)} |`,
19963
20192
  `| Bundle ID | ${cell(target.bundleId)} |`,
19964
20193
  `| Package ID | ${cell(target.packageId)} |`,
@@ -19969,62 +20198,37 @@ function renderReportMarkdown(input2) {
19969
20198
  ""
19970
20199
  ];
19971
20200
  if (!artifact) {
19972
- lines.push("\u5C1A\u672A\u767B\u8BB0 artifact\u3002", "");
20201
+ lines.push("No artifact has been registered yet.", "");
19973
20202
  } else {
19974
20203
  lines.push(
19975
- "| \u5B57\u6BB5 | \u503C |",
20204
+ "| Field | Value |",
19976
20205
  "| --- | --- |",
19977
- `| \u6587\u4EF6 | ${cell(artifact.path)} |`,
19978
- `| \u5305\u683C\u5F0F | ${cell(artifact.packageFormat.toUpperCase())} |`,
19979
- `| \u5927\u5C0F | ${cell(`${artifact.sizeBytes} bytes`)} |`,
20206
+ `| File | ${cell(artifact.path)} |`,
20207
+ `| Package format | ${cell(artifact.packageFormat.toUpperCase())} |`,
20208
+ `| Size | ${cell(`${artifact.sizeBytes} bytes`)} |`,
19980
20209
  `| SHA-256 | ${cell(artifact.sha256)} |`,
19981
20210
  `| Version / Build | ${cell(`${artifact.version ?? "unknown"} / ${artifact.buildNumber ?? "unknown"}`)} |`,
19982
- `| \u4E0B\u8F7D\u65F6\u95F4 | ${cell(artifact.downloadedAt)} |`,
20211
+ `| Acquired | ${cell(artifact.downloadedAt)} |`,
19983
20212
  "",
19984
- "### \u5305\u68C0\u67E5",
20213
+ "### Bundle inspection",
19985
20214
  ""
19986
20215
  );
19987
20216
  if (!inspection) {
19988
- lines.push("artifact \u5C1A\u672A\u5B8C\u6210\u5305\u68C0\u67E5\u3002", "");
20217
+ lines.push("The artifact has not been inspected yet.", "");
19989
20218
  } else if (typeof inspection.error === "string") {
19990
- lines.push(`\u68C0\u67E5\u5931\u8D25\uFF1A${cell(inspection.error)}`, "");
20219
+ lines.push(`Inspection failed: ${cell(inspection.error)}`, "");
20220
+ } else if (inspection.kind === "mac-app") {
20221
+ renderMacAppInspection(lines, inspection, warnings);
19991
20222
  } else {
19992
- lines.push(
19993
- "| \u5B57\u6BB5 | \u503C |",
19994
- "| --- | --- |",
19995
- `| Bundle ID | ${cell(inspectionValue(inspection, "bundleId"))} |`,
19996
- `| Version | ${cell(inspectionValue(inspection, "version"))} |`,
19997
- `| Build | ${cell(inspectionValue(inspection, "build"))} |`,
19998
- `| \u6700\u4F4E\u7CFB\u7EDF | ${cell(inspectionValue(inspection, "minimumOs"))} |`,
19999
- `| Bundle executable | ${cell(inspectionValue(inspection, "executable"))} |`,
20000
- ""
20001
- );
20002
- const main = inspection.mainExecutable;
20003
- if (main && typeof main === "object") {
20004
- const record2 = main;
20005
- const slices = Array.isArray(record2.slices) ? record2.slices : [];
20006
- lines.push("| \u67B6\u6784 | \u6587\u4EF6\u7C7B\u578B | cryptid | cryptoff | cryptsize |", "| --- | --- | --- | --- | --- |");
20007
- for (const item of slices) {
20008
- const slice = item && typeof item === "object" ? item : {};
20009
- lines.push(
20010
- `| ${cell(slice.arch)} | ${cell(slice.filetype)} | ${cell(slice.cryptid)} | ${cell(slice.cryptoff)} | ${cell(slice.cryptsize)} |`
20011
- );
20012
- }
20013
- lines.push("");
20014
- }
20015
- if (warnings.length > 0) {
20016
- lines.push("### \u68C0\u67E5\u8B66\u544A", "");
20017
- for (const warning of warnings) lines.push(`- ${warning}`);
20018
- lines.push("");
20019
- }
20223
+ renderIpaInspection(lines, inspection, warnings);
20020
20224
  }
20021
20225
  }
20022
20226
  lines.push(
20023
- "## \u7ED3\u6784\u5316\u53D1\u73B0",
20227
+ "## Structured findings",
20024
20228
  "",
20025
- `\u5171\u767B\u8BB0 ${findingTotal} \u6761 Finding\uFF1B\u62A5\u544A\u8F7D\u5165 ${findings.length} \u6761\u3002`,
20229
+ `${findingTotal} finding(s) registered; ${findings.length} included in this report.`,
20026
20230
  "",
20027
- "| \u7C7B\u578B | \u6570\u91CF |",
20231
+ "| Type | Count |",
20028
20232
  "| --- | --- |"
20029
20233
  );
20030
20234
  const byType = /* @__PURE__ */ new Map();
@@ -20042,29 +20246,35 @@ function renderReportMarkdown(input2) {
20042
20246
  }
20043
20247
  lines.push("");
20044
20248
  for (const [type, title] of [
20045
- ["route", "\u9875\u9762\u8DEF\u7531"],
20046
- ["network_endpoint", "\u7F51\u7EDC\u63A5\u53E3\u5019\u9009"],
20047
- ["module", "JavaScript \u6A21\u5757"],
20048
- ["native_procedure", "\u539F\u751F\u7B26\u53F7"],
20049
- ["risk", "\u98CE\u9669\u4E0E\u9650\u5236"]
20249
+ ["route", "Routes"],
20250
+ ["network_endpoint", "Network endpoint candidates"],
20251
+ ["module", "JavaScript modules"],
20252
+ ["native_procedure", "Native symbols"],
20253
+ ["risk", "Risks and limitations"]
20050
20254
  ]) {
20051
20255
  const items = findings.filter((finding) => finding.type === type).slice(0, 20);
20052
20256
  if (items.length === 0) continue;
20053
20257
  lines.push(`### ${title}`, "");
20054
20258
  for (const item of items) {
20055
20259
  const location = item.sourcePath ? ` \u2014 \`${item.sourcePath}\`${item.start ? `:${item.start.line}:${item.start.column}` : ""}` : "";
20056
- lines.push(`- ${item.value}${location}\uFF08Evidence: \`${item.evidenceId}\`\uFF09`);
20260
+ lines.push(`- ${item.value}${location} (Evidence: \`${item.evidenceId}\`)`);
20057
20261
  }
20058
20262
  lines.push("");
20059
20263
  }
20264
+ const analysisGaps = findings.filter((finding) => finding.type === "limitation").slice(0, 20);
20265
+ if (analysisGaps.length > 0) {
20266
+ lines.push("### Analysis gaps", "");
20267
+ for (const gap of analysisGaps) lines.push(`- ${gap.value}`);
20268
+ lines.push("");
20269
+ }
20060
20270
  lines.push(
20061
- "## \u4EFB\u52A1\u4E0E\u8BC1\u636E",
20271
+ "## Jobs and evidence",
20062
20272
  "",
20063
- "| \u80FD\u529B | \u72B6\u6001 | \u5F00\u59CB | \u5B8C\u6210 | \u7ED3\u679C / \u9519\u8BEF |",
20273
+ "| Capability | Status | Started | Finished | Result / error |",
20064
20274
  "| --- | --- | --- | --- | --- |"
20065
20275
  );
20066
20276
  if (jobs.length === 0) {
20067
- lines.push("| \u2014 | \u2014 | \u2014 | \u2014 | \u5C1A\u65E0\u4EFB\u52A1 |");
20277
+ lines.push("| \u2014 | \u2014 | \u2014 | \u2014 | No jobs yet |");
20068
20278
  } else {
20069
20279
  for (const job of jobs) {
20070
20280
  lines.push(
@@ -20074,19 +20284,19 @@ function renderReportMarkdown(input2) {
20074
20284
  );
20075
20285
  }
20076
20286
  }
20077
- lines.push("", "### Evidence \u8DEF\u5F84", "");
20287
+ lines.push("", "### Evidence paths", "");
20078
20288
  if (evidencePaths.length === 0) {
20079
- lines.push("\u5C1A\u65E0\u5DF2\u767B\u8BB0\u7684\u5206\u6790\u8BC1\u636E\u6587\u4EF6\u3002");
20289
+ lines.push("No evidence files have been registered yet.");
20080
20290
  } else {
20081
20291
  for (const evidencePath of evidencePaths) lines.push(`- \`${evidencePath}\``);
20082
20292
  }
20083
20293
  lines.push(
20084
20294
  "",
20085
- "## \u7ED3\u8BBA\u8FB9\u754C",
20295
+ "## Limitations",
20086
20296
  "",
20087
- "- \u9759\u6001\u5206\u6790\u7ED3\u679C\u5C5E\u4E8E\u89C2\u5BDF\u548C\u63A8\u65AD\uFF0C\u4E0D\u80FD\u8BC1\u660E\u672A\u8986\u76D6\u4EE3\u7801\u6216\u670D\u52A1\u5668\u7AEF\u884C\u4E3A\u3002",
20088
- "- `cryptid != 0` \u7684 Mach-O \u5207\u7247\u5904\u4E8E\u58F0\u660E\u52A0\u5BC6\u533A\uFF1B\u5176\u53CD\u7F16\u8BD1\u7ED3\u679C\u4E0D\u80FD\u89C6\u4E3A\u53EF\u4FE1\u539F\u59CB\u5B9E\u73B0\u3002",
20089
- "- \u62A5\u544A\u6CA1\u6709\u6267\u884C\u76EE\u6807 App\uFF0C\u4E5F\u6CA1\u6709\u8BBF\u95EE\u76EE\u6807\u540E\u53F0\u670D\u52A1\u3002",
20297
+ "- Static analysis is observation and inference; it cannot prove the absence of uncovered code or server-side behavior.",
20298
+ "- A Mach-O slice with `cryptid != 0` is declared encrypted; its decompilation must not be treated as trustworthy original code.",
20299
+ "- The target app was not executed and no backend service was contacted.",
20090
20300
  ""
20091
20301
  );
20092
20302
  return lines.join("\n");
@@ -20101,8 +20311,8 @@ function describeResult(result) {
20101
20311
  }
20102
20312
 
20103
20313
  // src/process/run.ts
20104
- var import_node_child_process = require("child_process");
20105
- var import_node_path3 = __toESM(require("path"));
20314
+ var import_node_child_process2 = require("child_process");
20315
+ var import_node_path4 = __toESM(require("path"));
20106
20316
  function quoteWindowsArgument(value) {
20107
20317
  if (value.length === 0) return '""';
20108
20318
  if (!/[\s"&|<>^()%!]/.test(value)) return value;
@@ -20112,7 +20322,7 @@ function windowsCommandLine(command, args) {
20112
20322
  return [command, ...args].map(quoteWindowsArgument).join(" ");
20113
20323
  }
20114
20324
  function windowsSpawnSpec(command, args) {
20115
- const extension = import_node_path3.default.extname(command).toLowerCase();
20325
+ const extension = import_node_path4.default.extname(command).toLowerCase();
20116
20326
  if (extension !== ".cmd" && extension !== ".bat") {
20117
20327
  return { command, args, verbatim: false };
20118
20328
  }
@@ -20130,7 +20340,7 @@ function runCommand(command, args, options = {}) {
20130
20340
  let child;
20131
20341
  try {
20132
20342
  const spec = process.platform === "win32" ? windowsSpawnSpec(command, args) : { command, args, verbatim: false };
20133
- child = (0, import_node_child_process.spawn)(spec.command, spec.args, {
20343
+ child = (0, import_node_child_process2.spawn)(spec.command, spec.args, {
20134
20344
  env: options.env ?? process.env,
20135
20345
  cwd: options.cwd,
20136
20346
  stdio: ["ignore", "pipe", "pipe"],
@@ -20190,8 +20400,8 @@ function now() {
20190
20400
  function isCancelled(job) {
20191
20401
  return String(job.status) === "cancelled";
20192
20402
  }
20193
- function parseJsonDocument(text) {
20194
- const trimmed = text.trim();
20403
+ function parseJsonDocument(text2) {
20404
+ const trimmed = text2.trim();
20195
20405
  if (!trimmed) return null;
20196
20406
  try {
20197
20407
  const parsed = JSON.parse(trimmed);
@@ -20208,7 +20418,7 @@ function parseJsonDocument(text) {
20208
20418
  }
20209
20419
  }
20210
20420
  }
20211
- function record(value) {
20421
+ function record2(value) {
20212
20422
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
20213
20423
  }
20214
20424
  function compactCounts(source) {
@@ -20222,20 +20432,20 @@ function compactCounts(source) {
20222
20432
  return result;
20223
20433
  }
20224
20434
  function observationProperties(node) {
20225
- const item = record(node);
20435
+ const item = record2(node);
20226
20436
  const observations = Array.isArray(item?.observations) ? item.observations : [];
20227
- return record(record(observations[0])?.properties) ?? {};
20437
+ return record2(record2(observations[0])?.properties) ?? {};
20228
20438
  }
20229
20439
  function observationSource(node) {
20230
- const item = record(node);
20440
+ const item = record2(node);
20231
20441
  const observations = Array.isArray(item?.observations) ? item.observations : [];
20232
- const evidence = record(record(observations[0])?.evidence);
20233
- const location = record(record(evidence?.location)?.value);
20442
+ const evidence = record2(record2(observations[0])?.evidence);
20443
+ const location = record2(record2(evidence?.location)?.value);
20234
20444
  if (typeof location?.path === "string") {
20235
20445
  return { sourcePath: location.path };
20236
20446
  }
20237
20447
  if (typeof location?.source === "string") {
20238
- const start = record(location.start);
20448
+ const start = record2(location.start);
20239
20449
  return {
20240
20450
  sourcePath: location.source,
20241
20451
  line: typeof start?.line === "number" ? start.line : void 0,
@@ -20255,16 +20465,16 @@ function isNetworkEndpointValue(value) {
20255
20465
  return /^(?:https?|wss?):\/\//i.test(value) || /^\/\//.test(value) || /^[a-z0-9.-]+\.[a-z]{2,}(?:[/:?#]|$)/i.test(value) || /^\/[a-z0-9._~!$&'()*+,;=:@%/-]+$/i.test(value);
20256
20466
  }
20257
20467
  function detectTechnology(subjectName, modulePaths, assetPaths) {
20258
- const text = [subjectName, ...modulePaths, ...assetPaths].filter((value) => typeof value === "string").join("\n").toLowerCase();
20468
+ const text2 = [subjectName, ...modulePaths, ...assetPaths].filter((value) => typeof value === "string").join("\n").toLowerCase();
20259
20469
  const hints = [];
20260
- if (/__uni__|uni-app|uni-jsframework|hbuilder/.test(text)) {
20470
+ if (/__uni__|uni-app|uni-jsframework|hbuilder/.test(text2)) {
20261
20471
  hints.push("uni-app");
20262
20472
  }
20263
- if (/hbuilder/.test(text)) hints.push("HBuilder");
20264
- if (/react-native|main\.jsbundle/.test(text)) hints.push("React Native");
20265
- if (/flutter/.test(text)) hints.push("Flutter");
20266
- if (/capacitor/.test(text)) hints.push("Capacitor");
20267
- if (/cordova/.test(text)) hints.push("Cordova");
20473
+ if (/hbuilder/.test(text2)) hints.push("HBuilder");
20474
+ if (/react-native|main\.jsbundle/.test(text2)) hints.push("React Native");
20475
+ if (/flutter/.test(text2)) hints.push("Flutter");
20476
+ if (/capacitor/.test(text2)) hints.push("Capacitor");
20477
+ if (/cordova/.test(text2)) hints.push("Cordova");
20268
20478
  return hints;
20269
20479
  }
20270
20480
  function hashText(value) {
@@ -20294,7 +20504,7 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
20294
20504
  createdAt
20295
20505
  });
20296
20506
  };
20297
- const technology = record(summary.technology);
20507
+ const technology = record2(summary.technology);
20298
20508
  if (Array.isArray(technology?.hints)) {
20299
20509
  for (const hint of technology.hints) {
20300
20510
  if (typeof hint === "string") {
@@ -20306,14 +20516,21 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
20306
20516
  }
20307
20517
  }
20308
20518
  }
20309
- const normalized = record(parsed.normalized_result);
20310
- const graph = record(normalized?.graph);
20519
+ if (artifact.packageFormat === "app") {
20520
+ push("technology", "Electron", {
20521
+ group: "technology",
20522
+ confidence: "high",
20523
+ metadata: { basis: "electron-bundle" }
20524
+ });
20525
+ }
20526
+ const normalized = record2(parsed.normalized_result);
20527
+ const graph = record2(normalized?.graph);
20311
20528
  const nodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
20312
20529
  const modulePaths = /* @__PURE__ */ new Set();
20313
20530
  const assetPaths = /* @__PURE__ */ new Set();
20314
20531
  const storageValues = /* @__PURE__ */ new Set();
20315
20532
  for (const node of nodes) {
20316
- const item = record(node);
20533
+ const item = record2(node);
20317
20534
  const kind = item?.kind;
20318
20535
  const properties = observationProperties(node);
20319
20536
  const location = observationSource(node);
@@ -20366,21 +20583,51 @@ function javascriptFindings(job, artifact, evidenceId, parsed, summary) {
20366
20583
  }
20367
20584
  }
20368
20585
  const limitations = Array.isArray(parsed.limitations) ? parsed.limitations : [];
20586
+ const seenLimitations = /* @__PURE__ */ new Set();
20587
+ const LIMITATION_CAP = 50;
20588
+ let kept = 0;
20369
20589
  for (const limitation of limitations) {
20370
- if (typeof limitation === "string") {
20371
- push("limitation", limitation, {
20590
+ if (typeof limitation !== "string") continue;
20591
+ const normalized2 = limitation.replace(/\s+/g, " ").trim();
20592
+ if (!normalized2 || seenLimitations.has(normalized2)) continue;
20593
+ if (kept >= LIMITATION_CAP) break;
20594
+ seenLimitations.add(normalized2);
20595
+ kept += 1;
20596
+ push("limitation", normalized2, {
20597
+ group: "analysis-limitation",
20598
+ confidence: "exact",
20599
+ metadata: { evidenceId }
20600
+ });
20601
+ }
20602
+ if (limitations.length > kept) {
20603
+ push(
20604
+ "limitation",
20605
+ `${limitations.length - kept} additional per-file limitations were omitted from this summary.`,
20606
+ {
20372
20607
  group: "analysis-limitation",
20373
20608
  confidence: "exact",
20374
- metadata: { evidenceId }
20375
- });
20376
- }
20609
+ metadata: { evidenceId, omitted: limitations.length - kept }
20610
+ }
20611
+ );
20377
20612
  }
20378
20613
  return findings;
20379
20614
  }
20615
+ function findElectronJavascriptRoot(appPath) {
20616
+ const asar = import_node_path5.default.join(appPath, "Contents", "Resources", "app.asar");
20617
+ if (import_node_fs5.default.existsSync(asar)) return asar;
20618
+ const unpacked = import_node_path5.default.join(appPath, "Contents", "Resources", "app");
20619
+ if (import_node_fs5.default.existsSync(unpacked) && import_node_fs5.default.statSync(unpacked).isDirectory()) {
20620
+ return unpacked;
20621
+ }
20622
+ fail(
20623
+ "CAPABILITY_UNAVAILABLE",
20624
+ "No Electron JavaScript bundle (app.asar or Resources/app) was found in this app."
20625
+ );
20626
+ }
20380
20627
  function nativeSearchFindings(job, artifact, evidenceId, parsed, kind) {
20381
20628
  const values2 = Array.isArray(parsed.normalized_result) ? parsed.normalized_result : Array.isArray(parsed.raw_result) ? parsed.raw_result : [];
20382
20629
  const createdAt = now();
20383
- return values2.map((value) => record(value)).filter((value) => Boolean(value?.value)).map((value) => ({
20630
+ return values2.map((value) => record2(value)).filter((value) => Boolean(value?.value)).map((value) => ({
20384
20631
  id: (0, import_node_crypto.randomUUID)(),
20385
20632
  targetId: artifact.targetId,
20386
20633
  artifactId: artifact.id,
@@ -20415,16 +20662,16 @@ function nativeRiskFindings(job, artifact, evidenceId, encryption) {
20415
20662
  ];
20416
20663
  }
20417
20664
  function summarizeRea(parsed) {
20418
- const normalized = record(parsed.normalized_result);
20419
- const graph = record(normalized?.graph);
20420
- const semantic = record(normalized?.semantic_graph);
20665
+ const normalized = record2(parsed.normalized_result);
20666
+ const graph = record2(normalized?.graph);
20667
+ const semantic = record2(normalized?.semantic_graph);
20421
20668
  const limitations = Array.isArray(parsed.limitations) ? parsed.limitations.slice(0, 12) : [];
20422
- const subject = record(parsed.subject);
20423
- const provider = record(parsed.provider);
20424
- const pseudocode = typeof record(parsed.raw_result)?.value === "string" ? String(record(parsed.raw_result)?.value) : void 0;
20669
+ const subject = record2(parsed.subject);
20670
+ const provider = record2(parsed.provider);
20671
+ const pseudocode = typeof record2(parsed.raw_result)?.value === "string" ? String(record2(parsed.raw_result)?.value) : void 0;
20425
20672
  const graphNodes = Array.isArray(graph?.nodes) ? graph.nodes : [];
20426
20673
  const endpointNodes = graphNodes.filter(
20427
- (node) => record(node)?.kind === "endpoint"
20674
+ (node) => record2(node)?.kind === "endpoint"
20428
20675
  );
20429
20676
  const routeItems = endpointNodes.filter((node) => observationProperties(node).endpoint_kind === "route").map((node) => {
20430
20677
  const properties = observationProperties(node);
@@ -20444,15 +20691,15 @@ function summarizeRea(parsed) {
20444
20691
  (item) => typeof item.value === "string" && isNetworkEndpointValue(item.value)
20445
20692
  );
20446
20693
  const modulePaths = uniqueStrings(
20447
- graphNodes.filter((node) => record(node)?.kind === "javascript-module").map((node) => observationProperties(node).path),
20694
+ graphNodes.filter((node) => record2(node)?.kind === "javascript-module").map((node) => observationProperties(node).path),
20448
20695
  200
20449
20696
  );
20450
20697
  const assetPaths = uniqueStrings(
20451
- graphNodes.filter((node) => record(node)?.kind === "javascript-asset").map((node) => observationProperties(node).path),
20698
+ graphNodes.filter((node) => record2(node)?.kind === "javascript-asset").map((node) => observationProperties(node).path),
20452
20699
  200
20453
20700
  );
20454
20701
  const storageItems = uniqueStrings(
20455
- graphNodes.filter((node) => record(node)?.kind === "storage").map((node) => {
20702
+ graphNodes.filter((node) => record2(node)?.kind === "storage").map((node) => {
20456
20703
  const properties = observationProperties(node);
20457
20704
  return `${String(properties.storage_kind ?? "storage")}:${String(
20458
20705
  properties.mechanism ?? properties.name ?? "unknown"
@@ -20471,11 +20718,11 @@ function summarizeRea(parsed) {
20471
20718
  name: subject.name,
20472
20719
  format: subject.format,
20473
20720
  architecture: subject.architecture,
20474
- sha256: record(subject.digest)?.sha256
20721
+ sha256: record2(subject.digest)?.sha256
20475
20722
  } : void 0,
20476
20723
  provider: provider ? { id: provider.id, name: provider.name, version: provider.version } : void 0,
20477
20724
  counts: {
20478
- ...compactCounts(record(normalized?.statistics) ?? normalized),
20725
+ ...compactCounts(record2(normalized?.statistics) ?? normalized),
20479
20726
  graphNodes: Array.isArray(graph?.nodes) ? graph.nodes.length : void 0,
20480
20727
  graphEdges: Array.isArray(graph?.edges) ? graph.edges.length : void 0,
20481
20728
  semanticNodes: Array.isArray(semantic?.nodes) ? semantic.nodes.length : void 0,
@@ -20518,15 +20765,15 @@ function encryptionState(inspection) {
20518
20765
  };
20519
20766
  }
20520
20767
  function shortFailure(stderr, stdout) {
20521
- const text = `${stderr}
20768
+ const text2 = `${stderr}
20522
20769
  ${stdout}`.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).join("\n");
20523
- return text.slice(-1200) || "\u5206\u6790\u5F15\u64CE\u6CA1\u6709\u8FD4\u56DE\u9519\u8BEF\u8BE6\u60C5\u3002";
20770
+ return text2.slice(-1200) || "\u5206\u6790\u5F15\u64CE\u6CA1\u6709\u8FD4\u56DE\u9519\u8BEF\u8BE6\u60C5\u3002";
20524
20771
  }
20525
20772
  function reaErrorMessage(parsed) {
20526
20773
  if (!parsed) return void 0;
20527
- const details = record(parsed.details);
20528
- const diagnostics = record(details?.diagnostics);
20529
- const failureCause = record(details?.failure_cause);
20774
+ const details = record2(parsed.details);
20775
+ const diagnostics = record2(details?.diagnostics);
20776
+ const failureCause = record2(details?.failure_cause);
20530
20777
  for (const value of [
20531
20778
  diagnostics?.message,
20532
20779
  details?.failure_message,
@@ -20635,6 +20882,9 @@ var CapabilityJobRunner = class {
20635
20882
  case "inspect:ipa":
20636
20883
  await this.runInspect(job, target, artifact);
20637
20884
  return;
20885
+ case "inspect:mac-app":
20886
+ await this.runInspectMacApp(job, target, artifact);
20887
+ return;
20638
20888
  case "extract:app":
20639
20889
  await this.runExtract(job, target, artifact);
20640
20890
  return;
@@ -20699,10 +20949,36 @@ var CapabilityJobRunner = class {
20699
20949
  warnings: inspection.warnings.length
20700
20950
  });
20701
20951
  }
20952
+ async runInspectMacApp(job, target, artifact) {
20953
+ if (!artifact) fail("ARTIFACT_REQUIRED", "Acquire an artifact first.");
20954
+ this.log(job, "info", "Inspecting the macOS app bundle.");
20955
+ this.patch(job, { progress: 25 });
20956
+ const inspection = await inspectMacApp(
20957
+ this.workspace.resolveStoredPath(artifact.path)
20958
+ );
20959
+ const updated = {
20960
+ ...artifact,
20961
+ version: inspection.bundle.version ?? artifact.version,
20962
+ buildNumber: inspection.bundle.build ?? artifact.buildNumber,
20963
+ architecture: inspection.mainExecutable?.architectures.join(",") || artifact.architecture,
20964
+ inspection
20965
+ };
20966
+ this.store.insertArtifact(updated);
20967
+ this.workspace.saveArtifactMetadata(target, updated);
20968
+ this.patch(job, {
20969
+ status: "analyzed",
20970
+ progress: 100,
20971
+ result: { inspection },
20972
+ finishedAt: now()
20973
+ });
20974
+ this.log(job, "info", "macOS bundle inspection complete.", {
20975
+ warnings: inspection.warnings.length
20976
+ });
20977
+ }
20702
20978
  async runExtract(job, target, artifact) {
20703
20979
  if (!artifact) fail("ARTIFACT_REQUIRED", "\u8BF7\u5148\u83B7\u53D6 artifact\u3002");
20704
20980
  this.log(job, "info", "\u5F00\u59CB\u89E3\u5305 .app\u3002");
20705
- const outputDir = import_node_path4.default.join(
20981
+ const outputDir = import_node_path5.default.join(
20706
20982
  this.workspace.analysisDir(target),
20707
20983
  "extract-app",
20708
20984
  job.id
@@ -20716,7 +20992,7 @@ var CapabilityJobRunner = class {
20716
20992
  progress: 100,
20717
20993
  result: {
20718
20994
  ...extracted,
20719
- outputDir: import_node_path4.default.relative(this.workspace.root, extracted.outputDir)
20995
+ outputDir: import_node_path5.default.relative(this.workspace.root, extracted.outputDir)
20720
20996
  },
20721
20997
  finishedAt: now()
20722
20998
  });
@@ -20726,31 +21002,52 @@ var CapabilityJobRunner = class {
20726
21002
  }
20727
21003
  async runReaJavascript(job, target, artifact) {
20728
21004
  if (!artifact) fail("ARTIFACT_REQUIRED", "\u8BF7\u5148\u83B7\u53D6 artifact\u3002");
20729
- const extraction = await this.ensureExtraction(job, target, artifact);
20730
- this.log(job, "info", "\u5BF9\u89E3\u5305\u76EE\u5F55\u8FD0\u884C JavaScript \u9759\u6001\u5206\u6790\u3002", {
20731
- path: import_node_path4.default.relative(this.workspace.root, extraction.appRoot)
20732
- });
20733
- this.patch(job, { progress: 25 });
21005
+ let javascriptRoot;
21006
+ if (artifact.packageFormat === "app") {
21007
+ javascriptRoot = findElectronJavascriptRoot(
21008
+ this.workspace.resolveStoredPath(artifact.path)
21009
+ );
21010
+ this.log(job, "info", "Running static analysis on the macOS JavaScript bundle.", {
21011
+ path: import_node_path5.default.relative(this.workspace.root, javascriptRoot)
21012
+ });
21013
+ this.patch(job, { progress: 25 });
21014
+ } else {
21015
+ const extraction = await this.ensureExtraction(job, target, artifact);
21016
+ javascriptRoot = extraction.appRoot;
21017
+ this.log(job, "info", "\u5BF9\u89E3\u5305\u76EE\u5F55\u8FD0\u884C JavaScript \u9759\u6001\u5206\u6790\u3002", {
21018
+ path: import_node_path5.default.relative(this.workspace.root, javascriptRoot)
21019
+ });
21020
+ this.patch(job, { progress: 25 });
21021
+ }
20734
21022
  const rea = await this.runReaJson(
20735
21023
  job,
20736
21024
  target,
20737
21025
  "javascript-analyze",
20738
21026
  [
20739
21027
  "analyze-javascript-application",
20740
- extraction.appRoot,
21028
+ javascriptRoot,
20741
21029
  "--analysis-timeout-ms",
20742
21030
  "300000"
20743
21031
  ],
20744
- 10 * 6e4
21032
+ // Electron bundles are much larger than iOS web bundles; a 136 MB asar
21033
+ // takes several minutes on its own.
21034
+ 15 * 6e4
20745
21035
  );
20746
21036
  const evidenceId = this.reaEvidenceId(rea);
21037
+ const summary = { ...rea.summary };
21038
+ if (artifact.packageFormat === "app") {
21039
+ const technology = record2(summary.technology) ?? {};
21040
+ const hints = Array.isArray(technology.hints) ? [...technology.hints] : [];
21041
+ if (!hints.includes("Electron")) hints.unshift("Electron");
21042
+ summary.technology = { ...technology, hints };
21043
+ }
20747
21044
  this.persistEvidence(
20748
21045
  job,
20749
21046
  artifact,
20750
21047
  "javascript-analysis",
20751
21048
  rea,
20752
21049
  evidenceId,
20753
- javascriptFindings(job, artifact, evidenceId, rea.parsed, rea.summary),
21050
+ javascriptFindings(job, artifact, evidenceId, rea.parsed, summary),
20754
21051
  [
20755
21052
  "technology",
20756
21053
  "route",
@@ -20765,9 +21062,9 @@ var CapabilityJobRunner = class {
20765
21062
  status: "analyzed",
20766
21063
  progress: 100,
20767
21064
  result: {
20768
- ...rea.summary,
21065
+ ...summary,
20769
21066
  evidenceId,
20770
- outputDir: import_node_path4.default.relative(this.workspace.root, extraction.appRoot),
21067
+ outputDir: import_node_path5.default.relative(this.workspace.root, javascriptRoot),
20771
21068
  evidencePath: rea.rawPath
20772
21069
  },
20773
21070
  finishedAt: now()
@@ -20811,7 +21108,7 @@ var CapabilityJobRunner = class {
20811
21108
  result: {
20812
21109
  ...rea.summary,
20813
21110
  evidenceId,
20814
- binaryPath: import_node_path4.default.relative(this.workspace.root, prepared.binaryPath),
21111
+ binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
20815
21112
  evidencePath: rea.rawPath,
20816
21113
  encryption,
20817
21114
  warning: encryption.encryptedSlices > 0 ? "\u4E3B\u7A0B\u5E8F\u5305\u542B\u58F0\u660E\u52A0\u5BC6\u7684\u5207\u7247\uFF1B\u4E0D\u8981\u628A\u52A0\u5BC6\u533A\u53CD\u7F16\u8BD1\u7ED3\u679C\u5F53\u4F5C\u53EF\u4FE1\u539F\u59CB\u5B9E\u73B0\u3002" : void 0
@@ -20862,7 +21159,7 @@ var CapabilityJobRunner = class {
20862
21159
  );
20863
21160
  this.persistEvidence(job, artifact, "native-search", rea, evidenceId, findings);
20864
21161
  const rawMatches = Array.isArray(rea.parsed.normalized_result) ? rea.parsed.normalized_result : Array.isArray(rea.parsed.raw_result) ? rea.parsed.raw_result : [];
20865
- const matches = rawMatches.map((item) => record(item)).filter((item) => Boolean(item?.value)).slice(0, 100);
21162
+ const matches = rawMatches.map((item) => record2(item)).filter((item) => Boolean(item?.value)).slice(0, 100);
20866
21163
  this.patch(job, {
20867
21164
  status: "analyzed",
20868
21165
  progress: 100,
@@ -20874,7 +21171,7 @@ var CapabilityJobRunner = class {
20874
21171
  mode,
20875
21172
  matchCount: rawMatches.length,
20876
21173
  matches,
20877
- binaryPath: import_node_path4.default.relative(this.workspace.root, prepared.binaryPath),
21174
+ binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
20878
21175
  evidencePath: rea.rawPath,
20879
21176
  limitations: Array.isArray(rea.parsed.limitations) ? rea.parsed.limitations : [],
20880
21177
  encryption: encryptionState(prepared.inspection)
@@ -20919,7 +21216,7 @@ var CapabilityJobRunner = class {
20919
21216
  result: {
20920
21217
  ...rea.summary,
20921
21218
  functionName: input2.functionName,
20922
- binaryPath: import_node_path4.default.relative(this.workspace.root, prepared.binaryPath),
21219
+ binaryPath: import_node_path5.default.relative(this.workspace.root, prepared.binaryPath),
20923
21220
  evidencePath: rea.rawPath,
20924
21221
  encryption
20925
21222
  },
@@ -20934,26 +21231,44 @@ var CapabilityJobRunner = class {
20934
21231
  this.log(job, "info", "\u6C47\u603B Target\u3001artifact \u548C\u4EFB\u52A1\u8BC1\u636E\u3002");
20935
21232
  this.patch(job, { progress: 35 });
20936
21233
  const generatedAt = now();
20937
- const reportPath = import_node_path4.default.join(
21234
+ const reportPath = import_node_path5.default.join(
20938
21235
  this.workspace.targetDir(target),
20939
21236
  "reports",
20940
21237
  `${job.id}.md`
20941
21238
  );
20942
- const findingResult = this.store.searchFindings({
21239
+ const findingTypes = [
21240
+ "technology",
21241
+ "route",
21242
+ "network_endpoint",
21243
+ "module",
21244
+ "asset",
21245
+ "storage",
21246
+ "native_procedure",
21247
+ "risk",
21248
+ "limitation"
21249
+ ];
21250
+ const findings = findingTypes.flatMap(
21251
+ (type) => this.store.searchFindings({
21252
+ targetId: target.id,
21253
+ types: [type],
21254
+ limit: 20
21255
+ }).items
21256
+ );
21257
+ const findingTotal = this.store.searchFindings({
20943
21258
  targetId: target.id,
20944
- limit: 1e3
20945
- });
21259
+ limit: 1
21260
+ }).total;
20946
21261
  const markdown = renderReportMarkdown({
20947
21262
  target,
20948
21263
  artifact,
20949
21264
  jobs: this.store.listJobs(target.id).filter((item) => item.id !== job.id).slice(0, 20),
20950
- findings: findingResult.items,
20951
- findingTotal: findingResult.total,
21265
+ findings,
21266
+ findingTotal,
20952
21267
  hostPlatform: this.config.hostPlatform,
20953
21268
  generatedAt
20954
21269
  });
20955
21270
  this.workspace.writeText(reportPath, markdown);
20956
- const relativePath = import_node_path4.default.relative(this.workspace.root, reportPath);
21271
+ const relativePath = import_node_path5.default.relative(this.workspace.root, reportPath);
20957
21272
  this.patch(job, {
20958
21273
  status: "analyzed",
20959
21274
  progress: 100,
@@ -20985,12 +21300,12 @@ var CapabilityJobRunner = class {
20985
21300
  fail("MAIN_EXECUTABLE_NOT_FOUND", "IPA \u68C0\u67E5\u7ED3\u679C\u4E2D\u6CA1\u6709\u4E3B\u7A0B\u5E8F\u8DEF\u5F84\u3002");
20986
21301
  }
20987
21302
  const extraction = await this.ensureExtraction(job, target, current);
20988
- const binaryPath = import_node_path4.default.resolve(extraction.outputDir, executable);
20989
- const root = import_node_path4.default.resolve(extraction.outputDir);
20990
- if (binaryPath !== root && !binaryPath.startsWith(root + import_node_path4.default.sep)) {
21303
+ const binaryPath = import_node_path5.default.resolve(extraction.outputDir, executable);
21304
+ const root = import_node_path5.default.resolve(extraction.outputDir);
21305
+ if (binaryPath !== root && !binaryPath.startsWith(root + import_node_path5.default.sep)) {
20991
21306
  fail("UNSAFE_ARTIFACT_PATH", "\u4E3B\u7A0B\u5E8F\u8DEF\u5F84\u8D8A\u51FA\u89E3\u5305\u76EE\u5F55\uFF0C\u5DF2\u62D2\u7EDD\u6267\u884C\u3002");
20992
21307
  }
20993
- if (!import_node_fs4.default.existsSync(binaryPath)) {
21308
+ if (!import_node_fs5.default.existsSync(binaryPath)) {
20994
21309
  fail("MAIN_EXECUTABLE_NOT_FOUND", `\u89E3\u5305\u76EE\u5F55\u4E2D\u6CA1\u6709\u4E3B\u7A0B\u5E8F\uFF1A${executable}`);
20995
21310
  }
20996
21311
  return { inspection, binaryPath };
@@ -20999,24 +21314,24 @@ var CapabilityJobRunner = class {
20999
21314
  const previous = this.findExtraction(target.id, artifact.id);
21000
21315
  if (previous) {
21001
21316
  this.log(job, "info", "\u590D\u7528\u5DF2\u6709\u89E3\u5305\u76EE\u5F55\u3002", {
21002
- path: import_node_path4.default.relative(this.workspace.root, previous.outputDir)
21317
+ path: import_node_path5.default.relative(this.workspace.root, previous.outputDir)
21003
21318
  });
21004
21319
  return previous;
21005
21320
  }
21006
- const outputDir = import_node_path4.default.join(
21321
+ const outputDir = import_node_path5.default.join(
21007
21322
  this.workspace.analysisDir(target),
21008
21323
  "extracted",
21009
21324
  artifact.id
21010
21325
  );
21011
- const existingApp = import_node_fs4.default.existsSync(outputDir) ? findAppPrefix(outputDir) : void 0;
21326
+ const existingApp = import_node_fs5.default.existsSync(outputDir) ? findAppPrefix(outputDir) : void 0;
21012
21327
  if (existingApp) {
21013
21328
  const location = {
21014
21329
  outputDir,
21015
21330
  prefix: existingApp,
21016
- appRoot: import_node_path4.default.join(outputDir, existingApp)
21331
+ appRoot: import_node_path5.default.join(outputDir, existingApp)
21017
21332
  };
21018
21333
  this.log(job, "info", "\u590D\u7528\u6309 artifact \u54C8\u5E0C\u5F52\u6863\u7684\u89E3\u5305\u76EE\u5F55\u3002", {
21019
- path: import_node_path4.default.relative(this.workspace.root, outputDir)
21334
+ path: import_node_path5.default.relative(this.workspace.root, outputDir)
21020
21335
  });
21021
21336
  return location;
21022
21337
  }
@@ -21026,8 +21341,8 @@ var CapabilityJobRunner = class {
21026
21341
  this.workspace.resolveStoredPath(artifact.path),
21027
21342
  outputDir
21028
21343
  );
21029
- const appRoot = import_node_path4.default.resolve(outputDir, extracted.prefix);
21030
- if (appRoot !== outputDir && !appRoot.startsWith(outputDir + import_node_path4.default.sep)) {
21344
+ const appRoot = import_node_path5.default.resolve(outputDir, extracted.prefix);
21345
+ if (appRoot !== outputDir && !appRoot.startsWith(outputDir + import_node_path5.default.sep)) {
21031
21346
  fail("UNSAFE_ARTIFACT_PATH", "\u89E3\u5305\u524D\u7F00\u8D8A\u51FA\u8F93\u51FA\u76EE\u5F55\uFF0C\u5DF2\u62D2\u7EDD\u7EE7\u7EED\u3002");
21032
21347
  }
21033
21348
  return { outputDir, appRoot, prefix: extracted.prefix };
@@ -21042,8 +21357,8 @@ var CapabilityJobRunner = class {
21042
21357
  if (typeof output !== "string" || typeof prefix !== "string") continue;
21043
21358
  try {
21044
21359
  const outputDir = this.workspace.resolveStoredPath(output);
21045
- const appRoot = import_node_path4.default.resolve(outputDir, prefix);
21046
- if (import_node_fs4.default.existsSync(appRoot) && (appRoot === outputDir || appRoot.startsWith(outputDir + import_node_path4.default.sep))) {
21360
+ const appRoot = import_node_path5.default.resolve(outputDir, prefix);
21361
+ if (import_node_fs5.default.existsSync(appRoot) && (appRoot === outputDir || appRoot.startsWith(outputDir + import_node_path5.default.sep))) {
21047
21362
  return { outputDir, appRoot, prefix };
21048
21363
  }
21049
21364
  } catch {
@@ -21052,11 +21367,11 @@ var CapabilityJobRunner = class {
21052
21367
  return void 0;
21053
21368
  }
21054
21369
  async runReaJson(job, target, folder, args, timeoutMs) {
21055
- const dir = import_node_path4.default.join(this.workspace.analysisDir(target), folder, job.id);
21056
- const rawPath = import_node_path4.default.join(dir, "result.json");
21057
- const stderrPath = import_node_path4.default.join(dir, "stderr.log");
21058
- const commandPath = import_node_path4.default.join(dir, "command.json");
21059
- import_node_fs4.default.mkdirSync(dir, { recursive: true, mode: 448 });
21370
+ const dir = import_node_path5.default.join(this.workspace.analysisDir(target), folder, job.id);
21371
+ const rawPath = import_node_path5.default.join(dir, "result.json");
21372
+ const stderrPath = import_node_path5.default.join(dir, "stderr.log");
21373
+ const commandPath = import_node_path5.default.join(dir, "command.json");
21374
+ import_node_fs5.default.mkdirSync(dir, { recursive: true, mode: 448 });
21060
21375
  this.workspace.writeJson(commandPath, {
21061
21376
  command: this.config.reaPath,
21062
21377
  args,
@@ -21075,7 +21390,7 @@ var CapabilityJobRunner = class {
21075
21390
  });
21076
21391
  this.workspace.writeText(rawPath, result.stdout);
21077
21392
  this.workspace.writeText(stderrPath, result.stderr);
21078
- this.workspace.writeJson(import_node_path4.default.join(dir, "status.json"), {
21393
+ this.workspace.writeJson(import_node_path5.default.join(dir, "status.json"), {
21079
21394
  code: result.code,
21080
21395
  timedOut: result.timedOut,
21081
21396
  finishedAt: now()
@@ -21089,7 +21404,7 @@ var CapabilityJobRunner = class {
21089
21404
  if (result.code !== 0) {
21090
21405
  const parsed2 = parseJsonDocument(result.stdout);
21091
21406
  this.log(job, "warn", "\u5206\u6790\u5F15\u64CE\u672A\u6210\u529F\u5B8C\u6210\uFF0C\u539F\u59CB\u8F93\u51FA\u5DF2\u4FDD\u7559\u3002", {
21092
- evidencePath: import_node_path4.default.relative(this.workspace.root, rawPath)
21407
+ evidencePath: import_node_path5.default.relative(this.workspace.root, rawPath)
21093
21408
  });
21094
21409
  const message = reaErrorMessage(parsed2) ?? shortFailure(result.stderr, result.stdout);
21095
21410
  fail("ENGINE_FAILED", message);
@@ -21103,7 +21418,7 @@ var CapabilityJobRunner = class {
21103
21418
  }
21104
21419
  return {
21105
21420
  parsed,
21106
- rawPath: import_node_path4.default.relative(this.workspace.root, rawPath),
21421
+ rawPath: import_node_path5.default.relative(this.workspace.root, rawPath),
21107
21422
  sha256: hashText(result.stdout),
21108
21423
  summary: summarizeRea(parsed)
21109
21424
  };
@@ -21151,10 +21466,10 @@ var CapabilityJobRunner = class {
21151
21466
  }
21152
21467
  };
21153
21468
  function findAppPrefix(outputDir) {
21154
- const payload = import_node_path4.default.join(outputDir, "Payload");
21155
- if (!import_node_fs4.default.existsSync(payload)) return void 0;
21469
+ const payload = import_node_path5.default.join(outputDir, "Payload");
21470
+ if (!import_node_fs5.default.existsSync(payload)) return void 0;
21156
21471
  try {
21157
- const app = import_node_fs4.default.readdirSync(payload, { withFileTypes: true }).find((entry) => entry.isDirectory() && entry.name.endsWith(".app"));
21472
+ const app = import_node_fs5.default.readdirSync(payload, { withFileTypes: true }).find((entry) => entry.isDirectory() && entry.name.endsWith(".app"));
21158
21473
  return app ? `Payload/${app.name}/` : void 0;
21159
21474
  } catch {
21160
21475
  return void 0;
@@ -21162,10 +21477,11 @@ function findAppPrefix(outputDir) {
21162
21477
  }
21163
21478
 
21164
21479
  // src/license.ts
21165
- var import_node_fs5 = __toESM(require("fs"));
21480
+ var import_node_fs6 = __toESM(require("fs"));
21166
21481
  var import_node_crypto2 = __toESM(require("crypto"));
21167
21482
  var FREE_FEATURES = /* @__PURE__ */ new Set([
21168
21483
  "inspect:ipa",
21484
+ "inspect:mac-app",
21169
21485
  "extract:app",
21170
21486
  "javascript:analyze",
21171
21487
  "generate:report"
@@ -21181,7 +21497,7 @@ function verifyLicense(token) {
21181
21497
  if (!encodedPayload || !encodedSignature) {
21182
21498
  throw new Error("Invalid license token.");
21183
21499
  }
21184
- const publicKeyValue = process.env.APPTRACE_LICENSE_PUBLIC_KEY || (process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE ? import_node_fs5.default.readFileSync(process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE, "utf8") : void 0);
21500
+ const publicKeyValue = process.env.APPTRACE_LICENSE_PUBLIC_KEY || (process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE ? import_node_fs6.default.readFileSync(process.env.APPTRACE_LICENSE_PUBLIC_KEY_FILE, "utf8") : void 0);
21185
21501
  if (!publicKeyValue) {
21186
21502
  throw new Error("APPTRACE_LICENSE_PUBLIC_KEY is not configured.");
21187
21503
  }
@@ -21238,8 +21554,8 @@ function compareVersionData(input2) {
21238
21554
  }
21239
21555
 
21240
21556
  // src/store.ts
21241
- var import_node_fs6 = __toESM(require("fs"));
21242
- var import_node_path5 = __toESM(require("path"));
21557
+ var import_node_fs7 = __toESM(require("fs"));
21558
+ var import_node_path6 = __toESM(require("path"));
21243
21559
  var import_node_module = require("module");
21244
21560
  var import_meta = {};
21245
21561
  function openSqlite(databasePath) {
@@ -21492,7 +21808,7 @@ var SqliteStore = class {
21492
21808
  kind = "sqlite";
21493
21809
  db;
21494
21810
  constructor(databasePath) {
21495
- import_node_fs6.default.mkdirSync(import_node_path5.default.dirname(databasePath), { recursive: true, mode: 448 });
21811
+ import_node_fs7.default.mkdirSync(import_node_path6.default.dirname(databasePath), { recursive: true, mode: 448 });
21496
21812
  const db = openSqlite(databasePath);
21497
21813
  if (!db) throw new Error("node:sqlite is not available");
21498
21814
  this.db = db;
@@ -21825,11 +22141,11 @@ var JsonStore = class {
21825
22141
  data;
21826
22142
  constructor(databasePath) {
21827
22143
  this.filePath = databasePath.replace(/\.sqlite$/i, "") + ".json";
21828
- import_node_fs6.default.mkdirSync(import_node_path5.default.dirname(this.filePath), { recursive: true, mode: 448 });
22144
+ import_node_fs7.default.mkdirSync(import_node_path6.default.dirname(this.filePath), { recursive: true, mode: 448 });
21829
22145
  this.data = this.load();
21830
22146
  }
21831
22147
  load() {
21832
- if (!import_node_fs6.default.existsSync(this.filePath)) {
22148
+ if (!import_node_fs7.default.existsSync(this.filePath)) {
21833
22149
  return {
21834
22150
  targets: [],
21835
22151
  artifacts: [],
@@ -21841,7 +22157,7 @@ var JsonStore = class {
21841
22157
  };
21842
22158
  }
21843
22159
  try {
21844
- const parsed = JSON.parse(import_node_fs6.default.readFileSync(this.filePath, "utf8"));
22160
+ const parsed = JSON.parse(import_node_fs7.default.readFileSync(this.filePath, "utf8"));
21845
22161
  return {
21846
22162
  targets: parsed.targets ?? [],
21847
22163
  artifacts: parsed.artifacts ?? [],
@@ -21865,8 +22181,8 @@ var JsonStore = class {
21865
22181
  }
21866
22182
  save() {
21867
22183
  const temp = `${this.filePath}.${process.pid}.tmp`;
21868
- import_node_fs6.default.writeFileSync(temp, JSON.stringify(this.data, null, 2), { mode: 384 });
21869
- import_node_fs6.default.renameSync(temp, this.filePath);
22184
+ import_node_fs7.default.writeFileSync(temp, JSON.stringify(this.data, null, 2), { mode: 384 });
22185
+ import_node_fs7.default.renameSync(temp, this.filePath);
21870
22186
  }
21871
22187
  listTargets() {
21872
22188
  return [...this.data.targets].sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
@@ -22007,44 +22323,44 @@ function createStore(databasePath) {
22007
22323
  }
22008
22324
 
22009
22325
  // src/workspace.ts
22010
- var import_node_fs7 = __toESM(require("fs"));
22011
- var import_node_path6 = __toESM(require("path"));
22326
+ var import_node_fs8 = __toESM(require("fs"));
22327
+ var import_node_path7 = __toESM(require("path"));
22012
22328
  var WorkspaceService = class {
22013
22329
  root;
22014
22330
  constructor(root) {
22015
- this.root = import_node_path6.default.resolve(root);
22016
- import_node_fs7.default.mkdirSync(this.root, { recursive: true, mode: 448 });
22017
- import_node_fs7.default.mkdirSync(import_node_path6.default.join(this.root, "targets"), { recursive: true, mode: 448 });
22018
- import_node_fs7.default.mkdirSync(import_node_path6.default.join(this.root, "tmp"), { recursive: true, mode: 448 });
22331
+ this.root = import_node_path7.default.resolve(root);
22332
+ import_node_fs8.default.mkdirSync(this.root, { recursive: true, mode: 448 });
22333
+ import_node_fs8.default.mkdirSync(import_node_path7.default.join(this.root, "targets"), { recursive: true, mode: 448 });
22334
+ import_node_fs8.default.mkdirSync(import_node_path7.default.join(this.root, "tmp"), { recursive: true, mode: 448 });
22019
22335
  }
22020
22336
  targetDir(target) {
22021
- return import_node_path6.default.join(
22337
+ return import_node_path7.default.join(
22022
22338
  this.root,
22023
22339
  "targets",
22024
22340
  `${target.targetRef.platform}-${target.targetRef.sourceId}-${target.slug}-${target.id.slice(0, 8)}`
22025
22341
  );
22026
22342
  }
22027
22343
  artifactDir(target) {
22028
- return import_node_path6.default.join(this.targetDir(target), "artifacts");
22344
+ return import_node_path7.default.join(this.targetDir(target), "artifacts");
22029
22345
  }
22030
22346
  analysisDir(target) {
22031
- return import_node_path6.default.join(this.targetDir(target), "analysis");
22347
+ return import_node_path7.default.join(this.targetDir(target), "analysis");
22032
22348
  }
22033
22349
  ensureTarget(target) {
22034
22350
  const dir = this.targetDir(target);
22035
22351
  for (const subdir of ["", "artifacts", "analysis", "reports"]) {
22036
- import_node_fs7.default.mkdirSync(import_node_path6.default.join(dir, subdir), { recursive: true, mode: 448 });
22352
+ import_node_fs8.default.mkdirSync(import_node_path7.default.join(dir, subdir), { recursive: true, mode: 448 });
22037
22353
  }
22038
22354
  }
22039
22355
  saveResolvedTarget(target, rawSource) {
22040
22356
  this.ensureTarget(target);
22041
22357
  const dir = this.targetDir(target);
22042
- this.writeJson(import_node_path6.default.join(dir, "meta.json"), target);
22043
- this.writeJson(import_node_path6.default.join(dir, "source.json"), rawSource);
22358
+ this.writeJson(import_node_path7.default.join(dir, "meta.json"), target);
22359
+ this.writeJson(import_node_path7.default.join(dir, "source.json"), rawSource);
22044
22360
  }
22045
22361
  saveArtifactMetadata(target, artifact, extra = {}) {
22046
22362
  const dir = this.targetDir(target);
22047
- this.writeJson(import_node_path6.default.join(dir, "artifact.json"), {
22363
+ this.writeJson(import_node_path7.default.join(dir, "artifact.json"), {
22048
22364
  schemaVersion: 1,
22049
22365
  target: {
22050
22366
  id: target.id,
@@ -22068,7 +22384,7 @@ var WorkspaceService = class {
22068
22384
  },
22069
22385
  ...extra
22070
22386
  });
22071
- this.writeJson(import_node_path6.default.join(dir, "current.json"), {
22387
+ this.writeJson(import_node_path7.default.join(dir, "current.json"), {
22072
22388
  artifactId: artifact.id,
22073
22389
  path: artifact.path,
22074
22390
  sha256: artifact.sha256,
@@ -22076,11 +22392,11 @@ var WorkspaceService = class {
22076
22392
  });
22077
22393
  }
22078
22394
  artifactRelativePath(target, filePath) {
22079
- return import_node_path6.default.relative(this.root, filePath);
22395
+ return import_node_path7.default.relative(this.root, filePath);
22080
22396
  }
22081
22397
  resolveStoredPath(relativePath) {
22082
- const resolved = import_node_path6.default.resolve(this.root, relativePath);
22083
- if (resolved !== this.root && !resolved.startsWith(this.root + import_node_path6.default.sep)) {
22398
+ const resolved = import_node_path7.default.resolve(this.root, relativePath);
22399
+ if (resolved !== this.root && !resolved.startsWith(this.root + import_node_path7.default.sep)) {
22084
22400
  throw new Error(`Path escapes workspace: ${relativePath}`);
22085
22401
  }
22086
22402
  return resolved;
@@ -22090,10 +22406,10 @@ var WorkspaceService = class {
22090
22406
  `);
22091
22407
  }
22092
22408
  writeText(filePath, value) {
22093
- import_node_fs7.default.mkdirSync(import_node_path6.default.dirname(filePath), { recursive: true, mode: 448 });
22409
+ import_node_fs8.default.mkdirSync(import_node_path7.default.dirname(filePath), { recursive: true, mode: 448 });
22094
22410
  const temp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
22095
- import_node_fs7.default.writeFileSync(temp, value, { mode: 384 });
22096
- import_node_fs7.default.renameSync(temp, filePath);
22411
+ import_node_fs8.default.writeFileSync(temp, value, { mode: 384 });
22412
+ import_node_fs8.default.renameSync(temp, filePath);
22097
22413
  }
22098
22414
  };
22099
22415
 
@@ -22159,12 +22475,12 @@ async function handle(line) {
22159
22475
  });
22160
22476
  return;
22161
22477
  }
22162
- const workspaceRoot = import_node_path7.default.resolve(request.workspacePath);
22163
- if (!import_node_fs8.default.existsSync(workspaceRoot)) {
22478
+ const workspaceRoot = import_node_path8.default.resolve(request.workspacePath);
22479
+ if (!import_node_fs9.default.existsSync(workspaceRoot)) {
22164
22480
  send({ id: request.id, ok: false, error: { code: "WORKSPACE_NOT_FOUND", message: workspaceRoot } });
22165
22481
  return;
22166
22482
  }
22167
- const store = createStore(import_node_path7.default.join(workspaceRoot, "workbench.sqlite"));
22483
+ const store = createStore(import_node_path8.default.join(workspaceRoot, "workbench.sqlite"));
22168
22484
  try {
22169
22485
  if (request.capability === "compare:versions") {
22170
22486
  send({