fix(resolution): Vue, Svelte and Astro calls follow the JS/TS rules
Problem
Refs in .vue, .svelte and .astro files carry language vue/svelte/astro, so the JS/TS resolution rules from #2120 skipped them. On halo, t('…') from useI18n() linked to an interface property t (562 made-up callers) and ref(…) from vue to an unrelated local ref (523).
Adding those languages alone exposed a weakness in how #2120 decides a binding is "from outside the repo": it treated any import the resolver couldn't place as outside. That also misclassified SvelteKit's $lib/…, a nested Nuxt app's ~/… and per-app @/… aliases. Calls to those bindings dropped in .ts files too, since #2120.
Change
-
JS_FAMILYincludesvue,svelte,astro. -
"Outside the repository" now means one of:
- a package declared by the importing file's
package.jsonchain (dependencies/dev/peer/optional) or by a Denodeno.json(c)import map entry that points atjsr:/npm:/ a URL; - a Node built-in,
node:/bun:/jsr:/npm:/ URL specifiers, or@std/…; - SvelteKit
$app/$envor Astroastro:…, unless the repository is that framework.
An unknown alias stays project code.
workspace:/file:/link:/portal:dependencies are in-repo. - a package declared by the importing file's
-
SFC files get the JS built-ins list (
fetch,Error,Map, …). A file's own import of a built-in's name (import Map from './Map.svelte') is the import, for TS too. -
Untyped 3-segment chains (
api.groupReports.getAll()) keep resolving in SFCs. The TS/JS guard from #1862 stays TS/JS-only. In the Vue repos these edges reached their API client class ~66 times against ~10 wrong.
Measured (wasm, main vs this branch, every loss/gain classified by source line)
| repo | edges | notes |
|---|---|---|
| halo | −1153 / +25 | −562 t, −523 ref, cross-component locals; gains are per-app @/ imports in .ts |
| element-plus | −162 / +0 | dayjs/lodash/@vueuse → props & test mocks, cross-component locals |
| mealie | −38 / +3 | new Error() → an enum member; destructured-composable calls (same as TS today) |
| kit | −15 / +230 | new Error → a +page.svelte; gains: kit's own $app/server etc. (repo is SvelteKit) |
| shadcn-svelte | −3 / +14 | $lib/… calls in .ts restored |
| svelte.dev | −17 / +23 | new Map() → a Map.svelte component; $lib gains |
| elk, astrowind, starlight | ≤15 | built-in confirm/props |
| excalidraw, trpc, bulletproof-react, hono, zod, typeorm, react-redux-realworld, axios | 0 / ≤1 | unchanged |
Every arm's init exited 0.
Follow-ups found on the way, tracked separately: a non-exported ES-module binding (kit's if (DEV) { const fetch }) is still reachable from other files. And const { f } = useX() doesn't reach the f inside useX, for TS as well as SFCs.
Tests
__tests__/js-member-guessing.test.ts adds Vue/Svelte/nested-app/Deno/workspace/Map cases. It fails on main. The full suite passes (5574).
🤖 Generated with Claude Code