@jsenv/core 28.3.2 → 28.3.5
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
|
@@ -16810,9 +16810,18 @@ const jsenvPluginHmr = () => {
|
|
|
16810
16810
|
return urlObject.href;
|
|
16811
16811
|
},
|
|
16812
16812
|
transformUrlSearchParams: (reference, context) => {
|
|
16813
|
-
|
|
16813
|
+
if (reference.type === "package_json") {
|
|
16814
|
+
// maybe the if above shoulb be .isImplicit but it's just a detail anyway
|
|
16815
|
+
return null;
|
|
16816
|
+
}
|
|
16814
16817
|
|
|
16815
|
-
if (
|
|
16818
|
+
if (context.reference && !context.reference.data.hmr) {
|
|
16819
|
+
// parent do not use hmr search param
|
|
16820
|
+
return null;
|
|
16821
|
+
}
|
|
16822
|
+
|
|
16823
|
+
if (!context.reference && !reference.data.hmr) {
|
|
16824
|
+
// entry point do not use hmr search param
|
|
16816
16825
|
return null;
|
|
16817
16826
|
}
|
|
16818
16827
|
|
|
@@ -16998,28 +17007,38 @@ const jsenvPluginAutoreloadServer = ({
|
|
|
16998
17007
|
url,
|
|
16999
17008
|
event
|
|
17000
17009
|
}) => {
|
|
17001
|
-
const
|
|
17010
|
+
const onUrlInfo = urlInfo => {
|
|
17011
|
+
const relativeUrl = formatUrlForClient(urlInfo.url);
|
|
17012
|
+
const hotUpdate = propagateUpdate(urlInfo);
|
|
17002
17013
|
|
|
17003
|
-
|
|
17004
|
-
|
|
17005
|
-
|
|
17014
|
+
if (hotUpdate.declined) {
|
|
17015
|
+
notifyDeclined({
|
|
17016
|
+
cause: `${relativeUrl} ${event}`,
|
|
17017
|
+
reason: hotUpdate.reason,
|
|
17018
|
+
declinedBy: hotUpdate.declinedBy
|
|
17019
|
+
});
|
|
17020
|
+
} else {
|
|
17021
|
+
notifyAccepted({
|
|
17022
|
+
cause: `${relativeUrl} ${event}`,
|
|
17023
|
+
reason: hotUpdate.reason,
|
|
17024
|
+
instructions: hotUpdate.instructions
|
|
17025
|
+
});
|
|
17026
|
+
}
|
|
17027
|
+
};
|
|
17006
17028
|
|
|
17007
|
-
const
|
|
17008
|
-
const hotUpdate = propagateUpdate(urlInfo);
|
|
17029
|
+
const exactUrlInfo = urlGraph.getUrlInfo(url);
|
|
17009
17030
|
|
|
17010
|
-
if (
|
|
17011
|
-
|
|
17012
|
-
cause: `${relativeUrl} ${event}`,
|
|
17013
|
-
reason: hotUpdate.reason,
|
|
17014
|
-
declinedBy: hotUpdate.declinedBy
|
|
17015
|
-
});
|
|
17016
|
-
} else {
|
|
17017
|
-
notifyAccepted({
|
|
17018
|
-
cause: `${relativeUrl} ${event}`,
|
|
17019
|
-
reason: hotUpdate.reason,
|
|
17020
|
-
instructions: hotUpdate.instructions
|
|
17021
|
-
});
|
|
17031
|
+
if (exactUrlInfo) {
|
|
17032
|
+
onUrlInfo(exactUrlInfo);
|
|
17022
17033
|
}
|
|
17034
|
+
|
|
17035
|
+
urlGraph.urlInfoMap.forEach(urlInfo => {
|
|
17036
|
+
if (urlInfo === exactUrlInfo) return;
|
|
17037
|
+
const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url);
|
|
17038
|
+
if (urlWithoutSearch !== url) return;
|
|
17039
|
+
if (exactUrlInfo && exactUrlInfo.dependents.has(urlInfo.url)) return;
|
|
17040
|
+
onUrlInfo(urlInfo);
|
|
17041
|
+
});
|
|
17023
17042
|
});
|
|
17024
17043
|
clientFilesPruneCallbackList.push((prunedUrlInfos, firstUrlInfo) => {
|
|
17025
17044
|
const mainHotUpdate = propagateUpdate(firstUrlInfo);
|
|
@@ -25301,11 +25320,23 @@ const createFileService = ({
|
|
|
25301
25320
|
clientFileChangeCallbackList.push(({
|
|
25302
25321
|
url
|
|
25303
25322
|
}) => {
|
|
25304
|
-
const
|
|
25305
|
-
|
|
25306
|
-
if (urlInfo) {
|
|
25323
|
+
const onUrlInfo = urlInfo => {
|
|
25307
25324
|
urlGraph.considerModified(urlInfo);
|
|
25325
|
+
};
|
|
25326
|
+
|
|
25327
|
+
const exactUrlInfo = urlGraph.getUrlInfo(url);
|
|
25328
|
+
|
|
25329
|
+
if (exactUrlInfo) {
|
|
25330
|
+
onUrlInfo(exactUrlInfo);
|
|
25308
25331
|
}
|
|
25332
|
+
|
|
25333
|
+
urlGraph.urlInfoMap.forEach(urlInfo => {
|
|
25334
|
+
if (urlInfo === exactUrlInfo) return;
|
|
25335
|
+
const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url);
|
|
25336
|
+
if (urlWithoutSearch !== url) return;
|
|
25337
|
+
if (exactUrlInfo && exactUrlInfo.dependents.has(urlInfo.url)) return;
|
|
25338
|
+
onUrlInfo(urlInfo);
|
|
25339
|
+
});
|
|
25309
25340
|
});
|
|
25310
25341
|
const kitchen = createKitchen({
|
|
25311
25342
|
signal,
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
composeTwoResponses,
|
|
6
6
|
} from "@jsenv/server"
|
|
7
7
|
import { registerDirectoryLifecycle, bufferToEtag } from "@jsenv/filesystem"
|
|
8
|
-
import { urlIsInsideOf, moveUrl } from "@jsenv/urls"
|
|
8
|
+
import { urlIsInsideOf, moveUrl, asUrlWithoutSearch } from "@jsenv/urls"
|
|
9
9
|
import { URL_META } from "@jsenv/url-meta"
|
|
10
10
|
|
|
11
11
|
import { getCorePlugins } from "@jsenv/core/src/plugins/plugins.js"
|
|
@@ -95,10 +95,20 @@ export const createFileService = ({
|
|
|
95
95
|
)
|
|
96
96
|
const urlGraph = createUrlGraph()
|
|
97
97
|
clientFileChangeCallbackList.push(({ url }) => {
|
|
98
|
-
const
|
|
99
|
-
if (urlInfo) {
|
|
98
|
+
const onUrlInfo = (urlInfo) => {
|
|
100
99
|
urlGraph.considerModified(urlInfo)
|
|
101
100
|
}
|
|
101
|
+
const exactUrlInfo = urlGraph.getUrlInfo(url)
|
|
102
|
+
if (exactUrlInfo) {
|
|
103
|
+
onUrlInfo(exactUrlInfo)
|
|
104
|
+
}
|
|
105
|
+
urlGraph.urlInfoMap.forEach((urlInfo) => {
|
|
106
|
+
if (urlInfo === exactUrlInfo) return
|
|
107
|
+
const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url)
|
|
108
|
+
if (urlWithoutSearch !== url) return
|
|
109
|
+
if (exactUrlInfo && exactUrlInfo.dependents.has(urlInfo.url)) return
|
|
110
|
+
onUrlInfo(urlInfo)
|
|
111
|
+
})
|
|
102
112
|
})
|
|
103
113
|
const kitchen = createKitchen({
|
|
104
114
|
signal,
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
urlIsInsideOf,
|
|
3
|
+
urlToRelativeUrl,
|
|
4
|
+
asUrlWithoutSearch,
|
|
5
|
+
} from "@jsenv/urls"
|
|
2
6
|
|
|
3
7
|
export const jsenvPluginAutoreloadServer = ({
|
|
4
8
|
clientFileChangeCallbackList,
|
|
@@ -113,26 +117,34 @@ export const jsenvPluginAutoreloadServer = ({
|
|
|
113
117
|
return iterate(firstUrlInfo, seen)
|
|
114
118
|
}
|
|
115
119
|
clientFileChangeCallbackList.push(({ url, event }) => {
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
const onUrlInfo = (urlInfo) => {
|
|
121
|
+
const relativeUrl = formatUrlForClient(urlInfo.url)
|
|
122
|
+
const hotUpdate = propagateUpdate(urlInfo)
|
|
123
|
+
if (hotUpdate.declined) {
|
|
124
|
+
notifyDeclined({
|
|
125
|
+
cause: `${relativeUrl} ${event}`,
|
|
126
|
+
reason: hotUpdate.reason,
|
|
127
|
+
declinedBy: hotUpdate.declinedBy,
|
|
128
|
+
})
|
|
129
|
+
} else {
|
|
130
|
+
notifyAccepted({
|
|
131
|
+
cause: `${relativeUrl} ${event}`,
|
|
132
|
+
reason: hotUpdate.reason,
|
|
133
|
+
instructions: hotUpdate.instructions,
|
|
134
|
+
})
|
|
135
|
+
}
|
|
120
136
|
}
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
notifyDeclined({
|
|
125
|
-
cause: `${relativeUrl} ${event}`,
|
|
126
|
-
reason: hotUpdate.reason,
|
|
127
|
-
declinedBy: hotUpdate.declinedBy,
|
|
128
|
-
})
|
|
129
|
-
} else {
|
|
130
|
-
notifyAccepted({
|
|
131
|
-
cause: `${relativeUrl} ${event}`,
|
|
132
|
-
reason: hotUpdate.reason,
|
|
133
|
-
instructions: hotUpdate.instructions,
|
|
134
|
-
})
|
|
137
|
+
const exactUrlInfo = urlGraph.getUrlInfo(url)
|
|
138
|
+
if (exactUrlInfo) {
|
|
139
|
+
onUrlInfo(exactUrlInfo)
|
|
135
140
|
}
|
|
141
|
+
urlGraph.urlInfoMap.forEach((urlInfo) => {
|
|
142
|
+
if (urlInfo === exactUrlInfo) return
|
|
143
|
+
const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url)
|
|
144
|
+
if (urlWithoutSearch !== url) return
|
|
145
|
+
if (exactUrlInfo && exactUrlInfo.dependents.has(urlInfo.url)) return
|
|
146
|
+
onUrlInfo(urlInfo)
|
|
147
|
+
})
|
|
136
148
|
})
|
|
137
149
|
clientFilesPruneCallbackList.push((prunedUrlInfos, firstUrlInfo) => {
|
|
138
150
|
const mainHotUpdate = propagateUpdate(firstUrlInfo)
|
|
@@ -7,7 +7,6 @@ export const jsenvPluginHmr = () => {
|
|
|
7
7
|
reference.data.hmr = false
|
|
8
8
|
return null
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
reference.data.hmr = true
|
|
12
11
|
const urlObject = new URL(reference.url)
|
|
13
12
|
// "hmr" search param goal is to mark url as enabling hmr:
|
|
@@ -19,8 +18,16 @@ export const jsenvPluginHmr = () => {
|
|
|
19
18
|
return urlObject.href
|
|
20
19
|
},
|
|
21
20
|
transformUrlSearchParams: (reference, context) => {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (reference.type === "package_json") {
|
|
22
|
+
// maybe the if above shoulb be .isImplicit but it's just a detail anyway
|
|
23
|
+
return null
|
|
24
|
+
}
|
|
25
|
+
if (context.reference && !context.reference.data.hmr) {
|
|
26
|
+
// parent do not use hmr search param
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
if (!context.reference && !reference.data.hmr) {
|
|
30
|
+
// entry point do not use hmr search param
|
|
24
31
|
return null
|
|
25
32
|
}
|
|
26
33
|
const urlInfo = context.urlGraph.getUrlInfo(reference.url)
|