@jsenv/core 39.3.6 → 39.3.8

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 (urlInfo.originalContent === undefined) {
17115
+ originalContent = reference.content;
17116
+ }
17113
17117
  lastInlineReference = reference;
17114
17118
  }
17115
17119
  }
@@ -17119,13 +17123,23 @@ const jsenvPluginInlineContentFetcher = () => {
17119
17123
  if (lastInlineReference.content === undefined) {
17120
17124
  const originalUrlInfo = prev.urlInfo;
17121
17125
  await originalUrlInfo.cook();
17126
+ originalContent = originalUrlInfo.originalContent;
17122
17127
  lastInlineReference.content = originalUrlInfo.content;
17123
17128
  lastInlineReference.contentType = originalUrlInfo.contentType;
17124
17129
  }
17125
17130
  }
17126
17131
  return {
17127
- originalContent: urlInfo.originalContent,
17128
- content: lastInlineReference.content,
17132
+ originalContent,
17133
+ content:
17134
+ // we must favor original content to re-apply the same plugin logic
17135
+ // so that the same references are generated
17136
+ // without this we would try to resolve references like
17137
+ // "/node_modules/package/file.js" instead of "package/file.js"
17138
+ // meaning we would not create the implicit dependency to package.json
17139
+ // resulting in a reload of the browser (as implicit reference to package.json is gone)
17140
+ originalContent === undefined
17141
+ ? lastInlineReference.content
17142
+ : originalContent,
17129
17143
  contentType: lastInlineReference.contentType,
17130
17144
  };
17131
17145
  },
@@ -19984,9 +19998,6 @@ const jsenvPluginAutoreloadServer = ({
19984
19998
  // are lost and sourcemap is considered as pruned
19985
19999
  continue;
19986
20000
  }
19987
- if (lastReferenceFromOther.type === "package_json") {
19988
- continue;
19989
- }
19990
20001
  const { ownerUrlInfo } = lastReferenceFromOther;
19991
20002
  if (!ownerUrlInfo.isUsed()) {
19992
20003
  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.8",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -69,7 +69,7 @@
69
69
  "@financial-times/polyfill-useragent-normaliser": "1.10.2",
70
70
  "@jsenv/abort": "4.3.0",
71
71
  "@jsenv/ast": "6.2.16",
72
- "@jsenv/filesystem": "4.10.0",
72
+ "@jsenv/filesystem": "4.10.1",
73
73
  "@jsenv/humanize": "1.2.8",
74
74
  "@jsenv/importmap": "1.2.1",
75
75
  "@jsenv/integrity": "0.0.2",
@@ -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 (urlInfo.originalContent === undefined) {
52
+ originalContent = reference.content;
53
+ }
50
54
  lastInlineReference = reference;
51
55
  }
52
56
  }
@@ -56,13 +60,23 @@ const jsenvPluginInlineContentFetcher = () => {
56
60
  if (lastInlineReference.content === undefined) {
57
61
  const originalUrlInfo = prev.urlInfo;
58
62
  await originalUrlInfo.cook();
63
+ originalContent = originalUrlInfo.originalContent;
59
64
  lastInlineReference.content = originalUrlInfo.content;
60
65
  lastInlineReference.contentType = originalUrlInfo.contentType;
61
66
  }
62
67
  }
63
68
  return {
64
- originalContent: urlInfo.originalContent,
65
- content: lastInlineReference.content,
69
+ originalContent,
70
+ content:
71
+ // we must favor original content to re-apply the same plugin logic
72
+ // so that the same references are generated
73
+ // without this we would try to resolve references like
74
+ // "/node_modules/package/file.js" instead of "package/file.js"
75
+ // meaning we would not create the implicit dependency to package.json
76
+ // resulting in a reload of the browser (as implicit reference to package.json is gone)
77
+ originalContent === undefined
78
+ ? lastInlineReference.content
79
+ : originalContent,
66
80
  contentType: lastInlineReference.contentType,
67
81
  };
68
82
  },