Skip to content

Commit bfc5afa

Browse files
github-actions[bot]danez
authored andcommitted
Publish new versions (beta)
1 parent 0a44fca commit bfc5afa

File tree

7 files changed

+227
-43
lines changed

7 files changed

+227
-43
lines changed

.changeset/pre.json

+18-1
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,51 @@
55
"react-docgen": "6.0.0-alpha.3",
66
"@react-docgen/cli": "1.0.0-alpha.0",
77
"@react-docgen-internal/website": "0.0.0",
8-
"@react-docgen-internal/playground": "0.0.0"
8+
"@react-docgen-internal/playground": "0.0.0",
9+
"@react-docgen-internal/benchmark": "0.0.0"
910
},
1011
"changesets": [
12+
"blue-points-exist",
1113
"bright-rivers-swim",
1214
"clean-cooks-attend",
15+
"famous-needles-wonder",
16+
"five-trainers-report",
17+
"friendly-timers-tap",
1318
"giant-apricots-compete",
1419
"great-rice-rush",
1520
"grumpy-falcons-rhyme",
1621
"grumpy-hotels-admire",
1722
"honest-boxes-behave",
1823
"honest-boxes-copy",
24+
"hungry-crabs-scream",
1925
"late-cats-design",
26+
"lazy-lions-dress",
2027
"loud-spiders-divide",
2128
"many-ligers-kneel",
2229
"mean-glasses-chew",
2330
"mighty-kids-report",
2431
"mighty-shrimps-shout",
2532
"nervous-humans-shave",
2633
"nine-vans-bow",
34+
"quiet-spiders-grab",
2735
"rare-taxis-divide",
2836
"rotten-mugs-walk",
2937
"selfish-ducks-mate",
38+
"seven-camels-flash",
39+
"shy-papayas-attack",
3040
"silent-swans-melt",
3141
"silly-ears-search",
3242
"smart-eagles-shop",
43+
"smart-files-tell",
3344
"smart-waves-refuse",
45+
"spotty-cameras-fetch",
3446
"strong-horses-build",
3547
"strong-pillows-visit",
48+
"stupid-files-buy",
49+
"ten-camels-jog",
50+
"ten-glasses-compete",
51+
"thin-foxes-talk",
52+
"thin-tables-sneeze",
3653
"tricky-shoes-check",
3754
"twelve-trainers-tap",
3855
"weak-numbers-bow"

packages/react-docgen-cli/CHANGELOG.md

+38-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,45 @@
11
# @react-docgen/cli
22

3+
## 1.0.0-beta.2
4+
5+
### Major Changes
6+
7+
- 80e4c74: Renamed `--handlers` option to `--handler`. This unifies all options
8+
to be singular.
9+
10+
### Minor Changes
11+
12+
- 80e4c74: `--resolver` option can now be used multiple times.
13+
14+
If used multiple times the resolvers will be chained in the defined order and
15+
all components from all resolvers will be used.
16+
17+
### Patch Changes
18+
19+
- ebd9130: Display the correct help info when running `react-docgen --help`
20+
- 050313d: Correctly add LICENSE file to published packages
21+
- 5b281f4: update dependency commander to v10
22+
- Updated dependencies [8fe3dbf]
23+
- Updated dependencies [d7a39af]
24+
- Updated dependencies [80e4c74]
25+
- Updated dependencies [e956802]
26+
- Updated dependencies [80e4c74]
27+
- Updated dependencies [ea25b16]
28+
- Updated dependencies [1aa0249]
29+
- Updated dependencies [050313d]
30+
- Updated dependencies [5215bab]
31+
- Updated dependencies [f6e4fe7]
32+
- Updated dependencies [5215bab]
33+
- Updated dependencies [80e4c74]
34+
35+
336
## 1.0.0-alpha.1
437

538
### Major Changes
639

7-
- 3b28f6e: Introducing the new CLI package `@react-docgen/cli` which was extracted from `react-docgen` and is a complete rewrite.
8-
Compared to the old CLI these are some of the major differences:
40+
- 3b28f6e: Introducing the new CLI package `@react-docgen/cli` which was
41+
extracted from `react-docgen` and is a complete rewrite. Compared to the old
42+
CLI these are some of the major differences:
943

1044
- Does not support input via stdin anymore
1145
- The path argument is now a glob
@@ -16,7 +50,8 @@
1650
- `--importer` added
1751
- `--failOnWarning` added
1852

19-
Check out https://react-docgen.dev/docs/getting-started/cli for the documentation.
53+
Check out https://react-docgen.dev/docs/getting-started/cli for the
54+
documentation.
2055

2156
### Patch Changes
2257

packages/react-docgen-cli/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@react-docgen/cli",
3-
"version": "1.0.0-alpha.1",
3+
"version": "1.0.0-beta.2",
44
"description": "A CLI to extract information from React components for documentation generation.",
55
"repository": "reactjs/react-docgen",
66
"type": "module",
@@ -32,7 +32,7 @@
3232
"commander": "10.0.0",
3333
"debug": "4.3.4",
3434
"fast-glob": "3.2.12",
35-
"react-docgen": "workspace:6.0.0-alpha.4",
35+
"react-docgen": "workspace:6.0.0-beta.5",
3636
"slash": "5.0.0"
3737
},
3838
"devDependencies": {

packages/react-docgen/CHANGELOG.md

+165-33
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,123 @@
11
# Changelog
22

3+
## 6.0.0-beta.5
4+
5+
### Major Changes
6+
7+
- d7a39af: Refactored `resolveComponentDefinition` utility.
8+
9+
- Renamed to `findComponentDefinition`
10+
- Removed named export `isComponentDefinition`
11+
- The utility now does a lot more than previously, check out the commit to see
12+
the changes in detail.
13+
14+
- e956802: Remove match utility.
15+
16+
The utility can be replaced by babel helpers and is not needed anymore. Also
17+
using explicit checks like `path.isMemberExpression()` is better for type
18+
safety and catching potential bugs.
19+
20+
- 5215bab: Removed support for the `@extends React.Component` annotation on
21+
react class components.
22+
23+
Instead you can use the new `@component` annotation.
24+
25+
- 80e4c74: Renamed and migrated built-in resolvers to classes.
26+
27+
- `findAllComponentDefinitions` was renamed to `FindAllDefinitionsResolver`
28+
and is now a class.
29+
30+
```diff
31+
-const resolver = builtinResolvers.findAllComponentDefinitions
32+
+const resolver = new builtinResolvers.FindAllDefinitionsResolver()
33+
```
34+
35+
- `findAllExportedComponentDefinitions` was renamed to
36+
`FindExportedDefinitionsResolver` and is now a class.
37+
38+
```diff
39+
-const resolver = builtinResolvers.findAllExportedComponentDefinitions
40+
+const resolver = new builtinResolvers.FindExportedDefinitionsResolver()
41+
```
42+
43+
- `findExportedComponentDefinition` was removed. Use
44+
`FindExportedDefinitionsResolver` with the `limit` option instead.
45+
46+
> This is still the default resolver.
47+
48+
```diff
49+
-const resolver = builtinResolvers.findExportedComponentDefinition
50+
+const resolver = new builtinResolvers.FindExportedDefinitionsResolver({ limit: 1 })
51+
```
52+
53+
### Minor Changes
54+
55+
- 80e4c74: Add the new ChainResolver which allows multiple resolvers to be
56+
chained.
57+
58+
```ts
59+
import { builtinResolvers } from 'react-docgen';
60+
61+
const { ChainResolver } = builtinResolvers;
62+
const resolver = new ChainResolver([resolver1, resolver2], {
63+
chainingLogic: ChainResolver.Logic.ALL, // or ChainResolver.Logic.FIRST_FOUND,
64+
});
65+
```
66+
67+
- 80e4c74: Allow resolvers to be classes in addition to functions.
68+
69+
```ts
70+
import type { ResolverClass, ResolverFunction } from 'react-docgen';
71+
72+
// This was the only option until now
73+
const functionResolver: ResolverFunction = (file: FileState) => {
74+
//needs to return array of found components
75+
};
76+
77+
// This is the new class resolver
78+
class MyResolver implements ResolverClass {
79+
resolve(file: FileState) {
80+
//needs to return array of found components
81+
}
82+
}
83+
84+
const classResolver = new MyResolver();
85+
```
86+
87+
- 5215bab: Added a new resolver that finds annotated components. This resolver
88+
is also enabled by default.
89+
90+
To use this feature simply annotated a component with `@component`.
91+
92+
```ts
93+
// @component
94+
class MyComponent {}
95+
```
96+
97+
### Patch Changes
98+
99+
- 8fe3dbf: Fix crash when using TypeScript mapped types
100+
- ea25b16: Handle cyclic references in PropTypes `shape()` and `exact()`
101+
methods.
102+
- 1aa0249: Handle `typeof import('...')` and `typeof MyType.property` correctly
103+
in TypeScript
104+
- 050313d: Correctly add LICENSE file to published packages
105+
- f6e4fe7: Update dependency strip-indent to v4
106+
3107
## 6.0.0-alpha.4
4108

5109
### Major Changes
6110

7-
- 96d6e9e: Rename `flowTypeHandler` to `codeTypeHandler` because it handles Flow and TypeScript
8-
- 96d6e9e: Simplify `resolveObjectValuesToArray` and remove type handling. None of the code that was handling types was actually used.
9-
- caae6bf: The return values of `resolveObjectValuesToArray` are now in the order they are defined in the source code.
10-
- 96d6e9e: Migrate react-docgen to ES modules. Please read [this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
11-
- 3b28f6e: The CLI was removed from `react-docgen` into its own package `@react-docgen/cli`.
111+
- 96d6e9e: Rename `flowTypeHandler` to `codeTypeHandler` because it handles Flow
112+
and TypeScript
113+
- 96d6e9e: Simplify `resolveObjectValuesToArray` and remove type handling. None
114+
of the code that was handling types was actually used.
115+
- caae6bf: The return values of `resolveObjectValuesToArray` are now in the
116+
order they are defined in the source code.
117+
- 96d6e9e: Migrate react-docgen to ES modules. Please read
118+
[this](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c)
119+
- 3b28f6e: The CLI was removed from `react-docgen` into its own package
120+
`@react-docgen/cli`.
12121

13122
Check out https://react-docgen.dev/cli for the documentation.
14123

@@ -23,23 +132,24 @@
23132

24133
- 96d6e9e: Renamed some of the main exports for clarity.
25134

26-
Renamed `handlers` to `builtinHandlers`
27-
Renamed `resolver` to `builtinResolvers`
28-
Renamed `importers` to `builtinImporters`
135+
Renamed `handlers` to `builtinHandlers` Renamed `resolver` to
136+
`builtinResolvers` Renamed `importers` to `builtinImporters`
29137

30138
- 96d6e9e: Migrated to babel toolchain
31139

32-
This is one of the big changes in this new version of react-docgen. It made the code a lot more robust
33-
because there are now finally working TypeScript types for the ASTs.
140+
This is one of the big changes in this new version of react-docgen. It made
141+
the code a lot more robust because there are now finally working TypeScript
142+
types for the ASTs.
34143

35-
Another benefit from this change that react-docgen is now a lot faster. 🚀 In some
36-
tests an improvement of nearly 50% was seen in comparison to version 5.
144+
Another benefit from this change that react-docgen is now a lot faster. 🚀 In
145+
some tests an improvement of nearly 50% was seen in comparison to version 5.
37146

38147
- d4c27d4: Improve performance of file system importer.
39148

40-
The file system importer now also caches resolving of files in addition to parsing files.
41-
If the importer is used in an environment where files do change at runtime (like a watch
42-
command) then the caches will need to be cleared on every file change.
149+
The file system importer now also caches resolving of files in addition to
150+
parsing files. If the importer is used in an environment where files do change
151+
at runtime (like a watch command) then the caches will need to be cleared on
152+
every file change.
43153

44154
- 96d6e9e: Changed the minimum Node.js version to 14.17.0
45155

@@ -55,8 +165,9 @@
55165
- 96d6e9e: Support resolving of destructurings in `resolveToValue`
56166
- 96d6e9e: Improve performance drastically by making changes to AST traversal
57167

58-
Visitors are now pre-exploded and are cached in the module scope instead of creating them on every call.
59-
This change brought the benchmark from 170ops/s to 225ops/sec
168+
Visitors are now pre-exploded and are cached in the module scope instead of
169+
creating them on every call. This change brought the benchmark from 170ops/s
170+
to 225ops/sec
60171

61172
- 96d6e9e: Add codes to errors to be able to easily detect them
62173

@@ -72,7 +183,8 @@
72183

73184
- 96d6e9e: Handle `React.forwardRef` calls without a function
74185
- 96d6e9e: Handle some edge cases in resolveToValue
75-
- 96d6e9e: Remove trailing commas and semicolons from raw values in the documentation
186+
- 96d6e9e: Remove trailing commas and semicolons from raw values in the
187+
documentation
76188
- 96d6e9e: Parse jsdoc comments for TypeScript structs
77189
- 96d6e9e: Correctly handle ObjectProperties in `isReactComponentMethod`
78190
- 96d6e9e: Add support for TSAsExpressions when trying to stringify expressions
@@ -81,34 +193,54 @@
81193

82194
### Bug Fixes
83195

84-
- Correctly detect index access types in typescript ([#400](https://github.com/reactjs/react-docgen/issues/400)) ([85ea6a5](https://github.com/reactjs/react-docgen/commit/85ea6a518c837e209043d9dac1505f60e8dd33b6))
85-
- Correctly handle ObjectTypeSpreadProperty in object type annotations ([#593](https://github.com/reactjs/react-docgen/issues/593)) ([395f338](https://github.com/reactjs/react-docgen/commit/395f338ab8aa3f1d9e1c0f5a81dadd0ce00eb7d5))
86-
- Fix typescript types for parsing ([34c55ac](https://github.com/reactjs/react-docgen/commit/34c55ac1d663cc604f4f548018d78e02e081a797))
87-
- Fix wrong detection of forwardRef in combination with memo ([#592](https://github.com/reactjs/react-docgen/issues/592)) ([ea9cbeb](https://github.com/reactjs/react-docgen/commit/ea9cbebef13de11d591f175438e59b48dbb67025))
88-
- Handle ObjectTypeSpreadProperties which are not resolvable ([4b8b721](https://github.com/reactjs/react-docgen/commit/4b8b721e6332185c0964a35329108ccdb64f8bb8))
89-
- Ignore methods in `Object.value()` calls ([4fc5b21](https://github.com/reactjs/react-docgen/commit/4fc5b21d899990681287c8d9d70771b7361ec41e))
196+
- Correctly detect index access types in typescript
197+
([#400](https://github.com/reactjs/react-docgen/issues/400))
198+
([85ea6a5](https://github.com/reactjs/react-docgen/commit/85ea6a518c837e209043d9dac1505f60e8dd33b6))
199+
- Correctly handle ObjectTypeSpreadProperty in object type annotations
200+
([#593](https://github.com/reactjs/react-docgen/issues/593))
201+
([395f338](https://github.com/reactjs/react-docgen/commit/395f338ab8aa3f1d9e1c0f5a81dadd0ce00eb7d5))
202+
- Fix typescript types for parsing
203+
([34c55ac](https://github.com/reactjs/react-docgen/commit/34c55ac1d663cc604f4f548018d78e02e081a797))
204+
- Fix wrong detection of forwardRef in combination with memo
205+
([#592](https://github.com/reactjs/react-docgen/issues/592))
206+
([ea9cbeb](https://github.com/reactjs/react-docgen/commit/ea9cbebef13de11d591f175438e59b48dbb67025))
207+
- Handle ObjectTypeSpreadProperties which are not resolvable
208+
([4b8b721](https://github.com/reactjs/react-docgen/commit/4b8b721e6332185c0964a35329108ccdb64f8bb8))
209+
- Ignore methods in `Object.value()` calls
210+
([4fc5b21](https://github.com/reactjs/react-docgen/commit/4fc5b21d899990681287c8d9d70771b7361ec41e))
90211

91212
## [6.0.0-alpha.2](https://github.com/reactjs/react-docgen/compare/v6.0.0-alpha.1...v6.0.0-alpha.2) (2022-04-04)
92213

93214
### Bug Fixes
94215

95-
- Change folder name inside the npm package back to `dist`. ([5f3da8c](https://github.com/reactjs/react-docgen/commit/5f3da8c892fd052db470d0a44d13c704eef4d011))
96-
There was no real reason to change this and happened during the TypeScript migration.
216+
- Change folder name inside the npm package back to `dist`.
217+
([5f3da8c](https://github.com/reactjs/react-docgen/commit/5f3da8c892fd052db470d0a44d13c704eef4d011))
218+
There was no real reason to change this and happened during the TypeScript
219+
migration.
97220

98221
## 6.0.0-alpha.1 (2022-04-04)
99222

100223
### Bug Fixes
101224

102-
- Fix for expressionTo with Spread and Methods ([5f3da8c](https://github.com/reactjs/react-docgen/commit/5f3da8c892fd052db470d0a44d13c704eef4d011))
103-
- Remove obsolete id check ([66961d8](https://github.com/reactjs/react-docgen/commit/66961d868fb09cbf2a96ea5a4edec602602851b3))
104-
- Remove usage of ast-type builders ([17c8a9c](https://github.com/reactjs/react-docgen/commit/17c8a9c123e0b699e96137e8714cd57fe6200e0c))
225+
- Fix for expressionTo with Spread and Methods
226+
([5f3da8c](https://github.com/reactjs/react-docgen/commit/5f3da8c892fd052db470d0a44d13c704eef4d011))
227+
- Remove obsolete id check
228+
([66961d8](https://github.com/reactjs/react-docgen/commit/66961d868fb09cbf2a96ea5a4edec602602851b3))
229+
- Remove usage of ast-type builders
230+
([17c8a9c](https://github.com/reactjs/react-docgen/commit/17c8a9c123e0b699e96137e8714cd57fe6200e0c))
105231

106232
### Features
107233

108-
- Migrate to TypeScript ([7b35e6f](https://github.com/reactjs/react-docgen/commit/7b35e6f1336c6c606b194b2d0e70376e9c1c0a9d))
109-
- Remove building out of scope AST Nodes from resolveToValue ([5bcf56c](https://github.com/reactjs/react-docgen/commit/5bcf56c6f7d2d8118adc1ed80573f2e3555455cb))
234+
- Migrate to TypeScript
235+
([7b35e6f](https://github.com/reactjs/react-docgen/commit/7b35e6f1336c6c606b194b2d0e70376e9c1c0a9d))
236+
- Remove building out of scope AST Nodes from resolveToValue
237+
([5bcf56c](https://github.com/reactjs/react-docgen/commit/5bcf56c6f7d2d8118adc1ed80573f2e3555455cb))
110238

111239
### BREAKING CHANGES
112240

113-
- `resolveToValue` will not create a `MemberExpression` for targets ending in destructuring. It will now simply resolve to the `Identifier` inside the destructuring. Use new helper `isDestructuringAssignment` to further check this identifier.
114-
- The helpers `resolveObjectValuesToArray` and `resolveObjectKeysToArray` return now `string[]` instead of a `NodePath`
241+
- `resolveToValue` will not create a `MemberExpression` for targets ending in
242+
destructuring. It will now simply resolve to the `Identifier` inside the
243+
destructuring. Use new helper `isDestructuringAssignment` to further check
244+
this identifier.
245+
- The helpers `resolveObjectValuesToArray` and `resolveObjectKeysToArray` return
246+
now `string[]` instead of a `NodePath`

packages/react-docgen/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-docgen",
3-
"version": "6.0.0-alpha.4",
3+
"version": "6.0.0-beta.5",
44
"description": "A library to extract information from React components for documentation generation.",
55
"repository": "reactjs/react-docgen",
66
"type": "module",

0 commit comments

Comments
 (0)