open-index/open-npm huggingface dataset:
npm package: @fedify/cli
Description: CLI toolchain for Fedify and debugging ActivityPub
Author: Hong Minhee
Latest version: 2.1.5

<!-- deno-fmt-ignore-file -->

`fedify`: the CLI toolchain for Fedify and debugging ActivityPub
================================================================

[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Releases][GitHub Releases badge]][GitHub Releases]

The `fedify` is a CLI toolchain for Fedify and debugging ActivityPub-enabled
federated server apps.  Although it is primarily designed for developers who use
[Fedify], it can be used with any ActivityPub-enabled server.

[JSR badge]: https://jsr.io/badges/@fedify/cli
[JSR]: https://jsr.io/@fedify/cli
[npm badge]: https://img.shields.io/npm/v/@fedify/cli?logo=npm
[npm]: https://www.npmjs.com/package/@fedify/cli
[GitHub Releases badge]: https://img.shields.io/github/v/release/fedify-dev/fedify?sort=semver&logo=github
[GitHub Releases]: https://github.com/fedify-dev/fedify/releases
[Fedify]: https://fedify.dev/


Installation
------------

### Using npm

If you have npm installed, you can install `fedify` by running the following
command:

~~~~ sh
npm install -g @fedify/cli
~~~~

### Using Bun

If you have [Bun] installed, you can install `fedify` by running the following
command:

~~~~ sh [Bun]
bun install -g @fedify/cli
~~~~

[Bun]: https://bun.sh/

### Using Deno

If you have [Deno] installed, you can install `fedify` by running the following
command:

~~~~ sh
# Linux/macOS
deno install \
  -A \
  --unstable-fs --unstable-kv \
  -n fedify \
  jsr:@fedify/cli
~~~~

~~~~ powershell
# Windows
deno install `
  -A `
  --unstable-fs --unstable-kv `
  -n fedify `
  jsr:@fedify/cli
~~~~

On Deno versions earlier than 2.7.0, add `--unstable-temporal` to the install
command above.

[Deno]: https://deno.com/

### Downloading the executable

You can download the pre-built executables from the [releases] page.  Download
the appropriate executable for your platform and put it in your `PATH`.

[releases]: https://github.com/fedify-dev/fedify/releases
npm package: @fedify/markdown-it-hashtag
Description: A markdown-it plugin that parses and renders Mastodon-style #hashtags.
Author: Hong Minhee
Latest version: 0.3.0

<!-- deno-fmt-ignore-file -->

@fedify/markdown-it-hashtag
===========================

[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]

This is a [markdown-it] plugin that parses and renders Mastodon-style #hashtags.
It converts, for example, `#FooBar` into a link:

~~~~ html
<a href="#FooBar"><span class="hash">#</span><span class="tag">FooBar</span></a>
~~~~

The value of `href` attributes, other attributes (if any), and the content of
the link can be customized by passing [options] to the plugin:

~~~~ typescript
import MarkdownIt from "markdown-it";
import { hashtag, spanHashAndTag } from "@fedify/markdown-it-hashtag";

const md = new MarkdownIt();
md.use(hashtag, {
  link: (tag: string) => `https://example.com/tags/${tag.substring(1)}`,
  linkAttributes: (handle: string) => ({ class: "hashtag" }),
  label: spanHashAndTag,
});
~~~~

If you want to collect all hashtags in a document, you can pass an environment
object to the `render()` method:

~~~~ typescript
const env = {};
md.render(
  "Hello, #FooBar\n\n> #BazQux",
  env,
);
console.log(env.hashtags);  // ["#FooBar", "#BazQux"]
~~~~

[JSR]: https://jsr.io/@fedify/markdown-it-hashtag
[JSR badge]: https://jsr.io/badges/@fedify/markdown-it-hashtag
[npm]: https://www.npmjs.com/package/@fedify/markdown-it-hashtag
[npm badge]: https://img.shields.io/npm/v/%40fedify%2Fmarkdown-it-hashtag?logo=npm
[GitHub Actions]: https://github.com/fedify-dev/markdown-it-hashtag/actions/workflows/main.yaml
[GitHub Actions badge]: https://github.com/fedify-dev/markdown-it-hashtag/actions/workflows/main.yaml/badge.svg
[markdown-it]: https://github.com/markdown-it/markdown-it
[options]: https://jsr.io/@fedify/markdown-it-hashtag/doc/~/PluginOptions


Installation
------------

### Deno

~~~~ sh
deno add @fedify/markdown-it-hashtag
~~~~

### Node.js

~~~~ sh
npm add @fedify/markdown-it-hashtag
~~~~

### Bun

