Skip to content

Commit

Permalink
🐳 chore: Update version for release
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Jul 13, 2024
1 parent 09fbe1a commit b77b0e1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@
<dependency>
<groupId>com.caoccao.javet</groupId>
<artifactId>swc4j</artifactId>
<version>0.9.0</version>
<version>0.10.0</version>
</dependency>
```

```kotlin
// Gradle Kotlin DSL
implementation("com.caoccao.javet:swc4j:0.9.0")
implementation("com.caoccao.javet:swc4j:0.10.0")
```

```groovy
// Gradle Groovy DSL
implementation 'com.caoccao.javet:swc4j:0.9.0'
implementation 'com.caoccao.javet:swc4j:0.10.0'
```

### Transpile
Expand Down
1 change: 1 addition & 0 deletions docs/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Upgraded deno_ast to v0.40.0
* Upgraded rust toolchain to v1.79.0
* Replaced `debug_print` with `log`
* Fixed extra line separators in JsxText

## 0.9.0

Expand Down
2 changes: 1 addition & 1 deletion scripts/ts/change_swc4j_version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,5 @@ class ChangeSwc4jVersion {
}
}

const changeSwc4jVersion = new ChangeSwc4jVersion('0.9.0', '0.10.0');
const changeSwc4jVersion = new ChangeSwc4jVersion('0.10.0', '0.10.0');
changeSwc4jVersion.change()
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ public class Swc4jAstCallExpr
protected static final Swc4jParseOptions PARSE_OPTIONS = new Swc4jParseOptions()
.setCaptureAst(true)
.setMediaType(Swc4jMediaType.JavaScript);
protected static final Swc4j SWC4J = new Swc4j();
/**
* The constant swc4j is for evaluating the expression.
*
* @since 0.10.0
*/
protected static Swc4j swc4j;
protected final List<Swc4jAstExprOrSpread> args;
protected ISwc4jAstCallee callee;
@Jni2RustField(componentBox = true)
Expand Down Expand Up @@ -86,6 +91,13 @@ public static Swc4jAstCallExpr create(
return new Swc4jAstCallExpr(callee, args, typeArgs, Swc4jSpan.DUMMY);
}

protected static Swc4j getSwc4j() {
if (swc4j == null) {
swc4j = new Swc4j();
}
return swc4j;
}

@Override
public Optional<ISwc4jAst> eval() {
switch (callee.getType()) {
Expand Down Expand Up @@ -244,7 +256,7 @@ public Optional<ISwc4jAst> eval() {
if (expr instanceof Swc4jAstStr) {
String code = expr.as(Swc4jAstStr.class).getValue();
try {
Swc4jParseOutput output = SWC4J.parse(code, PARSE_OPTIONS);
Swc4jParseOutput output = getSwc4j().parse(code, PARSE_OPTIONS);
List<? extends ISwc4jAst> body = output.getProgram().getBody();
if (body.size() == 1 && body.get(0) instanceof Swc4jAstReturnStmt) {
Swc4jAstReturnStmt returnStmt = body.get(0).as(Swc4jAstReturnStmt.class);
Expand Down

0 comments on commit b77b0e1

Please sign in to comment.