@wordpress/docgen 2.55.1-next.v.202609031004.0 → 2.56.1-next.v.202609171837.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.
Files changed (3) hide show
  1. package/README.md +32 -32
  2. package/lib/index.js +10 -1
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  Some characteristics:
6
6
 
7
- - If the export statement doesn't contain any JSDoc, it'll look up for JSDoc up to the declaration.
8
- - It can resolve relative dependencies, either files or directories. For example, `import default from './dependency'` will find `dependency.js` or `dependency/index.js`
9
- - For TypeScript support, all types must be explicitly annotated as the TypeScript Babel plugin is unable to consume inferred types (it does not run the TS compiler, after all—it merely parses TypeScript). For example, all function return types must be explicitly annotated if they are to be documented by `docgen`.
7
+ - If the export statement doesn't contain any JSDoc, it'll look up for JSDoc up to the declaration.
8
+ - It can resolve relative dependencies, either files or directories. For example, `import default from './dependency'` will find `dependency.js` or `dependency/index.js`
9
+ - For TypeScript support, all types must be explicitly annotated as the TypeScript Babel plugin is unable to consume inferred types (it does not run the TS compiler, after all—it merely parses TypeScript). For example, all function return types must be explicitly annotated if they are to be documented by `docgen`.
10
10
 
11
11
  ## Installation
12
12
 
@@ -21,25 +21,25 @@ npm install @wordpress/docgen --save-dev
21
21
  ## Usage
22
22
 
23
23
  ```bash
24
- npx docgen <entry-point.js>
24
+ npm exec --no -- docgen <entry-point.js>
25
25
  ```
26
26
 
27
27
  This command will generate a file named `entry-point-api.md` containing all the exports and their JSDoc comments.
28
28
 
29
29
  ### CLI options
30
30
 
31
- - **--formatter** `(String)`: A path to a custom formatter to control the contents of the output file. It should be a CommonJS module that exports a function that takes as input:
32
- - _rootDir_ `(String)`: current working directory as seen by docgen.
33
- - _docPath_ `(String)`: path of the output document to generate.
34
- - _symbols_ `(Array)`: the symbols found.
35
- - **--ignore** `(RegExp)`: A regular expression used to ignore symbols whose name match it.
36
- - **--output** `(String)`: Output file that will contain the API documentation.
37
- - **--to-section** `(String)`: Append generated documentation to this section in the Markdown output. To be used by the default Markdown formatter. Depends on `--output` and bypasses the custom `--formatter` passed, if any.
38
- - **--to-token**: Embed generated documentation within the start and end tokens in the Markdown output. To be used by the default Markdown formatter.Depends on `--output` and bypasses the custom `--formatter` passed, if any.
39
- - Start token: <code>&lt;!-- START TOKEN(Autogenerated API docs) --&gt;</code>
40
- - End token: <code>&lt;!-- END TOKEN(Autogenerated API docs) --&gt;</code>
41
- - **--use-token** `(String)`: This options allows you to customize the string between the tokens. For example, `--use-token my-api` will look up for the start token <code>&lt;!-- START TOKEN(my-api) --&gt;</code> and the end token <code>&lt;!-- END TOKEN(my-api) --&gt;</code>. Depends on `--to-token`.
42
- - **--debug**: Run in debug mode, which outputs some intermediate files useful for debugging.
31
+ - **--formatter** `(String)`: A path to a custom formatter to control the contents of the output file. It should be a CommonJS module that exports a function that takes as input:
32
+ - _rootDir_ `(String)`: current working directory as seen by docgen.
33
+ - _docPath_ `(String)`: path of the output document to generate.
34
+ - _symbols_ `(Array)`: the symbols found.
35
+ - **--ignore** `(RegExp)`: A regular expression used to ignore symbols whose name match it.
36
+ - **--output** `(String)`: Output file that will contain the API documentation.
37
+ - **--to-section** `(String)`: Append generated documentation to this section in the Markdown output. To be used by the default Markdown formatter. Depends on `--output` and bypasses the custom `--formatter` passed, if any.
38
+ - **--to-token**: Embed generated documentation within the start and end tokens in the Markdown output. To be used by the default Markdown formatter.Depends on `--output` and bypasses the custom `--formatter` passed, if any.
39
+ - Start token: <code>&lt;!-- START TOKEN(Autogenerated API docs) --&gt;</code>
40
+ - End token: <code>&lt;!-- END TOKEN(Autogenerated API docs) --&gt;</code>
41
+ - **--use-token** `(String)`: This options allows you to customize the string between the tokens. For example, `--use-token my-api` will look up for the start token <code>&lt;!-- START TOKEN(my-api) --&gt;</code> and the end token <code>&lt;!-- END TOKEN(my-api) --&gt;</code>. Depends on `--to-token`.
42
+ - **--debug**: Run in debug mode, which outputs some intermediate files useful for debugging.
43
43
 
