diff --git a/docs/angular.io-package/processors/addJadeDataDocsProcessor.js b/docs/angular.io-package/processors/addJadeDataDocsProcessor.js index fb6a655991..0e72149a49 100644 --- a/docs/angular.io-package/processors/addJadeDataDocsProcessor.js +++ b/docs/angular.io-package/processors/addJadeDataDocsProcessor.js @@ -51,12 +51,14 @@ module.exports = function addJadeDataDocsProcessor() { // GET DATA FOR EACH PAGE (CLASS, VARS, FUNCTIONS) var modulePageInfo = _(doc.exports) .map(function(exportDoc) { - return { + var dataDoc = { name: exportDoc.name + '-' + exportDoc.docType, title: exportDoc.name, - docType: exportDoc.docType, - varType: exportDoc.symbolTypeName && titleCase(exportDoc.symbolTypeName) + docType: exportDoc.docType }; + if (exportDoc.symbolTypeName) dataDoc.varType = titleCase(exportDoc.symbolTypeName); + if (exportDoc.originalModule) dataDoc.originalModule = exportDoc.originalModule; + return dataDoc; }) .sortBy('name') .value(); diff --git a/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js b/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js index 12fdf73a94..cc88c42fc4 100644 --- a/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js +++ b/docs/angular.io-package/processors/addJadeDataDocsProcessor.spec.js @@ -15,7 +15,9 @@ describe('addJadeDataDocsProcessor', function() { { docType: 'module', id: 'someModule', - exports: [{ name: 'someObj', docType: 'var', symbolTypeName: 'MyClass'}], + exports: [ + { name: 'someObj', docType: 'var', symbolTypeName: 'MyClass', originalModule: 'some/private/module' } + ], fileInfo: { baseName: 'x_y' }, description: 'some description\nsecond line' } @@ -28,8 +30,8 @@ describe('addJadeDataDocsProcessor', function() { docType : 'jade-data', originalDoc : docs[0], data : [ - { name : 'index', title : 'X Y', intro : 'some description second line' }, - { name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var' } + { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, + { name : 'someObj-var', title : 'someObj', varType : 'MyClass', docType: 'var', originalModule: 'some/private/module' } ] }); }); @@ -52,12 +54,12 @@ describe('addJadeDataDocsProcessor', function() { docs = processor.$process(docs); expect(docs[1].data).toEqual([ - { name : 'index', title : 'X Y', intro : 'some description second line' }, - { name: 'Alpha-class', title: 'Alpha', varType : undefined, docType: 'class' }, - { name: 'Beta-class', title: 'Beta', varType : undefined, docType: 'class' }, - { name: 'Gamma-class', title: 'Gamma', varType : undefined, docType: 'class' }, - { name: 'Mu-class', title: 'Mu', varType : undefined, docType: 'class' }, - { name: 'Nu-class', title: 'Nu', varType : undefined, docType: 'class' } + { name : 'index', title : 'X Y', intro : 'some description second line', docType : 'module' }, + { name: 'Alpha-class', title: 'Alpha', docType: 'class' }, + { name: 'Beta-class', title: 'Beta', docType: 'class' }, + { name: 'Gamma-class', title: 'Gamma', docType: 'class' }, + { name: 'Mu-class', title: 'Mu', docType: 'class' }, + { name: 'Nu-class', title: 'Nu', docType: 'class' } ]); }); diff --git a/docs/angular.io-package/templates/jade-data.template.html b/docs/angular.io-package/templates/jade-data.template.html index f19196de1e..a8c95ab1ee 100644 --- a/docs/angular.io-package/templates/jade-data.template.html +++ b/docs/angular.io-package/templates/jade-data.template.html @@ -8,6 +8,9 @@ {%- if item.varType %} "varType" : "{$ item.varType $}", {%- endif %} + {%- if item.originalModule %} + "originalModule" : "{$ item.originalModule $}", + {%- endif %} "docType": "{$ item.docType $}" }{% if not loop.last %},{% endif %} {% endfor -%} diff --git a/docs/typescript-package/mocks/readTypeScriptModules/privateModule.ts b/docs/typescript-package/mocks/readTypeScriptModules/privateModule.ts new file mode 100644 index 0000000000..d4c6ef610a --- /dev/null +++ b/docs/typescript-package/mocks/readTypeScriptModules/privateModule.ts @@ -0,0 +1 @@ +export var x = 10; \ No newline at end of file diff --git a/docs/typescript-package/mocks/readTypeScriptModules/publicModule.ts b/docs/typescript-package/mocks/readTypeScriptModules/publicModule.ts new file mode 100644 index 0000000000..c176de47fe --- /dev/null +++ b/docs/typescript-package/mocks/readTypeScriptModules/publicModule.ts @@ -0,0 +1 @@ +export { x as y} from './privateModule'; \ No newline at end of file diff --git a/docs/typescript-package/processors/readTypeScriptModules.js b/docs/typescript-package/processors/readTypeScriptModules.js index 5597898496..51e56a4242 100644 --- a/docs/typescript-package/processors/readTypeScriptModules.js +++ b/docs/typescript-package/processors/readTypeScriptModules.js @@ -223,6 +223,11 @@ module.exports = function readTypeScriptModules(tsParser, modules, getFileInfo, if (exportSymbol.flags & ts.SymbolFlags.TypeAlias) { exportDoc.typeDefinition = typeDefinition; } + + // Compute the original module name from the relative file path + exportDoc.originalModule = exportDoc.fileInfo.relativePath + .replace(new RegExp('\.' + exportDoc.fileInfo.extension + '$'), ''); + return exportDoc; } diff --git a/docs/typescript-package/processors/readTypeScriptModules.spec.js b/docs/typescript-package/processors/readTypeScriptModules.spec.js index 53d959c70c..5717945dde 100644 --- a/docs/typescript-package/processors/readTypeScriptModules.spec.js +++ b/docs/typescript-package/processors/readTypeScriptModules.spec.js @@ -14,6 +14,18 @@ describe('readTypeScriptModules', function() { }); + describe('exportDocs', function() { + it('should provide the original module if the export is re-exported', function() { + processor.sourceFiles = [ 'publicModule.ts' ]; + var docs = []; + processor.$process(docs); + + var exportedDoc = docs[1]; + expect(exportedDoc.originalModule).toEqual('privateModule'); + }); + }); + + describe('ignoreExportsMatching', function() { it('should ignore exports that match items in the `ignoreExportsMatching` property', function() { processor.sourceFiles = [ 'ignoreExportsMatching.ts'];