« get me outta code hell

content, url-spec: use static rather than shared, drop cachebust - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-05-21 08:01:14 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-05-21 08:01:41 -0300
commitdc318c6db0b92510e8297739f4f6999f24859215 (patch)
tree4982ed4db6512872ac4b59365f1f52301b742f09
parent5c973b488c58a836082d8ae5e48ff42e830d7661 (diff)
content, url-spec: use static rather than shared, drop cachebust
-rw-r--r--src/content/dependencies/generatePageLayout.js8
-rw-r--r--src/content/dependencies/image.js4
-rw-r--r--src/content/dependencies/linkExternalAsIcon.js2
-rwxr-xr-xsrc/upd8.js3
-rw-r--r--src/url-spec.js18
-rw-r--r--src/write/bind-utilities.js2
-rw-r--r--src/write/build-modes/live-dev-server.js2
-rw-r--r--src/write/build-modes/static-build.js2
-rw-r--r--test/lib/content-function.js1
9 files changed, 11 insertions, 31 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 9fe868ba..3bb8b00a 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -10,7 +10,6 @@ export default {
   ],
 
   extraDependencies: [
-    'cachebust',
     'getColors',
     'html',
     'language',
@@ -209,7 +208,6 @@ export default {
   },
 
   generate(data, relations, slots, {
-    cachebust,
     getColors,
     html,
     language,
@@ -598,7 +596,7 @@ export default {
 
             html.tag('link', {
               rel: 'stylesheet',
-              href: to('shared.staticFile', 'site.css', cachebust),
+              href: to('static.path', 'site.css'),
             }),
 
             html.tag('style', [
@@ -608,7 +606,7 @@ export default {
             ]),
 
             html.tag('script', {
-              src: to('shared.staticFile', 'lazy-loading.js', cachebust),
+              src: to('static.path', 'lazy-loading.js'),
             }),
           ]),
 
@@ -638,7 +636,7 @@ export default {
 
               html.tag('script', {
                 type: 'module',
-                src: to('shared.staticFile', 'client.js', cachebust),
+                src: to('static.path', 'client.js'),
               }),
             ]),
         ])
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 822efe3f..617065fc 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -3,7 +3,6 @@ import {empty} from '#sugar';
 
 export default {
   extraDependencies: [
-    'cachebust',
     'checkIfImagePathHasCachedThumbnails',
     'getDimensionsOfImagePath',
     'getSizeOfImagePath',
@@ -82,7 +81,6 @@ export default {
   },
 
   generate(data, relations, slots, {
-    cachebust,
     checkIfImagePathHasCachedThumbnails,
     getDimensionsOfImagePath,
     getSizeOfImagePath,
@@ -172,7 +170,7 @@ export default {
     if (willReveal) {
       reveal = [
         html.tag('img', {class: 'reveal-symbol'},
-          {src: to('shared.staticFile', 'warning.svg', cachebust)}),
+          {src: to('static.path', 'warning.svg')}),
 
         html.tag('br'),
 
diff --git a/src/content/dependencies/linkExternalAsIcon.js b/src/content/dependencies/linkExternalAsIcon.js
index 6f37529e..7f5ea432 100644
--- a/src/content/dependencies/linkExternalAsIcon.js
+++ b/src/content/dependencies/linkExternalAsIcon.js
@@ -37,7 +37,7 @@ export default {
             html.tag('title', platformText),
 
           html.tag('use', {
-            href: to('shared.staticIcon', iconId),
+            href: to('static.icon', iconId),
           }),
         ]),
 
diff --git a/src/upd8.js b/src/upd8.js
index f35f9e5f..d4198cf8 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -93,8 +93,6 @@ import * as buildModes from './write/build-modes/index.js';
 
 const __dirname = path.dirname(fileURLToPath(import.meta.url));
 
-const CACHEBUST = 23;
-
 let COMMIT;
 try {
   COMMIT = execSync('git log --format="%h %B" -n 1 HEAD', {cwd: __dirname}).toString().trim();
@@ -2116,7 +2114,6 @@ async function main() {
       webRoutes,
       wikiData,
 
-      cachebust: '?' + CACHEBUST,
       closeLanguageWatchers,
       developersComment,
       getSizeOfAdditionalFile,
diff --git a/src/url-spec.js b/src/url-spec.js
index ec971c0c..cafcb0a6 100644
--- a/src/url-spec.js
+++ b/src/url-spec.js
@@ -63,17 +63,7 @@ const urlSpec = {
   },
 
   shared: {
-    paths: {
-      ...genericPaths,
-
-      utilityRoot: 'util',
-      staticRoot: 'static',
-
-      utilityFile: 'util/<>',
-      staticFile: 'static/<>?<>',
-
-      staticIcon: 'static/icons.svg#icon-<>',
-    },
+    paths: genericPaths,
   },
 
   media: {
@@ -102,7 +92,11 @@ const urlSpec = {
 
   static: {
     prefix: 'static/',
-    paths: genericPaths,
+    paths: {
+      ...genericPaths,
+
+      icon: 'icons.svg#icon-<>',
+    },
   },
 
   util: {
diff --git a/src/write/bind-utilities.js b/src/write/bind-utilities.js
index 3d4ecc7a..8dd08dba 100644
--- a/src/write/bind-utilities.js
+++ b/src/write/bind-utilities.js
@@ -19,7 +19,6 @@ import {
 
 export function bindUtilities({
   absoluteTo,
-  cachebust,
   defaultLanguage,
   getSizeOfAdditionalFile,
   getSizeOfImagePath,
@@ -36,7 +35,6 @@ export function bindUtilities({
 
   Object.assign(bound, {
     absoluteTo,
-    cachebust,
     defaultLanguage,
     getSizeOfAdditionalFile,
     getSizeOfImagePath,
diff --git a/src/write/build-modes/live-dev-server.js b/src/write/build-modes/live-dev-server.js
index 03ef6049..f8e75bd2 100644
--- a/src/write/build-modes/live-dev-server.js
+++ b/src/write/build-modes/live-dev-server.js
@@ -103,7 +103,6 @@ export async function go({
   webRoutes,
   wikiData,
 
-  cachebust,
   developersComment: _developersComment,
   getSizeOfAdditionalFile,
   getSizeOfImagePath,
@@ -399,7 +398,6 @@ export async function go({
 
       const bound = bindUtilities({
         absoluteTo,
-        cachebust,
         defaultLanguage,
         getSizeOfAdditionalFile,
         getSizeOfImagePath,
diff --git a/src/write/build-modes/static-build.js b/src/write/build-modes/static-build.js
index 68cf0949..54286a02 100644
--- a/src/write/build-modes/static-build.js
+++ b/src/write/build-modes/static-build.js
@@ -115,7 +115,6 @@ export async function go({
   webRoutes,
   wikiData,
 
-  cachebust,
   developersComment: _developersComment,
   getSizeOfAdditionalFile,
   getSizeOfImagePath,
@@ -306,7 +305,6 @@ export async function go({
 
         const bound = bindUtilities({
           absoluteTo,
-          cachebust,
           defaultLanguage,
           getSizeOfAdditionalFile,
           getSizeOfImagePath,
diff --git a/test/lib/content-function.js b/test/lib/content-function.js
index 7bc62139..be76c31d 100644
--- a/test/lib/content-function.js
+++ b/test/lib/content-function.js
@@ -52,7 +52,6 @@ export function testContentFunctions(t, message, fn) {
             to,
             urls,
 
-            cachebust: 413,
             pagePath: ['home'],
             appendIndexHTML: false,
             getColors: c => getColors(c, {chroma}),