Skip to content

javascript: functions and arrows in a .vue <script setup> are not recorded, so the calls inside them have no caller #1778

Closed

Description

@swapnilpaliwal-sd

Symptom: in a JavaScript repository, a function or arrow declared inside a .vue <script setup> is not recorded: the component has only <module>, and the calls in those bodies have no caller. impact on the called function shows no users (not even text rows). An earlier engine resolved them. On a real Vue app the JavaScript graph drops from 477 to 144 call sites and from 101 to 20 .vue methods.

Repro

package.json:            {"name":"s"}
src/lib.js:              export function a1() {}  export function a2() {}
src/ScriptFirst.vue:     <script setup>
                         import { a1, a2 } from "./lib.js";
                         const f = () => { a1(); };
                         function g() { a2(); }
                         </script>

axiomcode index, then axiomcode impact a1 / impact a2.

Expected: ScriptFirst.vue:3 and :4 [resolved] (as the earlier engine gives).
Actual: "directly touches it: nothing the graph can see"; methods holds only <module> for the .vue file. Same with <template> before <script>.

Activity

  1. swapnilpaliwal-sd commented on Sep 29, 2026

    @swapnilpaliwal-sd
    ContributorAuthor

    Already fixed on the latest 0.1.9 by #1765 (read a .vue component once, as its virtual script).

    Repro from the issue (src/lib.js, src/ScriptFirst.vue, plus a <template>-first TemplateFirst.vue), axiomcode index then:

    $ axiomcode impact a1 --grep
    src/ScriptFirst.vue:3: const f = () => { a1(); };  [resolved]
    src/TemplateFirst.vue:4: const f = () => { a1(); };  [resolved]
    verified: ✓ (2 edge(s) looked up again)
    $ axiomcode impact a2 --grep
    src/ScriptFirst.vue:4: function g() { a2(); }  [resolved]
    src/TemplateFirst.vue:5: function g() { a2(); }  [resolved]
    verified: ✓ (2 edge(s) looked up again)
    

    The build just before #1765 still prints "nothing the graph can see" for both. On a real Vue app: before #1765 there are 109 call sites and 20 .vue methods; on the latest build there are 384 and 101.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingengineResolution / call-graph engine rulesjavascriptJavaScript

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions