StatusValue: Add a getter for MessageSpecifier list
[mediawiki.git] / jsdoc-plugin-allow-dots-in-modules.js
blobcc619914ecca87752ac2ee9a4b9c55438dbeb1f9
1 'use strict';
3 // We can use .replaceAll since Node.js 15
4 /* eslint-disable es-x/no-string-prototype-replaceall */
6 /**
7  * JSDoc incorrectly handles dots in 'module' annotations. When the module name includes any dots,
8  * it removes everything up to the last dot. This makes no sense because file names (and MediaWiki
9  * module names) can contain dots. https://github.com/jsdoc/jsdoc/issues/1157
10  *
11  * To work around this bug, replace dots with special markers before JSDoc parses the code,
12  * and then replace them back after it has parsed the code.
13  */
14 exports.handlers = {
15         beforeParse: function ( e ) {
16                 e.source = e.source.replaceAll( /@(module|exports) .+/g, function ( m ) {
17                         return m.replaceAll( '.', '(DOT)' );
18                 } );
19         },
21         newDoclet: function ( e ) {
22                 for ( const key in e.doclet ) {
23                         if ( typeof e.doclet[ key ] === 'string' ) {
24                                 e.doclet[ key ] = e.doclet[ key ].replaceAll( '(DOT)', '.' );
25                         }
26                 }
27         }