@midscene/web 0.1.2 → 0.1.4

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.
@@ -129,7 +129,7 @@ var require_polyfills = __commonJS({
129
129
  fs2.fstatSync = statFixSync(fs2.fstatSync);
130
130
  fs2.lstatSync = statFixSync(fs2.lstatSync);
131
131
  if (fs2.chmod && !fs2.lchmod) {
132
- fs2.lchmod = function(path2, mode, cb) {
132
+ fs2.lchmod = function(path3, mode, cb) {
133
133
  if (cb)
134
134
  process.nextTick(cb);
135
135
  };
@@ -137,7 +137,7 @@ var require_polyfills = __commonJS({
137
137
  };
138
138
  }
139
139
  if (fs2.chown && !fs2.lchown) {
140
- fs2.lchown = function(path2, uid, gid, cb) {
140
+ fs2.lchown = function(path3, uid, gid, cb) {
141
141
  if (cb)
142
142
  process.nextTick(cb);
143
143
  };
@@ -208,9 +208,9 @@ var require_polyfills = __commonJS({
208
208
  };
209
209
  }(fs2.readSync);
210
210
  function patchLchmod(fs3) {
211
- fs3.lchmod = function(path2, mode, callback) {
211
+ fs3.lchmod = function(path3, mode, callback) {
212
212
  fs3.open(
213
- path2,
213
+ path3,
214
214
  constants.O_WRONLY | constants.O_SYMLINK,
215
215
  mode,
216
216
  function(err, fd) {
@@ -228,8 +228,8 @@ var require_polyfills = __commonJS({
228
228
  }
229
229
  );
230
230
  };
231
- fs3.lchmodSync = function(path2, mode) {
232
- var fd = fs3.openSync(path2, constants.O_WRONLY | constants.O_SYMLINK, mode);
231
+ fs3.lchmodSync = function(path3, mode) {
232
+ var fd = fs3.openSync(path3, constants.O_WRONLY | constants.O_SYMLINK, mode);
233
233
  var threw = true;
234
234
  var ret;
235
235
  try {
@@ -250,8 +250,8 @@ var require_polyfills = __commonJS({
250
250
  }
251
251
  function patchLutimes(fs3) {
252
252
  if (constants.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
253
- fs3.lutimes = function(path2, at, mt, cb) {
254
- fs3.open(path2, constants.O_SYMLINK, function(er, fd) {
253
+ fs3.lutimes = function(path3, at, mt, cb) {
254
+ fs3.open(path3, constants.O_SYMLINK, function(er, fd) {
255
255
  if (er) {
256
256
  if (cb)
257
257
  cb(er);
@@ -265,8 +265,8 @@ var require_polyfills = __commonJS({
265
265
  });
266
266
  });
267
267
  };
268
- fs3.lutimesSync = function(path2, at, mt) {
269
- var fd = fs3.openSync(path2, constants.O_SYMLINK);
268
+ fs3.lutimesSync = function(path3, at, mt) {
269
+ var fd = fs3.openSync(path3, constants.O_SYMLINK);
270
270
  var ret;
271
271
  var threw = true;
272
272
  try {
@@ -403,12 +403,12 @@ var require_legacy_streams = __commonJS({
403
403
  ReadStream,
404
404
  WriteStream
405
405
  };
406
- function ReadStream(path2, options) {
406
+ function ReadStream(path3, options) {
407
407
  if (!(this instanceof ReadStream))
408
- return new ReadStream(path2, options);
408
+ return new ReadStream(path3, options);
409
409
  Stream.call(this);
410
410
  var self = this;
411
- this.path = path2;
411
+ this.path = path3;
412
412
  this.fd = null;
413
413
  this.readable = true;
414
414
  this.paused = false;
@@ -454,11 +454,11 @@ var require_legacy_streams = __commonJS({
454
454
  self._read();
455
455
  });
456
456
  }
457
- function WriteStream(path2, options) {
457
+ function WriteStream(path3, options) {
458
458
  if (!(this instanceof WriteStream))
459
- return new WriteStream(path2, options);
459
+ return new WriteStream(path3, options);
460
460
  Stream.call(this);
461
- this.path = path2;
461
+ this.path = path3;
462
462
  this.fd = null;
463
463
  this.writable = true;
464
464
  this.flags = "w";
@@ -602,14 +602,14 @@ var require_graceful_fs = __commonJS({
602
602
  fs3.createWriteStream = createWriteStream;
603
603
  var fs$readFile = fs3.readFile;
604
604
  fs3.readFile = readFile;
605
- function readFile(path2, options, cb) {
605
+ function readFile(path3, options, cb) {
606
606
  if (typeof options === "function")
607
607
  cb = options, options = null;
608
- return go$readFile(path2, options, cb);
609
- function go$readFile(path3, options2, cb2, startTime) {
610
- return fs$readFile(path3, options2, function(err) {
608
+ return go$readFile(path3, options, cb);
609
+ function go$readFile(path4, options2, cb2, startTime) {
610
+ return fs$readFile(path4, options2, function(err) {
611
611
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
612
- enqueue([go$readFile, [path3, options2, cb2], err, startTime || Date.now(), Date.now()]);
612
+ enqueue([go$readFile, [path4, options2, cb2], err, startTime || Date.now(), Date.now()]);
613
613
  else {
614
614
  if (typeof cb2 === "function")
615
615
  cb2.apply(this, arguments);
@@ -619,14 +619,14 @@ var require_graceful_fs = __commonJS({
619
619
  }
620
620
  var fs$writeFile = fs3.writeFile;
621
621
  fs3.writeFile = writeFile;
622
- function writeFile(path2, data, options, cb) {
622
+ function writeFile(path3, data, options, cb) {
623
623
  if (typeof options === "function")
624
624
  cb = options, options = null;
625
- return go$writeFile(path2, data, options, cb);
626
- function go$writeFile(path3, data2, options2, cb2, startTime) {
627
- return fs$writeFile(path3, data2, options2, function(err) {
625
+ return go$writeFile(path3, data, options, cb);
626
+ function go$writeFile(path4, data2, options2, cb2, startTime) {
627
+ return fs$writeFile(path4, data2, options2, function(err) {
628
628
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
629
- enqueue([go$writeFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
629
+ enqueue([go$writeFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
630
630
  else {
631
631
  if (typeof cb2 === "function")
632
632
  cb2.apply(this, arguments);
@@ -637,14 +637,14 @@ var require_graceful_fs = __commonJS({
637
637
  var fs$appendFile = fs3.appendFile;
638
638
  if (fs$appendFile)
639
639
  fs3.appendFile = appendFile;
640
- function appendFile(path2, data, options, cb) {
640
+ function appendFile(path3, data, options, cb) {
641
641
  if (typeof options === "function")
642
642
  cb = options, options = null;
643
- return go$appendFile(path2, data, options, cb);
644
- function go$appendFile(path3, data2, options2, cb2, startTime) {
645
- return fs$appendFile(path3, data2, options2, function(err) {
643
+ return go$appendFile(path3, data, options, cb);
644
+ function go$appendFile(path4, data2, options2, cb2, startTime) {
645
+ return fs$appendFile(path4, data2, options2, function(err) {
646
646
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
647
- enqueue([go$appendFile, [path3, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
647
+ enqueue([go$appendFile, [path4, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
648
648
  else {
649
649
  if (typeof cb2 === "function")
650
650
  cb2.apply(this, arguments);
@@ -675,31 +675,31 @@ var require_graceful_fs = __commonJS({
675
675
  var fs$readdir = fs3.readdir;
676
676
  fs3.readdir = readdir;
677
677
  var noReaddirOptionVersions = /^v[0-5]\./;
678
- function readdir(path2, options, cb) {
678
+ function readdir(path3, options, cb) {
679
679
  if (typeof options === "function")
680
680
  cb = options, options = null;
681
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path3, options2, cb2, startTime) {
682
- return fs$readdir(path3, fs$readdirCallback(
683
- path3,
681
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path4, options2, cb2, startTime) {
682
+ return fs$readdir(path4, fs$readdirCallback(
683
+ path4,
684
684
  options2,
685
685
  cb2,
686
686
  startTime
687
687
  ));
688
- } : function go$readdir2(path3, options2, cb2, startTime) {
689
- return fs$readdir(path3, options2, fs$readdirCallback(
690
- path3,
688
+ } : function go$readdir2(path4, options2, cb2, startTime) {
689
+ return fs$readdir(path4, options2, fs$readdirCallback(
690
+ path4,
691
691
  options2,
692
692
  cb2,
693
693
  startTime
694
694
  ));
695
695
  };
696
- return go$readdir(path2, options, cb);
697
- function fs$readdirCallback(path3, options2, cb2, startTime) {
696
+ return go$readdir(path3, options, cb);
697
+ function fs$readdirCallback(path4, options2, cb2, startTime) {
698
698
  return function(err, files) {
699
699
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
700
700
  enqueue([
701
701
  go$readdir,
702
- [path3, options2, cb2],
702
+ [path4, options2, cb2],
703
703
  err,
704
704
  startTime || Date.now(),
705
705
  Date.now()
@@ -770,7 +770,7 @@ var require_graceful_fs = __commonJS({
770
770
  enumerable: true,
771
771
  configurable: true
772
772
  });
773
- function ReadStream(path2, options) {
773
+ function ReadStream(path3, options) {
774
774
  if (this instanceof ReadStream)
775
775
  return fs$ReadStream.apply(this, arguments), this;
776
776
  else
@@ -790,7 +790,7 @@ var require_graceful_fs = __commonJS({
790
790
  }
791
791
  });
792
792
  }
793
- function WriteStream(path2, options) {
793
+ function WriteStream(path3, options) {
794
794
  if (this instanceof WriteStream)
795
795
  return fs$WriteStream.apply(this, arguments), this;
796
796
  else
@@ -808,22 +808,22 @@ var require_graceful_fs = __commonJS({
808
808
  }
809
809
  });
810
810
  }
811
- function createReadStream(path2, options) {
812
- return new fs3.ReadStream(path2, options);
811
+ function createReadStream(path3, options) {
812
+ return new fs3.ReadStream(path3, options);
813
813
  }
814
- function createWriteStream(path2, options) {
815
- return new fs3.WriteStream(path2, options);
814
+ function createWriteStream(path3, options) {
815
+ return new fs3.WriteStream(path3, options);
816
816
  }
817
817
  var fs$open = fs3.open;
818
818
  fs3.open = open;
819
- function open(path2, flags, mode, cb) {
819
+ function open(path3, flags, mode, cb) {
820
820
  if (typeof mode === "function")
821
821
  cb = mode, mode = null;
822
- return go$open(path2, flags, mode, cb);
823
- function go$open(path3, flags2, mode2, cb2, startTime) {
824
- return fs$open(path3, flags2, mode2, function(err, fd) {
822
+ return go$open(path3, flags, mode, cb);
823
+ function go$open(path4, flags2, mode2, cb2, startTime) {
824
+ return fs$open(path4, flags2, mode2, function(err, fd) {
825
825
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
826
- enqueue([go$open, [path3, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
826
+ enqueue([go$open, [path4, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
827
827
  else {
828
828
  if (typeof cb2 === "function")
829
829
  cb2.apply(this, arguments);
@@ -1006,10 +1006,10 @@ var require_fs = __commonJS({
1006
1006
  var require_utils = __commonJS({
1007
1007
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
1008
1008
  "use strict";
1009
- var path2 = __require("path");
1009
+ var path3 = __require("path");
1010
1010
  module.exports.checkPath = function checkPath(pth) {
1011
1011
  if (process.platform === "win32") {
1012
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path2.parse(pth).root, ""));
1012
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path3.parse(pth).root, ""));
1013
1013
  if (pathHasInvalidWinCharacters) {
1014
1014
  const error = new Error(`Path contains invalid characters: ${pth}`);
1015
1015
  error.code = "EINVAL";
@@ -1074,8 +1074,8 @@ var require_path_exists = __commonJS({
1074
1074
  "use strict";
1075
1075
  var u = require_universalify().fromPromise;
1076
1076
  var fs2 = require_fs();
1077
- function pathExists(path2) {
1078
- return fs2.access(path2).then(() => true).catch(() => false);
1077
+ function pathExists(path3) {
1078
+ return fs2.access(path3).then(() => true).catch(() => false);
1079
1079
  }
1080
1080
  module.exports = {
1081
1081
  pathExists: u(pathExists),
@@ -1090,8 +1090,8 @@ var require_utimes = __commonJS({
1090
1090
  "use strict";
1091
1091
  var fs2 = require_fs();
1092
1092
  var u = require_universalify().fromPromise;
1093
- async function utimesMillis(path2, atime, mtime) {
1094
- const fd = await fs2.open(path2, "r+");
1093
+ async function utimesMillis(path3, atime, mtime) {
1094
+ const fd = await fs2.open(path3, "r+");
1095
1095
  let closeErr = null;
1096
1096
  try {
1097
1097
  await fs2.futimes(fd, atime, mtime);
@@ -1106,8 +1106,8 @@ var require_utimes = __commonJS({
1106
1106
  throw closeErr;
1107
1107
  }
1108
1108
  }
1109
- function utimesMillisSync(path2, atime, mtime) {
1110
- const fd = fs2.openSync(path2, "r+");
1109
+ function utimesMillisSync(path3, atime, mtime) {
1110
+ const fd = fs2.openSync(path3, "r+");
1111
1111
  fs2.futimesSync(fd, atime, mtime);
1112
1112
  return fs2.closeSync(fd);
1113
1113
  }
@@ -1123,7 +1123,7 @@ var require_stat = __commonJS({
1123
1123
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module) {
1124
1124
  "use strict";
1125
1125
  var fs2 = require_fs();
1126
- var path2 = __require("path");
1126
+ var path3 = __require("path");
1127
1127
  var u = require_universalify().fromPromise;
1128
1128
  function getStats(src, dest, opts) {
1129
1129
  const statFunc = opts.dereference ? (file) => fs2.stat(file, { bigint: true }) : (file) => fs2.lstat(file, { bigint: true });
@@ -1153,8 +1153,8 @@ var require_stat = __commonJS({
1153
1153
  const { srcStat, destStat } = await getStats(src, dest, opts);
1154
1154
  if (destStat) {
1155
1155
  if (areIdentical(srcStat, destStat)) {
1156
- const srcBaseName = path2.basename(src);
1157
- const destBaseName = path2.basename(dest);
1156
+ const srcBaseName = path3.basename(src);
1157
+ const destBaseName = path3.basename(dest);
1158
1158
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1159
1159
  return { srcStat, destStat, isChangingCase: true };
1160
1160
  }
@@ -1176,8 +1176,8 @@ var require_stat = __commonJS({
1176
1176
  const { srcStat, destStat } = getStatsSync(src, dest, opts);
1177
1177
  if (destStat) {
1178
1178
  if (areIdentical(srcStat, destStat)) {
1179
- const srcBaseName = path2.basename(src);
1180
- const destBaseName = path2.basename(dest);
1179
+ const srcBaseName = path3.basename(src);
1180
+ const destBaseName = path3.basename(dest);
1181
1181
  if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1182
1182
  return { srcStat, destStat, isChangingCase: true };
1183
1183
  }
@@ -1196,9 +1196,9 @@ var require_stat = __commonJS({
1196
1196
  return { srcStat, destStat };
1197
1197
  }
1198
1198
  async function checkParentPaths(src, srcStat, dest, funcName) {
1199
- const srcParent = path2.resolve(path2.dirname(src));
1200
- const destParent = path2.resolve(path2.dirname(dest));
1201
- if (destParent === srcParent || destParent === path2.parse(destParent).root)
1199
+ const srcParent = path3.resolve(path3.dirname(src));
1200
+ const destParent = path3.resolve(path3.dirname(dest));
1201
+ if (destParent === srcParent || destParent === path3.parse(destParent).root)
1202
1202
  return;
1203
1203
  let destStat;
1204
1204
  try {
@@ -1214,9 +1214,9 @@ var require_stat = __commonJS({
1214
1214
  return checkParentPaths(src, srcStat, destParent, funcName);
1215
1215
  }
1216
1216
  function checkParentPathsSync(src, srcStat, dest, funcName) {
1217
- const srcParent = path2.resolve(path2.dirname(src));
1218
- const destParent = path2.resolve(path2.dirname(dest));
1219
- if (destParent === srcParent || destParent === path2.parse(destParent).root)
1217
+ const srcParent = path3.resolve(path3.dirname(src));
1218
+ const destParent = path3.resolve(path3.dirname(dest));
1219
+ if (destParent === srcParent || destParent === path3.parse(destParent).root)
1220
1220
  return;
1221
1221
  let destStat;
1222
1222
  try {
@@ -1235,8 +1235,8 @@ var require_stat = __commonJS({
1235
1235
  return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1236
1236
  }
1237
1237
  function isSrcSubdir(src, dest) {
1238
- const srcArr = path2.resolve(src).split(path2.sep).filter((i) => i);
1239
- const destArr = path2.resolve(dest).split(path2.sep).filter((i) => i);
1238
+ const srcArr = path3.resolve(src).split(path3.sep).filter((i) => i);
1239
+ const destArr = path3.resolve(dest).split(path3.sep).filter((i) => i);
1240
1240
  return srcArr.every((cur, i) => destArr[i] === cur);
1241
1241
  }
1242
1242
  function errMsg(src, dest, funcName) {
@@ -1261,7 +1261,7 @@ var require_copy = __commonJS({
1261
1261
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
1262
1262
  "use strict";
1263
1263
  var fs2 = require_fs();
1264
- var path2 = __require("path");
1264
+ var path3 = __require("path");
1265
1265
  var { mkdirs } = require_mkdirs();
1266
1266
  var { pathExists } = require_path_exists();
1267
1267
  var { utimesMillis } = require_utimes();
@@ -1284,7 +1284,7 @@ var require_copy = __commonJS({
1284
1284
  const include = await runFilter(src, dest, opts);
1285
1285
  if (!include)
1286
1286
  return;
1287
- const destParent = path2.dirname(dest);
1287
+ const destParent = path3.dirname(dest);
1288
1288
  const dirExists = await pathExists(destParent);
1289
1289
  if (!dirExists) {
1290
1290
  await mkdirs(destParent);
@@ -1345,8 +1345,8 @@ var require_copy = __commonJS({
1345
1345
  }
1346
1346
  const items = await fs2.readdir(src);
1347
1347
  await Promise.all(items.map(async (item) => {
1348
- const srcItem = path2.join(src, item);
1349
- const destItem = path2.join(dest, item);
1348
+ const srcItem = path3.join(src, item);
1349
+ const destItem = path3.join(dest, item);
1350
1350
  const include = await runFilter(srcItem, destItem, opts);
1351
1351
  if (!include)
1352
1352
  return;
@@ -1360,7 +1360,7 @@ var require_copy = __commonJS({
1360
1360
  async function onLink(destStat, src, dest, opts) {
1361
1361
  let resolvedSrc = await fs2.readlink(src);
1362
1362
  if (opts.dereference) {
1363
- resolvedSrc = path2.resolve(process.cwd(), resolvedSrc);
1363
+ resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
1364
1364
  }
1365
1365
  if (!destStat) {
1366
1366
  return fs2.symlink(resolvedSrc, dest);
@@ -1374,7 +1374,7 @@ var require_copy = __commonJS({
1374
1374
  throw e;
1375
1375
  }
1376
1376
  if (opts.dereference) {
1377
- resolvedDest = path2.resolve(process.cwd(), resolvedDest);
1377
+ resolvedDest = path3.resolve(process.cwd(), resolvedDest);
1378
1378
  }
1379
1379
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1380
1380
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1394,7 +1394,7 @@ var require_copy_sync = __commonJS({
1394
1394
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
1395
1395
  "use strict";
1396
1396
  var fs2 = require_graceful_fs();
1397
- var path2 = __require("path");
1397
+ var path3 = __require("path");
1398
1398
  var mkdirsSync = require_mkdirs().mkdirsSync;
1399
1399
  var utimesMillisSync = require_utimes().utimesMillisSync;
1400
1400
  var stat = require_stat();
@@ -1416,7 +1416,7 @@ var require_copy_sync = __commonJS({
1416
1416
  stat.checkParentPathsSync(src, srcStat, dest, "copy");
1417
1417
  if (opts.filter && !opts.filter(src, dest))
1418
1418
  return;
1419
- const destParent = path2.dirname(dest);
1419
+ const destParent = path3.dirname(dest);
1420
1420
  if (!fs2.existsSync(destParent))
1421
1421
  mkdirsSync(destParent);
1422
1422
  return getStats(destStat, src, dest, opts);
@@ -1487,8 +1487,8 @@ var require_copy_sync = __commonJS({
1487
1487
  fs2.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
1488
1488
  }
1489
1489
  function copyDirItem(item, src, dest, opts) {
1490
- const srcItem = path2.join(src, item);
1491
- const destItem = path2.join(dest, item);
1490
+ const srcItem = path3.join(src, item);
1491
+ const destItem = path3.join(dest, item);
1492
1492
  if (opts.filter && !opts.filter(srcItem, destItem))
1493
1493
  return;
1494
1494
  const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
@@ -1497,7 +1497,7 @@ var require_copy_sync = __commonJS({
1497
1497
  function onLink(destStat, src, dest, opts) {
1498
1498
  let resolvedSrc = fs2.readlinkSync(src);
1499
1499
  if (opts.dereference) {
1500
- resolvedSrc = path2.resolve(process.cwd(), resolvedSrc);
1500
+ resolvedSrc = path3.resolve(process.cwd(), resolvedSrc);
1501
1501
  }
1502
1502
  if (!destStat) {
1503
1503
  return fs2.symlinkSync(resolvedSrc, dest);
@@ -1511,7 +1511,7 @@ var require_copy_sync = __commonJS({
1511
1511
  throw err;
1512
1512
  }
1513
1513
  if (opts.dereference) {
1514
- resolvedDest = path2.resolve(process.cwd(), resolvedDest);
1514
+ resolvedDest = path3.resolve(process.cwd(), resolvedDest);
1515
1515
  }
1516
1516
  if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1517
1517
  throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
@@ -1548,11 +1548,11 @@ var require_remove = __commonJS({
1548
1548
  "use strict";
1549
1549
  var fs2 = require_graceful_fs();
1550
1550
  var u = require_universalify().fromCallback;
1551
- function remove(path2, callback) {
1552
- fs2.rm(path2, { recursive: true, force: true }, callback);
1551
+ function remove(path3, callback) {
1552
+ fs2.rm(path3, { recursive: true, force: true }, callback);
1553
1553
  }
1554
- function removeSync(path2) {
1555
- fs2.rmSync(path2, { recursive: true, force: true });
1554
+ function removeSync(path3) {
1555
+ fs2.rmSync(path3, { recursive: true, force: true });
1556
1556
  }
1557
1557
  module.exports = {
1558
1558
  remove: u(remove),
@@ -1567,7 +1567,7 @@ var require_empty = __commonJS({
1567
1567
  "use strict";
1568
1568
  var u = require_universalify().fromPromise;
1569
1569
  var fs2 = require_fs();
1570
- var path2 = __require("path");
1570
+ var path3 = __require("path");
1571
1571
  var mkdir = require_mkdirs();
1572
1572
  var remove = require_remove();
1573
1573
  var emptyDir = u(async function emptyDir2(dir) {
@@ -1577,7 +1577,7 @@ var require_empty = __commonJS({
1577
1577
  } catch (e) {
1578
1578
  return mkdir.mkdirs(dir);
1579
1579
  }
1580
- return Promise.all(items.map((item) => remove.remove(path2.join(dir, item))));
1580
+ return Promise.all(items.map((item) => remove.remove(path3.join(dir, item))));
1581
1581
  });
1582
1582
  function emptyDirSync(dir) {
1583
1583
  let items;
@@ -1587,7 +1587,7 @@ var require_empty = __commonJS({
1587
1587
  return mkdir.mkdirsSync(dir);
1588
1588
  }
1589
1589
  items.forEach((item) => {
1590
- item = path2.join(dir, item);
1590
+ item = path3.join(dir, item);
1591
1591
  remove.removeSync(item);
1592
1592
  });
1593
1593
  }
@@ -1605,7 +1605,7 @@ var require_file = __commonJS({
1605
1605
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
1606
1606
  "use strict";
1607
1607
  var u = require_universalify().fromPromise;
1608
- var path2 = __require("path");
1608
+ var path3 = __require("path");
1609
1609
  var fs2 = require_fs();
1610
1610
  var mkdir = require_mkdirs();
1611
1611
  async function createFile(file) {
@@ -1616,7 +1616,7 @@ var require_file = __commonJS({
1616
1616
  }
1617
1617
  if (stats && stats.isFile())
1618
1618
  return;
1619
- const dir = path2.dirname(file);
1619
+ const dir = path3.dirname(file);
1620
1620
  let dirStats = null;
1621
1621
  try {
1622
1622
  dirStats = await fs2.stat(dir);
@@ -1643,7 +1643,7 @@ var require_file = __commonJS({
1643
1643
  }
1644
1644
  if (stats && stats.isFile())
1645
1645
  return;
1646
- const dir = path2.dirname(file);
1646
+ const dir = path3.dirname(file);
1647
1647
  try {
1648
1648
  if (!fs2.statSync(dir).isDirectory()) {
1649
1649
  fs2.readdirSync(dir);
@@ -1668,7 +1668,7 @@ var require_link = __commonJS({
1668
1668
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
1669
1669
  "use strict";
1670
1670
  var u = require_universalify().fromPromise;
1671
- var path2 = __require("path");
1671
+ var path3 = __require("path");
1672
1672
  var fs2 = require_fs();
1673
1673
  var mkdir = require_mkdirs();
1674
1674
  var { pathExists } = require_path_exists();
@@ -1688,7 +1688,7 @@ var require_link = __commonJS({
1688
1688
  }
1689
1689
  if (dstStat && areIdentical(srcStat, dstStat))
1690
1690
  return;
1691
- const dir = path2.dirname(dstpath);
1691
+ const dir = path3.dirname(dstpath);
1692
1692
  const dirExists = await pathExists(dir);
1693
1693
  if (!dirExists) {
1694
1694
  await mkdir.mkdirs(dir);
@@ -1709,7 +1709,7 @@ var require_link = __commonJS({
1709
1709
  err.message = err.message.replace("lstat", "ensureLink");
1710
1710
  throw err;
1711
1711
  }
1712
- const dir = path2.dirname(dstpath);
1712
+ const dir = path3.dirname(dstpath);
1713
1713
  const dirExists = fs2.existsSync(dir);
1714
1714
  if (dirExists)
1715
1715
  return fs2.linkSync(srcpath, dstpath);
@@ -1727,12 +1727,12 @@ var require_link = __commonJS({
1727
1727
  var require_symlink_paths = __commonJS({
1728
1728
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
1729
1729
  "use strict";
1730
- var path2 = __require("path");
1730
+ var path3 = __require("path");
1731
1731
  var fs2 = require_fs();
1732
1732
  var { pathExists } = require_path_exists();
1733
1733
  var u = require_universalify().fromPromise;
1734
1734
  async function symlinkPaths(srcpath, dstpath) {
1735
- if (path2.isAbsolute(srcpath)) {
1735
+ if (path3.isAbsolute(srcpath)) {
1736
1736
  try {
1737
1737
  await fs2.lstat(srcpath);
1738
1738
  } catch (err) {
@@ -1744,8 +1744,8 @@ var require_symlink_paths = __commonJS({
1744
1744
  toDst: srcpath
1745
1745
  };
1746
1746
  }
1747
- const dstdir = path2.dirname(dstpath);
1748
- const relativeToDst = path2.join(dstdir, srcpath);
1747
+ const dstdir = path3.dirname(dstpath);
1748
+ const relativeToDst = path3.join(dstdir, srcpath);
1749
1749
  const exists = await pathExists(relativeToDst);
1750
1750
  if (exists) {
1751
1751
  return {
@@ -1761,11 +1761,11 @@ var require_symlink_paths = __commonJS({
1761
1761
  }
1762
1762
  return {
1763
1763
  toCwd: srcpath,
1764
- toDst: path2.relative(dstdir, srcpath)
1764
+ toDst: path3.relative(dstdir, srcpath)
1765
1765
  };
1766
1766
  }
1767
1767
  function symlinkPathsSync(srcpath, dstpath) {
1768
- if (path2.isAbsolute(srcpath)) {
1768
+ if (path3.isAbsolute(srcpath)) {
1769
1769
  const exists2 = fs2.existsSync(srcpath);
1770
1770
  if (!exists2)
1771
1771
  throw new Error("absolute srcpath does not exist");
@@ -1774,8 +1774,8 @@ var require_symlink_paths = __commonJS({
1774
1774
  toDst: srcpath
1775
1775
  };
1776
1776
  }
1777
- const dstdir = path2.dirname(dstpath);
1778
- const relativeToDst = path2.join(dstdir, srcpath);
1777
+ const dstdir = path3.dirname(dstpath);
1778
+ const relativeToDst = path3.join(dstdir, srcpath);
1779
1779
  const exists = fs2.existsSync(relativeToDst);
1780
1780
  if (exists) {
1781
1781
  return {
@@ -1788,7 +1788,7 @@ var require_symlink_paths = __commonJS({
1788
1788
  throw new Error("relative srcpath does not exist");
1789
1789
  return {
1790
1790
  toCwd: srcpath,
1791
- toDst: path2.relative(dstdir, srcpath)
1791
+ toDst: path3.relative(dstdir, srcpath)
1792
1792
  };
1793
1793
  }
1794
1794
  module.exports = {
@@ -1838,7 +1838,7 @@ var require_symlink = __commonJS({
1838
1838
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
1839
1839
  "use strict";
1840
1840
  var u = require_universalify().fromPromise;
1841
- var path2 = __require("path");
1841
+ var path3 = __require("path");
1842
1842
  var fs2 = require_fs();
1843
1843
  var { mkdirs, mkdirsSync } = require_mkdirs();
1844
1844
  var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
@@ -1862,7 +1862,7 @@ var require_symlink = __commonJS({
1862
1862
  const relative = await symlinkPaths(srcpath, dstpath);
1863
1863
  srcpath = relative.toDst;
1864
1864
  const toType = await symlinkType(relative.toCwd, type);
1865
- const dir = path2.dirname(dstpath);
1865
+ const dir = path3.dirname(dstpath);
1866
1866
  if (!await pathExists(dir)) {
1867
1867
  await mkdirs(dir);
1868
1868
  }
@@ -1883,7 +1883,7 @@ var require_symlink = __commonJS({
1883
1883
  const relative = symlinkPathsSync(srcpath, dstpath);
1884
1884
  srcpath = relative.toDst;
1885
1885
  type = symlinkTypeSync(relative.toCwd, type);
1886
- const dir = path2.dirname(dstpath);
1886
+ const dir = path3.dirname(dstpath);
1887
1887
  const exists = fs2.existsSync(dir);
1888
1888
  if (exists)
1889
1889
  return fs2.symlinkSync(srcpath, dstpath, type);
@@ -1976,7 +1976,7 @@ var require_jsonfile = __commonJS({
1976
1976
  return obj;
1977
1977
  }
1978
1978
  var readFile = universalify.fromPromise(_readFile);
1979
- function readFileSync(file, options = {}) {
1979
+ function readFileSync2(file, options = {}) {
1980
1980
  if (typeof options === "string") {
1981
1981
  options = { encoding: options };
1982
1982
  }
@@ -2008,7 +2008,7 @@ var require_jsonfile = __commonJS({
2008
2008
  }
2009
2009
  var jsonfile = {
2010
2010
  readFile,
2011
- readFileSync,
2011
+ readFileSync: readFileSync2,
2012
2012
  writeFile,
2013
2013
  writeFileSync
2014
2014
  };
@@ -2037,18 +2037,18 @@ var require_output_file = __commonJS({
2037
2037
  "use strict";
2038
2038
  var u = require_universalify().fromPromise;
2039
2039
  var fs2 = require_fs();
2040
- var path2 = __require("path");
2040
+ var path3 = __require("path");
2041
2041
  var mkdir = require_mkdirs();
2042
2042
  var pathExists = require_path_exists().pathExists;
2043
2043
  async function outputFile(file, data, encoding = "utf-8") {
2044
- const dir = path2.dirname(file);
2044
+ const dir = path3.dirname(file);
2045
2045
  if (!await pathExists(dir)) {
2046
2046
  await mkdir.mkdirs(dir);
2047
2047
  }
2048
2048
  return fs2.writeFile(file, data, encoding);
2049
2049
  }
2050
2050
  function outputFileSync(file, ...args) {
2051
- const dir = path2.dirname(file);
2051
+ const dir = path3.dirname(file);
2052
2052
  if (!fs2.existsSync(dir)) {
2053
2053
  mkdir.mkdirsSync(dir);
2054
2054
  }
@@ -2112,7 +2112,7 @@ var require_move = __commonJS({
2112
2112
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module) {
2113
2113
  "use strict";
2114
2114
  var fs2 = require_fs();
2115
- var path2 = __require("path");
2115
+ var path3 = __require("path");
2116
2116
  var { copy } = require_copy2();
2117
2117
  var { remove } = require_remove();
2118
2118
  var { mkdirp } = require_mkdirs();
@@ -2122,8 +2122,8 @@ var require_move = __commonJS({
2122
2122
  const overwrite = opts.overwrite || opts.clobber || false;
2123
2123
  const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2124
2124
  await stat.checkParentPaths(src, srcStat, dest, "move");
2125
- const destParent = path2.dirname(dest);
2126
- const parsedParentPath = path2.parse(destParent);
2125
+ const destParent = path3.dirname(dest);
2126
+ const parsedParentPath = path3.parse(destParent);
2127
2127
  if (parsedParentPath.root !== destParent) {
2128
2128
  await mkdirp(destParent);
2129
2129
  }
@@ -2164,7 +2164,7 @@ var require_move_sync = __commonJS({
2164
2164
  "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
2165
2165
  "use strict";
2166
2166
  var fs2 = require_graceful_fs();
2167
- var path2 = __require("path");
2167
+ var path3 = __require("path");
2168
2168
  var copySync = require_copy2().copySync;
2169
2169
  var removeSync = require_remove().removeSync;
2170
2170
  var mkdirpSync = require_mkdirs().mkdirpSync;
@@ -2175,12 +2175,12 @@ var require_move_sync = __commonJS({
2175
2175
  const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2176
2176
  stat.checkParentPathsSync(src, srcStat, dest, "move");
2177
2177
  if (!isParentRoot(dest))
2178
- mkdirpSync(path2.dirname(dest));
2178
+ mkdirpSync(path3.dirname(dest));
2179
2179
  return doRename(src, dest, overwrite, isChangingCase);
2180
2180
  }
2181
2181
  function isParentRoot(dest) {
2182
- const parent = path2.dirname(dest);
2183
- const parsedPath = path2.parse(parent);
2182
+ const parent = path3.dirname(dest);
2183
+ const parsedPath = path3.parse(parent);
2184
2184
  return parsedPath.root === parent;
2185
2185
  }
2186
2186
  function doRename(src, dest, overwrite, isChangingCase) {
@@ -2238,10 +2238,29 @@ var require_lib = __commonJS({
2238
2238
 
2239
2239
  // src/playwright/reporter/util.ts
2240
2240
  var import_fs_extra = __toESM(require_lib());
2241
- import path from "path";
2242
- import fs from "fs";
2243
- import assert from "assert";
2241
+ import path2 from "path";
2242
+ import assert2 from "assert";
2244
2243
  import os from "os";
2244
+
2245
+ // src/common/utils.ts
2246
+ import fs, { readFileSync } from "fs";
2247
+ import assert from "assert";
2248
+ import path from "path";
2249
+ import { alignCoordByTrim, base64Encoded, imageInfoOfBase64 } from "@midscene/core/image";
2250
+ import { getTmpFile } from "@midscene/core/utils";
2251
+ function findNearestPackageJson(dir) {
2252
+ const packageJsonPath = path.join(dir, "package.json");
2253
+ if (fs.existsSync(packageJsonPath)) {
2254
+ return dir;
2255
+ }
2256
+ const parentDir = path.dirname(dir);
2257
+ if (parentDir === dir) {
2258
+ return null;
2259
+ }
2260
+ return findNearestPackageJson(parentDir);
2261
+ }
2262
+
2263
+ // src/playwright/reporter/util.ts
2245
2264
  function generateTestData(testDataList2) {
2246
2265
  const filterDataList = testDataList2.reduce((res, testData) => {
2247
2266
  if (res.find((item) => item.testId === testData.testId)) {
@@ -2250,21 +2269,19 @@ function generateTestData(testDataList2) {
2250
2269
  return [...res, testData];
2251
2270
  }
2252
2271
  }, []);
2253
- const projectDir = process.cwd();
2254
- const reportDir = path.join(projectDir, "midscene_run", "report");
2255
- if (!fs.existsSync(reportDir)) {
2256
- fs.mkdirSync(reportDir);
2257
- }
2258
- const reportHtmlDir = path.join(projectDir, `dist/visualizer-report`);
2259
- const tempDir = path.join(os.tmpdir(), "temp-folder");
2272
+ const reportDir = findNearestPackageJson(__dirname);
2273
+ assert2(reportDir, `can't get reportDir from ${__dirname}`);
2274
+ const targetReportDir = path2.join(process.cwd(), "midscene_run", "report");
2275
+ const reportHtmlDir = path2.join(reportDir, `dist/visualizer-report`);
2276
+ const tempDir = path2.join(os.tmpdir(), "temp-folder");
2260
2277
  try {
2261
2278
  import_fs_extra.default.copySync(reportHtmlDir, tempDir);
2262
- import_fs_extra.default.moveSync(tempDir, reportDir, { overwrite: true });
2279
+ import_fs_extra.default.moveSync(tempDir, targetReportDir, { overwrite: true });
2263
2280
  } catch (err) {
2264
2281
  console.error("An error occurred while copying the folder.", err);
2265
2282
  }
2266
2283
  try {
2267
- import_fs_extra.default.removeSync(path.join(reportDir, "public"));
2284
+ import_fs_extra.default.removeSync(path2.join(targetReportDir, "public"));
2268
2285
  } catch (err) {
2269
2286
  console.error("An error occurred while deleting the folder.", err);
2270
2287
  }
@@ -2272,41 +2289,19 @@ function generateTestData(testDataList2) {
2272
2289
  const { dumpPath } = testData;
2273
2290
  if (dumpPath) {
2274
2291
  const srcFile = dumpPath.split("/").pop();
2275
- assert(srcFile, `Failed to get source file name from ${dumpPath}`);
2276
- const destFile = path.join(reportDir, "public", srcFile);
2292
+ assert2(srcFile, `Failed to get source file name from ${dumpPath}`);
2293
+ const destFile = path2.join(targetReportDir, "public", srcFile);
2277
2294
  import_fs_extra.default.copySync(dumpPath, destFile);
2278
2295
  }
2279
2296
  }
2280
2297
  try {
2281
2298
  import_fs_extra.default.outputFileSync(
2282
- path.join(reportDir, "public", "test-data-list.json"),
2299
+ path2.join(targetReportDir, "public", "test-data-list.json"),
2283
2300
  JSON.stringify({ "test-list": filterDataList })
2284
2301
  );
2285
2302
  } catch (err) {
2286
2303
  console.error("An error occurred while writing to the file.", err);
2287
2304
  }
2288
- modifyRoutesJson(reportDir, testDataList2);
2289
- }
2290
- function modifyRoutesJson(reportDir, testDataList2) {
2291
- const filePath = path.join(reportDir, "route.json");
2292
- try {
2293
- const data = fs.readFileSync(filePath, "utf8");
2294
- const newPaths = testDataList2.map((testData) => {
2295
- var _a;
2296
- const fileName = (_a = testData.dumpPath) == null ? void 0 : _a.split("/").pop();
2297
- return {
2298
- urlPath: `/${fileName}`,
2299
- isSPA: true,
2300
- isSSR: false,
2301
- entryPath: `public/${fileName}`
2302
- };
2303
- });
2304
- const jsonData = JSON.parse(data);
2305
- jsonData.routes.push(...newPaths);
2306
- fs.writeFileSync(filePath, JSON.stringify(jsonData, null, 2), "utf8");
2307
- } catch (err) {
2308
- console.error("modifyRoutesJson fail:", err);
2309
- }
2310
2305
  }
2311
2306
 
2312
2307
  // src/playwright/reporter/index.ts
@@ -2351,7 +2346,7 @@ var MidSceneReporter = class {
2351
2346
  generateTestData(testDataList);
2352
2347
  console.log(
2353
2348
  "\x1B[32m%s\x1B[0m",
2354
- `MidScene report has been generated. Run "npx http-server -p 0 ./midscene_run/report -o --s" to view.`
2349
+ `MidScene report has been generated. Run "npx http-server ./midscene_run/report -p 9888 -o -s" to view.`
2355
2350
  );
2356
2351
  }
2357
2352
  };