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

What are peer dependencies? #1490

Closed
RunDevelopment opened this issue Jul 20, 2018 · 10 comments · Fixed by #2141
Closed

What are peer dependencies? #1490

RunDevelopment opened this issue Jul 20, 2018 · 10 comments · Fixed by #2141

Comments

@RunDevelopment
Copy link
Member

In components.json I came across peerDependencies. What are they?

(Is there a doc for components.json?)

@mAAdhaTTah
Copy link
Member

peerDependencies were added here: #1417 – They're components that are modified by the component when it's added. e.g. if markup is present when css gets added, markup is modified by css to highlight <style> tag contents.

There is no doc for components.json at this time.

@RunDevelopment
Copy link
Member Author

They're components that are modified by the component when it's added.

That being the case, one would expect, that e.g. markup has to be loaded before css, right? Because otherwise css cannot modify markup.
But when you move css above markup in components.json, css will be loaded first when downloading prism.js. No nice <style> tag.

Peer dependencies don't do anything for the download page, so what do they do?

@mAAdhaTTah
Copy link
Member

They're currently used by loadComponents in Node to ensure the require.cache is cleared as expected. That's a good idea, use peerDeps for download page as well as the babel plugin.

@RunDevelopment
Copy link
Member Author

RunDevelopment commented Jul 20, 2018

I'm currently implementing #1475, so I have a lot of peer dependencies.
When will this be ready, or should I try implementing it myself? (I don't know about babel though.)

(Just out of curiosity: Is there anything checking that there are no circular dependencies? ...apart from a stack overflow?)

@RunDevelopment
Copy link
Member Author

I went ahead and fixed the download page.
Babel is still an open issue but I don't have any experience working with it.

@RunDevelopment
Copy link
Member Author

I found an other issue related to peer dependencies:

The Test Drive page doesn't handle peer dependencies at all. This is very similar to the problem #1417 solved.

@mAAdhaTTah
Copy link
Member

Babel is still an open issue but I don't have any experience working with it.

You might be able to tackle it if you'd like. I opened an issue here: mAAdhaTTah/babel-plugin-prismjs#3

The logic is all really here: https://github.com/mAAdhaTTah/babel-plugin-prismjs/blob/master/src/getComponents.js and none of it is babel-specific. It just products an array of component paths, which is used by the babel-specific logic to update the file.

@RunDevelopment
Copy link
Member Author

RunDevelopment commented Jul 21, 2018

On an unrelated note:
I really have to say that renaming components to config is very confusing... Among other things...

But I'll try.

@mAAdhaTTah
Copy link
Member

If you mean in the babel plugin, you can change that if you'd like. You can post your questions in that issue if you need help.

@RunDevelopment
Copy link
Member Author

Thank you very much.
ES6 isn't a very common sight for me so it takes some time to get used to, but I get it now.

However, I have to say that I am shocked by the lack of strict indentation conventions ;)

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