diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 23b7c8c..be70f33 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -66,6 +66,12 @@ updates: ] cloudflare: patterns: ["wrangler", "@cloudflare/*"] + # TypeScript 7 (`tsc`) and the TypeScript 6 API that typescript-eslint + # still needs, installed side by side as npm aliases (see package.json). + # Dependabot may not resolve `npm:` aliases — if no PR shows up for a new + # 7.x, bump both by hand. + typescript: + patterns: ["typescript", "@typescript/*"] lint-and-format: patterns: ["eslint*", "@eslint/*", "typescript-eslint", "prettier*", "knip"] build-tooling: @@ -89,8 +95,8 @@ updates: patterns: ["@types/*"] ignore: # Majors land in their own planned release because each one needs a real - # migration (TypeScript 7, Vitest 5 and lucide-react 1 are the current - # examples). Dependabot handles minor + patch. + # migration (Vitest 5 is the current example). Dependabot handles minor + + # patch. - dependency-name: "*" update-types: ["version-update:semver-major"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dae4ab0..ff80563 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,13 @@ jobs: node-version-file: .node-version cache: npm - run: npm ci + # `tsc` must be TypeScript 7 (@typescript/native). The `typescript` alias + # (@typescript/typescript6, the API typescript-eslint loads) pulls in + # TypeScript 6 as @typescript/old, which ships a `tsc` too — npm links the + # first one by path order. Fail loudly if that ever flips, instead of + # silently type-checking with 6. + - name: TypeScript 7 is the `tsc` on PATH + run: ./node_modules/.bin/tsc --version | grep -q '^Version 7\.' # --- correctness ------------------------------------------------------ # `typecheck` covers src/ (what Vite builds); `typecheck:all` adds tests/, diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 2899e2b..0511ddf 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -46,6 +46,7 @@ Used to build, test and check YTDescGen. Not shipped to users. | `@types/node` | 26.6.3 | MIT | | | `@types/react` | 19.3.0 | MIT | | | `@types/react-dom` | 19.3.0 | MIT | | +| `@typescript/typescript6` | 6.0.2 | Apache-2.0 | | | `@vitejs/plugin-react` | 6.1.2 | MIT | | | `@vitest/coverage-v8` | 4.1.11 | MIT | | | `autoprefixer` | 10.6.1 | MIT | | @@ -58,7 +59,7 @@ Used to build, test and check YTDescGen. Not shipped to users. | `prettier-plugin-tailwindcss` | 0.8.1 | MIT | | | `tailwindcss` | 4.3.3 | MIT | | | `tsx` | 4.23.15 | MIT | | -| `typescript` | 5.9.3 | Apache-2.0 | | +| `typescript` | 7.0.2 | Apache-2.0 | | | `typescript-eslint` | 8.71.1 | MIT | | | `vite` | 8.3.4 | MIT | | | `vitest` | 4.1.11 | MIT | | diff --git a/eslint.config.js b/eslint.config.js index 8cdaabd..af61d26 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -1,8 +1,9 @@ import js from "@eslint/js"; +import { defineConfig } from "eslint/config"; import tseslint from "typescript-eslint"; import reactHooks from "eslint-plugin-react-hooks"; -export default tseslint.config( +export default defineConfig( js.configs.recommended, ...tseslint.configs.strict, { diff --git a/package-lock.json b/package-lock.json index 57d4828..53dca3d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -38,6 +38,7 @@ "@types/node": "^26.6.3", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", + "@typescript/native": "npm:typescript@^7.0.2", "@vitejs/plugin-react": "^6.1.2", "@vitest/coverage-v8": "^4.1.11", "autoprefixer": "^10.6.1", @@ -50,7 +51,7 @@ "prettier-plugin-tailwindcss": "^0.8.1", "tailwindcss": "^4.3.3", "tsx": "^4.23.15", - "typescript": "^5.9.3", + "typescript": "npm:@typescript/typescript6@^6.0.2", "typescript-eslint": "^8.71.1", "vite": "^8.3.4", "vitest": "^4.1.11", @@ -5587,6 +5588,397 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript/native": { + "name": "typescript", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/@typescript/old": { + "name": "typescript", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, "node_modules/@vitejs/plugin-react": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.1.2.tgz", @@ -8568,17 +8960,17 @@ } }, "node_modules/typescript": { - "version": "5.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", - "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "name": "@typescript/typescript6", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript6/-/typescript6-6.0.2.tgz", + "integrity": "sha512-mbCddXd+jm7hfx7w2YU64/Av4/NqqeG3GoRZgxPcgoTxYjhrcfJRw9ULch71SS4G+Q3bOXFhRvPqjguN0Hyp5w==", "devOptional": true, "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" + "dependencies": { + "@typescript/old": "npm:typescript@^6" }, - "engines": { - "node": ">=14.17" + "bin": { + "tsc6": "bin/tsc6" } }, "node_modules/typescript-eslint": { diff --git a/package.json b/package.json index f6a314f..8af5c42 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "@types/node": "^26.6.3", "@types/react": "^19.3.0", "@types/react-dom": "^19.3.0", + "@typescript/native": "npm:typescript@^7.0.2", "@vitejs/plugin-react": "^6.1.2", "@vitest/coverage-v8": "^4.1.11", "autoprefixer": "^10.6.1", @@ -79,7 +80,7 @@ "prettier-plugin-tailwindcss": "^0.8.1", "tailwindcss": "^4.3.3", "tsx": "^4.23.15", - "typescript": "^5.9.3", + "typescript": "npm:@typescript/typescript6@^6.0.2", "typescript-eslint": "^8.71.1", "vite": "^8.3.4", "vitest": "^4.1.11", diff --git a/scripts/lib/third-party.ts b/scripts/lib/third-party.ts index 268fa2e..e61f52c 100644 --- a/scripts/lib/third-party.ts +++ b/scripts/lib/third-party.ts @@ -14,6 +14,7 @@ */ import { readFileSync, writeFileSync } from "fs"; import { resolve } from "path"; +import { compareCodeUnits } from "../../src/utils/sort.ts"; const ROOT = resolve(import.meta.dirname, "../.."); const NOTICES = resolve(ROOT, "THIRD_PARTY_NOTICES.md"); @@ -43,6 +44,7 @@ export function licenseAllowed(expression: string): boolean { } interface PackageJson { + name?: string; version?: string; license?: string; homepage?: string; @@ -74,16 +76,21 @@ interface Row { url: string; } -function npmRows(names: string[]): Row[] { - return names.sort().map((name) => { - const pkg = readJson(resolve(ROOT, "node_modules", name, "package.json")); - return { - name, - version: pkg.version ?? "?", - license: pkg.license ?? "UNKNOWN", - url: projectUrl(pkg), - }; - }); +function npmRows(keys: string[]): Row[] { + return keys + .map((key) => { + const pkg = readJson(resolve(ROOT, "node_modules", key, "package.json")); + return { + // An npm alias installs under its key: `"typescript": + // "npm:@typescript/typescript6@…"` puts @typescript/typescript6 in + // node_modules/typescript. Name the package that is really there. + name: pkg.name ?? key, + version: pkg.version ?? "?", + license: pkg.license ?? "UNKNOWN", + url: projectUrl(pkg), + }; + }) + .sort((a, b) => compareCodeUnits(a.name, b.name)); } /** diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index cbea85f..07952ca 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -42,6 +42,9 @@ "android": { "minSdkVersion": 30 }, + "macOS": { + "minimumSystemVersion": "11.0" + }, "windows": { "webviewInstallMode": { "type": "downloadBootstrapper" diff --git a/src/utils/sort.ts b/src/utils/sort.ts new file mode 100644 index 0000000..73ea422 --- /dev/null +++ b/src/utils/sort.ts @@ -0,0 +1,9 @@ +/** + * UTF-16 code-unit order — exactly what a bare `.sort()` does on strings, + * spelled out as a comparator. Unlike `localeCompare` it never depends on the + * runtime's locale, so generated files sort the same on every machine. + */ +export function compareCodeUnits(a: string, b: string): number { + if (a === b) return 0; + return a < b ? -1 : 1; +} diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 58b899f..4f5db5b 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1,9 +1,10 @@ /// /** - * File System Access API — `showSaveFilePicker` is not in TypeScript 5.9's - * `lib.dom`, but `FileSystemFileHandle` and `FileSystemWritableFileStream` are, - * so only the `Window` method needs declaring. + * File System Access API — `showSaveFilePicker` is not in TypeScript's + * `lib.dom` (checked with 7.0), but `FileSystemFileHandle` and + * `FileSystemWritableFileStream` are, so only the `Window` method needs + * declaring. * * Optional on purpose: it is absent in Firefox, Safari and the Android WebView, * and `src/utils/file-ops.ts` feature-detects it before use. diff --git a/tests/utils/uuid.test.ts b/tests/utils/uuid.test.ts index 5039afb..2bb8cf3 100644 --- a/tests/utils/uuid.test.ts +++ b/tests/utils/uuid.test.ts @@ -18,7 +18,7 @@ describe("generateId", () => { // black-screened the app at boot before the fallback existed. const real = globalThis.crypto; vi.stubGlobal("crypto", { - getRandomValues: (a: Uint8Array) => real.getRandomValues(a), + getRandomValues: (a: Uint8Array) => real.getRandomValues(a), }); expect(generateId()).toMatch(V4); }); diff --git a/tsconfig.check.json b/tsconfig.check.json index 12b421a..99ef1dc 100644 --- a/tsconfig.check.json +++ b/tsconfig.check.json @@ -12,7 +12,12 @@ // the global scope; without this they are undeclared identifiers here. // `node` covers the `fs`/`path`/`process` use in scripts/ — the app bundle // never sees these, which is why the base config leaves them out. - "types": ["vitest/globals", "node"] + "types": ["vitest/globals", "node"], + // tests/, scripts/ and build-plugins/ run on Node 26 and worker/ on + // workerd, so they may use the newer built-ins the app's browser floor + // keeps out of tsconfig.json. src/ is still held to that floor by + // `npm run typecheck`. + "lib": ["ES2025", "DOM"] }, "include": ["src", "tests", "scripts", "worker", "build-plugins"] } diff --git a/tsconfig.json b/tsconfig.json index cd6b75a..ce02d16 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,25 @@ { "compilerOptions": { - "target": "ES2020", - "lib": ["ES2020", "DOM", "DOM.Iterable"], + // The newest ECMAScript year that TypeScript 7.0, esbuild (tsx, wrangler) + // and Vite all understand. ES2026 arrives with TypeScript 7.1. + "target": "ES2025", + // `lib` is the runtime floor, not the syntax target. Vite lowers syntax but + // never polyfills, so a built-in typed here must exist in every engine the + // app supports: Vite's `baseline-widely-available` — Chrome 111, Safari + // 16.4, Firefox 114 (ES2023's copy-array methods need Firefox 115). Raise it + // when that floor moves. Code that runs on Node or workerd gets the newer + // lib in tsconfig.check.json. + "lib": ["ES2022", "DOM"], + // TypeScript 6+ no longer loads every installed @types package. The app + // needs none: `vite/client` comes in through src/vite-env.d.ts. + "types": [], "module": "ESNext", "skipLibCheck": true, "moduleResolution": "bundler", "allowImportingTsExtensions": true, "isolatedModules": true, + "verbatimModuleSyntax": true, + "erasableSyntaxOnly": true, "moduleDetection": "force", "noEmit": true, "jsx": "react-jsx", @@ -17,7 +30,6 @@ "noUncheckedIndexedAccess": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, - "baseUrl": ".", "paths": { "@/*": ["./src/*"], "@config/*": ["./src/config/*"], diff --git a/vite.config.ts b/vite.config.ts index beb71ee..d8a37d2 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -40,14 +40,13 @@ export default defineConfig({ watch: { ignored: ["**/src-tauri/**", "**/.wrangler/**"] }, }, build: { - // Tauri ships the *system* WebView. On Android that can be an old, frozen - // Chromium (e.g. some emulator system images sit at ~91 until the user - // updates Android System WebView), which chokes on Vite's modern default - // target and renders a blank/black screen. Downlevel the bundle for Tauri - // builds so it runs on those older WebViews; the web build keeps Vite's - // modern default. Desktop WebViews are evergreen, so a lower - // target is a harmless no-op there. - target: isTauri ? "es2020" : undefined, + // No `target`: the web and Tauri builds share Vite's default, + // `baseline-widely-available` (Chrome 111, Safari 16.4, Firefox 114), which + // is also the floor tsconfig.json's `lib` holds the app to. Tauri builds + // used to be lowered to es2020 for frozen ~91 Android System WebViews, but + // the stylesheet's cascade layers already need Chromium 99+ / Safari 15.4+, + // so such a WebView rendered the app unstyled either way. + // // Never inline assets as data: URIs — the Tauri CSP only allows 'self' // for images and fonts, so an inlined icon would silently fail there. assetsInlineLimit: 0,