Skip to content

Commit a2978e8

Browse files
jquensedanez
authored andcommitted
chore: update ast-types
1 parent 71e78b3 commit a2978e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1182
-1161
lines changed

package.json

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@
44
"description": "A CLI and toolkit to extract information from React components for documentation generation.",
55
"repository": {
66
"type": "git",
7-
"url": "https://github.com/reactjs/react-docgen.git"
7+
"url": "git+https://github.com/reactjs/react-docgen.git"
8+
},
9+
"bugs": {
10+
"url": "https://github.com/reactjs/react-docgen/issues"
811
},
9-
"bugs": "https://github.com/reactjs/react-docgen/issues",
1012
"bin": {
1113
"react-docgen": "bin/react-docgen.js"
1214
},
@@ -34,38 +36,40 @@
3436
"react",
3537
"documentation-generation"
3638
],
37-
"author": "Felix Kling",
39+
"author": {
40+
"name": "Felix Kling"
41+
},
3842
"license": "MIT",
3943
"dependencies": {
40-
"@babel/core": "^7.4.4",
41-
"@babel/runtime": "^7.0.0",
42-
"ast-types": "^0.12.4",
44+
"@babel/core": "^7.7.5",
45+
"@babel/runtime": "^7.7.6",
46+
"ast-types": "^0.13.2",
4347
"async": "^2.1.4",
4448
"commander": "^2.19.0",
4549
"doctrine": "^3.0.0",
4650
"node-dir": "^0.1.10",
4751
"strip-indent": "^3.0.0"
4852
},
4953
"devDependencies": {
50-
"@babel/cli": "^7.0.0",
51-
"@babel/plugin-transform-runtime": "^7.0.0",
52-
"@babel/preset-env": "^7.0.0",
53-
"@babel/preset-flow": "^7.0.0",
54-
"babel-eslint": "^10.0.1",
55-
"babel-jest": "^24.1.0",
54+
"@babel/cli": "^7.7.5",
55+
"@babel/plugin-transform-runtime": "^7.7.6",
56+
"@babel/preset-env": "^7.7.6",
57+
"@babel/preset-flow": "^7.7.4",
58+
"babel-eslint": "^10.0.3",
59+
"babel-jest": "^24.9.0",
5660
"benchmark": "^2.1.4",
5761
"cli-table": "^0.3.1",
5862
"cross-spawn": "^6.0.4",
5963
"eslint": "^5.7.0",
6064
"eslint-config-prettier": "^4.0.0",
61-
"eslint-plugin-prettier": "^3.0.0",
65+
"eslint-plugin-prettier": "^3.1.1",
6266
"flow-bin": "^0.98.0",
63-
"jest": "^24.1.0",
64-
"jest-diff": "^24.0.0",
65-
"jest-matcher-utils": "^24.0.0",
66-
"prettier": "^1.14.3",
67-
"rimraf": "^2.3.2",
68-
"temp": "^0.9.0"
67+
"jest": "^24.9.0",
68+
"jest-diff": "^24.9.0",
69+
"jest-matcher-utils": "^24.9.0",
70+
"prettier": "^1.19.1",
71+
"rimraf": "^3.0.0",
72+
"temp": "^0.9.1"
6973
},
7074
"jest": {
7175
"snapshotSerializers": [

src/handlers/componentDocblockHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import type Documentation from '../Documentation';
1212
import { getDocblock } from '../utils/docblock';
1313

14-
const { namedTypes: t } = types;
15-
1614
function isClassDefinition(nodePath) {
1715
const node = nodePath.node;
1816
return t.ClassDeclaration.check(node) || t.ClassExpression.check(node);

src/handlers/componentMethodsHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getMemberValuePath from '../utils/getMemberValuePath';
1212
import getMethodDocumentation from '../utils/getMethodDocumentation';
1313
import isReactComponentClass from '../utils/isReactComponentClass';
1414
import isReactComponentMethod from '../utils/isReactComponentMethod';
1515
import type Documentation from '../Documentation';
1616

17-
const { namedTypes: t } = types;
18-
1917
/**
2018
* The following values/constructs are considered methods:
2119
*

src/handlers/defaultPropsHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getPropertyName from '../utils/getPropertyName';
1212
import getMemberValuePath from '../utils/getMemberValuePath';
1313
import printValue from '../utils/printValue';
@@ -17,8 +17,6 @@ import isReactComponentClass from '../utils/isReactComponentClass';
1717
import isReactForwardRefCall from '../utils/isReactForwardRefCall';
1818
import type Documentation from '../Documentation';
1919

20-
const { namedTypes: t } = types;
21-
2220
function getDefaultValue(path: NodePath) {
2321
let node = path.node;
2422
let defaultValue;

src/handlers/displayNameHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getMemberValuePath from '../utils/getMemberValuePath';
1212
import getNameOrValue from '../utils/getNameOrValue';
1313
import resolveToValue from '../utils/resolveToValue';
1414
import resolveFunctionDefinitionToReturnValue from '../utils/resolveFunctionDefinitionToReturnValue';
1515
import type Documentation from '../Documentation';
1616

17-
const { namedTypes: t } = types;
18-
1917
export default function displayNameHandler(
2018
documentation: Documentation,
2119
path: NodePath,

src/handlers/flowTypeHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import type Documentation from '../Documentation';
1212
import { unwrapUtilityType } from '../utils/flowUtilityTypes';
1313
import getFlowType from '../utils/getFlowType';
@@ -20,8 +20,6 @@ import { type TypeParameters } from '../utils/getTypeParameters';
2020
import resolveToValue from '../utils/resolveToValue';
2121
import setPropDescription from '../utils/setPropDescription';
2222

23-
const { namedTypes: t } = types;
24-
2523
function setPropDescriptor(
2624
documentation: Documentation,
2725
path: NodePath,

src/handlers/index.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@
77
* @flow
88
*/
99

10-
export {
11-
default as componentDocblockHandler,
12-
} from './componentDocblockHandler';
10+
export { default as componentDocblockHandler } from './componentDocblockHandler';
1311
export { default as componentMethodsHandler } from './componentMethodsHandler';
14-
export {
15-
default as componentMethodsJsDocHandler,
16-
} from './componentMethodsJsDocHandler';
12+
export { default as componentMethodsJsDocHandler } from './componentMethodsJsDocHandler';
1713
export { default as defaultPropsHandler } from './defaultPropsHandler';
1814
export {
1915
propTypeHandler,
2016
contextTypeHandler,
2117
childContextTypeHandler,
2218
} from './propTypeHandler';
23-
export {
24-
default as propTypeCompositionHandler,
25-
} from './propTypeCompositionHandler';
19+
export { default as propTypeCompositionHandler } from './propTypeCompositionHandler';
2620
export { default as propDocBlockHandler } from './propDocBlockHandler';
2721
export { default as displayNameHandler } from './displayNameHandler';
2822
export { default as flowTypeHandler } from './flowTypeHandler';

src/handlers/propDocBlockHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getMemberValuePath from '../utils/getMemberValuePath';
1212
import resolveToValue from '../utils/resolveToValue';
1313
import setPropDescription from '../utils/setPropDescription';
1414
import type Documentation from '../Documentation';
1515

16-
const { namedTypes: t } = types;
17-
1816
function resolveDocumentation(
1917
documentation: Documentation,
2018
path: NodePath,

src/handlers/propTypeCompositionHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getMemberValuePath from '../utils/getMemberValuePath';
1212
import resolveToModule from '../utils/resolveToModule';
1313
import resolveToValue from '../utils/resolveToValue';
1414
import type Documentation from '../Documentation';
1515

16-
const { namedTypes: t } = types;
17-
1816
/**
1917
* It resolves the path to its module name and adds it to the "composes" entry
2018
* in the documentation.

src/handlers/propTypeHandler.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t } from 'ast-types';
1111
import getPropType from '../utils/getPropType';
1212
import getPropertyName from '../utils/getPropertyName';
1313
import getMemberValuePath from '../utils/getMemberValuePath';
@@ -18,8 +18,6 @@ import resolveToModule from '../utils/resolveToModule';
1818
import resolveToValue from '../utils/resolveToValue';
1919
import type Documentation from '../Documentation';
2020

21-
const { namedTypes: t } = types;
22-
2321
function isPropTypesExpression(path) {
2422
const moduleName = resolveToModule(path);
2523
if (moduleName) {

src/resolver/__tests__/findAllComponentDefinitions-test.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
*
77
*/
88

9-
import types from 'ast-types';
9+
import { NodePath } from 'ast-types';
1010
import * as utils from '../../../tests/utils';
1111
import findAllComponentDefinitions from '../findAllComponentDefinitions';
1212

13-
const { NodePath } = types;
14-
1513
describe('findAllComponentDefinitions', () => {
1614
function parse(source) {
1715
return findAllComponentDefinitions(utils.parse(source), utils.getParser());

src/resolver/findAllComponentDefinitions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t, visit } from 'ast-types';
1111
import isReactComponentClass from '../utils/isReactComponentClass';
1212
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
1313
import isReactForwardRefCall from '../utils/isReactForwardRefCall';
1414
import isStatelessComponent from '../utils/isStatelessComponent';
1515
import normalizeClassDefinition from '../utils/normalizeClassDefinition';
1616
import resolveToValue from '../utils/resolveToValue';
1717

18-
const { visit, namedTypes: t } = types;
19-
2018
/**
2119
* Given an AST, this function tries to find all object expressions that are
2220
* passed to `React.createClass` calls, by resolving all references properly.

src/resolver/findAllExportedComponentDefinitions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t, visit } from 'ast-types';
1111
import isExportsOrModuleAssignment from '../utils/isExportsOrModuleAssignment';
1212
import isReactComponentClass from '../utils/isReactComponentClass';
1313
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
@@ -18,8 +18,6 @@ import resolveExportDeclaration from '../utils/resolveExportDeclaration';
1818
import resolveToValue from '../utils/resolveToValue';
1919
import resolveHOC from '../utils/resolveHOC';
2020

21-
const { visit, namedTypes: t } = types;
22-
2321
function ignore(): false {
2422
return false;
2523
}

src/resolver/findExportedComponentDefinition.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @flow
88
*/
99

10-
import types from 'ast-types';
10+
import { namedTypes as t, visit } from 'ast-types';
1111
import isExportsOrModuleAssignment from '../utils/isExportsOrModuleAssignment';
1212
import isReactComponentClass from '../utils/isReactComponentClass';
1313
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
@@ -18,8 +18,6 @@ import resolveExportDeclaration from '../utils/resolveExportDeclaration';
1818
import resolveToValue from '../utils/resolveToValue';
1919
import resolveHOC from '../utils/resolveHOC';
2020

21-
const { namedTypes: t, visit } = types;
22-
2321
const ERROR_MULTIPLE_DEFINITIONS =
2422
'Multiple exported component definitions found.';
2523

src/utils/__tests__/__snapshots__/getMembers-test.js.snap

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ Array [
2626
"callee": Node {
2727
"computed": false,
2828
"end": 8,
29+
"innerComments": undefined,
30+
"leadingComments": undefined,
2931
"loc": SourceLocation {
3032
"end": Position {
3133
"column": 8,
@@ -38,6 +40,8 @@ Array [
3840
},
3941
"object": Node {
4042
"end": 4,
43+
"innerComments": undefined,
44+
"leadingComments": undefined,
4145
"loc": SourceLocation {
4246
"end": Position {
4347
"column": 4,
@@ -51,10 +55,13 @@ Array [
5155
},
5256
"name": "foo",
5357
"start": 1,
58+
"trailingComments": undefined,
5459
"type": "Identifier",
5560
},
5661
"property": Node {
5762
"end": 8,
63+
"innerComments": undefined,
64+
"leadingComments": undefined,
5865
"loc": SourceLocation {
5966
"end": Position {
6067
"column": 8,
@@ -68,12 +75,16 @@ Array [
6875
},
6976
"name": "bar",
7077
"start": 5,
78+
"trailingComments": undefined,
7179
"type": "Identifier",
7280
},
7381
"start": 1,
82+
"trailingComments": undefined,
7483
"type": "MemberExpression",
7584
},
7685
"end": 13,
86+
"innerComments": undefined,
87+
"leadingComments": undefined,
7788
"loc": SourceLocation {
7889
"end": Position {
7990
"column": 13,
@@ -85,11 +96,14 @@ Array [
8596
},
8697
},
8798
"start": 1,
99+
"trailingComments": undefined,
88100
"type": "CallExpression",
89101
},
90102
"computed": false,
91103
"path": Node {
92104
"end": 8,
105+
"innerComments": undefined,
106+
"leadingComments": undefined,
93107
"loc": SourceLocation {
94108
"end": Position {
95109
"column": 8,
@@ -103,6 +117,7 @@ Array [
103117
},
104118
"name": "bar",
105119
"start": 5,
120+
"trailingComments": undefined,
106121
"type": "Identifier",
107122
},
108123
},
@@ -111,6 +126,8 @@ Array [
111126
"computed": true,
112127
"path": Node {
113128
"end": 22,
129+
"innerComments": undefined,
130+
"leadingComments": undefined,
114131
"loc": SourceLocation {
115132
"end": Position {
116133
"column": 22,
@@ -124,6 +141,7 @@ Array [
124141
},
125142
"name": "baz",
126143
"start": 19,
144+
"trailingComments": undefined,
127145
"type": "Identifier",
128146
},
129147
},

0 commit comments

Comments
 (0)