mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Merge remote-tracking branch 'origin/main' into pr/wildlife-sightings
This commit is contained in:
commit
bd99000433
44 files changed
+1420
-139
No files matched your search
@@ -12,6 +12,9 @@ const INDEX_HTML = path.join(REPO_ROOT, 'index.html');
|
||||
/** The glyph written as element text: `<span class="material-symbols-outlined">radar</span>`. */
|
||||
const SPAN_TEXT =
|
||||
/class="[^"]*material-symbols-outlined[^"]*"[^>]*>\s*([a-z0-9_]+)\s*</g;
|
||||
/** A glyph chosen in a Vue template: `<span class="material-symbols-outlined">{{ a ? 'x' : 'y' }}</span>`. */
|
||||
const SPAN_MUSTACHE =
|
||||
/class="[^"]*material-symbols-outlined[^"]*"[^>]*>\s*\{\{([^}]{0,400})\}\}\s*</g;
|
||||
/** A whole `textContent =` statement, across lines, so a multi-line ternary is read once. */
|
||||
const TEXT_ASSIGNMENT = /(?:textContent|innerText)\s*=\s*([^;]{0,400})/gs;
|
||||
const STRING_LITERAL = /['"`]([a-z0-9_]{2,})['"`]/g;
|
||||
@@ -67,7 +70,24 @@ function referencedGlyphs() {
|
||||
};
|
||||
for (const match of source.matchAll(SPAN_TEXT)) add(match[1]);
|
||||
for (const match of source.matchAll(ICON_PROPERTY)) add(match[1]);
|
||||
for (const match of source.matchAll(TEXT_ASSIGNMENT)) {
|
||||
// A template glyph bound to a computed (`{{ entryIcon }}`) is whatever
|
||||
// that computed returns.
|
||||
for (const [, expression] of source.matchAll(SPAN_MUSTACHE)) {
|
||||
const name = /^\s*([A-Za-z_$][\w$]*)\s*$/.exec(expression)?.[1];
|
||||
if (!name) continue;
|
||||
const body = new RegExp(
|
||||
`\\b${name}\\s*=\\s*computed\\(\\(\\)\\s*=>\\s*\\{([\\s\\S]{0,600}?)\\n\\}\\);`,
|
||||
).exec(source)?.[1];
|
||||
for (const literal of body?.matchAll(
|
||||
/\breturn\s+['"`]([a-z0-9_]{2,})['"`]/g,
|
||||
) ?? [])
|
||||
add(literal[1]);
|
||||
}
|
||||
const expressions = [
|
||||
...source.matchAll(TEXT_ASSIGNMENT),
|
||||
...source.matchAll(SPAN_MUSTACHE),
|
||||
];
|
||||
for (const match of expressions) {
|
||||
const statement = match[1].replaceAll('?.', '.');
|
||||
const assigned = statement.includes('?')
|
||||
? statement.slice(statement.indexOf('?') + 1)
|
||||
|
||||
Reference in new issue
Block a user