|
1 | 1 | # Changelog
|
2 | 2 |
|
| 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 | + |
3 | 107 | ## 6.0.0-alpha.4
|
4 | 108 |
|
5 | 109 | ### Major Changes
|
6 | 110 |
|
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`. |
12 | 121 |
|
13 | 122 | Check out https://react-docgen.dev/cli for the documentation.
|
14 | 123 |
|
|
23 | 132 |
|
24 | 133 | - 96d6e9e: Renamed some of the main exports for clarity.
|
25 | 134 |
|
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` |
29 | 137 |
|
30 | 138 | - 96d6e9e: Migrated to babel toolchain
|
31 | 139 |
|
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. |
34 | 143 |
|
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. |
37 | 146 |
|
38 | 147 | - d4c27d4: Improve performance of file system importer.
|
39 | 148 |
|
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. |
43 | 153 |
|
44 | 154 | - 96d6e9e: Changed the minimum Node.js version to 14.17.0
|
45 | 155 |
|
|
55 | 165 | - 96d6e9e: Support resolving of destructurings in `resolveToValue`
|
56 | 166 | - 96d6e9e: Improve performance drastically by making changes to AST traversal
|
57 | 167 |
|
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 |
60 | 171 |
|
61 | 172 | - 96d6e9e: Add codes to errors to be able to easily detect them
|
62 | 173 |
|
|
72 | 183 |
|
73 | 184 | - 96d6e9e: Handle `React.forwardRef` calls without a function
|
74 | 185 | - 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 |
76 | 188 | - 96d6e9e: Parse jsdoc comments for TypeScript structs
|
77 | 189 | - 96d6e9e: Correctly handle ObjectProperties in `isReactComponentMethod`
|
78 | 190 | - 96d6e9e: Add support for TSAsExpressions when trying to stringify expressions
|
|
81 | 193 |
|
82 | 194 | ### Bug Fixes
|
83 | 195 |
|
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)) |
90 | 211 |
|
91 | 212 | ## [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)
|
92 | 213 |
|
93 | 214 | ### Bug Fixes
|
94 | 215 |
|
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. |
97 | 220 |
|
98 | 221 | ## 6.0.0-alpha.1 (2022-04-04)
|
99 | 222 |
|
100 | 223 | ### Bug Fixes
|
101 | 224 |
|
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)) |
105 | 231 |
|
106 | 232 | ### Features
|
107 | 233 |
|
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)) |
110 | 238 |
|
111 | 239 | ### BREAKING CHANGES
|
112 | 240 |
|
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` |
0 commit comments