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

[WIP] feat(api/plugins): create plugins api documentation #242

Closed

Conversation

TheLarkInn
Copy link
Member

@TheLarkInn TheLarkInn commented Oct 13, 2016

[WIP] This will be a big one, but I think we might as well get it started. I have fully scanned through the compiler calls for any applyPlugins****() functions, however I'm not 100% sure I have all the correct hooks.

  • Describe the x ways to create a plugin
  • Describe what tapable is, and how it relates to webpack
  • Describe a 'tapable instance'
    • List All Tapable Instances
  • List all hooks for all instances

@TheLarkInn TheLarkInn changed the title feat(api/plugins): create plugins api documentation [WIP] feat(api/plugins): create plugins api documentation Oct 13, 2016
@TheLarkInn
Copy link
Member Author

Part of me wants to separate these in to separate docs now that I'm think about the whole divide and conquer aspect of things, but in regards to the layout of the documentation, it makes sense for these things to all be on one page. @bebraw @jhnns @SpaceK33z Thoughts?

@bebraw
Copy link
Contributor

bebraw commented Oct 13, 2016

api/tapable/factories, api/tapable/templates and so on would work. api/tapable would work as a brief intro (high level view).

@TheLarkInn
Copy link
Member Author

Continuing on my thought dump before I move on to something else for now: I wonder, is there any way that we could generatively find all of the webpack hooks? Like do a lib search for all of the tapable.prorotype protected methods at the least, and mention what file they come from, and then use this to fill in the details (IE: what tapable instance is this, what are the data points called).

@bebraw
Copy link
Contributor

bebraw commented Oct 13, 2016

That sounds reasonable. recast can match the pattern if you can find a nice way to traverse the source (glob would work).

@SpaceK33z
Copy link
Member

SpaceK33z commented Oct 13, 2016

I don't have much experience with building plugins, so can't comment on the specifics. So far I like the structure.

Would it be possible to show an example of a very simple plugin and explain how it works? I think this would help many developers to actually get started quickly without scouting through the whole internet to find a piece of example code :).

@pksjce
Copy link

pksjce commented Oct 13, 2016

Referencing #36 here.

sort: 2
---

**Tapable Instances** are classes in the webpack source code which have been extended or mixed in from class `Tapable`. For more information on `Tapable` visit the [tapable repository](https://github.com/webpack/tapable) or visit the [plugins overview](./plugins#tapable)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I put in Tapable description from #36 here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's fine.

@pksjce
Copy link

pksjce commented Oct 19, 2016

@TheLarkInn - Hey how do I contribute to this PR? You have this in a branch in your fork. I cloned your fork but I have no permission push to your branch. I'm not sure what git flow I should follow here.

@jhnns
Copy link
Member

jhnns commented Oct 19, 2016

I agree with @bebraw 's suggestion on how to structure the content.

  • First overview (How do you write plugins? What is a tapable? How do you hook into the compilation process?)
  • Compiler, MultiCompiler
  • Compilation
  • ContextModuleFactory, NormalModuleFactory, ...
  • Resolver
  • Template, ChunkTemplate, ...

@pksjce
Copy link

pksjce commented Nov 18, 2016

bump @TheLarkInn I would love to take this up.

@TheLarkInn
Copy link
Member Author

Oh hey! @pksjce Thanks for the bump. I literally just started looking into to continuing on this.

@TheLarkInn
Copy link
Member Author

TheLarkInn commented Nov 18, 2016

I was thinking about having this have a sub folder structure @bebraw @jhnns:

/api/plugins (index.md) (contains links to other sections)
/api/plugins/compiler (also has multi compiler)
/api/plugins/compilation 
/api/plugins/module-factories
/api/plugins/parser
/api/plugins/resolver
/api/plugins/template
/api/plugins/dependencies (how to work with, create, add custom dependencies [IE when to use Null and ConstDep, etc, vs create your own, and link back to template]).
/api/plugins/examples

@bebraw
Copy link
Contributor

bebraw commented Nov 18, 2016

The structure looks good to me. I expect you can push some specific content below how tos (or guides) and cross-reference.

@TheLarkInn
Copy link
Member Author

Closing in favor of #361

@TheLarkInn TheLarkInn closed this Nov 18, 2016
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