@jon49/sw 0.12.10 → 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.
|
@@ -83,7 +83,7 @@ async function handleHTML(targetDirectory: string) {
|
|
|
83
83
|
|
|
84
84
|
let mappableFiles =
|
|
85
85
|
(await Promise.all(
|
|
86
|
-
(await glob("**/{css,js,images}
|
|
86
|
+
(await glob("**/{css,js,images}/**/*.*", "./src"))
|
|
87
87
|
.map(async x => {
|
|
88
88
|
let ext = path.extname(x)
|
|
89
89
|
if (ext === ".ts") {
|
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 =
|
package/bin/lib/system.ts
CHANGED
|
@@ -40,7 +40,9 @@ export async function findHashedFile(
|
|
|
40
40
|
|
|
41
41
|
let parsed = path.parse(filename)
|
|
42
42
|
for await (const file of Glob(`**/${parsed.dir}/${parsed.name}.*${ext}`, { cwd: targetDirectory })) {
|
|
43
|
-
|
|
43
|
+
if (file.startsWith(parsed.dir)) {
|
|
44
|
+
return file
|
|
45
|
+
}
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|