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

hexput

v1.0.9

Published

A WebSocket client for communicating with Hexput Runtime servers. This client allows for remote execution of Hexput code, parsing, and function registration with a Hexput Runtime instance.

Downloads

16

Readme

Hexput Client

A WebSocket client for communicating with Hexput Runtime servers. This client allows for remote execution of Hexput code, parsing, and function registration with a Hexput Runtime instance.

Installation

npm install hexput

Usage

Basic Connection

import HexputClient from 'hexput';

// Create a new client instance
const client = new HexputClient('ws://localhost:9091', { debug: true });

// Close connection when done
client.close();

Executing Code

Execute Hexput code on the remote Hexput Runtime:

const result = await client.execute(`
  vl x = 10;
  vl y = 20;
  res x + y;
`);
console.log(result); // 30

With execution options:

const options = {
  no_loops: true,
  no_conditionals: true
};

try {
  const result = await client.execute(`
    vl items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
    
    loop item in items {
      // This will fail due to no_loops option
      print(item);
    }
  `, options);
} catch (error) {
  console.error('Execution failed:', error.message);
  // Will throw an error due to no_loops option
}

Parsing Code

Parse Hexput code to obtain its AST:

const ast = await client.parse(`cb add(a, b) { res a + b; }`);
console.log(ast);

Registering Functions

Register JavaScript functions that can be called from Hexput code:

// Register a function
client.registerFunction('fetchData', async (url) => {
  const response = await fetch(url);
  return response.json();
});

// Unregister a function
client.unregisterFunction('fetchData');

API Reference

HexputClient

Constructor

new HexputClient(url: string, options?: { debug?: boolean })
  • url: WebSocket URL of the Hexput Runtime server
  • options: Configuration options
    • debug: Enable debug logging (default: false)

Methods

connect(): Promise<void>

Connect to the Hexput Runtime server.

close(): void

Close the WebSocket connection.

execute(code: string, options?: HexputExecutionOptions, context?: object): Promise<any>

Execute Hexput code in the Hexput Runtime.

  • code: The Hexput code to execute
  • options: Execution options (see below)
  • context: Initial context for execution
parse(code: string, options?: HexputParseOptions): Promise<any>

Parse Hexput code using the Hexput Runtime.

  • code: The Hexput code to parse
  • options: Parse options (see below)
registerFunction(name: string, handler: Function): void

Register a JavaScript function that can be called from Hexput code.

  • name: The name of the function
  • handler: The function handler
unregisterFunction(name: string): void

Unregister a function.

  • name: The name of the function to unregister

Options Interfaces

HexputOptions

interface HexputOptions {
  /** Minify the output (default: true) */
  minify?: boolean;
  /** Include source mapping in output (default: false) */
  include_source_mapping?: boolean;
  /** Disable object construction literals (default: false) */
  no_object_constructions?: boolean;
  /** Disable array construction literals (default: false) */
  no_array_constructions?: boolean;
  /** Disable object property access (default: false) */
  no_object_navigation?: boolean;
  /** Disable variable declarations (default: false) */
  no_variable_declaration?: boolean;
  /** Disable loops (default: false) */
  no_loops?: boolean;
  /** Disable object keys access (default: false) */
  no_object_keys?: boolean;
  /** Disable callback functions (default: false) */
  no_callbacks?: boolean;
  /** Disable conditional statements (default: false) */
  no_conditionals?: boolean;
  /** Disable return statements (default: false) */
  no_return_statements?: boolean;
  /** Disable loop control (break/continue) (default: false) */
  no_loop_control?: boolean;
  /** Disable operators (default: false) */
  no_operators?: boolean;
  /** Disable equality operators (default: false) */
  no_equality?: boolean;
  /** Disable assignment operators (default: false) */
  no_assignments?: boolean;
}

HexputParseOptions and HexputExecutionOptions

/** Options for parse operation */
type HexputParseOptions = HexputOptions;

/** Options for execution operation */
type HexputExecutionOptions = Omit<HexputOptions, "minify">;