@wordpress/docgen 2.55.1-next.v.202609031004.0 → 2.56.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.
- package/README.md +32 -32
- package/lib/index.js +10 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
Some characteristics:
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
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
|
-
|
|
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
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
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><!-- START TOKEN(Autogenerated API docs) --></code>
|
|
40
|
+
- End token: <code><!-- END TOKEN(Autogenerated API docs) --></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><!-- START TOKEN(my-api) --></code> and the end token <code><!-- END TOKEN(my-api) --></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 `
|
|
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
|
-
-
|
|
83
|
-
-
|
|
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 `
|
|
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
|
-
-
|
|
136
|
-
-
|
|
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
|
-
-
|
|
153
|
-
-
|
|
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 `
|
|
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
|
-
-
|
|
230
|
-
-
|
|
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
|
-
-
|
|
252
|
-
-
|
|
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 `
|
|
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
|
-
-
|
|
290
|
-
-
|
|
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 = [
|
|
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.
|
|
3
|
+
"version": "2.56.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",
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/WordPress/gutenberg/issues"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
|
-
"node": ">=18.12.0"
|
|
24
|
-
"npm": ">=8.19.2"
|
|
23
|
+
"node": ">=18.12.0"
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"bin",
|
|
@@ -44,10 +43,10 @@
|
|
|
44
43
|
},
|
|
45
44
|
"devDependencies": {
|
|
46
45
|
"@types/babel__core": "^7.20.5",
|
|
47
|
-
"vitest": "^
|
|
46
|
+
"vitest": "^5.0.0"
|
|
48
47
|
},
|
|
49
48
|
"publishConfig": {
|
|
50
49
|
"access": "public"
|
|
51
50
|
},
|
|
52
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "56d8058eda6e30c4cc8bfc37818fa6ed972f7dc2"
|
|
53
52
|
}
|