Skip to content

Commit

Permalink
feat: upgrade babel dependencies
Browse files Browse the repository at this point in the history
- Fix private method parsing/traversal
- Add TS bigint primitive
- Add flow symbol primitive
  • Loading branch information
jquense authored and tmcw committed Apr 7, 2020
1 parent 2701618 commit d0ec029
Show file tree
Hide file tree
Showing 10 changed files with 1,678 additions and 1,052 deletions.
820 changes: 641 additions & 179 deletions __tests__/__snapshots__/test.js.snap

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions __tests__/fixture/es6.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ function destructure({
/**
* Similar, but with an array
* @example
* destructure([0, 1, 2, 3])
* destructure2([0, 1, 2, 3])
*/
function destructure([, a, b, c]) {}
function destructure2([, a, b, c]) {}

/**
* This function returns the number one.
Expand Down
4 changes: 2 additions & 2 deletions __tests__/fixture/html/nested.input.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function bar() {
* Rest property function
* @returns {undefined} nothing
*/
function bar(...toys: Number) {
function bar2(...toys: Number) {
return undefined;
}

Expand All @@ -123,7 +123,7 @@ function bar(...toys: Number) {
*
* @returns {undefined} nothing
*/
function bar() {
function bar3() {
return undefined;
}

Expand Down
1 change: 1 addition & 0 deletions __tests__/lib/flow_doctrine.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ test('flowDoctrine', function() {
'InterfaceTypeAnnotation',
'IntersectionTypeAnnotation',
'EmptyTypeAnnotation',
'SymbolTypeAnnotation',
'TypeofTypeAnnotation'
]);
});
4 changes: 3 additions & 1 deletion __tests__/lib/ts_doctrine.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ test('tsDoctrine', function() {
});

expect(types).toEqual([
'TSBigIntKeyword',
'TSTypePredicate',
'TSTypeQuery',
'TSOptionalType', // handled - not top-level.
Expand All @@ -402,6 +403,7 @@ test('tsDoctrine', function() {
'TSTypeOperator',
'TSIndexedAccessType',
'TSMappedType',
'TSExpressionWithTypeArguments'
'TSExpressionWithTypeArguments',
'TSImportType'
]);
});
51 changes: 26 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,32 @@
"documentation": "./bin/documentation.js"
},
"dependencies": {
"@babel/core": "^7.1.2",
"@babel/generator": "^7.1.3",
"@babel/parser": "7.1.3",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-decorators": "^7.1.2",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.1.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-flow": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-stage-0": "^7.0.0",
"@babel/traverse": "^7.1.4",
"@babel/types": "^7.1.3",
"@babel/core": "^7.9.0",
"@babel/generator": "^7.9.4",
"@babel/parser": "7.9.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/plugin-proposal-do-expressions": "^7.8.3",
"@babel/plugin-proposal-export-default-from": "^7.8.3",
"@babel/plugin-proposal-export-namespace-from": "^7.8.3",
"@babel/plugin-proposal-function-bind": "^7.8.3",
"@babel/plugin-proposal-function-sent": "^7.8.3",
"@babel/plugin-proposal-json-strings": "^7.8.3",
"@babel/plugin-proposal-logical-assignment-operators": "^7.8.3",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.8.3",
"@babel/plugin-proposal-numeric-separator": "^7.8.3",
"@babel/plugin-proposal-optional-chaining": "^7.9.0",
"@babel/plugin-proposal-pipeline-operator": "^7.8.3",
"@babel/plugin-proposal-private-methods": "^7.8.3",
"@babel/plugin-proposal-throw-expressions": "^7.8.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@babel/preset-stage-0": "^7.8.3",
"@babel/traverse": "^7.9.0",
"@babel/types": "^7.9.0",
"ansi-html": "^0.0.7",
"babelify": "^10.0.0",
"chalk": "^2.3.0",
Expand Down
3 changes: 2 additions & 1 deletion src/flow_doctrine.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const generate = require('@babel/generator').default;
const namedTypes = {
NumberTypeAnnotation: 'number',
BooleanTypeAnnotation: 'boolean',
StringTypeAnnotation: 'string'
StringTypeAnnotation: 'string',
SymbolTypeAnnotation: 'symbol'
};

const oneToOne = {
Expand Down
1 change: 1 addition & 0 deletions src/input/dependency.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const STANDARD_BABEL_CONFIG = {
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-syntax-import-meta',
['@babel/plugin-proposal-class-properties', { loose: false }],
'@babel/plugin-proposal-private-methods',
'@babel/plugin-proposal-json-strings'
]
};
Expand Down
1 change: 1 addition & 0 deletions src/ts_doctrine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const generate = require('@babel/generator').default;

const namedTypes = {
TSBigIntKeyword: 'bigint',
TSNumberKeyword: 'number',
TSBooleanKeyword: 'boolean',
TSStringKeyword: 'string',
Expand Down
Loading

0 comments on commit d0ec029

Please sign in to comment.