Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caoccao/jaspiler
Jaspiler is a Java to Java transpiler.
https://github.com/caoccao/jaspiler
babel java plugins transpile transpiler
Last synced: about 1 month ago
JSON representation
Jaspiler is a Java to Java transpiler.
- Host: GitHub
- URL: https://github.com/caoccao/jaspiler
- Owner: caoccao
- License: apache-2.0
- Created: 2023-04-14T02:27:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-17T02:58:00.000Z (10 months ago)
- Last Synced: 2024-10-29T10:30:05.870Z (2 months ago)
- Topics: babel, java, plugins, transpile, transpiler
- Language: Java
- Homepage:
- Size: 661 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
Jaspiler
========|Build Jaspiler|
.. |Build Jaspiler| image:: https://github.com/caoccao/Jaspiler/actions/workflows/build_jaspiler_artifact.yml/badge.svg
:target: https://github.com/caoccao/Jaspiler/actions/workflows/build_jaspiler_artifact.yml`Jaspiler `_ is a Java to Java transpiler. It transpiles the given Java code to the corresponding Java code with some customizations. It is expected to be a Babel for Java. If you like this project, please star it.
Major Features
==============* Annotation based customizations
* AST based customizations
* JavaScript as the domain specific language (JS as DSL)
* Babel flavored plugins
* JDK 17 SupportQuick Start
===========* Download the all-in-one jar file ``Jaspiler-${version}.jar`` from the latest `Actions `_.
* Create a JavaScript file ``test.js`` as follows:.. code-block:: javascript
const result = jaspiler.transformSync(
`package com.test;
public class A {
}
`,
{
plugins: [{
visitor: {
Class(node) {
node.simpleName = jaspiler.createName('B');
},
},
}],
sourceType: 'string',
});
console.info(result.code);* Execute the command as follows:
.. code-block:: shell
java -jar Jaspiler-${version}.jar test.js
* The output is as follows:
.. code-block:: java
package com.test;
public class B {
}Document
========The complete document is at the `wiki `_.
Q & A
=====Why do I Need a Java to Java Transpiler?
----------------------------------------* I want to code with JDK 17 but support JDK 8/11. Jaspiler can help transform the code from JDK 17 to JDK 8/11.
* I want to remove some proprietary cloud features at source code level before deploying the binaries to an on-premise environment to prevent the reverse engineering. Jaspiler can help add/update/remove any part of the code at the AST level.
* I want to translate the Java code to JavaScript/Python/Go/.... Jaspiler can provide the complete AST and allow all kinds of translation.
* I want to obfuscate the code. Jaspiler can help perform all kinds of code obfuscation at the AST level.What's the Status of Jaspiler?
------------------------------Jaspiler is at its early stage with limited feature set. You are welcome taking a try. Jaspiler is expected to be a community driven open-source project, so if you want a feature, either you raise an issue, wait for the community to prioritize it, or you submit a pull request.
License
=======`APACHE LICENSE, VERSION 2.0 `_