« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/content/dependencies/generatePageLayout.js6
-rw-r--r--src/content/dependencies/image.js2
-rw-r--r--src/content/dependencies/linkExternalAsIcon.js2
-rw-r--r--src/static/css/site-basic.css (renamed from src/static/site-basic.css)0
-rw-r--r--src/static/css/site.css (renamed from src/static/site.css)0
-rw-r--r--src/static/js/client.js (renamed from src/static/client.js)2
-rw-r--r--src/static/js/lazy-loading.js (renamed from src/static/lazy-loading.js)0
-rw-r--r--src/static/js/xhr-util.js (renamed from src/static/xhr-util.js)0
-rw-r--r--src/static/misc/icons.svg (renamed from src/static/icons.svg)0
-rw-r--r--src/static/misc/warning.svg (renamed from src/static/warning.svg)0
-rw-r--r--src/static/shared-util/README.md11
-rw-r--r--src/url-spec.js37
-rw-r--r--src/web-routes.js16
13 files changed, 53 insertions, 23 deletions
diff --git a/src/content/dependencies/generatePageLayout.js b/src/content/dependencies/generatePageLayout.js
index 3bb8b00a..5322950f 100644
--- a/src/content/dependencies/generatePageLayout.js
+++ b/src/content/dependencies/generatePageLayout.js
@@ -596,7 +596,7 @@ export default {
 
             html.tag('link', {
               rel: 'stylesheet',
-              href: to('static.path', 'site.css'),
+              href: to('staticCSS.path', 'site.css'),
             }),
 
             html.tag('style', [
@@ -606,7 +606,7 @@ export default {
             ]),
 
             html.tag('script', {
-              src: to('static.path', 'lazy-loading.js'),
+              src: to('staticJS.path', 'lazy-loading.js'),
             }),
           ]),
 
@@ -636,7 +636,7 @@ export default {
 
               html.tag('script', {
                 type: 'module',
-                src: to('static.path', 'client.js'),
+                src: to('staticJS.path', 'client.js'),
               }),
             ]),
         ])
diff --git a/src/content/dependencies/image.js b/src/content/dependencies/image.js
index 617065fc..22fa2655 100644
--- a/src/content/dependencies/image.js
+++ b/src/content/dependencies/image.js
@@ -170,7 +170,7 @@ export default {
     if (willReveal) {
       reveal = [
         html.tag('img', {class: 'reveal-symbol'},
-          {src: to('static.path', 'warning.svg')}),
+          {src: to('staticMisc.icon', 'warning.svg')}),
 
         html.tag('br'),
 
diff --git a/src/content/dependencies/linkExternalAsIcon.js b/src/content/dependencies/linkExternalAsIcon.js
index 7f5ea432..e2ce4b3c 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('static.icon', iconId),
+            href: to('staticMisc.icon', iconId),
           }),
         ]),
 
diff --git a/src/static/site-basic.css b/src/static/css/site-basic.css
index 586f37b5..586f37b5 100644
--- a/src/static/site-basic.css
+++ b/src/static/css/site-basic.css
diff --git a/src/static/site.css b/src/static/css/site.css
index c23acffb..c23acffb 100644
--- a/src/static/site.css
+++ b/src/static/css/site.css
diff --git a/src/static/client.js b/src/static/js/client.js
index 729836b5..4fadffc4 100644
--- a/src/static/client.js
+++ b/src/static/js/client.js
@@ -6,7 +6,7 @@
 // ephemeral nature.
 
 import {accumulateSum, empty, filterMultipleArrays, stitchArrays}
-  from '../util/sugar.js';
+  from '../shared-util/sugar.js';
 import {fetchWithProgress} from './xhr-util.js';
 
 const clientInfo = window.hsmusicClientInfo = Object.create(null);
diff --git a/src/static/lazy-loading.js b/src/static/js/lazy-loading.js
index 1df56f08..1df56f08 100644
--- a/src/static/lazy-loading.js
+++ b/src/static/js/lazy-loading.js
diff --git a/src/static/xhr-util.js b/src/static/js/xhr-util.js
index 8a43072c..8a43072c 100644
--- a/src/static/xhr-util.js
+++ b/src/static/js/xhr-util.js
diff --git a/src/static/icons.svg b/src/static/misc/icons.svg
index 8c9a80a9..8c9a80a9 100644
--- a/src/static/icons.svg
+++ b/src/static/misc/icons.svg
diff --git a/src/static/warning.svg b/src/static/misc/warning.svg
index 92e55778..92e55778 100644
--- a/src/static/warning.svg
+++ b/src/static/misc/warning.svg
diff --git a/src/static/shared-util/README.md b/src/static/shared-util/README.md
new file mode 100644
index 00000000..92aa77e6
--- /dev/null
+++ b/src/static/shared-util/README.md
@@ -0,0 +1,11 @@
+# `src/static/shared-util`
+
+Module imports under `src/static/js` may appear to be pointing to files that aren't at quite the right place. For example, the import:
+
+    import {empty} from '../shared-util/sugar.js';
+
+...is reading a file that doesn't exist here, under `shared-util`. This isn't an error!
+
+This folder (`src/shared-util`) does not actually exist in a build of the website; instead, the folder `src/util` is symlinked in its place. So, all files under `src/util` are actually available at `/shared-util/` online.
+
+The above import would actually import from the bindings in `src/util/sugar.js`.
diff --git a/src/url-spec.js b/src/url-spec.js
index cafcb0a6..5bc34407 100644
--- a/src/url-spec.js
+++ b/src/url-spec.js
@@ -66,6 +66,29 @@ const urlSpec = {
     paths: genericPaths,
   },
 
+  staticCSS: {
+    prefix: 'static/css/',
+    paths: genericPaths,
+  },
+
+  staticJS: {
+    prefix: 'static/js/',
+    paths: genericPaths,
+  },
+
+  staticMisc: {
+    prefix: 'static/misc/',
+    paths: {
+      ...genericPaths,
+      icon: 'icons.svg#icon-<>',
+    },
+  },
+
+  staticSharedUtil: {
+    prefix: 'static/shared-util/',
+    paths: genericPaths,
+  },
+
   media: {
     prefix: 'media/',
 
@@ -89,20 +112,6 @@ const urlSpec = {
     prefix: 'thumb/',
     paths: genericPaths,
   },
-
-  static: {
-    prefix: 'static/',
-    paths: {
-      ...genericPaths,
-
-      icon: 'icons.svg#icon-<>',
-    },
-  },
-
-  util: {
-    prefix: 'util/',
-    paths: genericPaths,
-  },
 };
 
 // This gets automatically switched in place when working from a baseDirectory,
diff --git a/src/web-routes.js b/src/web-routes.js
index efd86ca1..619d5c62 100644
--- a/src/web-routes.js
+++ b/src/web-routes.js
@@ -16,13 +16,23 @@ function getNodeDependencyRootPath(dependencyName) {
 
 export const stationaryCodeRoutes = [
   {
-    from: path.join(codeSrcPath, 'static'),
-    to: ['static.root'],
+    from: path.join(codeSrcPath, 'static', 'css'),
+    to: ['staticCSS.root'],
+  },
+
+  {
+    from: path.join(codeSrcPath, 'static', 'js'),
+    to: ['staticJS.root'],
+  },
+
+  {
+    from: path.join(codeSrcPath, 'static', 'misc'),
+    to: ['staticMisc.root'],
   },
 
   {
     from: path.join(codeSrcPath, 'util'),
-    to: ['util.root'],
+    to: ['staticSharedUtil.root'],
   },
 ];