@jsenv/core 39.3.6 → 39.3.7

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.
@@ -17108,8 +17108,12 @@ const jsenvPluginInlineContentFetcher = () => {
17108
17108
  // when updating the file, first reference is the previous version
17109
17109
  // - we cannot use urlInfo.lastReference because it can be the reference created by "http_request"
17110
17110
  let lastInlineReference;
17111
+ let originalContent = urlInfo.originalContent;
17111
17112
  for (const reference of urlInfo.referenceFromOthersSet) {
17112
17113
  if (reference.isInline) {
17114
+ if (originalContent === undefined) {
17115
+ originalContent = reference.content;
17116
+ }
17113
17117
  lastInlineReference = reference;
17114
17118
  }
17115
17119
  }
@@ -17124,8 +17128,17 @@ const jsenvPluginInlineContentFetcher = () => {
17124
17128
  }
17125
17129
  }
17126
17130
  return {
17127
- originalContent: urlInfo.originalContent,
17128
- content: lastInlineReference.content,
17131
+ originalContent,
17132
+ content:
17133
+ // we must favor original content to re-apply the same plugin logic
17134
+ // so that the same references are generated
17135
+ // without this we would try to resolve references like
17136
+ // "/node_modules/package/file.js" instead of "package/file.js"
17137
+ // meaning we would not create the implicit dependency to package.json
17138
+ // resulting in a reload of the browser (as implicit reference to package.json is gone)
17139
+ originalContent === undefined
17140
+ ? lastInlineReference.content
17141
+ : originalContent,
17129
17142
  contentType: lastInlineReference.contentType,
17130
17143
  };
17131
17144
  },
@@ -19984,9 +19997,6 @@ const jsenvPluginAutoreloadServer = ({
19984
19997
  // are lost and sourcemap is considered as pruned
19985
19998
  continue;
19986
19999
  }
19987
- if (lastReferenceFromOther.type === "package_json") {
19988
- continue;
19989
- }
19990
20000
  const { ownerUrlInfo } = lastReferenceFromOther;
19991
20001
  if (!ownerUrlInfo.isUsed()) {
19992
20002
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "39.3.6",
3
+ "version": "39.3.7",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -238,9 +238,6 @@ export const jsenvPluginAutoreloadServer = ({
238
238
  // are lost and sourcemap is considered as pruned
239
239
  continue;
240
240
  }
241
- if (lastReferenceFromOther.type === "package_json") {
242
- continue;
243
- }
244
241
  const { ownerUrlInfo } = lastReferenceFromOther;
245
242
  if (!ownerUrlInfo.isUsed()) {
246
243
  continue;
@@ -45,8 +45,12 @@ const jsenvPluginInlineContentFetcher = () => {
45
45
  // when updating the file, first reference is the previous version
46
46
  // - we cannot use urlInfo.lastReference because it can be the reference created by "http_request"
47
47
  let lastInlineReference;
48
+ let originalContent = urlInfo.originalContent;
48
49
  for (const reference of urlInfo.referenceFromOthersSet) {
49
50
  if (reference.isInline) {
51
+ if (originalContent === undefined) {
52
+ originalContent = reference.content;
53
+ }
50
54
  lastInlineReference = reference;
51
55
  }
52
56
  }
@@ -61,8 +65,17 @@ const jsenvPluginInlineContentFetcher = () => {
61
65
  }
62
66
  }
63
67
  return {
64
- originalContent: urlInfo.originalContent,
65
- content: lastInlineReference.content,
68
+ originalContent,
69
+ content:
70
+ // we must favor original content to re-apply the same plugin logic
71
+ // so that the same references are generated
72
+ // without this we would try to resolve references like
73
+ // "/node_modules/package/file.js" instead of "package/file.js"
74
+ // meaning we would not create the implicit dependency to package.json
75
+ // resulting in a reload of the browser (as implicit reference to package.json is gone)
76
+ originalContent === undefined
77
+ ? lastInlineReference.content
78
+ : originalContent,
66
79
  contentType: lastInlineReference.contentType,
67
80
  };
68
81
  },