import { Package } from 'dgeni' ; import { ReadTypeScriptModules } from 'dgeni-packages/typescript/processors/readTypeScriptModules' ; import { Host } from 'dgeni-packages/typescript/services/ts-host/host' ; import { TypeFormatFlags } from 'typescript' ; import { HighlightNunjucksExtension } from './nunjucks-tags/highlight' ; import { patchLogService } from './patch-log-service' ; import { AsyncFunctionsProcessor } from './processors/async-functions' ; import { categorizer } from './processors/categorizer' ; import { DocsPrivateFilter } from './processors/docs-private-filter' ; import { EntryPointGrouper } from './processors/entry-point-grouper' ; import { FilterDuplicateExports } from './processors/filter-duplicate-exports' ; import { mergeInheritedProperties } from './processors/merge-inherited-properties' ; const jsdocPackage = require ( 'dgeni-packages/jsdoc' ) ; const nunjucksPackage = require ( 'dgeni-packages/nunjucks' ) ; const typescriptPackage = require ( 'dgeni-packages/typescript' ) ; /**
 * Dgeni package for the sbb-angular docs. This just defines the package, but doesn't
 * generate the docs yet.
 *
 * Dgeni packages are very similar to AngularJS modules. Those can contain:
 *
 *  - Services that can be injected
 *  - Templates that are used to convert the data into HTML output.
 *  - Processors that can modify the doc items (like a build pipeline).
 *
 * Similar to AngularJS, there is also a `config` lifecycle hook, that can be used to
 * configure specific processors, services before the procession begins.
 */ export const apiDocsPackage = new Package ( 'sbb-angular' , [ jsdocPackage , nunjucksPackage , typescriptPackage , ] ) ; apiDocsPackage . processor ( new FilterDuplicateExports ( ) ) ; apiDocsPackage . processor ( mergeInheritedProperties ) ; apiDocsPackage . processor ( new DocsPrivateFilter ( ) ) ; apiDocsPackage . processor ( categorizer ) ; apiDocsPackage . processor ( new EntryPointGrouper ( ) ) ; apiDocsPackage . processor ( new AsyncFunctionsProcessor ( ) ) ; apiDocsPackage . config ( function ( log ) { return ( log . level = 'warning' ) ; } ) ; apiDocsPackage . config ( function ( readFilesProcessor ) { readFilesProcessor . $enabled = false ; } ) ; apiDocsPackage . config ( function ( log ) { return patchLogService ( log ) ; } ) ; apiDocsPackage . config ( function ( computePathsProcessor ) { computePathsProcessor . pathTemplates = [ { docTypes : [ 'entry-point' ] , pathTemplate : '${name}' , outputPathTemplate : '${name}.html' , } , ] ; } ) ; apiDocsPackage . config ( function ( parseTagsProcessor ) { parseTagsProcessor . tagDefinitions = parseTagsProcessor . tagDefinitions . concat ( [ { name : 'docs-private' } , { name : 'docs-public' } , { name : 'docs-primary-export' } , { name : 'breaking-change' } , ] ) ; } ) ; apiDocsPackage . config ( function ( checkAnchorLinksProcessor ) { checkAnchorLinksProcessor . ignoredLinks . push ( /(components|cdk|business|core|maps|public)\/[\w-]+\/api#\w+/ ) ; } ) ; apiDocsPackage . config ( function ( readTypeScriptModules ) { readTypeScriptModules . hidePrivateMembers = true ; } ) ; apiDocsPackage . config ( function ( tsHost ) { tsHost . concatMultipleLeadingComments = false ; tsHost . typeFormatFlags = TypeFormatFlags . NoTruncation ; } ) ; apiDocsPackage . config ( function ( templateFinder , templateEngine ) { templateFinder . templatePatterns = [ '${ doc.template }' , '${ doc.id }.${ doc.docType }.template.html' , '${ doc.id }.template.html' , '${ doc.docType }.template.html' , '${ doc.id }.${ doc.docType }.template.js' , '${ doc.id }.template.js' , '${ doc.docType }.template.js' , '${ doc.id }.${ doc.docType }.template.json' , '${ doc.id }.template.json' , '${ doc.docType }.template.json' , 'common.template.html' , ] ; templateEngine . config . autoescape = true ; templateEngine . config . tags = { variableStart : '{$' , variableEnd : '$}' , } ; templateEngine . tags . push ( new HighlightNunjucksExtension ( ) ) ; } ) ;