astring icon indicating copy to clipboard operation
astring copied to clipboard

feat: import/export of literal string names

Open fabiosantoscode opened this issue 1 year ago • 2 comments

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.

fabiosantoscode avatar Sep 17 '24 20:09 fabiosantoscode

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.

fabiosantoscode avatar Sep 18 '24 07:09 fabiosantoscode

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.

fabiosantoscode avatar Sep 18 '24 09:09 fabiosantoscode