@midscene/shared 0.17.1 → 0.17.2-beta-20250521115451.0

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.
@@ -376,12 +376,12 @@ function setNodeToCacheList(node, id) {
376
376
  if (getNodeFromCacheList(id)) {
377
377
  return;
378
378
  }
379
- window.midsceneNodeHashCacheList.push({ node, id });
379
+ window.midsceneNodeHashCacheList?.push({ node, id });
380
380
  }
381
381
  }
382
382
  function getNodeFromCacheList(id) {
383
383
  if (typeof window !== "undefined") {
384
- return window.midsceneNodeHashCacheList.find(
384
+ return window.midsceneNodeHashCacheList?.find(
385
385
  (item) => item.id === id
386
386
  )?.node;
387
387
  }
@@ -514,12 +514,12 @@ function setNodeToCacheList(node, id) {
514
514
  if (getNodeFromCacheList(id)) {
515
515
  return;
516
516
  }
517
- window.midsceneNodeHashCacheList.push({ node, id });
517
+ window.midsceneNodeHashCacheList?.push({ node, id });
518
518
  }
519
519
  }
520
520
  function getNodeFromCacheList(id) {
521
521
  if (typeof window !== "undefined") {
522
- return window.midsceneNodeHashCacheList.find(
522
+ return window.midsceneNodeHashCacheList?.find(
523
523
  (item) => item.id === id
524
524
  )?.node;
525
525
  }
@@ -378,12 +378,12 @@ function setNodeToCacheList(node, id) {
378
378
  if (getNodeFromCacheList(id)) {
379
379
  return;
380
380
  }
381
- window.midsceneNodeHashCacheList.push({ node, id });
381
+ window.midsceneNodeHashCacheList?.push({ node, id });
382
382
  }
383
383
  }
384
384
  function getNodeFromCacheList(id) {
385
385
  if (typeof window !== "undefined") {
386
- return window.midsceneNodeHashCacheList.find(
386
+ return window.midsceneNodeHashCacheList?.find(
387
387
  (item) => item.id === id
388
388
  )?.node;
389
389
  }
@@ -551,12 +551,12 @@ function setNodeToCacheList(node, id) {
551
551
  if (getNodeFromCacheList(id)) {
552
552
  return;
553
553
  }
554
- window.midsceneNodeHashCacheList.push({ node, id });
554
+ window.midsceneNodeHashCacheList?.push({ node, id });
555
555
  }
556
556
  }
557
557
  function getNodeFromCacheList(id) {
558
558
  if (typeof window !== "undefined") {
559
- return window.midsceneNodeHashCacheList.find(
559
+ return window.midsceneNodeHashCacheList?.find(
560
560
  (item) => item.id === id
561
561
  )?.node;
562
562
  }
@@ -1105,19 +1105,20 @@ ${indentStr}${after}`;
1105
1105
  }
1106
1106
  }
1107
1107
  function setNodeToCacheList(node, id) {
1108
+ var _a;
1108
1109
  if (typeof window !== "undefined") {
1109
1110
  if (getNodeFromCacheList(id)) {
1110
1111
  return;
1111
1112
  }
1112
- window.midsceneNodeHashCacheList.push({ node, id });
1113
+ (_a = window.midsceneNodeHashCacheList) == null ? void 0 : _a.push({ node, id });
1113
1114
  }
1114
1115
  }
1115
1116
  function getNodeFromCacheList(id) {
1116
- var _a;
1117
+ var _a, _b;
1117
1118
  if (typeof window !== "undefined") {
1118
- return (_a = window.midsceneNodeHashCacheList.find(
1119
+ return (_b = (_a = window.midsceneNodeHashCacheList) == null ? void 0 : _a.find(
1119
1120
  (item) => item.id === id
1120
- )) == null ? void 0 : _a.node;
1121
+ )) == null ? void 0 : _b.node;
1121
1122
  }
1122
1123
  return null;
1123
1124
  }
@@ -944,19 +944,20 @@ var midscene_element_inspector = (() => {
944
944
  }
945
945
  }
946
946
  function setNodeToCacheList(node, id) {
947
+ var _a;
947
948
  if (typeof window !== "undefined") {
948
949
  if (getNodeFromCacheList(id)) {
949
950
  return;
950
951
  }
951
- window.midsceneNodeHashCacheList.push({ node, id });
952
+ (_a = window.midsceneNodeHashCacheList) == null ? void 0 : _a.push({ node, id });
952
953
  }
953
954
  }
954
955
  function getNodeFromCacheList(id) {
955
- var _a;
956
+ var _a, _b;
956
957
  if (typeof window !== "undefined") {
957
- return (_a = window.midsceneNodeHashCacheList.find(
958
+ return (_b = (_a = window.midsceneNodeHashCacheList) == null ? void 0 : _a.find(
958
959
  (item) => item.id === id
959
- )) == null ? void 0 : _a.node;
960
+ )) == null ? void 0 : _b.node;
960
961
  }
961
962
  return null;
962
963
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/shared",
3
- "version": "0.17.1",
3
+ "version": "0.17.2-beta-20250521115451.0",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -471,13 +471,13 @@ export function setNodeToCacheList(node: globalThis.Node, id: string) {
471
471
  if (getNodeFromCacheList(id)) {
472
472
  return;
473
473
  }
474
- (window as any).midsceneNodeHashCacheList.push({ node, id });
474
+ (window as any).midsceneNodeHashCacheList?.push({ node, id });
475
475
  }
476
476
  }
477
477
 
478
478
  export function getNodeFromCacheList(id: string) {
479
479
  if (typeof window !== 'undefined') {
480
- return (window as any).midsceneNodeHashCacheList.find(
480
+ return (window as any).midsceneNodeHashCacheList?.find(
481
481
  (item: { node: Node; id: string }) => item.id === id,
482
482
  )?.node;
483
483
  }