chore(typescript 1.6 upgrade): fix build.js and docs

This commit is contained in:
Alex Eagle
2015-09-23 15:02:37 -07:00
committed by Victor Savkin
parent 2ee32fb02c
commit 7a53f82516
12 changed files with 148 additions and 124 deletions

View File

@ -59,7 +59,10 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
if (anyMatches(ignoreExportsMatching, exportSymbol.name)) return;
// If the symbol is an Alias then for most things we want the original resolved symbol
var resolvedExport = exportSymbol.resolvedSymbol || exportSymbol;
var resolvedExport = exportSymbol;
if (exportSymbol.resolvedSymbol && exportSymbol.resolvedSymbol.name !== "unknown") {
resolvedExport = exportSymbol.resolvedSymbol;
}
var exportDoc = createExportDoc(exportSymbol.name, resolvedExport, moduleDoc, basePath, parseInfo.typeChecker);
log.debug('>>>> EXPORT: ' + exportDoc.name + ' (' + exportDoc.docType + ') from ' + moduleDoc.id);
@ -282,7 +285,11 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo,
function getDecorators(symbol) {
var declaration = symbol.valueDeclaration || symbol.declarations[0];
var declaration = symbol.valueDeclaration;
if (!declaration) {
console.log("missing declaration for symbol", declaration);
return [];
}
var sourceFile = ts.getSourceFileOfNode(declaration);
var decorators = declaration.decorators && declaration.decorators.map(function(decorator) {

View File

@ -56,7 +56,14 @@ module.exports = function createCompilerHost(log) {
},
getNewLine: function() {
return ts.sys.newLine;
},
fileExists: function(fileName) {
var stats;
fs.stat(fileName, function(err, s) {
stats = s;
});
return !!stats;
}
};
};
};
};

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');
});
});
@ -77,4 +77,4 @@ describe('createCompilerHost', function() {
expect(host.getNewLine()).toEqual(require('os').EOL);
});
});
});
});

View File

@ -4,6 +4,9 @@ var ts = require('typescript');
module.exports = function getFileInfo(log) {
return function (symbol, basePath) {
if (!symbol.declarations) {
console.log("ouch", symbol);
}
var fileName = ts.getSourceFileOfNode(symbol.declarations[0]).fileName;
var file = path.resolve(basePath, fileName);
@ -17,4 +20,4 @@ module.exports = function getFileInfo(log) {
};
return fileInfo;
};
};
};