aboutsummaryrefslogtreecommitdiffstats
path: root/config/webpack/utils/scripts.js
diff options
context:
space:
mode:
Diffstat (limited to 'config/webpack/utils/scripts.js')
-rw-r--r--config/webpack/utils/scripts.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/config/webpack/utils/scripts.js b/config/webpack/utils/scripts.js
index af58e0a..d5a0cdc 100644
--- a/config/webpack/utils/scripts.js
+++ b/config/webpack/utils/scripts.js
@@ -1,10 +1,18 @@
-import path from "path";
import fs from "fs";
+import path from "path";
+/**
+ * Reads `src/scripts.json` and re-indexes it so the outer key is the
+ * URL path fragment and the inner key is the script type. This makes it
+ * trivial to look up which scripts run on which page.
+ *
+ * @returns {Record<string, Record<string, string[]>>} e.g.
+ * `{ "*": { "injected": ["stop-blocking.ts"] }, "MuteApplication.action": … }`
+ */
const scripts = JSON.parse(
fs.readFileSync(
- path.resolve("./src/scripts.json"),
- ),
+ path.resolve("./src/scripts.json")
+ )
);
const formattedScripts = {};