@jsenv/core 29.1.15 → 29.1.16

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.
package/dist/main.js CHANGED
@@ -7913,13 +7913,9 @@ const createUrlGraph = () => {
7913
7913
  return firstReferenceOnThatUrl;
7914
7914
  };
7915
7915
 
7916
- const visitDependents = (urlInfo, visitor) => {
7916
+ const findDependent = (urlInfo, visitor) => {
7917
7917
  const seen = [urlInfo.url];
7918
- let stopped = false;
7919
-
7920
- const stop = () => {
7921
- stopped = true;
7922
- };
7918
+ let found = null;
7923
7919
 
7924
7920
  const iterate = currentUrlInfo => {
7925
7921
  for (const dependentUrl of currentUrlInfo.dependents) {
@@ -7927,21 +7923,27 @@ const createUrlGraph = () => {
7927
7923
  continue;
7928
7924
  }
7929
7925
 
7926
+ if (found) {
7927
+ break;
7928
+ }
7929
+
7930
7930
  seen.push(dependentUrl);
7931
7931
  const dependentUrlInfo = getUrlInfo(dependentUrl);
7932
- visitor(dependentUrlInfo, stop);
7933
7932
 
7934
- if (stopped) {
7935
- return dependentUrlInfo;
7933
+ if (visitor(dependentUrlInfo)) {
7934
+ found = dependentUrlInfo;
7935
+ }
7936
+
7937
+ if (found) {
7938
+ break;
7936
7939
  }
7937
7940
 
7938
7941
  iterate(dependentUrlInfo);
7939
7942
  }
7940
-
7941
- return null;
7942
7943
  };
7943
7944
 
7944
- return iterate(urlInfo);
7945
+ iterate(urlInfo);
7946
+ return found;
7945
7947
  };
7946
7948
 
7947
7949
  const updateReferences = (urlInfo, references) => {
@@ -8092,7 +8094,7 @@ const createUrlGraph = () => {
8092
8094
  inferReference,
8093
8095
  updateReferences,
8094
8096
  considerModified,
8095
- visitDependents,
8097
+ findDependent,
8096
8098
  toObject: () => {
8097
8099
  const data = {};
8098
8100
  urlInfoMap.forEach(urlInfo => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "29.1.15",
3
+ "version": "29.1.16",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -44,28 +44,30 @@ export const createUrlGraph = () => {
44
44
  )
45
45
  return firstReferenceOnThatUrl
46
46
  }
47
- const visitDependents = (urlInfo, visitor) => {
47
+ const findDependent = (urlInfo, visitor) => {
48
48
  const seen = [urlInfo.url]
49
- let stopped = false
50
- const stop = () => {
51
- stopped = true
52
- }
49
+ let found = null
53
50
  const iterate = (currentUrlInfo) => {
54
51
  for (const dependentUrl of currentUrlInfo.dependents) {
55
52
  if (seen.includes(dependentUrl)) {
56
53
  continue
57
54
  }
55
+ if (found) {
56
+ break
57
+ }
58
58
  seen.push(dependentUrl)
59
59
  const dependentUrlInfo = getUrlInfo(dependentUrl)
60
- visitor(dependentUrlInfo, stop)
61
- if (stopped) {
62
- return dependentUrlInfo
60
+ if (visitor(dependentUrlInfo)) {
61
+ found = dependentUrlInfo
62
+ }
63
+ if (found) {
64
+ break
63
65
  }
64
66
  iterate(dependentUrlInfo)
65
67
  }
66
- return null
67
68
  }
68
- return iterate(urlInfo)
69
+ iterate(urlInfo)
70
+ return found
69
71
  }
70
72
 
71
73
  const updateReferences = (urlInfo, references) => {
@@ -200,7 +202,7 @@ export const createUrlGraph = () => {
200
202
  inferReference,
201
203
  updateReferences,
202
204
  considerModified,
203
- visitDependents,
205
+ findDependent,
204
206
 
205
207
  toObject: () => {
206
208
  const data = {}