chore(docs): rename @private to @internal

The latter is understood by TypeScript's --stripInternal option, so this lets us
rely more on the tooling provided by typescript team.
This commit is contained in:
Alex Eagle
2015-10-02 13:32:48 -07:00
parent 4a36fd8203
commit f7aa890ade
38 changed files with 98 additions and 94 deletions

View File

@ -49,7 +49,7 @@ DtsSerializer.prototype = {
},
member: function(buffer, ast) {
if (ast.private) return;
if (ast.private || ast.internal) return;
buffer.push('\n');
this.comment(buffer, ast.content);

View File

@ -25,22 +25,22 @@ describe('createTypeDefinitionFile processor', function() {
describe('classes with private constructors', function() {
describe('classes with @internal constructors', function() {
it('should convert heritage from `implements` into `extends`', function() {
// Create some mock docs for testing
var docs = [
{
id: 'angular2/angular2',
exports: [
{ docType: 'class', heritage: 'implements Xyz', constructorDoc: { private: true } }
{ docType: 'class', heritage: 'implements Xyz', constructorDoc: { internal: true } }
]
}
];
docs = processor.$process(docs);
expect(docs.length).toEqual(1);
expect(docs[0].docType).toEqual('type-definition');
@ -49,5 +49,5 @@ describe('createTypeDefinitionFile processor', function() {
expect(moduleDoc.exports[0].heritage).toEqual('extends Xyz');
});
});
});

View File

@ -1,9 +1,10 @@
var basePackage = require('dgeni-packages/base');
var jsdocPackage = require('dgeni-packages/jsdoc');
var Package = require('dgeni').Package;
var path = require('canonical-path');
// Define the dgeni package for generating the docs
module.exports = new Package('typescript-parsing', [basePackage])
module.exports = new Package('typescript-parsing', [basePackage, jsdocPackage])
// Register the services and file readers
.factory(require('./services/modules'))
@ -37,6 +38,9 @@ module.exports = new Package('typescript-parsing', [basePackage])
log.level = 'warn';
})
.config(function(parseTagsProcessor) {
parseTagsProcessor.tagDefinitions.push({ name: 'internal', transforms: function() { return true; } });
})
// Configure ids and paths
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {

View File

@ -4,8 +4,8 @@ module.exports = function convertPrivateClassesToInterfaces() {
return function(exportDocs, addInjectableReference) {
_.forEach(exportDocs, function(exportDoc) {
// Search for classes with a constructor marked as `@private`
if (exportDoc.docType === 'class' && exportDoc.constructorDoc && exportDoc.constructorDoc.private) {
// Search for classes with a constructor marked as `@internal`
if (exportDoc.docType === 'class' && exportDoc.constructorDoc && exportDoc.constructorDoc.internal) {
// Convert this class to an interface with no constructor
exportDoc.docType = 'interface';

View File

@ -11,13 +11,13 @@ describe('readTypeScriptModules', function() {
convertPrivateClassesToInterfaces = injector.get('convertPrivateClassesToInterfaces');
});
it('should convert private class docs to interface docs', function() {
it('should convert @internal class docs to interface docs', function() {
var docs = [
{
docType: 'class',
name: 'privateClass',
id: 'privateClass',
constructorDoc: { private: true }
constructorDoc: { internal: true }
}
];
convertPrivateClassesToInterfaces(docs, false);
@ -25,7 +25,7 @@ describe('readTypeScriptModules', function() {
});
it('should not touch non-private class docs', function() {
it('should not touch non-internal class docs', function() {
var docs = [
{
docType: 'class',
@ -45,7 +45,7 @@ describe('readTypeScriptModules', function() {
docType: 'class',
name: 'privateClass',
id: 'privateClass',
constructorDoc: { private: true },
constructorDoc: { internal: true },
heritage: 'implements parentInterface'
}
];
@ -60,7 +60,7 @@ describe('readTypeScriptModules', function() {
docType: 'class',
name: 'privateClass',
id: 'privateClass',
constructorDoc: { private: true },
constructorDoc: { internal: true },
heritage: 'implements parentInterface'
}
];