-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split export extensions into 2 #6678
Comments
Would like to work on this ! |
Hi I would like to help with this.👍 |
I am not sure how far above my level this is, but I would like to give it a shot. @hzoo just so I understand correctly, What this is trying to do is change something like this: export default () => {
throw new Error('test');
}; Out: Error: test
at exports.default into something like this: let baz = () => {
throw new Error('test');
};
export default baz; Out: Error: test
at baz |
@pudility sounds good, but do you mind if we check if @rajikaimal has made any progress first (just want to make sure they didn't make a bunch of effort on it)? @rajikaimal friendly ping! :) |
Definitely, how should we check? |
Just see if he responds. If not by tomorrow, I'd say go for it. |
Great! Will do. |
@pudility just to be clear, this task is to split up the Check out the link to CONTRIBUTING in the original post by @hzoo for info on adding a new plugin. The Babel side of this was completed in #6080 (but we'll probably need to follow up with two different syntax-enabling plugins once this work is done). |
So the thing I made already exists, but what still needs to be made is something for exportNamespaces? For example, something like this: exports.hello = () => {} |
@pudility this task is a refactor; there is no behavior to implement - we need to split the logic. |
Alright, I think I understand. The only thing I am still confused on is what it needs to be split into. Do you mean that it should be accessible from two different |
exportextensions used to be 1 proposal and now its 2. export-default-from babel/proposals#17 they are independent and at different stages so we should split them up. you just need to change |
Ok, thank you so much for explaining, I now get it. I will give it a shot, but I am not quite sure if I will be able to do it fully. |
It should be as simple as using two separate plugin strings. Right now, we have one string ( |
Oh, Thats simpler than I thought. I just added that, I will update the docs and then create a PR. Thanks so much @jridgewell ! |
So I have modified the code to now look like this: parseExport(node: N.Node): N.Node {
// export * from '...'
if (this.shouldParseExportStar()) {
this.parseExportStar(node, (
this.hasPlugin("exportDefault") ||
this.hasPlugin("exportNamespace")
));
if (node.type === "ExportAllDeclaration") return node;
} else if (this.hasPlugin("exportDefault")) { and I replace export-expressions with 4223 passed
3 failed
112 skipped
index › experimental/export default/default
/Users/zoe/Developer/babylon/split-export/babylon/test/helpers/runFixtureTests.js:21
20: name + "/" + task.actual.filename + ": " + err.message;
21: t.fail(message);
22: }
experimental/export-default/default/actual.js: Unexpected token, expected { (1:7) plus two almost identical errors: Thank you all so much for helping me create my first real contribution to Babylon, I really like getting to learn the process for all of this stuff. |
So this is more of a refactor
exportExtensions:
Proposal 1:
export v from "mod"
Proposal 2:
export * as ns from "mod"
Like in #6080 except for the babylon plugin.
exportDefault
?exportNamespace
?The text was updated successfully, but these errors were encountered: