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

Comments

Projects
None yet
2 participants
@h13i32maru
Member

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

This comment has been minimized.

Show comment
Hide comment
@mysticatea

mysticatea 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.

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

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Jul 20, 2015

Member

@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);
}
Member

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

This comment has been minimized.

Show comment
Hide comment
@mysticatea

mysticatea commented Jul 20, 2015

👍

@h13i32maru

This comment has been minimized.

Show comment
Hide comment
@h13i32maru

h13i32maru Aug 2, 2015

Member

I create plugin feature 🚀

Member

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