refactor(astro): replace tsconfck with get-tsconfig#16433
refactor(astro): replace tsconfck with get-tsconfig#16433ocavue wants to merge 9 commits intowithastro:mainfrom
Conversation
|
485c17f to
87dd769
Compare
d9ddf6f to
a2c55af
Compare
| compilerOptions?: StripEnums<CompilerOptions>; | ||
| compileOnSave?: boolean; | ||
| extends?: string; | ||
| extends?: string | string[]; |
There was a problem hiding this comment.
Note for reviewers:
extends can be an array since TS 5.0
| */ | ||
| export async function loadTSConfig( | ||
| root: string | undefined, | ||
| findUp = false, |
There was a problem hiding this comment.
Note for reviewers:
findUp is never passed; it was always false. I removed findUp in this PR.
| tsconfigFile: normalize(resolved.path), | ||
| tsconfig: resolved.config satisfies TSConfig, | ||
| rawConfig, | ||
| sources: (resolved.sources || [resolved.path]).map(normalize), |
There was a problem hiding this comment.
Note for reviewers:
Here I use normalize to return the backward slash \ on Windows. This aligns with the previous behavior. I don't see any issue with returning / on Windows, but it's good to be cautious just in case.
75707a9 to
ceb6749
Compare
ceb6749 to
330a927
Compare
There was a problem hiding this comment.
If there's no user facing change, we can skip the changeset
There was a problem hiding this comment.
deleted the changeset file
delucis
left a comment
There was a problem hiding this comment.
@ocavue Did you investigate the option of using the rolldown utilities as suggested in the tsconfck issue: dominikg/tsconfck#240? The issue links Vite’s PR where they did this: vitejs/vite#21577.
That would have to be against next where we have Vite 8 + Rolldown available but could be worth doing to avoid the extra dep. (If it covers everything we need — I haven’t looked yet, but I had it on my todo list.)
|
That's also on my todo list. I will check it out. |
|
I have two concerns about reusing this API in Astro:
|
There was a problem hiding this comment.
IA with #16433 (comment) I feel IMHO this change should be blocked until there is a clear more direction from the vite team.
## Summary - resolves TypeScript from 5.9.2 to 5.9.3 in `pnpm-lock.yaml` - keeps the existing `package.json` range on TypeScript 5 so Astro tooling remains inside its declared peer dependency support ## Why not TypeScript 6 yet? TypeScript 6 is the npm latest, but it is a real migration release rather than a routine patch update. The TypeScript 6 notes call out changed compiler defaults, root directory behavior, stricter side-effect import handling, deprecated options, and other migration concerns. Astro support is also still catching up: - withastro/astro#16112 tracks `@astrojs/check@0.9.8` still requiring `typescript@^5.0.0`. - withastro/astro#16385 tracks Astro still depending on `tsconfck`, which also declares `typescript@^5.0.0` and is being discontinued. - withastro/astro#16433 is the open upstream PR to replace `tsconfck` with `get-tsconfig`; it is not merged yet. Keeping this PR to TypeScript 5.9.3 gets the latest supported 5.x patch without opting into peer dependency overrides or upstream compatibility assumptions. ## Validation - `mise exec -- corepack pnpm install --frozen-lockfile` - `mise exec -- corepack pnpm test -- --run` - `mise exec -- corepack pnpm format:check` - `mise run build`
|
i think it makes sense for vite to expose it and started a feature request here |
Summary
Replaces the discontinued
tsconfckdependency withget-tsconfig@5.0.0-beta.4andjsonc-parser. This is a step forward to support TS 6.0 astsconfckdoesn't support TS 6 in its peerDep.Closes #16385
Why beta
I need to use
get-tsconfigv5 beta instead of the v4 stable becauseget-tsconfigv4 leaks a feature that resolves all extended file paths for the purpose of dev server watch files (see privatenumber/get-tsconfig#119).If astro team doesn't want to ship a beta dependency, we can wait for the
get-tsconfigv5 stable.What's changed
jsonc-parserto parse the raw tsconfig fileget-tsconfigto resolve the tsconfig (i.e., mergeextends) and get a list of all files fromextends.'unknown-error'error typeNotes for maintainers
get-tsconfigis pinned to exactly5.0.0-beta.4(no caret).jsonc-parseris added as a direct dep. It was already transitively present via Vite, so no new bytes on disk.Test
Docs
Changeset added.