Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ggrossetie/opal-node-compiler
Opal Compiler for Node.js
https://github.com/ggrossetie/opal-node-compiler
compiler javascript nodejs opal
Last synced: 3 months ago
JSON representation
Opal Compiler for Node.js
- Host: GitHub
- URL: https://github.com/ggrossetie/opal-node-compiler
- Owner: ggrossetie
- License: mit
- Created: 2016-04-23T17:26:58.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-04-09T22:40:50.000Z (almost 2 years ago)
- Last Synced: 2024-05-21T12:26:09.906Z (9 months ago)
- Topics: compiler, javascript, nodejs, opal
- Language: JavaScript
- Homepage: https://opalrb.com/
- Size: 2.56 MB
- Stars: 19
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Opal Compiler for Node.js
[![Build](https://github.com/Mogztter/opal-node-compiler/workflows/Build/badge.svg)](https://github.com/Mogztter/opal-node-compiler/actions?query=workflow%3ABuild)
[![npm version](http://img.shields.io/npm/v/opal-compiler.svg)](https://www.npmjs.org/package/opal-compiler)Transpile Ruby code to JavaScript in JavaScript!
## Usage
Given a Ruby file named `hello.rb`:
```ruby
puts "Hello world"
```The following code will transpile `hello.rb` to JavaScript:
```javascript
const Builder = require('opal-compiler').Builder
// Opal object will be available on the global scopeconst builder = Builder.create()
const result = builder.build('hello.rb').toString()
console.log(result)
//(function(Opal) {
// var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;// Opal.add_stubs(['$puts']);
// return self.$puts("Hello world")
//})(Opal);
```