Skip to content

Commit 09a441a

Browse files
refactor: Remove plugin-proposal because it is related of transform code (documentationjs#1371)
* deps: Remove plugin-proposal because it is related of transform code 1. Documentation need to just parse code and do not transform anything. That why need to remove plugin and preset usages 2. Remove parser options which already included in parser and enabled by default * chore: Update docs related remark 13
1 parent bc4f510 commit 09a441a

File tree

5 files changed

+59
-1027
lines changed

5 files changed

+59
-1027
lines changed

docs/NODE_API.md

+42-42
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22

33
### Table of Contents
44

5-
- [lint][1]
6-
- [Parameters][2]
7-
- [Examples][3]
8-
- [build][4]
9-
- [Parameters][5]
10-
- [Examples][6]
11-
- [formats][7]
12-
- [formats.html][8]
13-
- [Parameters][9]
14-
- [Examples][10]
15-
- [formats.markdown][11]
16-
- [Parameters][12]
17-
- [Examples][13]
18-
- [formats.json][14]
19-
- [Parameters][15]
20-
- [Examples][16]
5+
* [lint][1]
6+
* [Parameters][2]
7+
* [Examples][3]
8+
* [build][4]
9+
* [Parameters][5]
10+
* [Examples][6]
11+
* [formats][7]
12+
* [formats.html][8]
13+
* [Parameters][9]
14+
* [Examples][10]
15+
* [formats.markdown][11]
16+
* [Parameters][12]
17+
* [Examples][13]
18+
* [formats.json][14]
19+
* [Parameters][15]
20+
* [Examples][16]
2121

2222
## lint
2323

@@ -27,19 +27,19 @@ of lint information intended for human-readable output.
2727

2828
### Parameters
2929

30-
- `indexes` **([Array][17]<[string][18]> | [string][18])** files to process
31-
- `args` **[Object][19]** args
30+
* `indexes` **([Array][17]<[string][18]> | [string][18])** files to process
31+
* `args` **[Object][19]** args
3232

33-
- `args.external` **[Array][17]&lt;[string][18]>** a string regex / glob match pattern
33+
* `args.external` **[Array][17]<[string][18]>** a string regex / glob match pattern
3434
that defines what external modules will be whitelisted and included in the
3535
generated documentation.
36-
- `args.shallow` **[boolean][20]** whether to avoid dependency parsing
36+
* `args.shallow` **[boolean][20]** whether to avoid dependency parsing
3737
even in JavaScript code. (optional, default `false`)
38-
- `args.inferPrivate` **[string][18]?** a valid regular expression string
38+
* `args.inferPrivate` **[string][18]?** a valid regular expression string
3939
to infer whether a code element should be private, given its naming structure.
4040
For instance, you can specify `inferPrivate: '^_'` to automatically treat
4141
methods named like `_myMethod` as private.
42-
- `args.extension` **([string][18] \| [Array][17]&lt;[string][18]>)?** treat additional file extensions
42+
* `args.extension` **([string][18] | [Array][17]<[string][18]>)?** treat additional file extensions
4343
as JavaScript, extending the default set of `js`, `es6`, and `jsx`.
4444

4545
### Examples
@@ -64,27 +64,27 @@ comments, given a root file as a path.
6464

6565
### Parameters
6666

67-
- `indexes` **([Array][17]&lt;[string][18]> | [string][18])** files to process
68-
- `args` **[Object][19]** args
67+
* `indexes` **([Array][17]<[string][18]> | [string][18])** files to process
68+
* `args` **[Object][19]** args
6969

70-
- `args.external` **[Array][17]&lt;[string][18]>** a string regex / glob match pattern
70+
* `args.external` **[Array][17]<[string][18]>** a string regex / glob match pattern
7171
that defines what external modules will be whitelisted and included in the
7272
generated documentation.
73-
- `args.shallow` **[boolean][20]** whether to avoid dependency parsing
73+
* `args.shallow` **[boolean][20]** whether to avoid dependency parsing
7474
even in JavaScript code. (optional, default `false`)
75-
- `args.order` **[Array][17]&lt;([string][18] \| [Object][19])>** optional array that
75+
* `args.order` **[Array][17]<([string][18] | [Object][19])>** optional array that
7676
defines sorting order of documentation (optional, default `[]`)
77-
- `args.access` **[Array][17]&lt;[string][18]>** an array of access levels
77+
* `args.access` **[Array][17]<[string][18]>** an array of access levels
7878
to output in documentation (optional, default `[]`)
79-
- `args.hljs` **[Object][19]?** hljs optional args
79+
* `args.hljs` **[Object][19]?** hljs optional args
8080

81-
- `args.hljs.highlightAuto` **[boolean][20]** hljs automatically detect language (optional, default `false`)
82-
- `args.hljs.languages` **[Array][17]?** languages for hljs to choose from
83-
- `args.inferPrivate` **[string][18]?** a valid regular expression string
81+
* `args.hljs.highlightAuto` **[boolean][20]** hljs automatically detect language (optional, default `false`)
82+
* `args.hljs.languages` **[Array][17]?** languages for hljs to choose from
83+
* `args.inferPrivate` **[string][18]?** a valid regular expression string
8484
to infer whether a code element should be private, given its naming structure.
8585
For instance, you can specify `inferPrivate: '^_'` to automatically treat
8686
methods named like `_myMethod` as private.
87-
- `args.extension` **([string][18] \| [Array][17]&lt;[string][18]>)?** treat additional file extensions
87+
* `args.extension` **([string][18] | [Array][17]<[string][18]>)?** treat additional file extensions
8888
as JavaScript, extending the default set of `js`, `es6`, and `jsx`.
8989

9090
### Examples
@@ -117,10 +117,10 @@ Formats documentation as HTML.
117117

118118
### Parameters
119119

120-
- `comments` **[Array][17]&lt;[Comment][22]>** parsed comments
121-
- `config` **[Object][19]** Options that can customize the output
120+
* `comments` **[Array][17]<[Comment][22]>** parsed comments
121+
* `config` **[Object][19]** Options that can customize the output
122122

123-
- `config.theme` **[string][18]** Name of a module used for an HTML theme. (optional, default `'default_theme'`)
123+
* `config.theme` **[string][18]** Name of a module used for an HTML theme. (optional, default `'default_theme'`)
124124

125125
### Examples
126126

@@ -136,7 +136,7 @@ documentation.build(['index.js'])
136136
});
137137
```
138138

139-
Returns **[Promise][21]&lt;[Array][17]&lt;[Object][19]>>** Promise with results
139+
Returns **[Promise][21]<[Array][17]<[Object][19]>>** Promise with results
140140

141141
## formats.markdown
142142

@@ -145,8 +145,8 @@ Formats documentation as
145145

146146
### Parameters
147147

148-
- `comments` **[Array][17]&lt;[Object][19]>** parsed comments
149-
- `args` **[Object][19]** Options that can customize the output
148+
* `comments` **[Array][17]<[Object][19]>** parsed comments
149+
* `args` **[Object][19]** Options that can customize the output
150150

151151
### Examples
152152

@@ -162,15 +162,15 @@ documentation.build(['index.js'])
162162
});
163163
```
164164

