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

gerbil-loader

v0.0.0

Published

A loader from Gerbil Scheme to Javascript

Downloads

2

Readme

Gerbil Loader: Use gxc and gsc load Gerbil to JavaScript

The gerbil-loader package makes it easy to load a gerbil file into a JavaScript runtime.

The gerbil-scheme package is based off of Gerbil, a scheme written in itself that compiles to Gambit Scheme.

The gerbil-scheme UMD library allows many different uses of that runtime and will at some point allow loading of gerbil modules.

Installation

Easy! I choose yarn, but npm also works.

yarn add gerbil-loader --dev
yarn add gerbil-scheme

Documentation

For details see the repo, man! https://github.com/drewc/gxjs

Usage

Let’s have a scheme file that uses a few js features.

Here is gambit-scheme-usage.ss.

(import :js)

(js#declaration "console.log('started gerbil scheme!')")

(def (this-is-gerbil!! (val 42))
  (js#statement "console.log('This is GxJS!', (@1@), (@2@))"
                val
                (js#expression "{ foo: 'bar' };")))

(js#statement "console.log('finished gerbil scheme init');
 module.exports = RTS.scm2host(@1@);" this-is-gerbil!!)

To load an .ss file, gerbil-loader is the easy way. The options are the same as gxjs-loader.

Now for a JavaScript file, gerbil-scheme-usage.js. We’ll make this a CommonJS module.

We do not actually need to require('gerbil-scheme') here at all and we export the RTS is exported pretty much so we can see just that. Just wait :)

const RTS = require('gerbil-scheme');

const thisIsGerbil = require('gerbil-loader!./gerbil-scheme-usage.ss');

thisIsGerbil('*');

module.exports = RTS;

That outputs this to the console. As you can see the function automagically converts the string into a Gerbil/Gambit string, but this is the JavaScript output.

started gerbil scheme!
finished gerbil scheme init
This is GxJS! { codes: [ 42 ] } { foo: 'bar' }

By default gerbil-loader automagically requires gerbil-scheme by prepending const RTS = require('gerbil-scheme'); to the top of the “file”.

The RTS.glo is the symbol table.

(import :js)
(js#declaration #<<EOF
console.log('Ok, auto RTS!', Object.keys(RTS.glo).length)

module.exports = RTS;

EOF
)

Now we’ll use that in a js module. This time around es6.

import RTS from './gerbil-scheme-usage.js'
import sameRTS from 'gerbil-loader!./gerbil-scheme-auto.ss';

console.log('Same Runtime?', RTS === sameRTS);

That outputs the following.

started gerbil scheme!
finished gerbil scheme init
This is GxJS! { codes: [ 42 ] } { foo: 'bar' }
Ok, auto RTS! 165
Same Runtime? true

So we just need to use gerbil-loader and have gerbil-scheme as a dependency and there you go.

Support

Go to https://github.com/drewc/gxjs/issues or contact the author.