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

Plugin feature #27

Closed
h13i32maru opened this issue Jul 12, 2015 · 4 comments
Closed

Plugin feature #27

h13i32maru opened this issue Jul 12, 2015 · 4 comments

Comments

@h13i32maru
Copy link
Member

@h13i32maru h13i32maru commented Jul 12, 2015

Plugin provides some hook point. And users can customize data at hook points.

  • after reading config file, and customize config object.
  • after reading source code file, and customize source code.
  • after reading source code file, and use own JavaScript parse(must compatible Espree)
  • after parsing source code file, and customize AST.
  • after parsing documentation tag, and customize documentation object.
  • after building HTML, and customize HTML.

config

{
  "source": "./src",
  "destination": "./esdoc",
  "plugins": [
    {"name": "foo-esdoc-plugin", "option": {}},
    {"name": "./bar-esdoc-plugin.js", "option": {}}
  ]
}

plugin

exports.onStart = function(ev){...};
exports.onHandleConfig = function(ev){...};
exports.onHandleCode = function(ev){...};
exports.onHandleCodeParser = function(ev){...};
exports.onHandleAST = function(ev){...};
exports.onHandleTag = function(ev){...};
exports.onHandleHTML = function(ev){...};
exports.onComplete = function(ev){...};
@mysticatea
Copy link

@mysticatea mysticatea commented Jul 19, 2015

Cool.

How about publishing of plugins with npm similar to babel or eslint?
For example, we can install eslint-plugin-react with npm.

@h13i32maru
Copy link
Member Author

@h13i32maru h13i32maru commented Jul 20, 2015

@mysticatea Thank you!
ESLint plugin system is nice 👍

I consider below.

{
  "source": "./src",
  "destination": "./esdoc",
  "plugins": ["foo-esdoc-plugin", "./bar-esdoc-plugin.js"]
}
  • foo-esdoc-plugin is loaded from local node_modules
  • ./bar-esdoc-plugin.js is loaded from local file.

So, internal code is

for (let pluginName of config.plugins) {
  let plugin = require(pluginName);
}

@mysticatea
Copy link

@mysticatea mysticatea commented Jul 20, 2015

👍

h13i32maru added a commit that referenced this issue Aug 2, 2015
h13i32maru added a commit that referenced this issue Aug 2, 2015
h13i32maru added a commit that referenced this issue Aug 2, 2015
#27
@h13i32maru
Copy link
Member Author

@h13i32maru h13i32maru commented Aug 2, 2015

I create plugin feature 🚀

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

Successfully merging a pull request may close this issue.

None yet
2 participants