@wordpress/docgen 1.21.0 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -110,12 +110,10 @@ function getTypeLiteralPropertyTypeAnnotations( typeAnnotation ) {
110
110
  * @param {babelTypes.TSTypeLiteral} typeAnnotation
111
111
  */
112
112
  function getTypeLiteralTypeAnnotation( typeAnnotation ) {
113
- const callProperties = getTypeLiteralCallSignatureDeclarationTypeAnnotations(
114
- typeAnnotation
115
- );
116
- const indexers = getTypeLiteralIndexSignatureTypeAnnotations(
117
- typeAnnotation
118
- );
113
+ const callProperties =
114
+ getTypeLiteralCallSignatureDeclarationTypeAnnotations( typeAnnotation );
115
+ const indexers =
116
+ getTypeLiteralIndexSignatureTypeAnnotations( typeAnnotation );
119
117
  const properties = getTypeLiteralPropertyTypeAnnotations( typeAnnotation );
120
118
 
121
119
  return `{ ${ callProperties }${ properties }${ indexers }}`;
package/lib/index.js CHANGED
@@ -11,6 +11,7 @@ const { last } = require( 'lodash' );
11
11
  const engine = require( './engine' );
12
12
  const defaultMarkdownFormatter = require( './markdown' );
13
13
  const isSymbolPrivate = require( './is-symbol-private' );
14
+ const isSymbolIgnore = require( './is-symbol-ignore' );
14
15
 
15
16
  /**
16
17
  * Helpers functions.
@@ -119,7 +120,7 @@ module.exports = ( sourceFile, options ) => {
119
120
  // Process.
120
121
  const result = processFile( processDir, sourceFile );
121
122
  const filteredIR = result.ir.filter( ( symbol ) => {
122
- if ( isSymbolPrivate( symbol ) ) {
123
+ if ( isSymbolPrivate( symbol ) || isSymbolIgnore( symbol ) ) {
123
124
  return false;
124
125
  }
125
126
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ const getSymbolTagsByName = require( './get-symbol-tags-by-name' );
5
+
6
+ /**
7
+ * Returns true if, given a symbol object, it contains a @ignore tag, or false
8
+ * otherwise.
9
+ *
10
+ * @param {Object} symbol Symbol object.
11
+ *
12
+ * @return {boolean} Whether symbol is private.
13
+ */
14
+ const isSymbolIgnore = ( symbol ) =>
15
+ getSymbolTagsByName( symbol, 'ignore' ).length > 0;
16
+
17
+ module.exports = isSymbolIgnore;
@@ -1,14 +1,8 @@
1
- /**
2
- * External dependencies
3
- */
4
- const { findLast } = require( 'lodash' );
5
-
6
1
  const getHeadingIndex = ( ast, index ) => {
7
2
  const astBeforeIndex = ast.children.slice( 0, index );
8
- const lastHeading = findLast(
9
- astBeforeIndex,
10
- ( node ) => node.type === 'heading'
11
- );
3
+ const lastHeading = astBeforeIndex
4
+ .reverse()
5
+ .find( ( node ) => node.type === 'heading' );
12
6
  return lastHeading ? lastHeading.depth : 1;
13
7
  };
14
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/docgen",
3
- "version": "1.21.0",
3
+ "version": "1.24.0",
4
4
  "description": "Autogenerate public API documentation from exports and JSDoc comments.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -39,5 +39,5 @@
39
39
  "publishConfig": {
40
40
  "access": "public"
41
41
  },
42
- "gitHead": "1ba52312b56db563df2d8d4fba5b00613fb46d8c"
42
+ "gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
43
43
  }