Skip to content

Commit

Permalink
Updated with latest rewrite. Minor polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
traceyyoshima committed Nov 10, 2023
1 parent 80a6407 commit f821f40
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 29 deletions.
2 changes: 1 addition & 1 deletion js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ nvm use && yarn update
```

## Structure

Each script may be run and debugged through `package.json => scripts`
- `src/`
- `codegen/` is for scripts that generate Java and TypeScript code during the build process
- `generatedLicenseHeader.txt` is inserted at the top of every generated Java/TS file
Expand Down
14 changes: 7 additions & 7 deletions js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"format": "prettier --write ./src"
},
"devDependencies": {
"@types/node": "^20.8.0",
"parcel": "^2.10.0",
"prettier": "^3.0.3",
"process": "^0.11.10",
"ts-node": "^10.9.1"
"@types/node": "20.8.7",
"parcel": "2.10.0",
"prettier": "3.0.3",
"process": "0.11.10",
"ts-node": "10.9.1"
},
"dependencies": {
"@typescript/vfs": "^1.5.0",
"typescript": "^5.2.2"
"@typescript/vfs": "1.5.0",
"typescript": "5.2.2"
}
}
14 changes: 7 additions & 7 deletions js/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e"
integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==

"@types/node@^20.8.0":
"@types/[email protected].7":
version "20.8.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.8.7.tgz#ad23827850843de973096edfc5abc9e922492a25"
integrity sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==
Expand All @@ -840,7 +840,7 @@
resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==

"@typescript/vfs@^1.5.0":
"@typescript/[email protected]":
version "1.5.0"
resolved "https://registry.yarnpkg.com/@typescript/vfs/-/vfs-1.5.0.tgz#ed942922724f9ace8c07c80b006c47e5e3833218"
integrity sha512-AJS307bPgbsZZ9ggCT3wwpg3VbTKMFNHfaY/uF0ahSkYYrPF2dSSKDNIDIQAHm9qJqbLvCsSJH7yN4Vs/CsMMg==
Expand Down Expand Up @@ -1401,7 +1401,7 @@ ordered-binary@^1.4.1:
resolved "https://registry.yarnpkg.com/ordered-binary/-/ordered-binary-1.4.1.tgz#205cb6efd6c27fa0ef4eced994a023e081cdc911"
integrity sha512-9LtiGlPy982CsgxZvJGNNp2/NnrgEr6EAyN3iIEP3/8vd3YLgAZQHbQ75ZrkfBRGrNg37Dk3U6tuVb+B4Xfslg==

parcel@^2.10.0:
[email protected]:
version "2.10.0"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.10.0.tgz#6b1245baf771ab025769069a28901a54fdc10823"
integrity sha512-YJmWEsiv1ClpPcJiWkr3gFj40sRvfeK89GGGwJjpzQMQsBmN6h6OHrSkByx0jrsPIvdsOIccU702upYpRAypuw==
Expand Down Expand Up @@ -1487,12 +1487,12 @@ posthtml@^0.16.4, posthtml@^0.16.5:
posthtml-parser "^0.11.0"
posthtml-render "^3.0.0"

prettier@^3.0.3:
[email protected]:
version "3.0.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.3.tgz#432a51f7ba422d1469096c0fdc28e235db8f9643"
integrity sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==

process@^0.11.10:
[email protected]:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==
Expand Down Expand Up @@ -1588,7 +1588,7 @@ to-regex-range@^5.0.1:
dependencies:
is-number "^7.0.0"

ts-node@^10.9.1:
[email protected]:
version "10.9.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==
Expand Down Expand Up @@ -1617,7 +1617,7 @@ type-fest@^0.20.2:
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==

typescript@^5.2.2:
[email protected]:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
package org.openrewrite.javascript.internal;

import org.openrewrite.FileAttributes;
import org.openrewrite.ParseExceptionResult;
import org.openrewrite.internal.ListUtils;
import org.openrewrite.internal.lang.Nullable;
import org.openrewrite.java.internal.JavaTypeCache;
import org.openrewrite.java.marker.Semicolon;
import org.openrewrite.java.marker.TrailingComma;
import org.openrewrite.java.tree.*;
import org.openrewrite.javascript.JavaScriptParser;
import org.openrewrite.javascript.TypeScriptTypeMapping;
import org.openrewrite.javascript.internal.tsc.TSCNode;
import org.openrewrite.javascript.internal.tsc.TSCNodeList;
Expand Down Expand Up @@ -80,16 +78,14 @@ public JS.CompilationUnit visitSourceFile() {
Space childPrefix = whitespace();
String text = child.getText();
skip(text);
Markers childMarkers = Markers.build(singletonList(ParseExceptionResult.build(JavaScriptParser.class, t)
.withTreeType(child.syntaxKind().name())));
visited = new J.Unknown(
randomId(),
childPrefix,
Markers.EMPTY,
new J.Unknown.Source(
randomId(),
EMPTY,
childMarkers,
Markers.EMPTY,
text));
}

Expand Down Expand Up @@ -3168,8 +3164,7 @@ private <J2 extends J> List<JRightPadded<J2>> convertAll(List<TSCNode> elements,
new J.Unknown.Source(
randomId(),
EMPTY,
Markers.build(singletonList(ParseExceptionResult.build(JavaScriptParser.class, e)
.withTreeType(element.syntaxKind().name()))),
Markers.EMPTY,
text));
}
Space after = i == elements.size() - 1 ? suffix.apply(element) : innerSuffix.apply(element);
Expand Down Expand Up @@ -3252,8 +3247,7 @@ private <T extends J> JContainer<T> mapContainer(TSCSyntaxKind open, List<TSCNod
new J.Unknown.Source(
randomId(),
EMPTY,
Markers.build(singletonList(ParseExceptionResult.build(JavaScriptParser.class, e)
.withTreeType(node.syntaxKind().name()))),
Markers.EMPTY,
text));
} else {
throw e;
Expand Down Expand Up @@ -3509,8 +3503,7 @@ private J unknown(TSCNode node) {
new J.Unknown.Source(
randomId(),
EMPTY,
Markers.build(singletonList(ParseExceptionResult.build(JavaScriptParser.class, new UnsupportedOperationException(node.syntaxKind().name() + " not implemented"))
.withTreeType(node.syntaxKind().name()))),
Markers.EMPTY,
text));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ void typeArguments() {
class User {
}
function foo < T > ( arg : T ) : T {
return arg ;
function foo < T > () : User {
return new User() ;
}
const bar = foo < User > ( new User ( ) ) ;
const bar = foo<User>();
"""
)
);
Expand Down

0 comments on commit f821f40

Please sign in to comment.