@jsenv/core 28.3.3 → 28.3.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.
package/dist/main.js CHANGED
@@ -16998,28 +16998,36 @@ const jsenvPluginAutoreloadServer = ({
16998
16998
  url,
16999
16999
  event
17000
17000
  }) => {
17001
- const urlInfo = urlGraph.getUrlInfo(url); // file not part of dependency graph
17001
+ const onUrlInfo = urlInfo => {
17002
+ const relativeUrl = formatUrlForClient(url);
17003
+ const hotUpdate = propagateUpdate(urlInfo);
17002
17004
 
17003
- if (!urlInfo) {
17004
- return;
17005
- }
17005
+ if (hotUpdate.declined) {
17006
+ notifyDeclined({
17007
+ cause: `${relativeUrl} ${event}`,
17008
+ reason: hotUpdate.reason,
17009
+ declinedBy: hotUpdate.declinedBy
17010
+ });
17011
+ } else {
17012
+ notifyAccepted({
17013
+ cause: `${relativeUrl} ${event}`,
17014
+ reason: hotUpdate.reason,
17015
+ instructions: hotUpdate.instructions
17016
+ });
17017
+ }
17018
+ };
17006
17019
 
17007
- const relativeUrl = formatUrlForClient(url);
17008
- const hotUpdate = propagateUpdate(urlInfo);
17020
+ urlGraph.urlInfoMap.forEach(urlInfo => {
17021
+ if (urlInfo.url === url) {
17022
+ onUrlInfo(urlInfo);
17023
+ } else {
17024
+ const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url);
17009
17025
 
17010
- if (hotUpdate.declined) {
17011
- notifyDeclined({
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
- });
17022
- }
17026
+ if (urlWithoutSearch === url) {
17027
+ onUrlInfo(urlInfo);
17028
+ }
17029
+ }
17030
+ });
17023
17031
  });
17024
17032
  clientFilesPruneCallbackList.push((prunedUrlInfos, firstUrlInfo) => {
17025
17033
  const mainHotUpdate = propagateUpdate(firstUrlInfo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "28.3.3",
3
+ "version": "28.3.4",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -1,4 +1,8 @@
1
- import { urlIsInsideOf, urlToRelativeUrl } from "@jsenv/urls"
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,33 @@ export const jsenvPluginAutoreloadServer = ({
113
117
  return iterate(firstUrlInfo, seen)
114
118
  }
115
119
  clientFileChangeCallbackList.push(({ url, event }) => {
116
- const urlInfo = urlGraph.getUrlInfo(url)
117
- // file not part of dependency graph
118
- if (!urlInfo) {
119
- return
120
- }
121
- const relativeUrl = formatUrlForClient(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
- })
120
+ const onUrlInfo = (urlInfo) => {
121
+ const relativeUrl = formatUrlForClient(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
+ }
135
136
  }
137
+ urlGraph.urlInfoMap.forEach((urlInfo) => {
138
+ if (urlInfo.url === url) {
139
+ onUrlInfo(urlInfo)
140
+ } else {
141
+ const urlWithoutSearch = asUrlWithoutSearch(urlInfo.url)
142
+ if (urlWithoutSearch === url) {
143
+ onUrlInfo(urlInfo)
144
+ }
145
+ }
146
+ })
136
147
  })
137
148
  clientFilesPruneCallbackList.push((prunedUrlInfos, firstUrlInfo) => {
138
149
  const mainHotUpdate = propagateUpdate(firstUrlInfo)