Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial support for TypeScript in Recast via Babylon 7 parser #461

Merged
merged 73 commits into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
cc44d37
Basic simplistic test with TypeScript and Babylon
Feb 1, 2018
7591bbf
Got some more complex expression pretty printed
Feb 2, 2018
f70efd5
Make basic classes work
Feb 2, 2018
1092a0c
Get typescript as expressions working
Feb 2, 2018
dc0e1b6
Support more type keywords
Feb 3, 2018
52eab83
typescript function type annotations
Feb 3, 2018
a7fb1fa
Support function type parameters
Feb 3, 2018
4411b63
typescript: support tuple types
Feb 3, 2018
6630b7f
typescript enum support
Feb 3, 2018
e203b53
typescript more cases for type declarations and enums
Feb 3, 2018
ebed213
Preserve representation of numerics not in base 10
Feb 4, 2018
d2b218f
TS: variable declarations
Feb 4, 2018
ae7d324
babylon version bump in yarn.lock
Feb 4, 2018
b8b12e2
type assertions and refactoring
Feb 4, 2018
c3cd3fa
TS: interfaces
Feb 4, 2018
d65fc44
TS: classes
Feb 4, 2018
a245402
TS: Allow optional identifiers
Feb 4, 2018
fef8c4d
type annotation in both flow and TS through babylon
Feb 4, 2018
c8a0d70
TS: more declarations and type annotations
Feb 4, 2018
955a8d1
TS: more complete enum support
Feb 4, 2018
cc77e49
TS: some more advanced types
Feb 4, 2018
74226ff
TS: Mapped types
Feb 5, 2018
06d6286
TS: more mapped types
Feb 5, 2018
e83690e
TS: namespaces
Feb 5, 2018
30fc8b9
fix(package): update ast-types to version 0.11.0
greenkeeper[bot] Feb 18, 2018
402e8ac
Reindent test/syntax.js to use two spaces per tab.
benjamn Feb 18, 2018
fdf37c4
Add printer cases for unprintable TSHasOptionalType{Parameters,Annota…
benjamn Feb 18, 2018
9e24093
Add printer case for TSDeclareFunction.
benjamn Feb 18, 2018
cd40b8a
Add printer cases for TS{Object,Symbol}Keyword and TSThisType.
benjamn Feb 18, 2018
fbeff42
Add printer case for TSParenthesizedType.
benjamn Feb 18, 2018
7ffeb87
Tweak return type spacing for function type declarations.
benjamn Feb 18, 2018
49af0f3
Add printer case for TSTypeQuery.
benjamn Feb 18, 2018
f79160b
Add a printer case for TSExportAssignment.
benjamn Feb 18, 2018
d4894dc
Add a printer case for TSNamespaceExportDeclaration.
benjamn Feb 18, 2018
d256233
Add a printer case for TSParameterProperty.
benjamn Feb 18, 2018
c0741d3
Add a printer case for TSImportEqualsDeclaration.
benjamn Feb 18, 2018
9cf2e7a
Add a printer case for TSExternalModuleReference.
benjamn Feb 18, 2018
af697fd
Unify printMethod and printObjectMethod.
benjamn Feb 18, 2018
16c6acc
Add a printer case for TSDeclareMethod.
benjamn Feb 18, 2018
ec14dda
Switch to a test/run.sh testing script.
benjamn Feb 18, 2018
e0054f2
Test re-printing Babylon TypeScript test fixtures.
benjamn Feb 18, 2018
bd0cfdd
Remove stray printTypeScriptModifiers call.
benjamn Feb 18, 2018
b362adc
Update ast-types to version 0.11.1.
benjamn Feb 18, 2018
a563a51
Test that reprinted TypeScript ASTs parse equivalently.
benjamn Feb 18, 2018
0b3b221
Correctly print empty TSInterfaceBody nodes.
benjamn Feb 18, 2018
5204628
Respect .optional property of TSMappedType.
benjamn Feb 18, 2018
d6f0d8a
Use printFunctionParams for TS{Function,Constructor}Type.
benjamn Feb 18, 2018
cdecca3
Respect .default property of TSTypeParameter.
benjamn Feb 18, 2018
8bee49f
Use printStatementSequence to print TSModuleBlock.
benjamn Feb 18, 2018
3e93dda
Respect .readonly property in printMethod.
benjamn Feb 18, 2018
1a9438c
Rework TSModuleDeclaration.
benjamn Feb 18, 2018
ad0429d
Unify TSInterfaceDeclaration with InterfaceDeclaration (Flow).
benjamn Feb 18, 2018
f5526e5
Allow .optional ClassProperty nodes.
benjamn Feb 18, 2018
09590d4
Allow .computed TS{Property,Method}Signature nodes.
benjamn Feb 18, 2018
46c0d62
Forbid class expressions as statements without parentheses.
benjamn Feb 18, 2018
9a3747e
Fix some abstract/readonly/access modifiers.
benjamn Feb 18, 2018
8c23a29
Use .id rather than .name field of TSNamespaceExportDeclaration.
benjamn Feb 18, 2018
c6e6f99
Fix TS{Call,Construct}SignatureDeclaration.
benjamn Feb 18, 2018
940ac27
Use .id rather than .name field of TSImportEqualsDeclaration.
benjamn Feb 18, 2018
8bbdf47
Tweak TypeScript test so it passes without semicolon.
benjamn Feb 18, 2018
198498c
Add "use strict" to lib/printer.js to enable block scoping for Node 4.
benjamn Feb 18, 2018
c63a44e
Tweak enum printing.
benjamn Feb 18, 2018
81638aa
Support TypeScript declared variable declarations.
benjamn Feb 18, 2018
49769dc
Add semicolon after class member declarations.
benjamn Feb 18, 2018
d78ff88
More .declare and .abstract modifiers.
benjamn Feb 18, 2018
1a18b51
Style tweaks to ArrowFunctionExpression printer case.
benjamn Feb 18, 2018
6161dd7
Support ? syntax for optional methods and method signatures.
benjamn Feb 18, 2018
001e47c
Style tweaks for TSType{Assertion,Parameter}.
benjamn Feb 18, 2018
6c0842a
Don't skip printing type parameters for anonymous classes.
benjamn Feb 18, 2018
a48b4bf
Rewrite ImportSpecifier printer case to wrap lines automatically.
benjamn Feb 19, 2018
f59bc54
Improve TSTypeLiteral printer case and remove redundant case.
benjamn Feb 19, 2018
5d12678
Test reprinting of graphql-tools TypeScript files.
benjamn Feb 19, 2018
945a14d
Update Babel-related dev dependencies.
benjamn Feb 19, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/node_modules
/test/data/babylon-typescript-fixtures
/test/data/graphql-tools-src
16 changes: 14 additions & 2 deletions lib/fast-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,20 @@ function containsCallExpression(node) {

FPp.canBeFirstInStatement = function() {
var node = this.getNode();
return !n.FunctionExpression.check(node)
&& !n.ObjectExpression.check(node);

if (n.FunctionExpression.check(node)) {
return false;
}

if (n.ObjectExpression.check(node)) {
return false;
}

if (n.ClassExpression.check(node)) {
return false;
}

return true;
};

FPp.firstInStatement = function() {
Expand Down
Loading