open-index/open-npm huggingface dataset:
npm package: @freestyle-sh/with-bun
Description: Bun runtime for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.2.10

# @freestyle-sh/with-bun

Bun runtime for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-bun freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmBun } from "@freestyle-sh/with-bun";

const { vm } = await freestyle.vms.create({
  with: {
    js: new VmBun(),
  },
});

const res = await vm.js.runCode({
  code: "console.log(JSON.stringify({ hello: 'world' }));"
});

console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello":"world"}\n', statusCode: 0 }
```

## Options

```typescript
new VmBun({
  version: "1.1.0",  // Optional: specific Bun version (default: latest)
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `version` | `string` | `undefined` | Bun version to install. If not specified, installs the latest version. |

## API

### `vm.js.runCode({ code: string })`

Executes JavaScript/TypeScript code in the Bun runtime.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};
```

### `vm.js.install(options?)`

Installs npm packages using Bun.

```typescript
// Install from package.json in current directory
await vm.js.install();

// Install from package.json in specific directory
await vm.js.install({ directory: "/app" });

// Install specific packages
await vm.js.install({ deps: ["lodash", "express"] });

// Install with specific versions
await vm.js.install({ deps: { "lodash": "^4.0.0", "express": "~5.0.0" } });

// Install as dev dependencies
await vm.js.install({ deps: ["typescript"], dev: true });

// Install globally
await vm.js.install({ global: true, deps: ["typescript"] });
```

**Returns:** `Promise<InstallResult>`

```typescript
type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [Bun Documentation](https://bun.sh/docs)
npm package: @freestyle-sh/with-deno
Description: Deno runtime for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.0.2

# @freestyle-sh/with-deno

Deno runtime for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-deno freestyle-sandboxes
```

## Usage

```typescript
import { freestyle, VmSpec } from "freestyle-sandboxes";
import { VmDeno } from "@freestyle-sh/with-deno";

const spec = new VmSpec({
  with: {
    deno: new VmDeno(),
  },
});

const { vm } = await freestyle.vms.create({ spec });

const res = await vm.deno.runCode({
  code: "console.log(JSON.stringify({ hello: 'world', runtime: 'deno' }));",
});

console.log(res);
// { result: { hello: 'world', runtime: 'deno' }, stdout: '{"hello":"world","runtime":"deno"}\n', statusCode: 0 }
```

## Options

```typescript
new VmDeno({
  version: "2.0.0",  // Optional: specific Deno version (default: latest)
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `version` | `string` | `undefined` | Deno version to install. If not specified, installs the latest version. |

## API

### `vm.deno.runCode({ code: string })`

Executes JavaScript/TypeScript code using `deno eval`.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};
```

### `vm.deno.install(options?)`

Installs packages using Deno. Supports both npm packages and JSR (Deno's native registry).

```typescript
// Install from deno.json in current directory
await vm.deno.install();

// Install from deno.json in specific directory
await vm.deno.install({ directory: "/app" });

// Install npm packages (auto-prefixed with npm:)
await vm.deno.install({ deps: ["lodash-es", "express"] });

// Install JSR packages (use jsr: prefix)
await vm.deno.install({ deps: ["jsr:@std/path", "jsr:@std/fs"] });

// Install with specific versions
await vm.deno.install({ deps: { "lodash-es": "^4.0.0" } });

// Install as dev dependencies
await vm.deno.install({ deps: ["typescript"], dev: true });

// Install globally
await vm.deno.install({ global: true, deps: ["jsr:@std/cli"] });
```

**Returns:** `Promise<InstallResult>`

```typescript
type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};
```

## JSR Packages

Deno has native support for [JSR](https://jsr.io) (JavaScript Registry), which hosts TypeScript-first packages including the Deno standard library.

```typescript
// Install @std/path from JSR
await vm.deno.install({ deps: ["jsr:@std/path"] });

// Use it in code
const res = await vm.deno.runCode({
  code: `
    import * as path from "jsr:@std/path";
    console.log(JSON.stringify({
      join: path.join("foo", "bar", "baz"),
      basename: path.basename("/home/user/file.txt"),
    }));
  `,
});
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [Deno Documentation](https://docs.deno.com)
- [JSR Registry](https://jsr.io)
npm package: @freestyle-sh/with-dev-server
Description: Node.js runtime via [NVM](https://github.com/nvm-sh/nvm) for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.1.8

# @freestyle-sh/with-nodejs

Node.js runtime via [NVM](https://github.com/nvm-sh/nvm) for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-nodejs freestyle-sandboxes
```

## Usage

```typescript
import { freestyle, VmSpec } from "freestyle-sandboxes";
import { VmDevServer } from "../src/index";
import { VmPtySession } from "@freestyle-sh/with-pty";

const TEMPLATE_REPO = "https://github.com/freestyle-sh/freestyle-next";

const { repoId } = await freestyle.git.repos.create({
  source: {
    url: TEMPLATE_REPO,
  },
});

const domain = `${repoId}.style.dev`;
const devPty = new VmPtySession({ sessionId: "dev-server" });

const { vm } = await freestyle.vms.create({
  snapshot: new VmSpec({
    with: {
      devPty,
      devServer: new VmDevServer({
        workdir: "/repo",
        templateRepo: TEMPLATE_REPO,
        devCommand: "npm run dev",
        devCommandPty: devPty,
      }),
    },
  }),
  with: {
    devServer: new VmDevServer({
      repo: repoId,
    }),
  },
  domains: [
    {
      domain: domain,
      vmPort: 3000,
    },
  ],
});

```
npm package: @freestyle-sh/with-nodejs
Description: Node.js runtime via [NVM](https://github.com/nvm-sh/nvm) for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.2.8

# @freestyle-sh/with-nodejs

Node.js runtime via [NVM](https://github.com/nvm-sh/nvm) for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-nodejs freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmNodeJs } from "@freestyle-sh/with-nodejs";

const { vm } = await freestyle.vms.create({
  with: {
    node: new VmNodeJs(),
  },
});

const res = await vm.node.runCode({
  code: "console.log(JSON.stringify({ hello: 'world' }));"
});

console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello":"world"}\n', statusCode: 0 }
```

## Options

```typescript
new VmNodeJs({
  version: "22", // Optional: Node.js version (default: "24")
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `version` | `string` | `"24"` | Node.js version to install via NVM. |

## API

### `vm.node.runCode({ code: string })`

Executes JavaScript code in the Node.js runtime.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};
```

### `vm.node.install(options?)`

Installs npm packages.

```typescript
// Install from package.json in current directory
await vm.node.install();

// Install from package.json in specific directory
await vm.node.install({ directory: "/app" });

// Install specific packages
await vm.node.install({ deps: ["lodash", "express"] });

// Install with specific versions
await vm.node.install({ deps: { "lodash": "^4.0.0", "express": "~5.0.0" } });

// Install as dev dependencies
await vm.node.install({ deps: ["typescript"], dev: true });

// Install globally
await vm.node.install({ global: true, deps: ["typescript"] });
```

**Returns:** `Promise<InstallResult>`

```typescript
type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [Node.js Documentation](https://nodejs.org/docs)
- [NVM Documentation](https://github.com/nvm-sh/nvm)
npm package: @freestyle-sh/with-playwright
Description: Playwright runtime for [Freestyle](https://freestyle.sh) VMs, including browser installs.
Latest version: 0.2.8

# @freestyle-sh/with-playwright

Playwright runtime for [Freestyle](https://freestyle.sh) VMs, including browser installs.

## Installation

```bash
npm install @freestyle-sh/with-playwright freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmPlaywright } from "@freestyle-sh/with-playwright";

const { vm } = await freestyle.vms.create({
  with: {
    playwright: new VmPlaywright(),
  },
});

const res = await vm.playwright.runCode({
  code: `
  const { chromium } = require("playwright");
  (async () => {
    const browser = await chromium.launch();
    const page = await browser.newPage();
    await page.goto("https://example.com");
    const title = await page.title();
    await browser.close();
    console.log(JSON.stringify({ title }));
  })();
  `,
});

console.log(res);
```

## Options

```typescript
new VmPlaywright({
  nodeVersion: "24",
  playwrightVersion: "1.47.0",
  installDeps: true,
  browsers: ["chromium"],
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `nodeVersion` | `string` | `"24"` | Node.js version to install via NVM. |
| `playwrightVersion` | `string` | `undefined` | Playwright version to install. |
| `installDeps` | `boolean` | `true` | Install Playwright system dependencies via `--with-deps`. |
| `browsers` | `("chromium" \| "firefox" \| "webkit")[]` | `undefined` | Limit browser installs; default installs all. |

## API

### `vm.playwright.runCode({ code: string })`

Executes JavaScript code in the Playwright-ready Node.js runtime.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;
  stdout?: string;
  stderr?: string;
  statusCode?: number;
};
```

### `vm.playwright.install(options?)`

Installs npm packages with `npm install`.

```typescript
await vm.playwright.install({ deps: ["@playwright/test"] });
```

**Returns:** `Promise<InstallResult>`

```typescript
type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [Playwright Documentation](https://playwright.dev)
```
npm package: @freestyle-sh/with-postgres
Description: PostgreSQL runtime extension for Freestyle VMs. Provides a fully configured PostgreSQL database server in your Freestyle VM.
Latest version: 0.2.8

# @freestyle-sh/with-postgres

PostgreSQL runtime extension for Freestyle VMs. Provides a fully configured PostgreSQL database server in your Freestyle VM.

## Installation

```bash
npm install @freestyle-sh/with-postgres freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmPostgres } from "@freestyle-sh/with-postgres";

const { vm } = await freestyle.vms.create({
  with: {
    postgres: new VmPostgres({
      password: "mypassword",
      database: "mydb",
      version: "16", // Optional, defaults to "16"
      user: "postgres", // Optional, defaults to "postgres"
    }),
  },
});

// Create a table
await vm.postgres.exec(`
  CREATE TABLE users (
    id SERIAL PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(100)
  )
`);

// Insert data
await vm.postgres.exec(`
  INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com')
`);

// Query data
const result = await vm.postgres.query<{ id: number; name: string; email: string }>(`
  SELECT * FROM users
`);

console.log(result.rows); // [{ id: 1, name: 'Alice', email: 'alice@example.com' }]
```

## API

### Constructor Options

- `version?: string` - PostgreSQL version to install (default: "16")
- `password?: string` - Password for the postgres user (default: "postgres")
- `database?: string` - Default database to create (default: "postgres")
- `user?: string` - PostgreSQL user (default: "postgres")

### Methods

#### `query<T>(sql: string): Promise<QueryResult<T>>`

Execute a SQL query and return results as JSON.

**Returns:** `{ rows: T[], rowCount: number, error?: string }`

```typescript
const result = await vm.postgres.query<{ id: number; name: string }>(`
  SELECT id, name FROM users WHERE id = 1
`);
```

#### `exec(sql: string): Promise<{ success: boolean, error?: string }>`

Execute a SQL command without returning results (for CREATE, INSERT, UPDATE, DELETE, etc.).

```typescript
const result = await vm.postgres.exec(`
  UPDATE users SET name = 'Bob' WHERE id = 1
`);
```

#### `createDatabase(dbName: string): Promise<{ success: boolean, error?: string }>`

Create a new database.

```typescript
await vm.postgres.createDatabase("newdb");
```

#### `dropDatabase(dbName: string): Promise<{ success: boolean, error?: string }>`

Drop a database.

```typescript
await vm.postgres.dropDatabase("olddb");
```

## How It Works

The package uses a systemd oneshot service to install and configure PostgreSQL during VM creation:

1. Installs PostgreSQL from apt repositories
2. Configures password authentication
3. Creates the default database (if specified)
4. Enables network connections
5. Starts PostgreSQL as a system service

The installation is fully automated and completes during VM initialization.
npm package: @freestyle-sh/with-ruby
Description: Ruby runtime via [RVM](https://rvm.io) for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.2.8

# @freestyle-sh/with-ruby

Ruby runtime via [RVM](https://rvm.io) for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-ruby freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmRuby } from "@freestyle-sh/with-ruby";

const { vm } = await freestyle.vms.create({
  with: {
    ruby: new VmRuby(),
  },
});

const res = await vm.ruby.runCode({
  code: "require 'json'; puts JSON.generate({ hello: 'world' })"
});

console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello":"world"}\n', statusCode: 0 }
```

## Options

```typescript
new VmRuby({
  version: "3.3.6", // Optional: specific Ruby version (default: "3.4.8")
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `version` | `string` | `"3.4.8"` | Ruby version to install via RVM. |

## API

### `vm.ruby.runCode({ code: string })`

Executes Ruby code in the RVM-managed Ruby runtime.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};
```

### `vm.ruby.install(options?)`

Installs gems via `gem install` or `bundle install`.

**Returns:** `Promise<InstallResult>`

```typescript
// Install specific gems
await vm.ruby.install({ deps: ["nokogiri", "colorize"] });

// Install from Gemfile (bundle install)
await vm.ruby.install();
await vm.ruby.install({ directory: "/app" });
```

```typescript
type InstallOptions =
  | { deps: string[] }
  | { directory?: string; deps?: undefined };

type InstallResult = {
  success: boolean;
  stdout?: string;
  stderr?: string;
};
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [Ruby Documentation](https://www.ruby-lang.org/en/documentation/)
- [RVM Documentation](https://rvm.io)
npm package: @freestyle-sh/with-uv
Description: Python runtime via [uv](https://github.com/astral-sh/uv) for [Freestyle](https://freestyle.sh) VMs.
Latest version: 0.2.8

# @freestyle-sh/with-uv

Python runtime via [uv](https://github.com/astral-sh/uv) for [Freestyle](https://freestyle.sh) VMs.

## Installation

```bash
npm install @freestyle-sh/with-uv freestyle-sandboxes
```

## Usage

```typescript
import { freestyle } from "freestyle-sandboxes";
import { VmUv } from "@freestyle-sh/with-uv";

const { vm } = await freestyle.vms.create({
  with: {
    uv: new VmUv(),
  },
});

const res = await vm.uv.runCode({
  code: "import json; print(json.dumps({ 'hello': 'world' }))"
});

console.log(res);
// { result: { hello: 'world' }, stdout: '{"hello": "world"}\n', statusCode: 0 }
```

## Options

```typescript
new VmUv({
  version: "0.5.0",      // Optional: specific uv version
  pythonVersion: "3.13", // Optional: Python version (default: "3.14")
})
```

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `version` | `string` | `undefined` | uv version to install. If not specified, installs the latest version. |
| `pythonVersion` | `string` | `"3.14"` | Python version to install via uv. |

## API

### `vm.uv.runCode({ code: string })`

Executes Python code using uv's managed Python runtime.

**Returns:** `Promise<RunCodeResponse>`

```typescript
type RunCodeResponse<Result> = {
  result: Result;      // Parsed JSON from stdout (if valid JSON)
  stdout?: string;     // Raw stdout output
  stderr?: string;     // Raw stderr output
  statusCode?: number; // Exit code
};
```

## Documentation

- [Freestyle Documentation](https://docs.freestyle.sh)
- [uv Documentation](https://docs.astral.sh/uv/)