Skip to content
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

loadLanguages() should work with aliases #1427

Closed
Golmote opened this issue May 25, 2018 · 3 comments · Fixed by #1998
Closed

loadLanguages() should work with aliases #1427

Golmote opened this issue May 25, 2018 · 3 comments · Fixed by #1998

Comments

@Golmote
Copy link
Contributor

Golmote commented May 25, 2018

The loadLanguages() function defined in components/index.js should resolve aliases.

loadLanguages('js');
@mAAdhaTTah
Copy link
Member

mAAdhaTTah commented May 27, 2018

We could limit the complexity a bit if we broke this into two steps:

  1. Generate a list of languages to load based on a provided list of languages and reorder them to ensure peer dependencies are loaded first.
  2. Load the languages.

I suggest this because I built something like step 1 into the babel plugin but it doesn't currently handle peerDependencies or aliases. Step 2 in the babel plugin injects the dependencies into the AST. If we extracted that out to a common function, I could offload that logic to prism itself and share it between loadLanguages and the babel plgin.

@mAAdhaTTah
Copy link
Member

Also, I think implementing that logic would be easier if the aliases were keyed in components.js, so we would add "js": { "alias": "javascript" } and then we know to go look at "javascript": { ... } for details.

@Golmote
Copy link
Contributor Author

Golmote commented May 27, 2018

You're very welcome to start a PR if you want 😉

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

Successfully merging a pull request may close this issue.

2 participants