Regexes with super-linear backtracking (S8786 x16) are rewritten to stay linear on long runs; each new pattern gives the same results as the old one on 150k-450k fuzzed inputs (except where noted) and finishes adversarial 50k-character inputs in under 3 ms: - tag-generator QUALIFIER_SUFFIX_RE starts just before a `:`/space run (`(^|[^:\s])…` + "$1"), never inside one - timeline-parser matches `line.trimEnd()` with a greedy label, and renders with trimEnd(); cleanCpuName collapses whitespace before the patterns - editor-store endings, Google Play urlPattern (lookahead for `id=`), channel-phrase punctuation, SPDX OR/AND split, legal-docs slug and link stripping (link text/URL may not contain `[`), base64url padding, and a loop for trailing slashes in the worker router Others: - S2871: sorts take the shared code-unit comparator (same order as before; THIRD_PARTY_NOTICES is unchanged) - S4822: ErrorBoundary catches the logger import with .catch(), which a try/catch never could - S3516: migrateProfilesState returns a new object - S7773: Number.parseInt (x10) - S9379: Modal takes an initialFocusRef (Radix onOpenAutoFocus), so the shortcut search box gets focus without an autoFocus attribute - S2245: generateId drops the Math.random fallback; getRandomValues exists everywhere the app runs, and a non-random ID is worse than an error - S4036: NOSONAR on the dev script's `git` call (PATH lookup by design) - S6505/S8543: every workflow installs with `npm ci --ignore-scripts`, and CI runs `npm run cf:check` instead of `npx wrangler …` - S6358: Android sets allowBackup="false" — app data is no longer copied to Google Drive backups; Backup & Restore moves it to a new phone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
791 B
TypeScript
23 lines
791 B
TypeScript
import { readFileSync } from "fs";
|
|
import { resolve } from "path";
|
|
import { compareCodeUnits } from "@utils/sort";
|
|
|
|
interface LocaleSchema {
|
|
ui: Record<string, string[]>;
|
|
templates: Record<string, string[]>;
|
|
}
|
|
|
|
/**
|
|
* `src/i18n/locales/_schema.json` — every leaf key, listed under its parent
|
|
* path. `validate:locales` holds all eight locales to it, so a key checked
|
|
* here is a key every locale has.
|
|
*/
|
|
export const LOCALE_SCHEMA = JSON.parse(
|
|
readFileSync(resolve("src/i18n/locales/_schema.json"), "utf8"),
|
|
) as LocaleSchema;
|
|
|
|
/** The leaf keys under one parent path, sorted; empty when the path is missing. */
|
|
export function schemaKeys(namespace: keyof LocaleSchema, parent: string): string[] {
|
|
return [...(LOCALE_SCHEMA[namespace][parent] ?? [])].sort(compareCodeUnits);
|
|
}
|