@jon49/sw 0.12.11 → 0.12.12
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/bin/lib/file-mapper.ts +7 -3
- package/package.json +1 -1
package/bin/lib/file-mapper.ts
CHANGED
|
@@ -51,11 +51,15 @@ export async function fileMapper(targetDirectory: string, force = false) {
|
|
|
51
51
|
})
|
|
52
52
|
.filter(isFileMapper)
|
|
53
53
|
|
|
54
|
-
// Write mapper to file in src/web/file-map.js
|
|
55
54
|
if (option.isWaiting) return
|
|
56
|
-
|
|
57
|
-
let
|
|
55
|
+
// Write mapper to file in src/web/file-map.js
|
|
56
|
+
let fileMapJsonContent = JSON.stringify(mapper)
|
|
57
|
+
let hash = getHash(fileMapJsonContent)
|
|
58
58
|
let fileMapUrl = `/web/file-map.${hash}.js`
|
|
59
|
+
|
|
60
|
+
fileMapJsonContent = `${fileMapJsonContent.slice(0, -1)},{"url":"/web/file-map.js","file":"${fileMapUrl}"}]`
|
|
61
|
+
|
|
62
|
+
let fileMapContent = `(() => { self.app = { links: ${fileMapJsonContent} } })()`
|
|
59
63
|
await write(`${targetDirectory}${fileMapUrl}`, fileMapContent)
|
|
60
64
|
|
|
61
65
|
let globalFiles =
|