@jsenv/core 24.5.3 → 24.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "24.5.3",
3
+ "version": "24.5.4",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,14 +20,31 @@ const fileNamePatternFromRessource = (ressource) => {
20
20
  }
21
21
 
22
22
  if (ressource.urlVersioningDisabled) {
23
- if (ressource.isEntryPoint || ressource.isJsModule) {
24
- return `[name][extname]`
23
+ if (canMoveToAssetsDirectory(ressource)) {
24
+ return assetFileNamePatternWithoutHash
25
25
  }
26
- return assetFileNamePatternWithoutHash
26
+ return `[name][extname]`
27
27
  }
28
28
 
29
- if (ressource.isEntryPoint || ressource.isJsModule) {
30
- return `[name]-[hash][extname]`
29
+ if (canMoveToAssetsDirectory(ressource)) {
30
+ return assetFileNamePattern
31
31
  }
32
- return assetFileNamePattern
32
+ return `[name]-[hash][extname]`
33
+ }
34
+
35
+ const canMoveToAssetsDirectory = (ressource) => {
36
+ if (ressource.isEntryPoint) {
37
+ return false
38
+ }
39
+ // in theory js module can be moved to assets directory
40
+ // but that needs to be tested
41
+ if (ressource.isJsModule) {
42
+ return false
43
+ }
44
+ // service worker MUST be at the root (same level than the HTML file)
45
+ // otherwise it might be registered for the scope "/assets/" instead of "/"
46
+ if (ressource.isServiceWorker) {
47
+ return false
48
+ }
49
+ return true
33
50
  }