npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mruby-native

v2.0.0

Published

mruby compiler for Node.js applications

Downloads

1

Readme

mruby-native

Prebuilt mruby compiler package for Node.js applications

This supplies mrbc command as prebuilt binaries for various platforms and architectures.

  • No C/C++ compiler needed to install this package.
  • Faster installation (only downloads a compressed archive for your platform, ~1MB)

What is mruby?

The lightweight implementation of Ruby language.
See http://mruby.org/

Included mruby versions

|mruby version|RITE binary version|Included?| |:--:|:--:|:--:| |1.4.0|0004|Yes| |1.3.0|0004|Yes| |1.2.0|0003|Yes|

Included commands

Currently, this package includes mrbc (mruby compiler) only.

|Command|Included?| |:--|:--:| |mrbc|Yes| |mirb|No| |mruby|No| |mruby-strip|No| |mrdb|No|

Supported platform & architectures

|process.platform|process.arch|Supported?| |:--:|:--:|:--:| |win32|ia32|Yes| |win32|x64|Yes| |linux|ia32|Yes| |linux|x64|Yes| |darwin|x64|Yes|

How to install

npm install mruby-native

If you want to use globally, add -g option (In some environments, sudo may be also required):

npm install -g mruby-native

How to use (CLI)

You can run mruby compiler by simply running mrbc command in terminal.
All arguments (except for special options mentioned later) are passed to internal mrbc binary.

Example:

$ mrbc -h
Usage: mrbc.exe [switches] programfile
  switches:
  -c           check syntax only
  -o<outfile>  place the output into <outfile>
  -v           print version number, then turn on verbose mode
  -g           produce debugging information
  -B<symbol>   binary <symbol> output in C language format
  -e           generate little endian iseq data
  -E           generate big endian iseq data
  --verbose    run at verbose mode
  --version    print the version
  --copyright  print the copyright

How to change mruby version (CLI)

Add special option --mrubyVersion=x.x.x to mrbc command.

Example 1: (Without --mrubyVersion option, the newest version is used)

$ mrbc --version
mruby 1.4.0 (2018-1-16)

Example 2: (Change version. You can use SemVer syntax to specify version)

$ mrbc --mrubyVersion=1.2.x --version
mruby 1.2.0 (2015-11-17)

Example 3: (If specified version is not included, raises error)

$ mrbc --mrubyVersion=1.0.x --version
R:\test\node_modules\mruby-native\out\index.js:77
            throw new Error(`No matched mruby version: ${version}`);
            ^

Error: No matched mruby version: 1.0.x
    at new MrubyCompiler (R:\test\node_modules\mruby-native\out\index.js:77:19)
      :
    snip

How to use (JavaScript API)

const { MrubyCompiler } = require("mruby-native");

let compiler = new MrubyCompiler();
compiler.compile("test.rb")
.then((stdout) => {
    console.log("success:", stdout);
}, (reason) => {
    console.error("fail: ", reason);
});

// You can change mruby version by passing 1st argument with semver syntax to constructor
let olderCompiler = new MrubyCompiler("1.2.x");

For other APIs and details, see out/index.d.ts

License

This package is released under MIT License.