~~~~ sh
bun add @fedify/markdown-it-hashtag
~~~~
npm package: @fedify/markdown-it-mention
Description: A markdown-it plugin that parses and renders Mastodon-style @mentions.
Author: Hong Minhee
Latest version: 0.3.0

<!-- deno-fmt-ignore-file -->

@fedify/markdown-it-mention
===========================

[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]
[![GitHub Actions][GitHub Actions badge]][GitHub Actions]

This is a [markdown-it] plugin that parses and renders Mastodon-style @mentions,
e.g., `@username@domain.com`.  It converts them to a link, e.g.:

~~~~ html
<a href="acct:@username@domain.com"><span class="at">@</span><span
  class="user">username</span></a>
~~~~

The value of `href` attributes, other attributes (if any), and the content of
the link can be customized by passing [options] to the plugin:

~~~~ typescript
import MarkdownIt from "markdown-it";
import { mention, toFullHandle } from "@fedify/markdown-it-mention";

const md = new MarkdownIt();
md.use(mention, {
  link: (handle: string, env: any) => `https://example.com/${handle}`,
  linkAttributes: (handle: string, env: any) => ({ class: "mention" }),
  label: toFullHandle,
});
~~~~

> [!TIP]
> The `link` callback can return `null` to disable the link.

If you want to collect all the handles mentioned in the document, you can pass
the environment object to the `render()` method:

~~~~ typescript
const env = {};
md.render(
  "# Hello, @foo@bar.com\n\n> @baz@qux.com",
  env,
);
console.log(env.mentions);  // ["@foo@bar.com", "@baz@qux.com"]
~~~~

[JSR]: https://jsr.io/@fedify/markdown-it-mention
[JSR badge]: https://jsr.io/badges/@fedify/markdown-it-mention
[npm]: https://www.npmjs.com/package/@fedify/markdown-it-mention
[npm badge]: https://img.shields.io/npm/v/%40fedify%2Fmarkdown-it-mention?logo=npm
[GitHub Actions]: https://github.com/fedify-dev/markdown-it-mention/actions/workflows/main.yaml
[GitHub Actions badge]: https://github.com/fedify-dev/markdown-it-mention/actions/workflows/main.yaml/badge.svg
[markdown-it]: https://github.com/markdown-it/markdown-it
[options]: https://jsr.io/@fedify/markdown-it-mention/doc/~/PluginOptions


Installation
------------

### Deno

~~~~ sh
deno add jsr:@fedify/markdown-it-mention
~~~~

### Node.js

~~~~ sh
npm add @fedify/markdown-it-mention
~~~~

### Bun

~~~~ sh
bun add @fedify/markdown-it-mention
~~~~
npm package: @fedify/uri-template
Description: URI Template (RFC 6570) utilities for Fedify
Author: Lee ByeongJun
Latest version: 2.0.0-pr.475.1

<!-- deno-fmt-ignore-file -->

@fedify/uri-template: RFC 6570 URI Template implementation
===========================================================

[![JSR][JSR badge]][JSR]
[![npm][npm badge]][npm]

This package provides [RFC 6570] fully compliant URI template expansion and
pattern matching library.  Supports symmetric matching where
`expand(match(url))` and `match(expand(vars))` behave predictably.

[JSR]: https://jsr.io/@fedify/uri-template
[JSR badge]: https://jsr.io/badges/@fedify/uri-template
[npm]: https://www.npmjs.com/package/@fedify/uri-template
[npm badge]: https://img.shields.io/npm/v/@fedify/uri-template?logo=npm
[RFC 6570]: https://datatracker.ietf.org/doc/html/rfc6570


Features
--------

 -  **Full RFC 6570 Level 4 support**: Handles all operators and modifiers
    (explode `*`, prefix `:n`)
 -  **Symmetric pattern matching**:
     -  `opaque`: byte-for-byte exact round-trips
     -  `cooked`: human-readable decoded values
     -  `lossless`: preserves both raw and decoded forms
 -  **Strict percent-encoding validation**: Prevents malformed sequences
    (`%GZ`, etc.)
 -  **Deterministic expansion**: Correctly handles undefined/empty values per
    RFC rules


Installation
------------

~~~~ sh
deno add jsr:@fedify/uri-template  # Deno
npm  add     @fedify/uri-template  # npm
pnpm add     @fedify/uri-template  # pnpm
yarn add     @fedify/uri-template  # Yarn
bun  add     @fedify/uri-template  # Bun
~~~~


Usage
-----

~~~~ typescript
import { compile } from "@fedify/uri-template";

const tmpl = compile("/repos{/owner,repo}{?q,lang}");

