corequery 0.1.6 → 0.1.7
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 +1 -1
- package/server/dist/server/web-server-asset-preparer.d.ts +1 -0
- package/server/dist/server/web-server-asset-preparer.js +37 -1
- package/server/dist/server/web-server-asset-preparer.js.map +1 -1
- package/web/dist/apple-touch-icon.png +0 -0
- package/web/dist/favicon.svg +2 -2
- package/web/dist/index.html +10 -10
- package/web/dist/manifest.webmanifest +1 -1
- package/web/dist/pwa-192x192.png +0 -0
- package/web/dist/pwa-512x512.png +0 -0
- package/web/dist/pwa-maskable-192x192.png +0 -0
- package/web/dist/pwa-maskable-512x512.png +0 -0
- package/web/dist/sw.js +92 -1
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import fsp from "fs/promises";
|
|
3
3
|
import { parse } from "node-html-parser";
|
|
4
|
+
import crypto from "crypto";
|
|
4
5
|
export class WebServerAssetPreparer {
|
|
5
6
|
_config;
|
|
6
7
|
constructor(_config) {
|
|
@@ -12,6 +13,9 @@ export class WebServerAssetPreparer {
|
|
|
12
13
|
await this._replaceIndexHtmlTags(indexHtmlPath);
|
|
13
14
|
await this._replaceWebManifest(webManifestPath);
|
|
14
15
|
await this._replaceIcons(distFolderPath);
|
|
16
|
+
// Must come last, otherwise we'll calculate hashes before the file contents
|
|
17
|
+
// are swapped.
|
|
18
|
+
await this._replaceServiceWorkerRevisionHashes(distFolderPath);
|
|
15
19
|
}
|
|
16
20
|
async _replaceWebManifest(filePath) {
|
|
17
21
|
const manifestStr = await fsp.readFile(filePath, "utf-8");
|
|
@@ -31,7 +35,7 @@ export class WebServerAssetPreparer {
|
|
|
31
35
|
function requireTag(selector) {
|
|
32
36
|
const tag = indexHtml.querySelector(selector);
|
|
33
37
|
if (tag == null)
|
|
34
|
-
throw new Error(
|
|
38
|
+
throw new Error(`"${selector}" tag not found.`);
|
|
35
39
|
return tag;
|
|
36
40
|
}
|
|
37
41
|
const titleTag = requireTag("title");
|
|
@@ -59,5 +63,37 @@ export class WebServerAssetPreparer {
|
|
|
59
63
|
await fsp.copyFile(sourcePath, destPath);
|
|
60
64
|
}
|
|
61
65
|
}
|
|
66
|
+
async _replaceServiceWorkerRevisionHashes(distFolderPath) {
|
|
67
|
+
const serviceWorkerPath = path.join(distFolderPath, "sw.js");
|
|
68
|
+
const serviceWorkerStr = await fsp.readFile(serviceWorkerPath, "utf-8");
|
|
69
|
+
const filesRequiringRevisionUpdates = [
|
|
70
|
+
"index.html",
|
|
71
|
+
"manifest.webmanifest",
|
|
72
|
+
"favicon.svg",
|
|
73
|
+
"apple-touch-icon.png",
|
|
74
|
+
"pwa-192x192.png",
|
|
75
|
+
"pwa-512x512.png",
|
|
76
|
+
"pwa-maskable-192x192.png",
|
|
77
|
+
"pwa-maskable-512x512.png",
|
|
78
|
+
];
|
|
79
|
+
const matches = Array.from(serviceWorkerStr.matchAll(/{url:"([^"]+)",revision:"[^"]+"}/g)).map((match) => ({
|
|
80
|
+
fullText: match[0],
|
|
81
|
+
url: match[1],
|
|
82
|
+
}));
|
|
83
|
+
let newServiceWorkerStr = serviceWorkerStr;
|
|
84
|
+
for (const file of filesRequiringRevisionUpdates) {
|
|
85
|
+
// Filter, as some assets (e.g. pwa-192x192.png) are in there twice.
|
|
86
|
+
const entries = matches.filter((m) => m.url === file);
|
|
87
|
+
if (entries.length === 0)
|
|
88
|
+
throw new Error(`"${file}" had no revisions.`);
|
|
89
|
+
const fullFilePath = path.join(distFolderPath, file);
|
|
90
|
+
const fileContent = await fsp.readFile(fullFilePath);
|
|
91
|
+
const hash = crypto.createHash("md5").update(fileContent).digest("hex");
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
newServiceWorkerStr = newServiceWorkerStr.replace(entry.fullText, `{url:"${entry.url}",revision:"${hash}"}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
await fsp.writeFile(serviceWorkerPath, newServiceWorkerStr);
|
|
97
|
+
}
|
|
62
98
|
}
|
|
63
99
|
//# sourceMappingURL=web-server-asset-preparer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-server-asset-preparer.js","sourceRoot":"","sources":["../../web-server-asset-preparer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"web-server-asset-preparer.js","sourceRoot":"","sources":["../../web-server-asset-preparer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,GAAG,MAAM,aAAa,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAgB5B,MAAM,OAAO,sBAAsB;IACJ;IAA7B,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAErD,KAAK,CAAC,iBAAiB,CAAC,cAAsB;QAC5C,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC;QAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;QAE1E,MAAM,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;QAChD,MAAM,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;QAEzC,4EAA4E;QAC5E,eAAe;QACf,MAAM,IAAI,CAAC,mCAAmC,CAAC,cAAc,CAAC,CAAC;IACjE,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,QAAgB;QAChD,MAAM,WAAW,GAAG,MAAM,GAAG,CAAC,QAAQ,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E,mBAAmB,CAAC,CAAC;IAC9D,CAAC;CACF"}
|
|
Binary file
|
package/web/dist/favicon.svg
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
|
|
2
2
|
<style>
|
|
3
|
-
.top { fill: rgba(
|
|
4
|
-
.bottom { fill:
|
|
3
|
+
.top { fill: rgba(90, 141, 152, 1); }
|
|
4
|
+
.bottom { fill: rgb(162, 54, 227); }
|
|
5
5
|
.inner { fill: white; }
|
|
6
6
|
.outer { fill: black; }
|
|
7
7
|
@media (prefers-color-scheme: dark) {
|
package/web/dist/index.html
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
|
-
<meta charset="UTF-8"
|
|
4
|
+
<meta charset="UTF-8" >
|
|
5
5
|
|
|
6
|
-
<title>
|
|
7
|
-
<meta name="description" content="
|
|
8
|
-
<meta name="corequery-app-name" content="
|
|
9
|
-
<meta name="corequery-frontend-version" content="
|
|
6
|
+
<title>TrainQuery v4 (Beta)</title>
|
|
7
|
+
<meta name="description" content="Navigate Melbourne's train network with TrainQuery.">
|
|
8
|
+
<meta name="corequery-app-name" content="TrainQuery v4 (Beta)">
|
|
9
|
+
<meta name="corequery-frontend-version" content="dev">
|
|
10
10
|
|
|
11
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg"
|
|
12
|
-
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180"
|
|
13
|
-
<link rel="mask-icon" href="/favicon.svg" color="#FFFFFF"
|
|
14
|
-
<meta name="theme-color" content="#242933"
|
|
15
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0"
|
|
11
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" >
|
|
12
|
+
<link rel="apple-touch-icon" href="/apple-touch-icon.png" sizes="180x180" >
|
|
13
|
+
<link rel="mask-icon" href="/favicon.svg" color="#FFFFFF" >
|
|
14
|
+
<meta name="theme-color" content="#242933" >
|
|
15
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
|
|
16
16
|
<script type="module" crossorigin src="/assets/index-DPgpp2iG.js"></script>
|
|
17
17
|
<link rel="manifest" href="/manifest.webmanifest"></head>
|
|
18
18
|
<body>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"
|
|
1
|
+
{"name":"TrainQuery v4 (Beta)","short_name":"TQ4 (Beta)","description":"Navigate Melbourne's train network with TrainQuery.","start_url":"/","display":"standalone","background_color":"#242933","theme_color":"#242933","lang":"en","scope":"/","icons":[{"src":"/pwa-192x192.png","sizes":"192x192","type":"image/png","purpose":"any"},{"src":"/pwa-512x512.png","sizes":"512x512","type":"image/png","purpose":"any"},{"src":"/pwa-maskable-192x192.png","sizes":"192x192","type":"image/png","purpose":"maskable"},{"src":"/pwa-maskable-512x512.png","sizes":"512x512","type":"image/png","purpose":"maskable"}]}
|
package/web/dist/pwa-192x192.png
CHANGED
|
Binary file
|
package/web/dist/pwa-512x512.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/web/dist/sw.js
CHANGED
|
@@ -1 +1,92 @@
|
|
|
1
|
-
if
|
|
1
|
+
if (!self.define) {
|
|
2
|
+
let e,
|
|
3
|
+
s = {};
|
|
4
|
+
const i = (i, n) => (
|
|
5
|
+
(i = new URL(i + ".js", n).href),
|
|
6
|
+
s[i] ||
|
|
7
|
+
new Promise((s) => {
|
|
8
|
+
if ("document" in self) {
|
|
9
|
+
const e = document.createElement("script");
|
|
10
|
+
(e.src = i), (e.onload = s), document.head.appendChild(e);
|
|
11
|
+
} else (e = i), importScripts(i), s();
|
|
12
|
+
}).then(() => {
|
|
13
|
+
let e = s[i];
|
|
14
|
+
if (!e) throw new Error(`Module ${i} didn’t register its module`);
|
|
15
|
+
return e;
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
self.define = (n, r) => {
|
|
19
|
+
const l =
|
|
20
|
+
e ||
|
|
21
|
+
("document" in self ? document.currentScript.src : "") ||
|
|
22
|
+
location.href;
|
|
23
|
+
if (s[l]) return;
|
|
24
|
+
let o = {};
|
|
25
|
+
const a = (e) => i(e, l),
|
|
26
|
+
d = { module: { uri: l }, exports: o, require: a };
|
|
27
|
+
s[l] = Promise.all(n.map((e) => d[e] || a(e))).then((e) => (r(...e), o));
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
define(["./workbox-1ef09536"], function (e) {
|
|
31
|
+
"use strict";
|
|
32
|
+
self.addEventListener("message", (e) => {
|
|
33
|
+
e.data && "SKIP_WAITING" === e.data.type && self.skipWaiting();
|
|
34
|
+
}),
|
|
35
|
+
e.precacheAndRoute(
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
url: "pwa-maskable-512x512.png",
|
|
39
|
+
revision: "3e9258e806845be2c5733ad7d036eb69",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
url: "pwa-maskable-192x192.png",
|
|
43
|
+
revision: "237699b6e6c8431b835b9dd463704571",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
url: "pwa-512x512.png",
|
|
47
|
+
revision: "1aabd45e2a3c4a3639916d0047174532",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
url: "pwa-192x192.png",
|
|
51
|
+
revision: "f6533345ab23f07ecfc0510994c09216",
|
|
52
|
+
},
|
|
53
|
+
{ url: "index.html", revision: "37d5e52f3271fae4d3e7c805249efc1a" },
|
|
54
|
+
{ url: "favicon.svg", revision: "ab1138908b34eed237bbe8c845aa0293" },
|
|
55
|
+
{
|
|
56
|
+
url: "apple-touch-icon.png",
|
|
57
|
+
revision: "f249a943ebab995556223c95625d1be1",
|
|
58
|
+
},
|
|
59
|
+
{ url: "assets/workbox-window.prod.es5-BIl4cyR9.js", revision: null },
|
|
60
|
+
{ url: "assets/index-DPgpp2iG.js", revision: null },
|
|
61
|
+
{ url: "assets/NotFound-iEZNehaH.js", revision: null },
|
|
62
|
+
{ url: "assets/Nav-BmJ5gVHE.js", revision: null },
|
|
63
|
+
{ url: "assets/Home-h_rCrXOP.js", revision: null },
|
|
64
|
+
{ url: "assets/About-DPPma4Gx.js", revision: null },
|
|
65
|
+
{
|
|
66
|
+
url: "pwa-192x192.png",
|
|
67
|
+
revision: "f6533345ab23f07ecfc0510994c09216",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
url: "pwa-512x512.png",
|
|
71
|
+
revision: "1aabd45e2a3c4a3639916d0047174532",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
url: "pwa-maskable-192x192.png",
|
|
75
|
+
revision: "237699b6e6c8431b835b9dd463704571",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
url: "pwa-maskable-512x512.png",
|
|
79
|
+
revision: "3e9258e806845be2c5733ad7d036eb69",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
url: "manifest.webmanifest",
|
|
83
|
+
revision: "1d9fdaf607d4af5d12883a769d38bcd8",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
{}
|
|
87
|
+
),
|
|
88
|
+
e.cleanupOutdatedCaches(),
|
|
89
|
+
e.registerRoute(
|
|
90
|
+
new e.NavigationRoute(e.createHandlerBoundToURL("index.html"))
|
|
91
|
+
);
|
|
92
|
+
});
|