apply: function()

in packages/docpack-jsdoc-extractor/lib/plugin.js [15:36]


  apply: function (compiler) {
    var config = this.config;
    var doxConfig = { raw: !config.parseMarkdown };

    compiler.plugin('compilation', function (compilation) {
      compilation.plugin(Docpack.HOOKS.EXTRACT, function (sources, done) {
        var targets = sources.filter(function (source) {
          return tools.matcher(config.match, source.absolutePath);
        });

        var promises = Promise.map(targets, function (source) {
          var module = tools.getModuleByFilepath(compilation, source.absolutePath);
          var context = createContext(compiler.inputFileSystem, module);
          return extractor.call(context, source, doxConfig);
        });

        Promise.all(promises).then(function () {
          done(null, sources);
        });
      });
    });
  }