import { Package } from 'dgeni' ; const typescriptPackage = require ( 'dgeni-packages/typescript' ) ; const linksPackage = require ( 'dgeni-packages/links' ) ; import { daffodilBasePackage } from '../daffodil-base-package' ; import { API_SOURCE_PATH , API_TEMPLATES_PATH } from '../config' ; import { GenerateApiListProcessor } from '../../processors/generateApiList' ; import { PackagesProcessor } from '../../processors/packages' ; import { FilterContainedDocsProcessor } from '../../processors/filterDocs' ; import { CleanSelectorsProcessor } from '../../processors/cleanSelectors' ; import { MakeTypesHtmlCompatibleProcessor } from '../../processors/makeTypesHtmlCompatible' ; import { FilterOutPrivatePropertiesProcessor } from '../../processors/filterOutPrivateProperties' ; import { AddInheritedDocsContentProcessor } from '../../processors/addInheritedDocsContent' ; import { AddLinkTagToDaffodilReferencesProcessor } from '../../processors/addLinkTagToDaffodilReferences' ; const excludedPackages = [ 'branding' ] ; const excludedPackagesRegex = '!(' + excludedPackages . join ( '|' ) + ')' ; export const apiDocs = new Package ( 'checkout' , [ daffodilBasePackage , typescriptPackage , linksPackage , ] ) . processor ( new FilterContainedDocsProcessor ( ) ) . processor ( new CleanSelectorsProcessor ( ) ) . processor ( new MakeTypesHtmlCompatibleProcessor ( ) ) . processor ( new FilterOutPrivatePropertiesProcessor ( ) ) . processor ( new AddInheritedDocsContentProcessor ( ) ) . processor ( new AddLinkTagToDaffodilReferencesProcessor ( ) ) . processor ( new GenerateApiListProcessor ( ) ) . processor ( new PackagesProcessor ( ) ) . factory ( function API_DOC_TYPES_TO_RENDER ( EXPORT_DOC_TYPES ) { return EXPORT_DOC_TYPES . concat ( [ 'component' , 'directive' , 'pipe' , 'package' ] ) ; } ) . config ( function ( readFilesProcessor , readTypeScriptModules , tsParser ) { tsParser . options . paths = { '@daffodil/*' : [ API_SOURCE_PATH + '/*/src' ] } ; tsParser . options . baseUrl = '.' ; readFilesProcessor . $enabled = false ; readTypeScriptModules . basePath = API_SOURCE_PATH ; readTypeScriptModules . hidePrivateMembers = true ; readTypeScriptModules . sourceFiles = [ excludedPackagesRegex + '/**/src/index.ts' , ] ; } ) . config ( function ( computePathsProcessor , EXPORT_DOC_TYPES , generateApiList ) { const API_SEGMENT = 'api' ; generateApiList . outputFolder = API_SEGMENT ; computePathsProcessor . pathTemplates . push ( { docTypes : [ 'package' ] , getPath : function computeModulePath ( doc ) { doc . moduleFolder = `${ API_SEGMENT }/${ doc . id . replace ( /\/src$/ , '' ) }` ; return doc . moduleFolder ; } , outputPathTemplate : '${moduleFolder}.json' } ) ; computePathsProcessor . pathTemplates . push ( { docTypes : EXPORT_DOC_TYPES , pathTemplate : '${moduleDoc.moduleFolder}/${name}' , outputPathTemplate : '${moduleDoc.moduleFolder}/${name}.json' , } ) ; } ) . config ( function ( parseTagsProcessor ) { parseTagsProcessor . tagDefinitions = parseTagsProcessor . tagDefinitions . concat ( [ { name : 'docs-private' } , { name : 'inheritdoc' } ] ) ; } ) . config ( function ( convertToJson , API_DOC_TYPES_TO_RENDER ) { convertToJson . docTypes = convertToJson . docTypes . concat ( API_DOC_TYPES_TO_RENDER ) ; } ) . config ( function ( templateFinder ) { templateFinder . templateFolders . unshift ( API_TEMPLATES_PATH ) ; } ) ;