Skip to content

Commit

Permalink
📃 docs: Fix javadoc error
Browse files Browse the repository at this point in the history
  • Loading branch information
caoccao committed Mar 10, 2024
1 parent 1e2edc8 commit cda72e5
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 6 deletions.
17 changes: 17 additions & 0 deletions src/main/java/com/caoccao/javet/swc4j/Swc4j.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,27 @@ public String getVersion() {
return Swc4jNative.coreGetVersion();
}

/**
* Transpile.
*
* @param code the code
* @return the swc4j transpile output
* @throws Swc4jCoreException the swc4j core exception
* @since 0.1.0
*/
public Swc4jTranspileOutput transpile(String code) throws Swc4jCoreException {
return transpile(code, new Swc4jTranspileOptions());
}

/**
* Transpile.
*
* @param code the code
* @param options the options
* @return the swc4j transpile output
* @throws Swc4jCoreException the swc4j core exception
* @since 0.1.0
*/
@SuppressWarnings("RedundantThrows")
public Swc4jTranspileOutput transpile(String code, Swc4jTranspileOptions options) throws Swc4jCoreException {
return (Swc4jTranspileOutput) Swc4jNative.coreTranspile(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ public boolean isTransformJsx() {

/**
* Should import declarations be transformed to variable declarations using
* a dynamic import. This is useful for import & export declaration support
* in script contexts such as the Deno REPL. Defaults to `false`.
* a dynamic import. This is useful for import and export declaration support
* in script contexts such as the Deno REPL.
* Defaults to `false`.
*
* @return true : transformed, false : not transformed
* @since 0.1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,47 +16,110 @@

package com.caoccao.javet.swc4j.outputs;

public class Swc4jTranspileOutput {
protected String code;
protected boolean module;
protected String sourceMap;
/**
* The type Swc4j transpile output.
*
* @since 0.1.0
*/
public final class Swc4jTranspileOutput {
private String code;
private boolean module;
private String sourceMap;

/**
* Instantiates a new Swc4j transpile output.
*
* @since 0.1.0
*/
public Swc4jTranspileOutput() {
this(null);
}

/**
* Instantiates a new Swc4j transpile output.
*
* @param code the code
* @since 0.1.0
*/
public Swc4jTranspileOutput(String code) {
this(code, null, false);
}

/**
* Instantiates a new Swc4j transpile output.
*
* @param code the code
* @param sourceMap the source map
* @param module the module
* @since 0.1.0
*/
public Swc4jTranspileOutput(String code, String sourceMap, boolean module) {
setCode(code);
setModule(module);
setSourceMap(sourceMap);
}

/**
* Transpiled text.
*
* @return the code
* @since 0.1.0
*/
public String getCode() {
return code;
}

/**
* Source map back to the original file.
*
* @return the source map
* @since 0.1.0
*/
public String getSourceMap() {
return sourceMap;
}

/**
* Gets if this source is a module.
*
* @return the boolean
* @since 0.1.0
*/
public boolean isModule() {
return module;
}

/**
* Sets code.
*
* @param code the code
* @return the self
* @since 0.1.0
*/
public Swc4jTranspileOutput setCode(String code) {
this.code = code;
return this;
}

/**
* Sets module.
*
* @param module the module
* @return the self
* @since 0.1.0
*/
public Swc4jTranspileOutput setModule(boolean module) {
this.module = module;
return this;
}

/**
* Sets source map.
*
* @param sourceMap the source map
* @return the self
* @since 0.1.0
*/
public Swc4jTranspileOutput setSourceMap(String sourceMap) {
this.sourceMap = sourceMap;
return this;
Expand Down

0 comments on commit cda72e5

Please sign in to comment.