astring
astring copied to clipboard
feat: import/export of literal string names
Closes #713
Foreign names can be string literals, like so:
export {m as "m"};
export {n as "n", "o" as o, "p"} from "module";
import {"s" as t} from "module";
This implementation is incomplete. Changing ExportAllDeclaration to support this raised an issue with testing (specifically with acorn-import-attributes), and fixing it would make the PR too large.
I opened this PR over on acorn-import-attributes: https://github.com/xtuc/acorn-import-attributes/pull/36. If it gets merged, I'll implement quoted export-all in this one.
I decided to implement export * as "string" from ..., but not submit a test.
Locally, I added
export * as "q" from "module"; to exports.js, and then ran the test with a patched node_modules/acorn-import-attributes. It passed.