Skip to content

Commit ae58b66

Browse files
committed
chore: update deps and quit analytics
1 parent 914ac9b commit ae58b66

File tree

6 files changed

+38
-17
lines changed

6 files changed

+38
-17
lines changed

.eleventy.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const { DateTime } = require("luxon");
4444
const { promisify } = require("util");
4545
const fs = require("fs");
4646
const path = require("path");
47-
const hasha = require("hasha");
4847
const touch = require("touch");
4948
const readFile = promisify(fs.readFile);
5049
const readdir = promisify(fs.readdir);
@@ -61,6 +60,12 @@ const { partytownSnippet } = require('@builder.io/partytown/integration');
6160
const { copyLibFiles } = require('@builder.io/partytown/utils');
6261

6362
module.exports = function (eleventyConfig) {
63+
let hasha;
64+
65+
eleventyConfig.on('eleventy.before', async ({}) => {
66+
hasha = await import('hasha');
67+
});
68+
6469
eleventyConfig.addPlugin(pluginRss);
6570
eleventyConfig.addPlugin(pluginSyntaxHighlight);
6671
eleventyConfig.addPlugin(pluginNavigation);
@@ -98,7 +103,7 @@ module.exports = function (eleventyConfig) {
98103
encoding: "utf-8",
99104
})
100105
.then((content) => {
101-
return hasha.async(content);
106+
return hasha.hash(content);
102107
})
103108
.then((hash) => {
104109
callback(null, `${absolutePath}?hash=${hash.substr(0, 10)}`);

_data/csp.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,17 @@ const SELF = quote("self");
3232
const CSP = {
3333
regular: serialize([
3434
// By default only talk to same-origin
35-
["default-src", SELF, 'https://stats.piraces.co/', 'https://giscus.app'],
35+
["default-src", SELF, 'https://giscus.app'],
3636
// No plugins
3737
["object-src", quote("none")],
3838
// Script from same-origin, inline-hashes and unsafe-eval
39-
["script-src", SELF, 'https://stats.piraces.co/', 'https://cdn.jsdelivr.net', 'https://unpkg.com', 'https://giscus.app', quote("unsafe-eval"), /* Replaced by csp.js plugin */ "HASHES"],
39+
["script-src", SELF, 'https://cdn.jsdelivr.net', 'https://unpkg.com', 'https://giscus.app', quote("unsafe-eval"), /* Replaced by csp.js plugin */ "HASHES"],
4040
// Inline CSS is allowed.
4141
["style-src", quote("unsafe-inline")],
4242
// Images may also come from data-URIs.
4343
["img-src", SELF, "data:", "https://gh-card.dev", "blob:"],
4444
// connect-src to allow some connections to APIs
45-
["connect-src", SELF, 'https://stats.piraces.co', 'https://cdn.jsdelivr.net', "https://api.hackertarget.com", "blob:"],
45+
["connect-src", SELF, 'https://cdn.jsdelivr.net', "https://api.hackertarget.com", "blob:"],
4646
// frame-ancestors to allow iframes from same origin
4747
["frame-ancestors", SELF]
4848

_includes/layouts/base.njk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
</script>
4848
<script type="text/partytown" async defer src="{{ "/js/pwa.js" | addHash }}"></script>
4949
<script type="text/partytown" async defer src="{{ "/js/search.js" | addHash }}"></script>
50-
<script type="text/partytown" async defer src="https://stats.piraces.co/script.js" data-website-id="8546dad7-f5d8-4982-b29e-912416a116cf"></script>
5150
<link rel="manifest" href="/manifest.webmanifest" />
5251
<!-- Notably iOS UAs also contain Mac OS X -->
5352
<script csp-hash>if (/Mac OS X/.test(navigator.userAgent))document.documentElement.classList.add('apple')

package-lock.json

Lines changed: 26 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"csso": "^5.0.5",
5353
"datauri": "^4.1.0",
5454
"expect.js": "^0.3.1",
55-
"hasha": "^5.2.2",
55+
"hasha": "^6.0.0",
5656
"html-minifier": "^4.0.0",
5757
"image-size": "^1.1.0",
5858
"jimp": "^0.22.10",

test/test-generic-post.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ describe("check build output for a generic post", () => {
6363

6464
it("should have script elements", () => {
6565
const scripts = doc.querySelectorAll("script[src]");
66-
expect(scripts).to.have.length(5); // NOTE: update this when adding more <script>
66+
expect(scripts).to.have.length(4); // NOTE: update this when adding more <script>
6767
expect(scripts[0].getAttribute("src")).to.match(
6868
/^\/js\/min\.js\?hash=\w+/
6969
);

0 commit comments

Comments
 (0)