@jsenv/core 29.1.15 → 29.1.17
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
|
|
7916
|
+
const findDependent = (urlInfo, visitor) => {
|
|
7917
7917
|
const seen = [urlInfo.url];
|
|
7918
|
-
let
|
|
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 (
|
|
7935
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8097
|
+
findDependent,
|
|
8096
8098
|
toObject: () => {
|
|
8097
8099
|
const data = {};
|
|
8098
8100
|
urlInfoMap.forEach(urlInfo => {
|
|
@@ -29976,7 +29978,7 @@ const jsenvPluginInjectGlobals = urlAssociations => {
|
|
|
29976
29978
|
return {
|
|
29977
29979
|
name: "jsenv:inject_globals",
|
|
29978
29980
|
appliesDuring: "*",
|
|
29979
|
-
transformUrlContent: async urlInfo => {
|
|
29981
|
+
transformUrlContent: async (urlInfo, context) => {
|
|
29980
29982
|
const url = Object.keys(urlAssociations).find(url => {
|
|
29981
29983
|
return url === urlInfo.url;
|
|
29982
29984
|
});
|
|
@@ -29988,7 +29990,7 @@ const jsenvPluginInjectGlobals = urlAssociations => {
|
|
|
29988
29990
|
let globals = urlAssociations[url];
|
|
29989
29991
|
|
|
29990
29992
|
if (typeof globals === "function") {
|
|
29991
|
-
globals = await globals();
|
|
29993
|
+
globals = await globals(urlInfo, context);
|
|
29992
29994
|
}
|
|
29993
29995
|
|
|
29994
29996
|
if (Object.keys(globals).length === 0) {
|
package/package.json
CHANGED
package/src/kitchen/url_graph.js
CHANGED
|
@@ -44,28 +44,30 @@ export const createUrlGraph = () => {
|
|
|
44
44
|
)
|
|
45
45
|
return firstReferenceOnThatUrl
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const findDependent = (urlInfo, visitor) => {
|
|
48
48
|
const seen = [urlInfo.url]
|
|
49
|
-
let
|
|
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
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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
|
-
|
|
205
|
+
findDependent,
|
|
204
206
|
|
|
205
207
|
toObject: () => {
|
|
206
208
|
const data = {}
|
|
@@ -4,7 +4,7 @@ export const jsenvPluginInjectGlobals = (urlAssociations) => {
|
|
|
4
4
|
return {
|
|
5
5
|
name: "jsenv:inject_globals",
|
|
6
6
|
appliesDuring: "*",
|
|
7
|
-
transformUrlContent: async (urlInfo) => {
|
|
7
|
+
transformUrlContent: async (urlInfo, context) => {
|
|
8
8
|
const url = Object.keys(urlAssociations).find((url) => {
|
|
9
9
|
return url === urlInfo.url
|
|
10
10
|
})
|
|
@@ -13,7 +13,7 @@ export const jsenvPluginInjectGlobals = (urlAssociations) => {
|
|
|
13
13
|
}
|
|
14
14
|
let globals = urlAssociations[url]
|
|
15
15
|
if (typeof globals === "function") {
|
|
16
|
-
globals = await globals()
|
|
16
|
+
globals = await globals(urlInfo, context)
|
|
17
17
|
}
|
|
18
18
|
if (Object.keys(globals).length === 0) {
|
|
19
19
|
return null
|