Merge pull request #328 from Coffey-Labs/i18n-scripts-typescript7

Give the i18n scripts a parser again
This commit is contained in:
jcoffey
2026-09-10 14:24:06 -07:00
committed by GitHub
7 changed files with 94 additions and 7 deletions
+17 -1
View File
@@ -14,7 +14,8 @@
], ],
"devDependencies": { "devDependencies": {
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"typescript": "^7.0.2" "typescript": "^7.0.2",
"typescript-ast": "npm:typescript@^5.9.3"
}, },
"engines": { "engines": {
"node": ">=20.19" "node": ">=20.19"
@@ -2777,6 +2778,21 @@
"@typescript/typescript-win32-x64": "7.0.2" "@typescript/typescript-win32-x64": "7.0.2"
} }
}, },
"node_modules/typescript-ast": {
"name": "typescript",
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "8.9.0", "version": "8.9.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
+2 -1
View File
@@ -28,6 +28,7 @@
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^9.1.2", "concurrently": "^9.1.2",
"typescript": "^7.0.2" "typescript": "^7.0.2",
"typescript-ast": "npm:typescript@^5.9.3"
} }
} }
+15 -1
View File
@@ -12,7 +12,21 @@
* in the file looking correct, is never looked up, and the app renders English * 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. * 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"; import { readFileSync, globSync } from "node:fs";
const wanted = new Set(); const wanted = new Set();
+15 -1
View File
@@ -11,7 +11,21 @@
* exits non-zero only with --check, so CI can be told to fail on regressions * exits non-zero only with --check, so CI can be told to fail on regressions
* later, once the number is low enough for that to mean something. * later, once the number is low enough for that to mean something.
*/ */
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"; import { readFileSync, globSync } from "node:fs";
/** Attributes a person reads. `className` and `key` are not among them. */ /** Attributes a person reads. `className` and `key` are not among them. */
+15 -1
View File
@@ -12,7 +12,21 @@
* node scripts/i18n-extract.mjs <file...> rewrite in place * node scripts/i18n-extract.mjs <file...> rewrite in place
* node scripts/i18n-extract.mjs --dry <file...> * node scripts/i18n-extract.mjs --dry <file...>
*/ */
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, writeFileSync } from "node:fs"; import { readFileSync, writeFileSync } from "node:fs";
const ATTRS = new Set(["title", "aria-label", "placeholder", "alt", "label", "hint", "confirmLabel", "description"]); const ATTRS = new Set(["title", "aria-label", "placeholder", "alt", "label", "hint", "confirmLabel", "description"]);
+15 -1
View File
@@ -18,7 +18,21 @@
* string that is neither -- one no catalogue has a key for, which therefore * string that is neither -- one no catalogue has a key for, which therefore
* cannot be translated at all, however many languages ship. * cannot be translated at all, however many languages ship.
*/ */
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"; import { readFileSync, globSync } from "node:fs";
/* Where a string literal in this position is shown to somebody. */ /* Where a string literal in this position is shown to somebody. */
+15 -1
View File
@@ -9,7 +9,21 @@
* exists is dead weight, but a call with no key is an untranslated string * exists is dead weight, but a call with no key is an untranslated string
* nobody noticed. * nobody noticed.
*/ */
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"; import { readFileSync, globSync } from "node:fs";
const strings = new Set(); const strings = new Set();