44
44
  ### Babel Configuration
45
45
 
@@ -66,7 +66,7 @@ export default function addition( term1, term2 ) {
66
66
  }
67
67
  ```
68
68
 
69
- Output of `npx docgen index.js` would be `index-api.js`:
69
+ Output of `npm exec --no -- docgen index.js` would be `index-api.js`:
70
70
 
71
71
  ```markdown
72
72
  # API
@@ -79,8 +79,8 @@ Adds two numbers.
79
79
 
80
80
  **Parameters**
81
81
 
82
- - **term1** `number`: First number.
83
- - **term2** `number`: Second number.
82
+ - **term1** `number`: First number.
83
+ - **term2** `number`: Second number.
84
84
 
85
85
  **Returns**
86
86
 
@@ -119,7 +119,7 @@ function count( term1, term2 ) {
119
119
  export { count, addition };
120
120
  ```
121
121
 
122
- Output of `npx docgen index.js` would be `index-api.js`:
122
+ Output of `npm exec --no -- docgen index.js` would be `index-api.js`:
123
123
 
124
124
  ```markdown
125
125
  # API
@@ -132,8 +132,8 @@ Adds two numbers.
132
132
 
133
133
  **Parameters**
134
134
 
135
- - **term1** `number`: First number.
136
- - **term2** `number`: Second number.
135
+ - **term1** `number`: First number.
136
+ - **term2** `number`: Second number.
137
137
 
138
138
  **Returns**
139
139
 
@@ -149,8 +149,8 @@ Adds two numbers.
149
149
 
150
150
  **Parameters**
151
151
 
152
- - **term1** `number`: First number.
153
- - **term2** `number`: Second number.
152
+ - **term1** `number`: First number.
153
+ - **term2** `number`: Second number.
154
154
 
155
155
  **Returns**
156
156
 
@@ -206,7 +206,7 @@ export function addition( term1, term2 ) {
206
206
  }
207
207
  ````
208
208
 
209
- Output of `npx docgen index.js` would be `index-api.js`:
209
+ Output of `npm exec --no -- docgen index.js` would be `index-api.js`:
210
210
 
211
211
  ````markdown
212
212
  # API
@@ -226,8 +226,8 @@ console.log( result ); // Will log 7
226
226
 
227
227
  **Parameters**
228
228
 
229
- - **term1** `number`: First number.
230
- - **term2** `number`: Second number.
229
+ - **term1** `number`: First number.
230
+ - **term2** `number`: Second number.
231
231
 
232
232
  **Returns**
233
233
 
@@ -248,8 +248,8 @@ console.log( result ); // Will log 3
248
248
 
249
249
  **Parameters**
250
250
 
251
- - **term1** `number`: First number.
252
- - **term2** `number`: Second number.
251
+ - **term1** `number`: First number.
252
+ - **term2** `number`: Second number.
253
253
 
254
254
  **Returns**
255
255
 
@@ -273,7 +273,7 @@ export default function addition( term1: number, term2: number ): number {
273
273
  }
274
274
  ```
275
275
 
276
- Output of `npx docgen index.ts` would be `index-api.js`:
276
+ Output of `npm exec --no -- docgen index.ts` would be `index-api.js`:
277
277
 
278
278
  ```markdown
279
279
  # API
@@ -286,8 +286,8 @@ Adds two numbers.
286
286
 
287
287
  **Parameters**
288
288
 
289
- - **term1** `number`: First number.
290
- - **term2** `number`: Second number.
289
+ - **term1** `number`: First number.
290
+ - **term2** `number`: Second number.
291
291
 
292
292
  **Returns**
293
293
 
package/lib/index.js CHANGED
@@ -8,7 +8,16 @@ const isSymbolIgnore = require( './is-symbol-ignore' );
8
8
  /**
9
9
  * Helpers functions.
10
10
  */
11
- const extensions = [ '.js', '.jsx', '.ts', '.tsx' ];
11
+ const extensions = [
12
+ '.js',
13
+ '.jsx',
14
+ '.mjs',
15
+ '.cjs',
16
+ '.ts',
17
+ '.tsx',
18
+ '.mts',
19
+ '.cts',
20
+ ];
12
21
  const relativeToAbsolute = ( basePath, relativePath ) => {
13
22
  const target = path.join( path.dirname( basePath ), relativePath );
14
23
  const extension = path.extname( target );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/docgen",
3
- "version": "2.55.1-next.v.202609031004.0",
3
+ "version": "2.56.1-next.v.202609171837.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",
@@ -44,10 +44,10 @@
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/babel__core": "^7.20.5",
47
- "vitest": "^4.1.10"
47
+ "vitest": "^5.0.0"
48
48
  },
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "7275d6c6d93b542fca3cd98cdb9c7344ddd11e19"
52
+ "gitHead": "7fc9f6676debc888d2f071d17cb71837040d4b48"
53
53
  }