// Expansion
const url = tmpl.expand({ owner: "foo", repo: "hello/world", q: "a b" });
// => "/repos/foo/hello%2Fworld?q=a%20b"

// Matching
const result = tmpl.match("/repos/foo/hello%2Fworld?q=a%20b", {
  encoding: "cooked"
});
// => { owner: "foo", repo: "hello/world", q: "a b" }
~~~~

**Matching options:**

 -  `encoding`: `"opaque"` (default, preserves raw) | `"cooked"` (decoded) |
    `"lossless"` (both)
 -  `strict`: `true` (default, strict) | `false` (lenient parsing)


Documentation
-------------

For detailed implementation details, see [*specification.md*].

[*specification.md*]: ./docs/specification.md
npm package: @fedikit/host-meta
Description: Building Blocks for Fediverse.
Latest version: 0.0.1-alpha.7

# @fedikit/host-meta

Implement [Web Host Metadata](https://datatracker.ietf.org/doc/html/rfc6415) in
a simple way.

## Usage

###### `/.well-known/host-meta` `/.well-known/host-meta.*` (simpleHostMeta)

```ts
import { simpleHostMeta } from '@fedikit/webfinger'
import { Hono } from 'hono'

const app = new Hono()

// GET https://example.com/.well-known/host-meta (accept json)
// GET https://example.com/.well-known/host-meta.json
// GET https://example.com/.well-known/host-meta.jrd
// {
//   "links": [
//     {
//       "rel": "lrdd",
//       "type": "application/jrd+json",
//       "template": "https://example.com/.well-known/webfinger?resource={uri}"
//     }
//   ]
// }
// GET https://example.com/.well-known/host-meta
// GET https://example.com/.well-known/host-meta.xrd
// <?xml version="1.0" encoding="UTF-8"?>
// <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0">
//   <Link rel="lrdd" type="application/jrd+json" template="https://example.com/.well-known/webfinger?resource={uri}" />
// </XRD>
app
  .get('/.well-known/host-meta', ({ req }) => simpleHostMeta(req.raw))
  .get('/.well-known/host-meta.*', ({ req }) => simpleHostMeta(req.raw))
```
npm package: @fedikit/http-signature
Description: Building Blocks for Fediverse.
Latest version: 0.0.1-alpha.7

# @fedikit/http-signature

Modern alternative to `http-signature`. [WIP]

## About

`@fedikit/http-signature` Using the
[Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API),
currently supported up to
[draft-cavage-http-signatures-12](https://datatracker.ietf.org/doc/html/draft-cavage-http-signatures-12).

- Q: Why is the latest
  [draft-ietf-httpbis-message-signatures](https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-message-signatures)
  not supported?
  - A: Most Fediverse apps aren't currently compatible with it, and I'll
    consider implementing it when at least two major app is.
- Q: Why Use the Web Crypto API?
  - A: 0KB! this means that this package can be more lightweight, at the cost of
    having to use async/await.

## Usage

###### Sign

```ts
import { generateKey, sign } from '@fedikit/http-signature'

const keyPair = await generateKey()

let req = new Request('https://post.deno.dev', {
  method: 'POST',
  body: JSON.stringify({
    message: 'Hello world!',
  }),
  headers: {
    'content-type': 'application/json',
  },
})

req = await sign(req, {
  key: keyPair.privateKey,
  keyId: 'rsa-key-1',
})

await fetch(req)
```
npm package: @fedikit/nodeinfo
Description: Building Blocks for Fediverse.
Latest version: 0.0.1-alpha.7

# @fedikit/nodeinfo

Implement NodeInfo in a simple way.

## Usage

###### `/.well-known/nodeinfo` (simpleWellKnownNodeInfo)

```ts
import { simpleWellKnownNodeInfo } from '@fedikit/nodeinfo'
import { Hono } from 'hono'

const app = new Hono()

// GET https://example.com/.well-known/nodeinfo
// {
//   "links": [
//     {
//       "rel": "http://nodeinfo.diaspora.software/ns/schema/2.0",
//       "href": "https://example.com/nodeinfo/2.0"
//     },
//     {
//       "rel": "http://nodeinfo.diaspora.software/ns/schema/2.1",
//       "href": "https://example.com/nodeinfo/2.1"
//     }
//   ]
// }
app.get(
  '.well-known/nodeinfo',
  ({ req }) => simpleWellKnownNodeInfo(new URL(req.raw.url).origin),
)
```

###### `/nodeinfo/*` (simpleNodeInfo)

```ts
import { simpleNodeInfo } from '@fedikit/nodeinfo'
import { Hono } from 'hono'

// {
//   "name": "fedikit",
//   "version: "0.0.1",
//   "repository": {
//     "type": "git",
//     "url": "https://github.com/fedikit/fedikit.git"
//   },
//   "homepage": "https://github.com/fedikit/fedikit#readme"
// }
import pkg from './package.json' assert { type: 'json' }

const app = new Hono()

// GET https://example.com/nodeinfo/2.1
// {
//   "version": "2.1",
//   "software": {
//     "name": "fedikit",
//     "version": "0.0.1",
//     "repository": "https://github.com/fedikit/fedikit.git",
//     "homepage": "https://github.com/fedikit/fedikit#readme"
//   },
//   "protocols": ["activitypub"],
//   "services": {
//     "inbound": [],
//     "outbound": []
//   },
//   "openRegistrations": false,
//   "usage": {
//     "users": {}
//   },
//   "metadata": {}
// }
// GET https://example.com/nodeinfo/2.0
// {
//   "version": "2.0",
//   "software": {
//     "name": "fedikit",
//     "version": "0.0.1",
//   },
//   "protocols": ["activitypub"],
//   "services": {
//     "inbound": [],
//     "outbound": []
//   },
//   "openRegistrations": false,
//   "usage": {
//     "users": {}
//   },
//   "metadata": {}
// }
app.get('/nodeinfo/*', ({ req }) =>
  simpleNodeInfo(req.raw, {
    software: {
      name: pkg.name,
      version: pkg.version,
      repository: pkg.repository.url,
      homepage: pkg.homepage,
    },
  }))
```
npm package: @fedikit/rehype-custom-emoji
Description: Rehype plugin to support custom emoji (emojo)
Author: 藍+85CD
Latest version: 0.0.1

# @fedikit/rehype-custom-emoji

Rehype plugin to support custom emoji (emojo)

## Use

```ts
import { rehype } from 'rehype'
import { rehypeCustomEmoji, all, category, one, oneMisskey } from '@fedikit/rehype-custom-emoji'

const file = await rehype()
  .use(rehypeCustomEmoji, {
    emojis: [
      // user defined
      {
        shortcode: 'custom_emoji',
        url: 'https://example.com/custom_emoji.png',
      },
      // get all emoji from mastodon instance
      ...(await all('https://mastodon.social')),
      // get category-specific emoji from mastodon instance
      ...(await category('https://mozilla.social', 'Mozilla')),
      // get a specific emoji from mastodon instance
      ...(await one('https://m.webtoo.ls', 'vitest')),
      // get a specific emoji from misskey instance
      ...(await oneMisskey('https://misskey.io', 'ai_acid_misskeyio'))
    ],
  })
  .process(':custom_emoji:')

// <picture>
//   <source media="(prefers-reduced-motion: no-preference)" srcset="https://example.com/custom_emoji.png">
//   <img alt=":custom_emoji:" src="https://example.com/custom_emoji.png" style="aspect-ratio:1/1;height:1em;vertical-align:text-top" title=":custom_emoji:">
// </picture>
console.log(String(file))
```
npm package: @fedikit/remark-webfinger-mentions
Description: Remark plugin to replace acct mentions with links
Author: 藍+85CD
Latest version: 0.0.1

# @fedikit/remark-webfinger-mentions

Remark plugin to replace acct mentions with links

## Use

```ts
import { remark } from 'remark'
import { remarkWebfingerMentions } from '@fedikit/rehype-custom-emoji'

const file = await remark()
  .use(remarkWebfingerMentions)
  .process('Hello, @mozilla@mozilla.social!')

// Hello, [@mozilla@mozilla.social](https://mozilla.social/@mozilla)!\n
console.log(String(file))
```
npm package: @fedikit/webfinger
Description: Building Blocks for Fediverse.
Latest version: 0.0.1-alpha.7

# @fedikit/webfinger

Implement Webfinger in a simple way.

## Usage

###### `/.well-known/webfinger` (simpleWebfinger)

```ts
import {
  simpleWebfinger,
  type SimpleWebfingerHandler,
} from '@fedikit/webfinger'
import { Hono } from 'hono'

const app = new Hono()

const handler = ({ user, host }) => `https://${host}/users/${user}`

// GET https://example.com/.well-known/webfinger?resource=acct:carol@example.com
// {
//   "subject": "acct:carol@example.com",
//   "aliases": ["https://example.com/users/carol"],
//   "links": [
//     {
//       "href": "https://example.com/users/carol",
//       "rel": "http://webfinger.net/rel/profile-page",
//       "type": "text/html"
//     },
//     {
//       "href": "https://example.com/users/carol",
//       "rel": "self",
//       "type": "application/activity+json"
//     }
//   ]
// }
app.get(
  '.well-known/webfinger',
  () => simpleWebfinger(handler),
)
```