magicast icon indicating copy to clipboard operation
magicast copied to clipboard

Parse Re-exporting / Aggregating exports.

Open tcK1 opened this issue 2 years ago • 1 comments

Environment

magicast: 0.2.3 Node: v16.17.0

Reproduction

Codesandbox.

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

tcK1 avatar Apr 10 '23 09:04 tcK1

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

zoeyzhao19 avatar Jun 28 '23 07:06 zoeyzhao19