magicast
magicast copied to clipboard
Parse Re-exporting / Aggregating exports.
Environment
magicast: 0.2.3
Node: v16.17.0
Reproduction
import { parseModule } from "magicast";
const mod = parseModule(`
export { default as function1, function2 } from "bar.js";
export { default } from "foo.js";
export { x } from "mod";
export { x as v } from "mod";
export * as ns from "mod";
`);
Describe the bug
Not sure if it's a bug or a feature request, but re-exporting files are not being "indexed" as neither imports nor exports. For reference, es-module-lexer parses them as imports.
I took the examples from MDN.
Additional context
No response
Logs
No response
Both mod.import and mod.exports are proxied, If you want to check the output, you would need to wrap it like
console.log(JSON.stringify(mod.imports, null, 2))
But you would still see empty result as magicast does not handle import/export from external resources