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

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

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

@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

👍

@h13i32maru
Copy link
Member Author

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
Development

No branches or pull requests

2 participants