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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wll8/any-proxy

v0.0.1

Published

Transform or execute remote code via proxy.

Readme

any-proxy

Transform or execute remote code via proxy.

Why

If you have a server-side service and want to call certain APIs on the client side, you might initially use RPC to create a method for each API for client-side invocation. As the number of APIs grows, this becomes tedious and time-consuming.

Now, you can use a proxy in the client to represent the server environment. All methods called through the proxy run as if they were executed on the server.

For example, if you want to run the following code on the server to get the largest number:

a = 1
b = 2
Math.max(a, b)

You can use it like this:

const { proxy } = anyHook(opt)

proxy.a = 1
proxy.b = 2
const res = await proxy.Math.max(proxy.a, proxy.b)
expect(res).toStrictEqual(2)

Function calls, assignments, and other operations on the proxy object are sent to the remote server for execution. If you need to retrieve the result, use await.

Why does it work this way? Because it internally transforms the proxy into server-side code and runs it in the server environment, so you need to pay attention to server security, such as limiting the execution scope using a VM.

Features

  • Supports assignment, value retrieval, function calls, and callbacks
  • Supports logical continuity, not just single function calls
  • Supports custom global execution space
  • Supports referencing remote variables
  • Supports custom transformers

Custom Execution

Customize the run function in the SDK to implement a custom execution process and return the result.

const { anyHook } = require(`@wll8/any-hook`)

new Promise(async () => {
  const { proxy } = anyHook({
    toolOpt: {
      sdk: {
        async run([opt], ctx) {
          return new Promise((resolve, reject) => {
            console.log(`run`, opt)
            resolve([`res`])
          })
        }
      }
    },
  })
  const fs = proxy.require(`fs`)
  const list = await fs.readdirSync(`./`)
  console.log({list})
})

If you need to write code in other languages, such as Python, within JavaScript, you may need to refer to the server/index.js file to add the execution environment in Python.

Custom Code Transformation

anyHook supports passing a tool function to customize the transformation process:

anyHook({
  tool(){}, // Write transformation logic here
  toolOpt: {},
})

You can refer to the to.js.js file, which implements the transformation of proxies into JavaScript code.

Development

# Install dependencies
pnpm i

# Run the RPC service
pnpm run server

# Run test cases
pnpm run test

License

MIT