chore(doc-gen): upgrade to use TypeScript 1.7.3

This commit is contained in:
Peter Bacon Darwin 2015-12-09 12:18:33 +00:00
parent 46735ad925
commit 326e1f7395
8 changed files with 36 additions and 4 deletions

View File

@ -59,7 +59,7 @@
"path": "^0.11.14",
"prompt": "^0.2.14",
"q": "^1.4.1",
"typescript": "~1.5.3",
"typescript": "1.7.3",
"yargs": "^3.23.0"
},
"dependencies": {

View File

@ -0,0 +1 @@
{% extends 'var.template.html' -%}

View File

@ -22,6 +22,7 @@ module.exports = new Package('typescript-parsing', [basePackage])
'function',
'var',
'const',
'let',
'enum',
'type-alias'
];

View File

@ -1 +1,3 @@
export { x as y} from './privateModule';
export { x as y} from './privateModule';
export abstract class AbstractClass {}

View File

@ -214,7 +214,7 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
location: getLocation(exportSymbol)
};
if (exportDoc.docType === 'var' || exportDoc.docType === 'const') {
if (exportDoc.docType === 'var' || exportDoc.docType === 'const' || exportDoc.docType === 'let') {
exportDoc.symbolTypeName = exportSymbol.valueDeclaration.type &&
exportSymbol.valueDeclaration.type.typeName &&
exportSymbol.valueDeclaration.type.typeName.text;

View File

@ -22,6 +22,16 @@ describe('readTypeScriptModules', function() {
var exportedDoc = docs[1];
expect(exportedDoc.originalModule).toEqual('privateModule');
});
it('should include exported abstract classes', function() {
processor.sourceFiles = [ 'publicModule.ts' ];
var docs = [];
processor.$process(docs);
var exportedDoc = docs[2];
expect(exportedDoc.name).toEqual('AbstractClass');
});
});

View File

@ -56,6 +56,24 @@ module.exports = function createCompilerHost(log) {
},
getNewLine: function() {
return ts.sys.newLine;
},
fileExists(fileName) {
var text, resolvedPath, resolvedPathWithExt;
// Strip off the extension and resolve relative to the baseDir
baseFilePath = fileName.replace(/\.[^.]+$/, '');
resolvedPath = path.resolve(baseDir, baseFilePath);
// Iterate through each possible extension and return the first source file that is actually found
for(var i=0; i<extensions.length; i++) {
// Try reading the content from files using each of the given extensions
resolvedPathWithExt = resolvedPath + extensions[i];
if (fs.existsSync(resolvedPathWithExt)) return true;
}
return false;
},
readFile(fileName) {
console.log('readFile - NOT IMPLEMENTED', fileName);
}
};
};

View File

@ -38,7 +38,7 @@ describe('createCompilerHost', function() {
describe('getDefaultLibFileName', function() {
it('should return a path to the default library', function() {
expect(host.getDefaultLibFileName(options)).toContain('typescript/bin/lib.d.ts');
expect(host.getDefaultLibFileName(options)).toContain('typescript/lib/lib.d.ts');
});
});