Skip to content

Commit

Permalink
chore: update ast-types
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense authored and danez committed Dec 11, 2019
1 parent 71e78b3 commit a2978e8
Show file tree
Hide file tree
Showing 56 changed files with 1,182 additions and 1,161 deletions.
42 changes: 23 additions & 19 deletions package.json
Expand Up @@ -4,9 +4,11 @@
"description": "A CLI and toolkit to extract information from React components for documentation generation.",
"repository": {
"type": "git",
"url": "https://github.com/reactjs/react-docgen.git"
"url": "git+https://github.com/reactjs/react-docgen.git"
},
"bugs": {
"url": "https://github.com/reactjs/react-docgen/issues"
},
"bugs": "https://github.com/reactjs/react-docgen/issues",
"bin": {
"react-docgen": "bin/react-docgen.js"
},
Expand Down Expand Up @@ -34,38 +36,40 @@
"react",
"documentation-generation"
],
"author": "Felix Kling",
"author": {
"name": "Felix Kling"
},
"license": "MIT",
"dependencies": {
"@babel/core": "^7.4.4",
"@babel/runtime": "^7.0.0",
"ast-types": "^0.12.4",
"@babel/core": "^7.7.5",
"@babel/runtime": "^7.7.6",
"ast-types": "^0.13.2",
"async": "^2.1.4",
"commander": "^2.19.0",
"doctrine": "^3.0.0",
"node-dir": "^0.1.10",
"strip-indent": "^3.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-flow": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-jest": "^24.1.0",
"@babel/cli": "^7.7.5",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.6",
"@babel/preset-flow": "^7.7.4",
"babel-eslint": "^10.0.3",
"babel-jest": "^24.9.0",
"benchmark": "^2.1.4",
"cli-table": "^0.3.1",
"cross-spawn": "^6.0.4",
"eslint": "^5.7.0",
"eslint-config-prettier": "^4.0.0",
"eslint-plugin-prettier": "^3.0.0",
"eslint-plugin-prettier": "^3.1.1",
"flow-bin": "^0.98.0",
"jest": "^24.1.0",
"jest-diff": "^24.0.0",
"jest-matcher-utils": "^24.0.0",
"prettier": "^1.14.3",
"rimraf": "^2.3.2",
"temp": "^0.9.0"
"jest": "^24.9.0",
"jest-diff": "^24.9.0",
"jest-matcher-utils": "^24.9.0",
"prettier": "^1.19.1",
"rimraf": "^3.0.0",
"temp": "^0.9.1"
},
"jest": {
"snapshotSerializers": [
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/componentDocblockHandler.js
Expand Up @@ -7,12 +7,10 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import type Documentation from '../Documentation';
import { getDocblock } from '../utils/docblock';

const { namedTypes: t } = types;

function isClassDefinition(nodePath) {
const node = nodePath.node;
return t.ClassDeclaration.check(node) || t.ClassExpression.check(node);
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/componentMethodsHandler.js
Expand Up @@ -7,15 +7,13 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getMemberValuePath from '../utils/getMemberValuePath';
import getMethodDocumentation from '../utils/getMethodDocumentation';
import isReactComponentClass from '../utils/isReactComponentClass';
import isReactComponentMethod from '../utils/isReactComponentMethod';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

/**
* The following values/constructs are considered methods:
*
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/defaultPropsHandler.js
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getPropertyName from '../utils/getPropertyName';
import getMemberValuePath from '../utils/getMemberValuePath';
import printValue from '../utils/printValue';
Expand All @@ -17,8 +17,6 @@ import isReactComponentClass from '../utils/isReactComponentClass';
import isReactForwardRefCall from '../utils/isReactForwardRefCall';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

function getDefaultValue(path: NodePath) {
let node = path.node;
let defaultValue;
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/displayNameHandler.js
Expand Up @@ -7,15 +7,13 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getMemberValuePath from '../utils/getMemberValuePath';
import getNameOrValue from '../utils/getNameOrValue';
import resolveToValue from '../utils/resolveToValue';
import resolveFunctionDefinitionToReturnValue from '../utils/resolveFunctionDefinitionToReturnValue';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

export default function displayNameHandler(
documentation: Documentation,
path: NodePath,
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/flowTypeHandler.js
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import type Documentation from '../Documentation';
import { unwrapUtilityType } from '../utils/flowUtilityTypes';
import getFlowType from '../utils/getFlowType';
Expand All @@ -20,8 +20,6 @@ import { type TypeParameters } from '../utils/getTypeParameters';
import resolveToValue from '../utils/resolveToValue';
import setPropDescription from '../utils/setPropDescription';

const { namedTypes: t } = types;

function setPropDescriptor(
documentation: Documentation,
path: NodePath,
Expand Down
12 changes: 3 additions & 9 deletions src/handlers/index.js
Expand Up @@ -7,22 +7,16 @@
* @flow
*/

export {
default as componentDocblockHandler,
} from './componentDocblockHandler';
export { default as componentDocblockHandler } from './componentDocblockHandler';
export { default as componentMethodsHandler } from './componentMethodsHandler';
export {
default as componentMethodsJsDocHandler,
} from './componentMethodsJsDocHandler';
export { default as componentMethodsJsDocHandler } from './componentMethodsJsDocHandler';
export { default as defaultPropsHandler } from './defaultPropsHandler';
export {
propTypeHandler,
contextTypeHandler,
childContextTypeHandler,
} from './propTypeHandler';
export {
default as propTypeCompositionHandler,
} from './propTypeCompositionHandler';
export { default as propTypeCompositionHandler } from './propTypeCompositionHandler';
export { default as propDocBlockHandler } from './propDocBlockHandler';
export { default as displayNameHandler } from './displayNameHandler';
export { default as flowTypeHandler } from './flowTypeHandler';
4 changes: 1 addition & 3 deletions src/handlers/propDocBlockHandler.js
Expand Up @@ -7,14 +7,12 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getMemberValuePath from '../utils/getMemberValuePath';
import resolveToValue from '../utils/resolveToValue';
import setPropDescription from '../utils/setPropDescription';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

function resolveDocumentation(
documentation: Documentation,
path: NodePath,
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/propTypeCompositionHandler.js
Expand Up @@ -7,14 +7,12 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getMemberValuePath from '../utils/getMemberValuePath';
import resolveToModule from '../utils/resolveToModule';
import resolveToValue from '../utils/resolveToValue';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

/**
* It resolves the path to its module name and adds it to the "composes" entry
* in the documentation.
Expand Down
4 changes: 1 addition & 3 deletions src/handlers/propTypeHandler.js
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t } from 'ast-types';
import getPropType from '../utils/getPropType';
import getPropertyName from '../utils/getPropertyName';
import getMemberValuePath from '../utils/getMemberValuePath';
Expand All @@ -18,8 +18,6 @@ import resolveToModule from '../utils/resolveToModule';
import resolveToValue from '../utils/resolveToValue';
import type Documentation from '../Documentation';

const { namedTypes: t } = types;

function isPropTypesExpression(path) {
const moduleName = resolveToModule(path);
if (moduleName) {
Expand Down
4 changes: 1 addition & 3 deletions src/resolver/__tests__/findAllComponentDefinitions-test.js
Expand Up @@ -6,12 +6,10 @@
*
*/

import types from 'ast-types';
import { NodePath } from 'ast-types';
import * as utils from '../../../tests/utils';
import findAllComponentDefinitions from '../findAllComponentDefinitions';

const { NodePath } = types;

describe('findAllComponentDefinitions', () => {
function parse(source) {
return findAllComponentDefinitions(utils.parse(source), utils.getParser());
Expand Down
4 changes: 1 addition & 3 deletions src/resolver/findAllComponentDefinitions.js
Expand Up @@ -7,16 +7,14 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t, visit } from 'ast-types';
import isReactComponentClass from '../utils/isReactComponentClass';
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
import isReactForwardRefCall from '../utils/isReactForwardRefCall';
import isStatelessComponent from '../utils/isStatelessComponent';
import normalizeClassDefinition from '../utils/normalizeClassDefinition';
import resolveToValue from '../utils/resolveToValue';

const { visit, namedTypes: t } = types;

/**
* Given an AST, this function tries to find all object expressions that are
* passed to `React.createClass` calls, by resolving all references properly.
Expand Down
4 changes: 1 addition & 3 deletions src/resolver/findAllExportedComponentDefinitions.js
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t, visit } from 'ast-types';
import isExportsOrModuleAssignment from '../utils/isExportsOrModuleAssignment';
import isReactComponentClass from '../utils/isReactComponentClass';
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
Expand All @@ -18,8 +18,6 @@ import resolveExportDeclaration from '../utils/resolveExportDeclaration';
import resolveToValue from '../utils/resolveToValue';
import resolveHOC from '../utils/resolveHOC';

const { visit, namedTypes: t } = types;

function ignore(): false {
return false;
}
Expand Down
4 changes: 1 addition & 3 deletions src/resolver/findExportedComponentDefinition.js
Expand Up @@ -7,7 +7,7 @@
* @flow
*/

import types from 'ast-types';
import { namedTypes as t, visit } from 'ast-types';
import isExportsOrModuleAssignment from '../utils/isExportsOrModuleAssignment';
import isReactComponentClass from '../utils/isReactComponentClass';
import isReactCreateClassCall from '../utils/isReactCreateClassCall';
Expand All @@ -18,8 +18,6 @@ import resolveExportDeclaration from '../utils/resolveExportDeclaration';
import resolveToValue from '../utils/resolveToValue';
import resolveHOC from '../utils/resolveHOC';

const { namedTypes: t, visit } = types;

const ERROR_MULTIPLE_DEFINITIONS =
'Multiple exported component definitions found.';

Expand Down
18 changes: 18 additions & 0 deletions src/utils/__tests__/__snapshots__/getMembers-test.js.snap
Expand Up @@ -26,6 +26,8 @@ Array [
"callee": Node {
"computed": false,
"end": 8,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 8,
Expand All @@ -38,6 +40,8 @@ Array [
},
"object": Node {
"end": 4,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 4,
Expand All @@ -51,10 +55,13 @@ Array [
},
"name": "foo",
"start": 1,
"trailingComments": undefined,
"type": "Identifier",
},
"property": Node {
"end": 8,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 8,
Expand All @@ -68,12 +75,16 @@ Array [
},
"name": "bar",
"start": 5,
"trailingComments": undefined,
"type": "Identifier",
},
"start": 1,
"trailingComments": undefined,
"type": "MemberExpression",
},
"end": 13,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 13,
Expand All @@ -85,11 +96,14 @@ Array [
},
},
"start": 1,
"trailingComments": undefined,
"type": "CallExpression",
},
"computed": false,
"path": Node {
"end": 8,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 8,
Expand All @@ -103,6 +117,7 @@ Array [
},
"name": "bar",
"start": 5,
"trailingComments": undefined,
"type": "Identifier",
},
},
Expand All @@ -111,6 +126,8 @@ Array [
"computed": true,
"path": Node {
"end": 22,
"innerComments": undefined,
"leadingComments": undefined,
"loc": SourceLocation {
"end": Position {
"column": 22,
Expand All @@ -124,6 +141,7 @@ Array [
},
"name": "baz",
"start": 19,
"trailingComments": undefined,
"type": "Identifier",
},
},
Expand Down

0 comments on commit a2978e8

Please sign in to comment.