diff --git a/tools/dgeni/common/decorators.ts b/tools/dgeni/common/decorators.ts index e5e9a538980..6392f429a70 100644 --- a/tools/dgeni/common/decorators.ts +++ b/tools/dgeni/common/decorators.ts @@ -1,13 +1,13 @@ -/** - * We want to avoid emitting selectors that are deprecated but don't have a way to mark - * them as such in the source code. Thus, we maintain a separate blacklist of selectors - * that should not be emitted in the documentation. - */ import {ClassExportDoc} from 'dgeni-packages/typescript/api-doc-types/ClassExportDoc'; import {PropertyMemberDoc} from 'dgeni-packages/typescript/api-doc-types/PropertyMemberDoc'; import {MemberDoc} from 'dgeni-packages/typescript/api-doc-types/MemberDoc'; import {CategorizedClassDoc, DeprecationDoc, HasDecoratorsDoc} from './dgeni-definitions'; +/** + * We want to avoid emitting selectors that are deprecated but don't have a way to mark + * them as such in the source code. Thus, we maintain a separate blacklist of selectors + * that should not be emitted in the documentation. + */ const SELECTOR_BLACKLIST = new Set([ '[portal]', '[portalHost]', diff --git a/tools/dgeni/index.ts b/tools/dgeni/index.ts index b25ce36ad69..892ae2fb3d1 100644 --- a/tools/dgeni/index.ts +++ b/tools/dgeni/index.ts @@ -11,7 +11,7 @@ import {TsParser} from 'dgeni-packages/typescript/services/TsParser'; import {sync as globSync} from 'glob'; import * as path from 'path'; -// Dgeni packages +// Dgeni packages that the Material docs package depends on. const jsdocPackage = require('dgeni-packages/jsdoc'); const nunjucksPackage = require('dgeni-packages/nunjucks'); const typescriptPackage = require('dgeni-packages/typescript'); @@ -22,24 +22,6 @@ const sourceDir = path.resolve(projectRootDir, 'src'); const outputDir = path.resolve(projectRootDir, 'dist/docs/api'); const templateDir = path.resolve(__dirname, './templates'); -// Package definition for material2 api docs. This only *defines* the package- it does not yet -// actually *run* anything. -// -// A dgeni package is very similar to an AngularJS module. Modules contain: -// "services" (injectables) -// "processors" (injectables that conform to a specific interface) -// "templates": nunjucks templates that can be used to render content -// -// A dgeni package also has a `config` method, similar to an AngularJS module. -// A config block can inject any services/processors and configure them before -// docs processing begins. - -const dgeniPackageDeps = [ - jsdocPackage, - nunjucksPackage, - typescriptPackage, -]; - /** List of CDK packages that need to be documented. */ const cdkPackages = globSync(path.join(sourceDir, 'cdk', '*/')) .filter(packagePath => !packagePath.endsWith('testing/')) @@ -49,7 +31,24 @@ const cdkPackages = globSync(path.join(sourceDir, 'cdk', '*/')) const materialPackages = globSync(path.join(sourceDir, 'lib', '*/')) .map(packagePath => path.basename(packagePath)); -export const apiDocsPackage = new Package('material2-api-docs', dgeniPackageDeps); +/** + * Dgeni package for the Angular Material 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('material2-api-docs', [ + jsdocPackage, + nunjucksPackage, + typescriptPackage, +]); // Processor that filters out duplicate exports that should not be shown in the docs. apiDocsPackage.processor(new FilterDuplicateExports()); @@ -121,7 +120,7 @@ apiDocsPackage.config((readTypeScriptModules: ReadTypeScriptModules, tsParser: T tsParser.options.paths = typescriptPathMap; tsParser.options.baseUrl = sourceDir; - // Entry points for docs generation. All publically exported symbols found through these + // Entry points for docs generation. All publicly exported symbols found through these // files will have docs generated. readTypeScriptModules.sourceFiles = [ ...cdkPackages.map(packageName => `./cdk/${packageName}/index.ts`), @@ -149,7 +148,7 @@ apiDocsPackage.config((templateFinder: any, templateEngine: any) => { 'common.template.html' ]; - // dgeni disables autoescape by default, but we want this turned on. + // Dgeni disables autoescape by default, but we want this turned on. templateEngine.config.autoescape = true; // Nunjucks and Angular conflict in their template bindings so change Nunjucks diff --git a/tools/dgeni/processors/merge-inherited-properties.ts b/tools/dgeni/processors/merge-inherited-properties.ts index 5f9f1272188..346bf8fd505 100644 --- a/tools/dgeni/processors/merge-inherited-properties.ts +++ b/tools/dgeni/processors/merge-inherited-properties.ts @@ -13,10 +13,10 @@ export class MergeInheritedProperties implements Processor { $process(docs: DocCollection) { return docs .filter(doc => doc.docType === 'class') - .forEach(doc => this.addInhertiedProperties(doc)); + .forEach(doc => this.addInheritedProperties(doc)); } - private addInhertiedProperties(doc: ClassExportDoc) { + private addInheritedProperties(doc: ClassExportDoc) { doc.implementsClauses.filter(clause => clause.doc).forEach(clause => { clause.doc!.members.forEach(member => this.addMemberDocIfNotPresent(doc, member)); });