Skip to content

generate package in presetPluginConfigs (fixes #1365) - #1411

Merged
Daniel15 merged 4 commits into
babel:masterfrom
VictorHom:pr/pluginconfig_package
Oct 20, 2017
Merged

Daniel15 merged 4 commits into
babel:masterfrom
VictorHom:pr/pluginconfig_package

Conversation

@VictorHom

Copy link
Copy Markdown
Contributor

The issue presented in #1365 asks to delete the package key from presetPluginConfigs

@Daniel15
I'm not sure if that was the exact task to be done or if there is something more here. Checking js/repl/ReplOptions.js, it looks like the presetPluginConfig needs the package key in order for http://babeljs.io/repl/# page to handle its state.

Currently I just deleted the hardcoded package key and generated after the object is created, so that the package key is still used in ReplOptions.js

Happy to help on the issue in any way I can :)

@VictorHom VictorHom changed the title generate package instead of hardcode (fixes #1365) generate package in presetPluginConfigs (fixes #1365) Oct 7, 2017
@babel-bot

babel-bot commented Oct 7, 2017 •

Copy link
Copy Markdown
Collaborator

@Daniel15

Daniel15 commented Oct 7, 2017

Copy link
Copy Markdown
Member

This is close. You don't need to set config.package at all. Instead, modify the code that uses it to instead use config.label.

@VictorHom

Copy link
Copy Markdown
Contributor Author

@Daniel15 another question - was the intention to remove all package key from other configs in PluginConfig.js or just from presetPluginConfigs?

right now, I have it replUtils to still check the package key because pluginConfig is still using package key. (https://github.com/babel/website/blob/master/js/repl/ReplOptions.js#L118)

@VictorHom

Copy link
Copy Markdown
Contributor Author

@Daniel15 - just wanted to bring this back up and see what your thoughts are on this. thanks :)

@Daniel15

Copy link
Copy Markdown
Member

Sorry for the delay, I've been super busy recently. This looks good to me. @bvaughn what do you think?

@bvaughn

bvaughn commented Oct 15, 2017

Copy link
Copy Markdown
Contributor

I dunno. This looks like a clean-up task you filed, @Daniel15 ? 😄

That being said, if we are just assuming the plugin is "babel-preset-" + label, then I would expect to see us concatenating those strings somewhere here rather than just doing package || label.

Also I think this change will break the serialized/local-storage settings for the REPL since it would cause a mismatch.

@hzoo

hzoo commented Oct 15, 2017 •

Copy link
Copy Markdown
Member

I think the hardcoding is fine, and actually I guess this would break when we use scoped packages like @babel/core or something, unless we add that logic too?

@bvaughn

bvaughn commented Oct 15, 2017

Copy link
Copy Markdown
Contributor

I guess I didn't see the original code as problematic so I'm not sure what the motivation is. 😄

@VictorHom

Copy link
Copy Markdown
Contributor Author

I don't have a strong take on this. If this isn't the right fix, I can close.

Was just trying to get a feel for the repo through working on an issue 😄

@Daniel15

Copy link
Copy Markdown
Member

I'm not sure what the motivation is.

To remove duplication :)

I tested it and old URLs still seem to work fine, so let's do it.

@Daniel15
Daniel15 merged commit f34ae22 into babel:master Oct 20, 2017
@VictorHom
VictorHom deleted the pr/pluginconfig_package branch October 20, 2017 19:10
@bvaughn

bvaughn commented Oct 20, 2017 •

Copy link
Copy Markdown
Contributor

I'm not sure what the motivation is.

To remove duplication :)

At the cost of added complexity.

That isn't an obvious win to me. 😄

Edit This isn't to say that it's a bad change, I just thought the code was fine before too. The amount of duplication was trivial.

@hzoo

hzoo commented Oct 20, 2017

Copy link
Copy Markdown
Member

^ this won't be the same next release since we moved to scoped like I since earlier babel/babel#6495 😄

@Daniel15

Daniel15 commented Oct 20, 2017 •

Copy link
Copy Markdown
Member

@hzoo - The plugins are all in babel-standalone, so changing the package name likely won't affect anything. We don't actually use the npm package name anywhere in the REPL.

At the cost of added complexity.

I don't think we actually care about the package name in the REPL at the moment, so IMO it's not worth caring about it in the REPL code at this point in time. Maybe in the future we should add it again if we need it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants