open-index/open-npm huggingface dataset:
npm package: @funcmatic/lambda-response
Description: Express-like HTTP response methods (e.g. res.json(), res.sendFile()) to be used in AWS Lambda Node functions connected to API Gateway using AWS Lambda Proxy Integration.
Author: Daniel Jhin Yoo
Latest version: 1.1.0

# lambda-response
Express-like HTTP response methods (e.g. res.json(), res.sendFile()) to be used in AWS Lambda Node functions connected to API Gateway using AWS Lambda Proxy Integration.

Test
npm package: @funcmatic/lambda-router
Description: A simple server-side URL router for AWS Lambda that does not depend on Node HTTP request/response.
Author: Daniel Jhin Yoo
Latest version: 2.4.3

# lambda-router
A lightweight Express-like HTTP request router for AWS Lambda functions triggered by API Gateway's Lambda Proxy Integration.

### This might be helpful if ...

* You use API Gateway's [Lambda Proxy Integration](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-lambda.html).
* Your Lambda function will execute different logic based on the AWS event's **httpMethod** and **path** parameters.
* Your Lambda function will use the Node.js 8.10 runtime with [new async-style handler](https://aws.amazon.com/blogs/compute/node-js-8-10-runtime-now-available-in-aws-lambda/).

_If these conditions DO NOT apply to you then see the bottom of this README for some alternative routing solutions._

## Key Features

* Route handlers are invoked with the AWS event and context objects rather than HTTP request/response
* Written for the new [Node.js 8.10 async-style handler]
* Uses the [path-to-regexp](https://github.com/pillarjs/path-to-regexp) module to support similar route matching as Express (e.g. '/:foo/:bar+')

## Getting Started
```
npm install @funcmatic/lambda-router
```
```
// function.js
'use strict'

const app = require('@funcmatic/lambda-router')

// define a route 
app.get('/user/:id', async ({ event, context }, params) => {
  var ret = { 'user': params.userid }
  return ret
})  

// This will be invoked by AWS Lambda and 
exports.handler = async (event, context) => {
  // You can pass any data into your route 
  var ctx = { event, context }  
  return await app.dispatch(ctx)
}
```
```

```

## How to Use

### Route methods

### Route paths

### Route parameters

### Route handlers

### Response methods


## Running the tests
Most existing Javascript routers require an HTTP request/response object. Here an example of route using [Express](https://expressjs.com/en/guide/routing.html):

```
// Router handler in Expresss is passed in a Node HTTP request and response object
app.get('/', function (req, res) {
  res.send('hello world')
})
```

You can define the equivalent route handler using **lambda-router** by:

```
// lambda-router uses similar syntax but passes in the AWS event and context 
// objects instead of request/response
app.get('/', async function ({event, context}) {
  
  return {
    statusCode: 200,
    headers: {
     "Content-Type": "text/plain"
    },
    body: 'hello world'
  }
})
```

## Alternative Routing Solutions

## Why? 


Micro server-side URL router that can be used with AWS Lambda (NodeJS) and has Express-like routing syntax. Written in vanilla javascript that natively runs in Node v8.10 and does not depend on any other external packages or modules.

_Inspired and adapted from [visionmedia/page.js](https://github.com/visionmedia/page.js) &mdash; a simple express-like client-side router._

```
Test code
```
npm package: @funcmaticjs/accesslog-plugin
Description: Log a line at the end of a request using NGINX access_log format.
Author: Daniel Jhin Yoo
Latest version: 0.0.1

# accesslog-plugin
Log a JSON line at the end of a request using NGINX access_log format.

Based on [Using JSON for Nginx log_format](https://medium.com/bolt-labs/using-json-for-nginx-log-format-793743064fc4) by Kain Kalju.
npm package: @funcmaticjs/auth0-plugin
Description: Verifies an Auth0 JWT token in the 'Authorization' header and puts the decoded token in 'ctx.state.auth'
Author: Daniel Jhin Yoo
Latest version: 0.0.2

# auth0-plugin
Verifies an Auth0 JWT token

## Install

```
$> npm install --save @funcmaticjs/auth0-plugin
```

## Use

```js
const func = require('@funcmaticjs/funcmatic')
const Auth0Plugin = require('@funcmaticjs/auth0-plugin')
...
func.use(new Auth0Plugin())
```

## Configure the Environment

The following variables must exist in `ctx.env` during the env handler:

- `FUNC_AUTH0_DOMAIN`: The Auth0 domain from your Auth0 account (e.g. "xyz.auth0.com"). To find your Auth0 domain, see Auth0's documentatation, *[Learn the Basics](https://auth0.com/docs/getting-started/the-basics)*.
- `FUNC_AUTH0_SKIP_VERIFICATION` (OPTIONAL): If set to the string value of `'true'`, then the Auth0Plugin will decode the token WITHOUT verifying that it was issued by Auth0 for your Auth0 domain. Recommended to only be used in unit testing so that you can test with a mocked token rather than a real issued token from Auth0.


## Side Effects

- `ctx.event.headers['Authorization']`: The Auth0Plugin will check for a JWT token in the `Authorization` http header (i.e. `ctx.event.headers['Authorize']`) with the format: `Bearer Your.JWTTokenHere`. If no Authorization header value is sent by the client, then it is considered a failed authentication (see *No Authorization Token Sent* below).
- `ctx.state.auth`: The Auth0Plugin will first verify the token is valid, and then store the results of the decoded token in `ctx.state.auth`. If the token is not valid (e.g. expired), then it will store 

#### Valid Token (Successful Authentication)

```js
{
  success: true,
  t:  1562517085196,   // ms since epoch i.e. Date.now()
  decoded: {
    /* the decoded JWT token */
  }
}
```

#### Invalid Token (Unsuccessful Authentication)

```js
{
  success: true,
  t:  1562517085196, // ms since epoch i.e. Date.now()
  error: true,
  errorMessage: "Some reason for the error"  
}
```

#### No Authorization Token Sent (Unsuccessful Authentication)

```js
{
  success: true,
  t:  1562517085196, // ms since epoch i.e. Date.now()
  error: true,
  errorMessage: "No token provided"  
}
```
npm package: @funcmaticjs/bodyparser-plugin
Description: Funcmatic plugin that parses common types of event.body content (e.g. application/json, application/x-www-form-urlencoded, multipart/form-data)
Author: Daniel Jhin Yoo
Latest version: 0.0.1

# bodyparser-plugin
Parse common types of event.body content (e.g. application/json, application/x-www-form-urlencoded, multipart/form-data)
npm package: @funcmaticjs/correlation-plugin
Description: Funcmatic middleware plugin that sets 'x-correlation-id' in 'ctx.logger' so that log messages can be correlated across different functions and services
Author: Daniel Jhin Yoo
Latest version: 0.0.4

# correlation-plugin
Funcmatic middleware plugin that sets 'x-correlation-id' in 'ctx.logger' so that log messages can be correlated across different functions and services.

Based on [Yan Cui's](https://github.com/theburningmonk) Medium Post: [Capture and forward correlation IDs through different Lambda event sources](https://hackernoon.com/capture-and-forward-correlation-ids-through-different-lambda-event-sources-220c227c65f5)
npm package: @funcmaticjs/event-plugin
Description: Performs some helpful formatting and normalization of the an AWS API Gateway Lambda Proxy Integration HTTP event.
Author: Daniel Jhin Yoo
Latest version: 0.0.2

# event-plugin
Performs some helpful formatting and normalization of the an AWS API Gateway Lambda Proxy Integration HTTP event.


### Install

```
$> npm install --save @funcmaticjs/event-plugin
```

### Usage

```js


```

### Side Effects

#### `event.queryStringParameters`

If there are no query parameters AWS Lambda Proxy event will set this value to `null`. event-plugin will initilize this value to `{}`.

#### `event.pathParameters`

If there are no url path parameters, AWS Lambda Proxy event will set this value to `null`. event-plugin will initialize this value to `{}`

#### Normalize HTTP Headers

API Gateway HTTP header values are sent through as they are from the client. For example if the client sends `Content-Type` header. It's name will be `Content-Type`. If the client sends `content-type`, it's name will be `content-type`. 

event-plugin uses the **[header-case-normalizer](https://github.com/marten-de-vries/header-case-normalizer)** package to normalize all header values. So if the client sends `content-type`, it's name will be changed to `Content-Type`.
npm package: @funcmaticjs/jwks-plugin
Description: Verifies a JWT token using public keys retrieved from JWKS URI and puts the decoded token in 'ctx.state.auth'
Author: Daniel Jhin Yoo
Latest version: 0.0.3

# jwks-plugin
Verifies a JWT token using public keys retrieved from JWKS URI and puts the decoded token in 'ctx.state.auth'
npm package: @funcmaticjs/loglevel-plugin
Description: Uses the 'X-Log-Level' or 'X-Correlation-Log-Level' headers to dynamically set the log level of ctx.logger
Author: Daniel Jhin Yoo
Latest version: 0.0.5

# loglevel-plugin

Uses the 'X-Log-Level' or 'X-Correlation-Log-Level' headers to dynamically set the log level of ctx.logger. 

Based on [Yan Cui's](https://github.com/theburningmonk) Medium Post: [Capture and forward correlation IDs through different Lambda event sources](https://hackernoon.com/capture-and-forward-correlation-ids-through-different-lambda-event-sources-220c227c65f5). See the section *Enable debug logging on entire call chain*.
npm package: @funcmaticjs/mongodb-plugin
Description: Funcmatic middleware that creates and manages a MongoDB connection
Author: Daniel Jhin Yoo
Latest version: 0.0.6

# mongodb-plugin
Funcmatic plugin that creates and manages a MongoDB connection

## Install

```
$> npm install --save @funcmaticjs/mongodb-plugin
```

## Use

```js
const func = require('@funcmaticjs/funcmatic')
const MongoDBPlugin = require('@funcmaticjs/mongodb-plugin')
...
func.use(new MongoDBPlugin())
```

## Environment

The following variables must exist in `ctx.env` during the env handler:

- `FUNC_MONGODB_URI`: A MongoDB [connection string](https://docs.mongodb.com/manual/reference/connection-string/).
- `FUNC_MONGODB_CACHE_CONNECTION` (OPTIONAL): If it is set to the string 'false', then the plugin will establish and close a connection on every request.

## Side Effects

- `ctx.state.mongodb`: The MongoDB [DB instance](https://mongodb.github.io/node-mongodb-native/3.2/api/Db.html). Will NOOP if ctx.state.mongodb is already defined in `ctx.state` before this middleware runs. This property is useful if you want to mock `ctx.state.mongodb`.
npm package: @funcmaticjs/package
Description: Simple utility that create an AWS Lambda zip file using your project's package.json file. Assumes 'npm' and 'zip' commands are available in PATH.
Author: Daniel Jhin Yoo
Latest version: 0.0.3

# package
Simple utility that create an AWS Lambda zip file using your project's package.json file. Assumes 'npm' and 'zip' commands are available in PATH.
npm package: @funcmaticjs/parameterstore-plugin
Description: Funcmatic plugin that fetches environment variables from AWS Parameter Store and sets them in ctx.env
Author: Daniel Jhin Yoo
Latest version: 0.0.3

# parameterstore-plugin
Funcmatic plugin that fetches environment variables from AWS Parameter Store and sets them in ctx.env

### Install 

```
$> npm install --save @funcmaticjs/parameterstore-plugin
```

### Usage

```js
const ParameterStorePlugin = require('@funcmaticjs/parameterstore-plugin')
func.use(new ParameterStorePlugin())
```

### Configuration

#### Environment Variables

**FUNC_PARAMETERSTORE_PATH** 
- Prefix of parameter name. For example if you have two parameters: `/myapp/prod/VAR1=hello` and `/myapp/prod/var2=world` you should set value to be `/myapp/prod/`. Then this plugin will set the following variables in `ctx.env`:
```js
{
  "VAR1": "hello",
  "VAR2": "world
}
```
- Must be available in `ctx.env` or `process.env` when this plugin runs in the **env handler** lifecycle.
npm package: @funcmaticjs/response-plugin
Description: Express-like HTTP response methods (e.g. res.json(), res.sendFile()) to be used in AWS Lambda Node functions connected to API Gateway using AWS Lambda Proxy Integration.
Author: Daniel Jhin Yoo
Latest version: 1.1.1

# response-plugin
Express-like HTTP response methods (e.g. res.json(), res.sendFile()) to be used in AWS Lambda Node functions connected to API Gateway using AWS Lambda Proxy Integration.
npm package: @funcstache/koa-middleware
Description: Koa middleware to create dynamic webpages that are rendered on the server.
Author: Richard L. McNeary II
Latest version: 0.1.10

# koa-middleware

[koa](https://koajs.com/) middleware to create dynamic webpages that are rendered on the server.

- Defines conventions that simplify page creation for developers
- File-based routing
- Ideal for rendering templates on the server and returning HTML to the client
- Brings the fun back to web development!

We're using: the proven pattern of rendered templates, combined with new JavaScript capabilities,
plus some defined conventions, to simplify rendering web pages dynamically.

Why? Because client-side rendered SPAs are unnecessary for most websites. Also, using a
client-side-rendering library to render pages on the server adds complexity for developers, render
time, and code bloat that slows down development progress.

## install

```sh
npm i @funcstache/koa-middleware
```

## File-based routing

funcstache koa-middleware uses file-based routing, the path of the URL defines which part of the
file system is accessed. For example the URL path **/** might be handled by the contents of a
directory named **site**. The root directory is passed to
[funcstache](https://codeberg.org/rlmcneary2/funcstache/src/branch/main/libs/funcstache) using the
`directory` option.

koa-middleware depends on each directory, that can be accessed by the URL, to contain an
[**index.js**](https://codeberg.org/rlmcneary2/funcstache/src/branch/main/libs/funcstache/README-API.md#index-js)
file. koa-middleware treats **index.js** as an ES module that exports three optional functions.

Of course you will also need at least one mustache file to render a document (usually an HTML file).
The mustache file can have whatever name you want, but it _must_ end with the ".mustache" extension,
e.g. **books.mustache**. For example, your directory structure could look like this:

```txt
/
├── books/
│   ├── index.js
│   └── books.mustache
└── movies/
    ├── index.js
    └── movies.mustache
```

### Path params

koa-middleware allows directories to be named using path-to-regexp [named
parameters](https://github.com/component/path-to-regexp#named-parameters). The named parameter
values will be available to functions in the **index.js** file from
[`Context.params`](https://codeberg.org/rlmcneary2/funcstache/src/branch/main/libs/funcstache/README-API.md#types_context).

Here's an example of a directory structure that uses a named parameter. The **books** directory has
a subdirectory named **:id**. If a path like "/books/451" is provided to funcstache it will resolve
to the **/books/:id** directory and the value "451" will be provided via `Context.params`.

```txt
/
└── books/
    ├── index.js
    ├── books.mustache
    └── :id/
        ├── index.js
        └── book.mustache
```
npm package: @function-decorator/unplugin
Description: Function decorator polyfill for vite, rollup, rolldown, webpack and more.
Author: Naily Zero
Latest version: 1.0.0

# @function-decorator/unplugin

[![NPM version](https://img.shields.io/npm/v/@function-decorator/unplugin?color=a1b858&label=)](https://www.npmjs.com/package/@function-decorator/unplugin)

Function decorator polyfill for vite, rollup, rolldown, webpack and more.

## Install

```bash
npm i @function-decorator/unplugin
```

<details>
<summary>Vite</summary><br>

```ts
// vite.config.ts
import FnDecorator from '@function-decorator/unplugin/vite'

export default defineConfig({
  plugins: [
    FnDecorator({ /* options */ }),
  ],
})
```

Example: [`playground/`](./playground/)

<br></details>

<details>
<summary>Rollup</summary><br>

```ts
// rollup.config.js
import FnDecorator from '@function-decorator/unplugin/rollup'

export default {
  plugins: [
    FnDecorator({ /* options */ }),
  ],
}
```

<br></details>

<details>
<summary>Webpack</summary><br>

```ts
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('@function-decorator/unplugin/webpack')({ /* options */ })
  ]
}
```

<br></details>

<details>
<summary>Nuxt</summary><br>

```ts
// nuxt.config.js
export default defineNuxtConfig({
  modules: [
    ['@function-decorator/unplugin/nuxt', { /* options */ }],
  ],
})
```

> This module works for both Nuxt 2 and [Nuxt Vite](https://github.com/nuxt/vite)

<br></details>

<details>
<summary>Vue CLI</summary><br>

```ts
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('@function-decorator/unplugin/webpack')({ /* options */ }),
    ],
  },
}
```

<br></details>

<details>
<summary>esbuild</summary><br>

```ts
import FnDecorator from '@function-decorator/unplugin/esbuild'
// esbuild.config.js
import { build } from 'esbuild'

build({
  plugins: [FnDecorator()],
})
```

<br></details>
npm package: @functional-bitcoin/agent
Description: 🚨 **Alert: This repository is for the legacy JavaScript-based agent, which is not being actively developed right now.**
Latest version: 0.0.1-beta.22

[![license](https://img.shields.io/github/license/functional-bitcoin/library.svg)](https://github.com/functional-bitcoin/library/blob/master/license.md)

# Functional Bitcoin :: Agent

🚨 **Alert: This repository is for the legacy JavaScript-based agent, which is not being actively developed right now.**

A node module for fetching and executing Functional Bitcoin scripts.

## Installation

```console
$ yarn add @functional-bitcoin/agent@beta
```

## Usage

```javascript
const fbAgent = require('@functional-bitcoin/agent')

fbAgent.runScript(txid)
  .on('load:script', (script, tx) => {
    // Callback after script TX has been loaded
    // `script.tx` contains the whole tx so is possible to
    // check all outputs and other tx attributes
  })
  .on('load:functions', (script, funcs) => {
    // Callback after all functions have been loaded,
    // but prior to script being validated
  })
  .on('success', (script, res) => {
    console.log('Result:', res)
  })
  .on('error', (script, err) => {
    console.log('Error:', err)
  })

```

### Compatibility with Bitcom protocols

Bitcom protocols are identified using a 25-byte Bitcoin address as the prefix for a protocol, whereas Functional Bitcoin scripts rely on a 32 byte TXID to reference a function. It is possible transform Bitcom address prefixes into valid function references using the following approach:

```javascript
const prefixTransforms = {
  // b:// protocal prefix               // bfile/new function
  '19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut': '5f94a325c835ac0fcc89370061c6a63b305b2c6cf3d2fe002d264e98dbd44ac2'

}

fbAgent.runScript(txid)
  .on('load:script', (script) => {
    script.stack
      .filter(ln => Object.keys(prefixTransforms).includes(ln.cmd))
      .forEach(ln => ln.cmd = prefixTransforms[ln.cmd])
  })
  .on('success', (script) => {
    console.log('B:// file:', script.result)
  })
```

### Function sandbox

Functions are executed within a sandboxed node VM, which by default has access to very little of the agent's environment. A function cannot access environment variables, or overwrite global functions.

It is expected that functions remain small, simple and self contained, and the agent application itself be responsible for handling and responding to the output of a script.

However, it is possible to manually expose objects to the sandbox, and so opt-in to sharing external libraries and environment variables with the functions executed within a script.

```javascript
const datapay = require('datapay')

fbAgent.config.env.datapay = datapay;
fbAgent.config.env.privKey = process.env.PRIVATE_KEY;

// functions can now access `env.datapay` and `env.privKey`
fbAgent.runScript(txid)
```

Using this approach it is entirely possible for a function to create a new transaction, and for multiple agents to autonomously interract by sending scripts to one another.
npm package: @functional-bitcoin/cli
Description: **🚨 Alert: Functional Bitcoin is VERY beta software with frequent breaking changes. Brave pioneers only until the beta tag is removed.**
Latest version: 0.1.0-beta.2

[![license](https://img.shields.io/github/license/functional-bitcoin/library.svg)](https://github.com/functional-bitcoin/library/blob/master/license.md)

# Functional Bitcoin :: CLI

**🚨 Alert: Functional Bitcoin is VERY beta software with frequent breaking changes. Brave pioneers only until the beta tag is removed.**

Command line utility to help author and publish functions to the Bitcoin (SV) blockchain, for use in extensible Bitcoin application protocols.

## Installation

```console
# Install cli
$ npm install -g @functional-bitcoin/cli@beta

# List available commands
$ fb --help 
```

## Usage

Initialise your working directory. This will generate a `.bit` environemnt file containing your publishing address and private key.

```console
$ fb init --help

$ fb init .
```

Create new functions. This will generate a blank function in the `src` folder of your working directory.

```console
$ fb new --help

$ fb new my/function -a arg1 -a arg2
```

Publish functions to the blockchain. It is necessary to fund your publishing address (in the `.bit` file) with a few satoshis before publishing.


```console
$ fb publish --help

$ fb publish my/function
```

## Creating functions

A generated function will look like this:

```lua
function main(ctx, arg1, arg2)
  return ctx
end
```

Functions are scripts that define a `main()` function, although within the script any other necessary functions, classes and variables can be defined. The script is written using Lua, and executed within a sandboxed environment with the `file` and `io` modules removed.

A function represents a "cell" - an atomic subroutine within a "tape" (a transaction output). The return value of each cell is passed to the next cell in the tape. Thus cell by cell the tapes' result is calculated - pure functional programming on bitcoin!
npm package: @functional-examples/devkit
Description: Plugin development kit for functional-examples
Author: Craigory Coppola
Latest version: 0.1.2

# @functional-examples/devkit

Plugin development kit for functional-examples — shared types and utilities.

## Installation

```bash
npm install @functional-examples/devkit

```

## Overview

The devkit provides the foundational types and utility modules used by `functional-examples` and its plugins.

## Usage

### Types (root)

```typescript
import type {
  Config,
  Example,
  Extractor,
  Plugin,
} from '@functional-examples/devkit';

```

Core type definitions: `Plugin`, `Extractor`, `ExtractorResult`, `Config`, `Example`, `ExampleFile`, and more.

### Utilities (root)

```typescript
import {
  createMatcher,
  glob,
  isMatch,
  JsonParseError,
  parseJson,
  parseYaml,
  tryParseJson,
  tryParseYaml,
  YamlParseError,
} from '@functional-examples/devkit';

```

Includes JSON parsing (`parseJson`, `tryParseJson`, `JsonParseError`), YAML parsing (`parseYaml`, `tryParseYaml`, `YamlParseError`), and glob helpers (`glob`, `isMatch`, `createMatcher`) from the root import.

## Peer Dependencies

The utility helpers rely on optional peer dependencies:

| Utility area | Optional peers |
|--------------|----------------|
| Glob helpers | `tinyglobby`, `picomatch` |
| YAML parser | `yaml` |
| JSON parser | `jsonc-parser` and/or `json5` for extended formats |

## License

MIT
npm package: @functional-examples/documentation
Description: Documentation generation plugin for functional-examples
Author: Craigory Coppola
Latest version: 0.1.2

# @functional-examples/documentation

Documentation generation plugin for functional-examples.

## Installation

```bash
npm install @functional-examples/documentation

```

## Overview

This plugin generates documentation from your scanned examples using customizable templates. It supports both Markdown and Markdoc output formats, with Eta-powered template rendering.

## Usage

```typescript
import { createDocumentationPlugin } from '@functional-examples/documentation';
import { createJavaScriptPlugin } from '@functional-examples/javascript';
import type { Config } from 'functional-examples';

/**
 * Configuration demonstrating the documentation plugin.
 *
 * The documentation plugin:
 * - Adds the `generate` CLI command
 * - Enables template-based doc generation
 * - Provides prose helpers (file(), region(), fencedBlock())
 */
const config: Config = {
  plugins: [
    createJavaScriptPlugin(),
    createDocumentationPlugin({
      outputDir: 'generated-docs',
      format: 'markdown',
    }),
  ],
  scan: {
    include: ['src/**/*'],
    exclude: ['**/node_modules/**', '**/dist/**'],
  },
};

export default config;

```

## Features

- **Template-based generation**: Eta templates for full control over output
- **Per-example templates**: Override the template for specific examples
- **Prose file rendering**: README.md files in examples are rendered with helper expansion
- **Region references**: Use `file()` and `region()` helpers in prose to embed code
- **Guide hydration**: Expand cross-example references in standalone guide documents
- **Check mode**: CI-friendly `--check` flag to verify docs are up-to-date
- **Multiple formats**: Markdown and Markdoc output

## Template Helpers

Inside prose files (README.md in examples), use:

```markdown
<%= file('utils.ts') %>       <% /* Embed a file as a fenced code block */ %>
<%= region('setup') %>        <% /* Embed a code region */ %>

```

Inside guide documents, reference any example:

```markdown
<%= example('basic-usage').file('scan.ts') %>
<%= example('basic-usage').region('scan') %>

```

## License

MIT
npm package: @functional-examples/javascript
Description: JavaScript/TypeScript plugin for functional-examples
Author: Craigory Coppola
Latest version: 0.1.2

# @functional-examples/javascript

JavaScript/TypeScript extractor plugin for functional-examples.

## Installation

```bash
npm install @functional-examples/javascript

```

## Overview

This plugin adds JavaScript and TypeScript support to functional-examples:

- **YAML frontmatter extraction** from JS/TS files (comment-wrapped frontmatter)
- **Automatic dependency tree resolution** via `dependency-tree`
- **TypeScript-aware file matching** with configurable glob patterns

## Usage

```typescript
import { createJavaScriptPlugin } from '@functional-examples/javascript';
import type { Config } from 'functional-examples';

/**
 * Configuration for the JavaScript plugin example.
 *
 * This example demonstrates:
 * - Frontmatter metadata extraction (id, title, description, custom fields)
 * - Region markers for code snippets (#region / #endregion)
 *
 * Plugin options (all optional):
 * - skipFrontmatter: true  - Disable frontmatter parsing
 * - skipRegions: true      - Disable region extraction
 */
const config: Config = {
  plugins: [createJavaScriptPlugin()],
  scan: {
    include: ['src/**/*'],
    exclude: ['**/node_modules/**', '**/dist/**'],
  },
};

export default config;

```

## Features

### Frontmatter Extraction

The plugin detects YAML frontmatter in JS/TS comment blocks:

```typescript
// ---
// id: getting-started
// title: Getting Started
// description: A simple example demonstrating frontmatter metadata extraction
// tags:
//   - beginner
//   - tutorial
// ---

/**
 * A simple greeting function.
 *
 * @param name - The name to greet
 * @returns A greeting message
 */
export function greet(name: string): string {
  return `Hello, ${name}!`;
}

// Example usage of the greet function
const message = greet('World');
console.log(message); // Output: Hello, World!

```

### Dependency Resolution

When an entry point is specified, the plugin automatically resolves its dependency tree to discover related files.

### Path Mappings

Configure path mappings to handle TypeScript path aliases in your examples.

## License

MIT
npm package: @functional-examples/test
Description: Test runner plugin for functional-examples
Author: Craigory Coppola
Latest version: 0.1.2

# @functional-examples/test

Test runner plugin for functional-examples.

## Installation

```bash
npm install @functional-examples/test

```

## Overview

This plugin provides test execution capabilities for functional-examples. It lets you define and run tests against your code examples to ensure they stay correct and up-to-date.

## Usage

```json
{
  "$schema": "./.functional-examples/schema.json",
  "plugins": [
    "@functional-examples/javascript",
    "@functional-examples/test"
  ],
  "scan": {
    "include": ["examples/**/*.js", "examples/**/package.json"],
    "exclude": ["**/node_modules/**"]
  },
}

```

## Features

- **Example validation**: Run examples to verify they work correctly
- **CLI integration**: Adds test commands to the functional-examples CLI
- **Schema validation**: Validates test metadata using Zod schemas
- **Configurable**: Customize test behavior per-example via metadata

## License

MIT
npm package: @functional-examples/yaml-manifest
Description: YAML manifest plugin for multi-file examples in functional-examples
Author: Craigory Coppola
Latest version: 0.1.2

# @functional-examples/yaml-manifest

YAML manifest extractor plugin for multi-file examples in functional-examples.

## Installation

```bash
npm install @functional-examples/yaml-manifest

```

## Overview

This plugin enables directory-based example discovery using `meta.yml` manifest files. Each example directory contains a `meta.yml` that declares the example's metadata and file structure.

## Usage

```json
{
  "$schema": "./.functional-examples/schema.json",
  "scan": {
    "include": ["examples/**/*"],
    "exclude": ["**/node_modules/**", "**/dist/**"]
  }
}

```

## Manifest Format

Create a `meta.yml` file in each example directory:

```yaml
id: basic-usage
title: Basic Usage
description: |
  Demonstrates scanning for examples in a directory
  using the functional-examples library.
tags:
  - getting-started
  - api

```

### Directory Structure

```txt
examples/
  my-example/
    meta.yml
    main.ts
    utils.ts
    README.md

```

## Features

- **Multi-file examples**: Group related files under a single example
- **Entry point declaration**: Specify which file is the main entry
- **Rich metadata**: Title, description, tags, and custom fields
- **README support**: Include prose documentation alongside code

## License

MIT