Give the i18n scripts a parser again
TypeScript 7 is the native port: the package ships a `tsc` shim over a Go binary, and `typescript` now exports `version` and `versionMajorMinor` and no compiler API. Every `ts.createSourceFile` in scripts/ has been throwing "Cannot read properties of undefined (reading 'Latest')" since the 5.9.3 → 7.0.2 bump -- four of the five i18n scripts dead, only i18n-extract still running. Nothing noticed because no workflow runs them. The catalogue gate for nine languages has been dark, and the only signal was running it by hand. There is no official TS7 API package (@typescript/ast and @typescript/api are both 404), and the alternative was rewriting 493 lines and 25 distinct AST calls, including the JSX guards, against a different tree -- in tooling with no tests of its own. So `typescript-ast` is an npm alias for the last TypeScript carrying the JS API. It parses; `typescript` still type-checks and builds. Two entries, two jobs, said so in each script so the next reader does not delete one as a leftover. What the gate says now it can speak: catalogues are green and coverage is 100%. The "16 falling back to English" it reports in every locale are placeholders, example domains, a product name, a licence id and the quote glyph -- strings that should stay English. The 41 stale keys per locale are real dead weight and are left for their own change.
This commit is contained in:
@@ -12,7 +12,21 @@
|
||||
* in the file looking correct, is never looked up, and the app renders English
|
||||
* for ever. Nothing warns, because a catalogue is only ever read by key.
|
||||
*/
|
||||
import ts from "typescript";
|
||||
/*
|
||||
* The parser, not the compiler.
|
||||
*
|
||||
* TypeScript 7 is the native port: its package ships a `tsc` shim over a Go
|
||||
* binary and nothing else, so `typescript` now exports `version` and
|
||||
* `versionMajorMinor` and no compiler API at all. Every `ts.createSourceFile`
|
||||
* in this directory started throwing "Cannot read properties of undefined
|
||||
* (reading 'Latest')" the day the bump landed, and nothing noticed, because no
|
||||
* workflow runs these.
|
||||
*
|
||||
* `typescript-ast` is an npm alias for the last TypeScript that carries the JS
|
||||
* API (see package.json). It parses; `typescript` still type-checks and builds.
|
||||
* Two entries, two jobs -- not a version someone forgot to remove.
|
||||
*/
|
||||
import ts from "typescript-ast";
|
||||
import { readFileSync, globSync } from "node:fs";
|
||||
|
||||
const wanted = new Set();
|
||||
|
||||
Reference in New Issue
Block a user