open-index/open-npm huggingface dataset:
npm package: 2wasm
Description: A command-line tool to convert OpenAPI specifications into WebAssembly plugins
Author: microchipgnu
Latest version: 0.0.3

# OpenAPI to WebAssembly CLI

A command-line tool built with Bun and Extism to convert OpenAPI specifications into WebAssembly plugins.

## Features

- Convert OpenAPI specification files (YAML or JSON) to WASM plugins
- Automatically generate TypeScript handlers for each API endpoint
- Create a compatible WebAssembly module and manifest file
- Support for path parameters, query parameters, and request bodies

## Prerequisites

- [Bun](https://bun.sh/) (v1.0.0 or higher)
- [Extism JS PDK](https://github.com/extism/js-pdk)

## Installation

### NPM Installation
```bash
# Install globally
npm install -g openapi2wasm

# Or install locally in your project
npm install --save-dev openapi2wasm
```

### Manual Installation
```bash
# Clone the repository
git clone https://github.com/yourusername/openapi-2-wasm-cli.git
cd openapi-2-wasm-cli

# Install dependencies
bun install
```

## Usage

```bash
# If installed via npm (globally)
openapi2wasm --schema path/to/your/openapi.yaml

# If installed manually or locally
./index.ts --schema path/to/your/openapi.yaml

# Specify output directory
openapi2wasm --schema path/to/your/openapi.yaml --output ./dist

# Specify a custom name for the plugin
openapi2wasm --schema path/to/your/openapi.yaml --name my-custom-plugin
```

### Options

- `--schema, -s`: Path to the OpenAPI schema file (YAML or JSON) (required)
- `--output, -o`: Output directory for the generated files (default: current directory)
- `--name, -n`: Custom name for the plugin (default: derived from the schema's title)

## Output Files

The tool generates:

- `[plugin-name].wasm`: The WebAssembly plugin file
- `manifest.json`: The plugin manifest file for Extism

## How it Works

1. The tool reads and parses the OpenAPI specification
2. Generates TypeScript code for each API endpoint
3. Creates PDK integration files
4. Compiles the TypeScript code to JavaScript
5. Uses Extism to build the final WASM plugin

## License

MIT