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

zenwrap

v1.0.3

Published

Some wrapper code around Zenroom to make it behave the way I want it to and deal with some minor bugs.

Downloads

5

Readme

Zenwrap

Some wrapper code around Zenroom to make it behave the way I want it to and deal with some minor bugs.

  • [x] No output to stdout/stderr
  • [x] Exec VM mulitple times, without RuntimeError: memory access out of bounds
  • [x] Simplified Promise / async function API
  • [x] Deals with some bug in print() command

Example

This Lua script will produce a trace with one element (because print() is called once), containing a json dictionary (because the printed string can be parsed as JSON) with a key random.

We wrap this script in a helper function generateRandom().

For more details, use the source Luke!

let zenwrap = require('zenwrap')

let script = `
random = OCTET.random(256)
result = {random = random:hex()}
s = JSON.encode(result)
print(s)
`.trim()

async function generateRandom(seed) {
    let opts = {rngseed: seed}
    let trace = await zenwork(script, null, null, opts)
    return trace[0].json.random
}

let rngseed = '04b0848f3b3b5c62c6867a6fb53d2afbdcc76d9f5d22ad7a35fdb2dbe3122ec2939feb70fb3f5887d51f7dd30461e48d460f0f0e31251f3d5023f7d123ca2947e16aa496f31775b4e509d77bf0d8895b3cca732b4a4b4d34c2195d0d7c3405e78977b5810d9eb7a3e29476ba517efd6d7504b0848f3b3b5c62c6867a6fb53d2afbdcc76d9f5d22ad7a35fdb2dbe3122ec2939feb70fb3f5887d51f7dd30461e48d460f0f0e31251f3d5023f7d123ca2947e16aa496f31775b4e509d77bf0d8895b3cca732b4a4b4d34c2195d0d7c3405e78977b5810d9eb7a3e29476ba517efd6d750d9eb7a3e29476ba0d9eb7a3e29476ba517efd6d75517efd6d756d75d6d6'

async function main () {
    let r = await generateRandom(rngseed)
    console.log('RANDOM', r)
}

main()

This prints:

RANDOM b9cfd03b70bc925b88f88254bd2ecbd33afb2995b630a93795ecd25018d4d424fc4bb7ffd3b5e55735a3d0b57a500744b719689b49f5fdc3f42232b2c26f50f80aee1b90d4fb5678f5c293cfefcddca3addd8cb9aeacdada716baf34a0f8883f697732371bdcc14eb385ae34cf3f4bd4e12e9228979ffbe0862936bc8e0e1e3140ac01b959dfa92b1a8716a5e6eae45beb9a23e857c6b18da9f183a24a9b360e34240d00beed5ff83350eb42a18210963cb8f1978c5d2afd7d91d56d51ea2e78e8eadcbc11ab6875529685da49a15acd604f2f6273200f41bdbc4874b6e4523a43cc58ae1065c94caf5d5dd1b04165a6b1a238ddf55743cbddd74a14720d29d8

API

const zenwrap = require('zenwrap')
zenwrap(script, keys, data, opts)
    .then(trace => console.log(trace))

Rought edges

  • [ ] in silence.js, the uncaughtException handler isn't removed after running the function
  • [ ] There is code that deals with the double-printing-bug, should be removed when this bug is fixed
  • [ ] Error handling is wonky... hard to debug probably