In #41788, the `disambiguateDocsPathsProcessor` was introduced to fix an issue with case-insensitively equal paths. This processor may alter the output paths of some docs. Due to its nature, the `disambiguateDocPathsProcessor` must be the last processor in the pipeline that updates a doc's output path. However, the `updateGlobalApiPathProcess` (which also alters the output paths of some docs) was not configured to run before `disambiguateDocPathsProcessor`. As a result, the changes made by `disambiguateDocPathsProcessor` were overridden by `updateGlobalApiPathProcess`, resulting in the app's failing to load such global API docs pages. An example of such an API page is: https://angular.io/api/core/global/ngApplyChanges This commit fixes it by ensuring that the `updateGlobalApiPathProcess` is explicitly run before the `disambiguateDocPathsProcessor`, so that the former does not override the changes made by the latter. PR Close #42648
27 lines
961 B
JavaScript
27 lines
961 B
JavaScript
/**
|
|
* @dgProcessor updateGlobalApiPath
|
|
*
|
|
* If a global API has a namespace, its name will contain a dot which will cause its
|
|
* URL to look like a file path. This processor updates it so it's less ambiguous.
|
|
*/
|
|
module.exports = function updateGlobalApiPathProcessor() {
|
|
return {
|
|
$runAfter: ['paths-computed'],
|
|
$runBefore: ['disambiguateDocPathsProcessor', 'processNgModuleDocs'],
|
|
$process: function(docs) {
|
|
docs.forEach(doc => {
|
|
if (doc.global && doc.globalNamespace) {
|
|
// We need to change the path to camel case, because having a dot
|
|
// in the URL will make it look like a file path.
|
|
const name = doc.unprefixedName;
|
|
const fileName = doc.globalNamespace + name[0].toUpperCase() + name.slice(1);
|
|
|
|
doc.path = `${doc.moduleDoc.moduleFolder}/${fileName}`;
|
|
doc.outputPath =
|
|
`${doc.moduleDoc.moduleFolder}/${fileName}.json`;
|
|
}
|
|
});
|
|
}
|
|
};
|
|
};
|