@jsenv/core 29.1.12 → 29.1.14

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
@@ -7060,7 +7060,7 @@ const fetchFileSystem = async (filesystemUrl, {
7060
7060
 
7061
7061
  rootDirectoryUrl = rootDirectoryUrlString;
7062
7062
  } // here you might be tempted to add || cacheControl === 'no-cache'
7063
- // but no-cache means resource can be cache but must be revalidated (yeah naming is strange)
7063
+ // but no-cache means resource can be cached but must be revalidated (yeah naming is strange)
7064
7064
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#Cacheability
7065
7065
 
7066
7066
 
@@ -25759,10 +25759,16 @@ const createFileService = ({
25759
25759
  response = {
25760
25760
  url: reference.url,
25761
25761
  status: 200,
25762
- headers: {
25763
- "cache-control": `private,max-age=0,must-revalidate`,
25764
- // it's safe to use "_" separator because etag is encoded with base64 (see https://stackoverflow.com/a/13195197)
25765
- "eTag": `${urlInfoTargetedByCache.originalContentEtag}_${urlInfoTargetedByCache.contentEtag}`,
25762
+ headers: { // when we send eTag to the client the next request to the server
25763
+ // will send etag in request headers.
25764
+ // If they match jsenv bypass cooking and returns 304
25765
+ // This must not happen when a plugin uses "no-store" or "no-cache" as it means
25766
+ // plugin logic wants to happens for every request to this url
25767
+ ...(urlInfo.headers["cache-control"] === "no-store" || urlInfo.headers["cache-control"] === "no-cache" ? {} : {
25768
+ "cache-control": `private,max-age=0,must-revalidate`,
25769
+ // it's safe to use "_" separator because etag is encoded with base64 (see https://stackoverflow.com/a/13195197)
25770
+ "eTag": `${urlInfoTargetedByCache.originalContentEtag}_${urlInfoTargetedByCache.contentEtag}`
25771
+ }),
25766
25772
  ...urlInfo.headers,
25767
25773
  "content-type": urlInfo.contentType,
25768
25774
  "content-length": Buffer.byteLength(urlInfo.content)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "29.1.12",
3
+ "version": "29.1.14",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -100,7 +100,7 @@
100
100
  "@babel/eslint-parser": "7.19.1",
101
101
  "@babel/plugin-syntax-import-assertions": "7.18.6",
102
102
  "@jsenv/assert": "2.7.0",
103
- "@jsenv/eslint-config": "16.2.1",
103
+ "@jsenv/eslint-config": "16.2.3",
104
104
  "@jsenv/file-size-impact": "13.0.1",
105
105
  "@jsenv/https-local": "3.0.1",
106
106
  "@jsenv/package-workspace": "0.5.0",
@@ -334,9 +334,19 @@ export const createFileService = ({
334
334
  url: reference.url,
335
335
  status: 200,
336
336
  headers: {
337
- "cache-control": `private,max-age=0,must-revalidate`,
338
- // it's safe to use "_" separator because etag is encoded with base64 (see https://stackoverflow.com/a/13195197)
339
- "eTag": `${urlInfoTargetedByCache.originalContentEtag}_${urlInfoTargetedByCache.contentEtag}`,
337
+ // when we send eTag to the client the next request to the server
338
+ // will send etag in request headers.
339
+ // If they match jsenv bypass cooking and returns 304
340
+ // This must not happen when a plugin uses "no-store" or "no-cache" as it means
341
+ // plugin logic wants to happens for every request to this url
342
+ ...(urlInfo.headers["cache-control"] === "no-store" ||
343
+ urlInfo.headers["cache-control"] === "no-cache"
344
+ ? {}
345
+ : {
346
+ "cache-control": `private,max-age=0,must-revalidate`,
347
+ // it's safe to use "_" separator because etag is encoded with base64 (see https://stackoverflow.com/a/13195197)
348
+ "eTag": `${urlInfoTargetedByCache.originalContentEtag}_${urlInfoTargetedByCache.contentEtag}`,
349
+ }),
340
350
  ...urlInfo.headers,
341
351
  "content-type": urlInfo.contentType,
342
352
  "content-length": Buffer.byteLength(urlInfo.content),