165-
Returns **[Promise][21]&lt;[string][18]>** a promise of the eventual value
165+
Returns **[Promise][21]<[string][18]>** a promise of the eventual value
166166

167167
## formats.json
168168

169169
Formats documentation as a JSON string.
170170

171171
### Parameters
172172

173-
- `comments` **[Array][17]&lt;[Comment][22]>** parsed comments
173+
* `comments` **[Array][17]<[Comment][22]>** parsed comments
174174

175175
### Examples
176176

@@ -186,7 +186,7 @@ documentation.build(['index.js'])
186186
});
187187
```
188188

189-
Returns **[Promise][21]&lt;[string][18]>**
189+
Returns **[Promise][21]<[string][18]>**
190190

191191
[1]: #lint
192192

package.json

-16
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,6 @@
1111
"@babel/core": "7.12.3",
1212
"@babel/generator": "7.12.1",
1313
"@babel/parser": "7.12.3",
14-
"@babel/plugin-proposal-class-properties": "^7.12.1",
15-
"@babel/plugin-proposal-decorators": "^7.12.1",
16-
"@babel/plugin-proposal-do-expressions": "^7.12.1",
17-
"@babel/plugin-proposal-export-default-from": "^7.12.1",
18-
"@babel/plugin-proposal-export-namespace-from": "^7.12.1",
19-
"@babel/plugin-proposal-function-bind": "^7.12.1",
20-
"@babel/plugin-proposal-function-sent": "^7.12.1",
21-
"@babel/plugin-proposal-json-strings": "^7.12.1",
22-
"@babel/plugin-proposal-pipeline-operator": "^7.12.1",
23-
"@babel/plugin-proposal-private-methods": "^7.12.1",
24-
"@babel/plugin-proposal-throw-expressions": "^7.12.1",
25-
"@babel/plugin-syntax-import-meta": "^7.10.4",
26-
"@babel/preset-env": "^7.12.1",
27-
"@babel/preset-flow": "^7.9.0",
28-
"@babel/preset-react": "^7.9.4",
29-
"@babel/preset-stage-0": "^7.8.3",
3014
"@babel/traverse": "^7.12.1",
3115
"@babel/types": "^7.12.1",
3216
"ansi-html": "^0.0.7",

src/input/dependency.js

+1-22
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,8 @@ const { standardBabelParserPlugins } = require('../parsers/parse_to_ast');
77
const smartGlob = require('../smart_glob.js');
88

99
const STANDARD_BABEL_CONFIG = {
10-
sourceMaps: false,
1110
compact: false,
12-
cwd: path.resolve(__dirname, '../../'),
13-
presets: ['@babel/preset-react', '@babel/preset-env', '@babel/preset-flow'],
14-
parserOpts: { plugins: standardBabelParserPlugins },
15-
plugins: [
16-
// Stage 0
17-
'@babel/plugin-proposal-function-bind',
18-
// Stage 1
19-
'@babel/plugin-proposal-export-default-from',
20-
['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
21-
'@babel/plugin-proposal-do-expressions',
22-
// Stage 2
23-
['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }],
24-
'@babel/plugin-proposal-function-sent',
25-
'@babel/plugin-proposal-export-namespace-from',
26-
'@babel/plugin-proposal-throw-expressions',
27-
// Stage 3
28-
'@babel/plugin-syntax-import-meta',
29-
['@babel/plugin-proposal-class-properties', { loose: false }],
30-
'@babel/plugin-proposal-private-methods',
31-
'@babel/plugin-proposal-json-strings'
32-
]
11+
parserOpts: { plugins: [...standardBabelParserPlugins, 'flow'] }
3312
};
3413

3514
/**

src/parsers/parse_to_ast.js

-12
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,14 @@ const TYPESCRIPT_EXTS = {
77
};
88

99
const standardBabelParserPlugins = [
10-
'asyncGenerators',
11-
'bigInt',
1210
'classProperties',
13-
'classConstructorCall',
1411
'classPrivateProperties',
1512
'classPrivateMethods',
1613
'doExpressions',
17-
'dynamicImport',
1814
'exportDefaultFrom',
19-
'exportNamespaceFrom',
2015
'exportExtensions',
2116
'functionBind',
22-
'functionSent',
2317
'jsx',
24-
'logicalAssignment',
25-
'nullishCoalescingOperator',
26-
'numericSeparator',
27-
'objectRestSpread',
28-
'optionalCatchBinding',
29-
'optionalChaining',
3018
'partialApplication',
3119
['pipelineOperator', { proposal: 'minimal' }],
3220
'throwExpressions'

0 commit comments

Comments
 (0)