fix(extraction): index CommonJS export assignments as functions (#1675) (#1771)

`exports.getItems = async (req, res) => {…}` and `module.exports.x =
function () {…}` — the Express controller style — produced no symbol: the
arrow's parent is an assignment, not a declarator, so it stayed anonymous,
its calls attributed to the file, and `node`/`callers` answered "Symbol
not found" for a route-wired handler. Resolve the name from the export
property, mark it exported, in both the wasm walker and the kernel.

Co-authored-by: danusha2345 <ewidusoc498@gmail.com>
Co-authored-by: Colby McHenry <colbymchenry@users.noreply.github.com>
This commit is contained in:
Colby Mchenry
2026-09-08 09:37:20 -05:00
committed by GitHub
co-authored by danusha2345 Colby McHenry
parent 3adf06772b
commit 43271f3cd3
5 changed files with 153 additions and 3 deletions
@@ -74,6 +74,11 @@ export default {
},
};
// --- CommonJS export assignments (#1675) -----------------------------------
exports.getItems = async (req, res) => { res.json(await findItems()); };
module.exports.deleteItem = function (req, res) { removeItem(req.params.id); res.end(); };
exports.plain = 42;
handlers.onSave = () => { persist(); };
// --- call-expression receivers (#1683) ----------------------------------------
function bucketChains(d, k, v) {
d.setdefault(k, []).append(v);