@@ -206,15 +206,6 @@ module.exports = {
206206 return new AddonDocsDeployPlugin ( this . _readUserConfig ( ) ) ;
207207 } ,
208208
209- setupPreprocessorRegistry ( type , registry ) {
210- if ( type === 'parent' ) {
211- let TemplateCompiler = require ( './lib/preprocessors/markdown-template-compiler' ) ;
212- let ContentExtractor = require ( './lib/preprocessors/hbs-content-extractor' ) ;
213- registry . add ( 'template' , new TemplateCompiler ( ) ) ;
214- registry . add ( 'template' , new ContentExtractor ( this . getBroccoliBridge ( ) ) ) ;
215- }
216- } ,
217-
218209 contentFor ( type ) {
219210 if ( type === 'body' ) {
220211 return fs . readFileSync (
@@ -247,12 +238,36 @@ module.exports = {
247238 return this . _broccoliBridge ;
248239 } ,
249240
250- postprocessTree ( type , tree ) {
241+ treeForApp ( tree ) {
242+ if ( ! this . _appTree ) {
243+ let { app, templates } = this . app . trees ;
244+ let appTree = new MergeTrees ( [ new Funnel ( app ) , new Funnel ( templates ) ] , {
245+ overwrite : true ,
246+ annotation : 'app md & templates' ,
247+ } ) ;
248+ let TemplateCompiler = require ( './lib/preprocessors/markdown-template-compiler' ) ;
249+ const templateCompiler = new TemplateCompiler ( ) ;
250+ appTree = templateCompiler . toTree ( appTree ) ;
251+ appTree = new Funnel ( appTree , {
252+ include : [ / .* \. h b s / ] ,
253+ annotation : 'app templates' ,
254+ } ) ;
255+ this . _appTree = this . _super ( new MergeTrees ( [ tree , appTree ] ) ) ;
256+ }
257+ return this . _appTree ;
258+ } ,
259+
260+ treeForPublic ( tree ) {
251261 let addonToDocument = this . _documentingAddon ( ) ;
252- if ( ! addonToDocument || type !== 'all' ) {
262+ if ( ! addonToDocument ) {
253263 return tree ;
254264 }
255265
266+ let ContentExtractor = require ( './lib/preprocessors/hbs-content-extractor' ) ;
267+ let appTree = this . _treeFor ( 'app' ) ;
268+ const contentExtractor = new ContentExtractor ( this . getBroccoliBridge ( ) ) ;
269+ contentExtractor . toTree ( appTree ) ;
270+
256271 let PluginRegistry = require ( './lib/models/plugin-registry' ) ;
257272 let DocsCompiler = require ( './lib/broccoli/docs-compiler' ) ;
258273 let SearchIndexer = require ( './lib/broccoli/search-indexer' ) ;
@@ -285,19 +300,22 @@ module.exports = {
285300 ) ;
286301 }
287302
288- let docsTree = new MergeTrees ( docsTrees ) ;
303+ let docsTree = new MergeTrees ( docsTrees , { annotation : 'docsTrees' } ) ;
289304
290305 let templateContentsTree =
291306 this . getBroccoliBridge ( ) . placeholderFor ( 'template-contents' ) ;
292307 let searchIndexTree = new SearchIndexer (
293- new MergeTrees ( [ docsTree , templateContentsTree ] ) ,
308+ new MergeTrees ( [ docsTree , templateContentsTree ] , {
309+ annotation : 'SearchIndexer' ,
310+ } ) ,
294311 {
295312 outputFile : 'ember-cli-addon-docs/search-index.json' ,
296313 config : this . project . config ( EmberApp . env ( ) ) ,
297314 }
298315 ) ;
299-
300- return new MergeTrees ( [ tree , docsTree , searchIndexTree ] ) ;
316+ return new MergeTrees ( [ this . _super ( tree ) , searchIndexTree , docsTree ] , {
317+ annotation : 'this._super(tree), docsTree' ,
318+ } ) ;
301319 } ,
302320
303321 _lunrTree ( ) {
0 commit comments