-
-
Notifications
You must be signed in to change notification settings - Fork 258
Split export extensions into 2 #706
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. |
Before I set up my babylon environment and test it more thoroughly, I would really appreciate it if someone would look over my code just to make sure that I am doing everything correctly. Thank you! |
@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 babel/babel#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. babylon/src/parser/statement.js Lines 1266 to 1274 in 65bea96
this.hasPlugin("exportExtensions") is split
|
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. |
@hzoo I think this may be a bit above my current skill level. I am going to keep looking through the code, but I don't think that I will be able to solve this issue. Thanks again for the help. |
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. |
This issue has been moved to babel/babel#6678. |
So this is more of a refactor
exportExtensions:
Proposal 1:
export v from "mod"
Proposal 2:
export * as ns from "mod"
Like in babel/babel#6080 except for the babylon plugin.
exportDefault
?exportNamespace
?The text was updated successfully, but these errors were encountered: