open-index/open-npm huggingface dataset:
npm package: @rill/loader
Description: Data loading and caching for Rill.
Author: Dylan Piercey
Latest version: 2.2.1

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/loader
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/loader">
    <img src="https://img.shields.io/npm/v/@rill/loader.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/loader">
    <img src="https://img.shields.io/npm/dm/@rill/loader.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Utility to handle cached data loading in Rill.

# Installation

```console
npm install @rill/loader
```

# Example

#### Load the data in middleware.
```js
const app = require('rill')()
const loader = require('@rill/loader')

app.use(loader())
app.get('/my-view',
	(ctx, next)=> {
		// A #load function will be attached to the context.
		return ctx.load('myStuff', ...).then((myStuff)=> {
			// Loaded data cached automatically attached to ctx.locals
			ctx.locals.myStuff; //-> 'data'
		})
	}
)
```

#### Register a data loader.
```js
const loader = require('@rill/loader')

// Register a loadable item.
loader.register(
	{ name: 'myStuff', ttl: '30 minutes' },
	(ctx, ...)=> {
	    // Return any promise of data and it will be cached.
	    return myApi.fetchMyStuff();
	}
);
```

# API

###`ctx.load(name:String, arguments...)`
Requests data from a registered loader and returns cached data if possible.
`name` is the name of the loader and `arguments` are provided to the loader.

###`loader.register(opts:Object, getter:Function)`
Registers a getter function with the loader.
This function will be cached and automatically set it's data on `ctx.locals` when loaded.

#### Register Options
```js
{
	// The name where the data will be stored on `ctx.locals`.
	name: "myStuff",

	// A timeout (in milliseconds or as a string) that the data will deleted in.
	ttl: 3000,

	// If true the `ttl` option will be reset every time the data is loaded.
	refresh: false,

	// If shared is set the true then a global cache will be used on the server side. (By default is uses the users session).
	shared: false
}
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/logger
Description: Logging middleware for Rill.
Author: Dylan Piercey
Latest version: 2.2.1

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/logger
  <br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/logger">
    <img src="https://img.shields.io/npm/v/@rill/logger.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/logger">
    <img src="https://img.shields.io/npm/dm/@rill/logger.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Isomorphic request logging for Rill. With colors!

```console
<-- GET /
--> GET / 200 835ms 746b
<-- GET /
--> GET / 200 960ms 1.9kb
<-- GET /users
--> GET /users 200 357ms 922b
<-- GET /users?page=2
--> GET /users?page=2 200 466ms 4.66kb
```

# Installation

```console
npm install @rill/logger
```

# Example

```javascript
const app = require('rill')()
const logger = require('@rill/logger')

app.use(logger())
```

# Options

```js
{
  group: false // If true, will use console.group instead of log. (Shims in node)
}
```

# Notes
Recommended that you `.use()` this middleware near the top to "wrap" all subsequent middleware.


### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/marko
Description: Marko views for Rill.
Author: Dylan Piercey
Latest version: 1.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/marko
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/marko">
    <img src="https://img.shields.io/npm/v/@rill/marko.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/marko">
    <img src="https://img.shields.io/npm/dm/@rill/marko.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Universal [Marko](http://markojs.com) rendering middleware for [Rill](https://github.com/rill-js/rill).

It is recommended to combine this middleware with [@rill/page](https://github.com/rill-js/page) as seen below to facilitate full page isomorphic rendering with [Marko](http://markojs.com).

# Installation

```console
npm install @rill/marko
```

# Example

```javascript
import Rill from 'rill'
import page from '@rill/page'
import render from '@rill/marko'

// Create a rill app.
const app = Rill()

// Setup the document template.
app.get(page
  .html({ lang: 'en' })
  .meta({ charset: 'utf8' })
  .title('My Marko App')
  .meta({ name: 'author', content: 'Dylan Piercey' })
  .meta({ name: 'descripton', content: 'Universal JS is awesome' })
  .link({ rel: 'stylesheet', href: 'index.css' })
  .script({ src: 'index.js', async: true })
)

// Set locals in middleware. (access in marko with out.global)
app.use(({ locals }), next)=> {
	locals.title = '@rill/marko'
	return next()
})

// Render a Marko template.
const HomeTemplate = require('./home.marko')
app.get('/home', render(HomeTemplate, {
  message: 'world'
}))
```

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/parallel
Description: Run Rill middleware in parallel.
Author: Dylan Piercey
Latest version: 1.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/parallel
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/parallel">
    <img src="https://img.shields.io/npm/v/@rill/parallel.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/parallel">
    <img src="https://img.shields.io/npm/dm/@rill/parallel.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Simple utility to run standard Rill middleware in parallel.

# Installation

```console
npm install @rill/parallel
```

## Example

```js
// Run both timeouts in parallel.
app.use(parallel([
	(ctx, next)=> next().then(sleep(1000)),
	(ctx, next)=> sleep(1000).then(next)
]))

function sleep (ms) {
	return new Promise((accept)=> setTimeout(accept, ms))
}
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/polyfill
Description: Dynamic polyfill generator based on useragent for Rill.
Author: Dylan Piercey
Latest version: 1.2.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/polyfill
  <br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/polyfill">
    <img src="https://img.shields.io/npm/v/@rill/polyfill.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/polyfill">
    <img src="https://img.shields.io/npm/dm/@rill/polyfill.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

A small wrapper around [polyfill-service](https://github.com/Financial-Times/polyfill-service) which allows automatic user-agent based polyfills to be sent with Rill.

## Installation

```console
npm install @rill/polyfill
```

## Example

```js
const app = require('rill')()
const polyfill = require('@rill/polyfill')

// Setup route to send the polyfill.
app.get('/polyfill.js.min', polyfill({ minify: true }))
```

#### In the browser

```html
<script src="/polyfill.js.min"></script>
```

# API Options/Defaults

```js
{
  // The cache time for the polyfill file (string or number of seconds).
  maxage: '1 year',
  // Enable or disable minification.
  minify: true,
  // Enable or disable polyfilling unknown user agents.
  unknown: true,
  // Array of excluded features.
  excludes: undefined,
  // Object containing the features to pollyfill (defaults to all).
  features: undefined
}
```

**For a list of polyfills and more documentation [click here](https://github.com/Financial-Times/polyfill-service/tree/master/polyfills)**

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/progress
Description: Simple loading bar animation for Rill applications.
Author: Dylan Piercey
Latest version: 2.0.4

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/progress
  <br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/progress">
    <img src="https://img.shields.io/npm/v/@rill/progress.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/progress">
    <img src="https://img.shields.io/npm/dm/@rill/progress.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Adds a simple loading bar during requests with Rill.
The progress bar is powered by [nprogress](http://ricostacruz.com/nprogress).

# Installation

```console
npm install @rill/progress
```

# Example

```javascript
var app = require('rill')()
var progress = require('@rill/progress')

// All requests to the app will now have a progress bar.
app.use(progress({ speed: 500, easing: 'ease' }))
```

# Options

```js
{
  color: "green", // The default color of the progress bar and spinner.
  spinner: true,    // Show the spinning circle along with the bar.
  parent: "body",  // The element that will contain the progress bar.
  style: true     // Uses inline styles to create the progress bar. Set to false to use your own.
}
```

# Styling

All styles are injected into the document when the page is loaded. You can see the unminified styles [here](https://github.com/rstacruz/nprogress/blob/master/nprogress.css). To use your own styles use `style: false` to disable the inline styles.

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/rate-limit
Description: RIll middleware to rate-limit an API.
Author: Dylan Piercey
Latest version: 0.2.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/rate-limit
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/rate-limit">
    <img src="https://img.shields.io/npm/v/@rill/rate-limit.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/rate-limit">
    <img src="https://img.shields.io/npm/dm/@rill/rate-limit.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Rate limit middleware for Rill.

Uses [Keyv](https://github.com/lukechilds/keyv) for persistance. Supports caching in memory, mongodb, redis, sqllite, mysql and postgre.

# Installation

```console
npm install @rill/rate-limit
```

# Example

#### app.js

```js
const app = rill()
const limit = require("@rill/rate-limit")

// Setup the middleware. (1000 req/hr max)
app.use(limit({
  max: 1000,
  duration: '1 hour'
}))
```

# Options

```js
{
  /**
   * Key used for keyv namespace.
   */
  key: '@rill/rate-limit',
  /**
   * The maximum amount of requests from a user per period.
   */
  max: 2500,
  /**
   * The duration of a period. (in ms or as a string).
   */
  duration: '1 hour',
  /**
   * Overrride the identifier for the users (default is their ip addresss).
   */
  id: ctx => ctx.req.ip,
  /**
   * Passed to keyv, do not send this to client.
   * Mongo db example. (must have installed keyv-mongo).
   */
  cache: !process.brower && {
    uri: 'mongodb://user:pass@localhost:27017/dbname' // Default is in memory (see keyv uri).
  }
}
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/redirect
Description: Simple permanent redirect middleware for Rill.
Author: Dylan Piercey
Latest version: 1.0.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/redirect
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/redirect">
    <img src="https://img.shields.io/npm/v/@rill/redirect.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/redirect">
    <img src="https://img.shields.io/npm/dm/@rill/redirect.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Simple redirect setting middleware for Rill. Supports overriding status with easy defaults.

# Installation

```console
npm install @rill/redirect
```

## Example

```js
const app = require('rill')()

// Redirect all "/from" to "/to".
app.get('/from', redirect('/to'))
app.get('/from', redirect('/to', 302))

// Same as.
app.get('/from', ({ res })=> res.redirect('/to'))
app.get('/from', ({ res })=> {
	res.redirect('/to')
	res.status = 302
})

// Will not override existing redirects.
app.get('/from', redirect('/a'))
app.get('/from', redirect('/b')) // b gets skipped.
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/refresh-with
Description: Redirect and alter the query string for Rill.
Author: Dylan Piercey
Latest version: 3.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/refresh-with
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/refresh-with">
    <img src="https://img.shields.io/npm/v/@rill/refresh-with.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/refresh-with">
    <img src="https://img.shields.io/npm/dm/@rill/refresh-with.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Utility to redirect/refresh with an updated query string.

# Installation

```console
npm install @rill/refresh-with
```

# Example

```js
const app = require('rill')()
const refreshWith = require('@rill/refresh-with')

// Setup the middleware.
app.use(refreshWith())

// Use the 'res.refreshWith' utility.
// Example `href` is `http://test.com/my-view?modal=hello&test=1`
app.get('/my-view', ({ req, res }, next)=> {
	// Example usecase of removing a modal from the querystring.
	if (req.query.modal) {
		res.refreshWith({ modal: '', success: true })
		// Removes `modal` and adds `success=true`
		res.get('Location') // -> `http://test.com/my-view?success=true&test=1`
	}
})

// Example `referrer` is `http://test.com/my-view?modal=hello&test=1`
app.get('/from-somewhere-else', ({ req, res }, next)=> {
	// Example usecase of redirecting to the previous page while unsetting a modal.
	res.refreshWith({ modal: '', success: true }, { url: 'back', hash: '#top' })
	// Removes `modal` and adds `success=true to the referrer`
	res.get('Location') // -> `http://test.com/my-view?success=true&test=1`
})
```

# API

###`ctx.res.refreshWith(setters:Object, options:Object)`
Similar to calling `ctx.res.redirect` but will update the current querystring with `setters` and default the `url` to the current `href`.
Specify the `options.url` option as `back` to automatically redirect to the `referrer` page.

You can also specify `options.alt` for the fallback when using `options.url = 'back'`.

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/response-time
Description: Add X-Response-Time header to Rill responses.
Author: Dylan Piercey
Latest version: 1.0.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/response-time
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/response-time">
    <img src="https://img.shields.io/npm/v/@rill/response-time.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/response-time">
    <img src="https://img.shields.io/npm/dm/@rill/response-time.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

<div align="center">
  Automatically set an `X-Response-Time` header for all requests in Rill.
</div>

## Installation

```console
npm install @rill/response-time
```

## Example

```js
const rill = require('rill')
const app = rill()
const responseTime = require('@rill/response-time')

// Best to use before all other middleware.
app.use(responseTime())
```

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/rewrite
Description: URL rewriter for Rill.
Author: Dylan Piercey
Latest version: 1.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/rewrite
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/rewrite">
    <img src="https://img.shields.io/npm/v/@rill/rewrite.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/rewrite">
    <img src="https://img.shields.io/npm/dm/@rill/rewrite.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

URL rewrite and modify middleware for Rill.

# Installation

```console
npm install @rill/rewrite
```

## Examples

Rewrite using a regular expression.

```js
const app = require('rill')()

// `/i123` to `/items/123`
app.use(rewrite(/^\/i(\w+)/, '/items/$1'))
```

Rewrite using route parameters, references may be named or numeric.

```js
// `/foo..bar` to `/commits/foo/to/bar`
app.use(rewrite('/:src..:dst', '/commits/$1/to/$2'))
app.use(rewrite('/:src..:dst', '/commits/:src/to/:dst'))
```

You may also use the wildcard `*` to soak up several segments.

```js
// `/js/vendor/jquery.js` to `/public/assets/js/vendor/jquery.js`
app.use(rewrite('/js/*', '/public/assets/js/$1'))
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/set
Description: Set a local variable in all requests for Rill.
Author: Dylan Piercey
Latest version: 1.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/set
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/set">
    <img src="https://img.shields.io/npm/v/@rill/set.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/set">
    <img src="https://img.shields.io/npm/dm/@rill/set.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Simple utility to set a local variable using a middleware.

# Installation

```console
npm install @rill/set
```

## Example

```js
const app = require('rill')()

// Set a local variable for each request.
// Uses the same setter as the query string parser
app.use(set("a", 1))
app.use(set("b[]", 1))
app.use(set("c[d]", 1))


app.use(({ locals })=> {
	locals //-> {
		a: 1,
		b: [1],
		c: { d: 1 }
	}
})
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/static
Description: Serve static files with Rill.
Author: Dylan Piercey
Latest version: 2.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/static
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/static">
    <img src="https://img.shields.io/npm/v/@rill/static.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/static">
    <img src="https://img.shields.io/npm/dm/@rill/static.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

A static file server for Rill. Internally [node-static](https://github.com/cloudhead/node-static) is used and all options are valid.

# Installation

#### Npm
```console
npm install @rill/static
```

# Example

```javascript
const app = require('rill')()
const static = require('@rill/static')

// Directory can be relative to where node_modules are installed or an absolute path.
// Cache time will use the `ms` module to parse time strings, otherwise use milliseconds.
app.use(static('public', { gzip: true, cache: '30 days' }))

// You can also serve a directory at a specific path.
app.at('/assets/*', server('assets_folder')) // -> /assets/test.txt will look in project/assets_foler/test.txt
```

# API

**static(directory, options)** - All files in the provided directory will automatically be served.

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/stats
Description: Simple browser performance monitoring.
Author: Dylan Piercey
Latest version: 1.0.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/stats
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/stats">
    <img src="https://img.shields.io/npm/v/@rill/stats.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/stats">
    <img src="https://img.shields.io/npm/dm/@rill/stats.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Adds a simple browser performance monitoring to a Rill app.
The performance monitoring is powered by [stats.js](https://github.com/mrdoob/stats.js).

# Installation

```console
npm install @rill/stats
```

# Example

```javascript
var app = require('rill')()
var stats = require('@rill/stats')

// Every request will be measured with stats.js.
app.use(stats({ mode: "ms" }))
```

# Default modes
#### (Click on the frame to switch between modes).

```js
{
	"ms" // monitor (avg) ms during requests.
	"mb" // monitor current MBytes of allocated memory.
	"fps"// monitor (avg) fps during requests (typically useless).
}
```

# Production Use

@rill/stats exposes a noop function when "process.env.NODE_ENV" is true.
This allows for build tools such as babel, browserify or webpack to remove this functionality for production sites.

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/svelte
Description: Svelte views for Rill.
Author: Dylan Piercey
Latest version: 1.0.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/svelte
  <br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/svelte">
    <img src="https://img.shields.io/npm/v/@rill/svelte.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/svelte">
    <img src="https://img.shields.io/npm/dm/@rill/svelte.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Universal [Svelte](http://svelte.technology) rendering middleware for [Rill](https://github.com/rill-js/rill).
It is recommended to combine this middleware with [@rill/page](https://github.com/rill-js/page) as seen below to facilitate full page isomorphic rendering with svelte.

# Installation

```console
npm install @rill/svelte
```

# Example

```javascript
import Rill from 'rill'
import page from '@rill/page'
import renderer from '@rill/svelte'
import HomeView from './home.html'

// Create a rill app.
const app = Rill()

// Setup the document template.
app.get(page
  .html({ lang: 'en' })
  .meta({ charset: 'utf8' })
  .title('My Svelte App')
  .meta({ name: 'author', content: 'Dylan Piercey' })
  .meta({ name: 'descripton', content: 'Universal JS is awesome' })
  .link({ rel: 'stylesheet', href: 'index.css' })
  .script({ src: 'index.js', async: true })
)

// Setup svelte middleware.
app.get(renderer())

// Render a Svelte template.
app.get('/home', ({ res, locals }) => {
  // Set locals passed in as data.
  locals.title = '@rill/svelte'
  // Set a svelte component as the body to render it.
  res.body = HomeView
})
```

# Custom Render Target.
@rill/svelte adds the ability to change the svelte `target` element with an option. By default the `document.body` will be the `target` element.

```js
// Use a query selector to set the root element.
app.use(renderer({ target: '#my-element' }))
```

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/unhandled
Description: Build Rill middleware that only run on unhandled requests.
Author: Dylan Piercey
Latest version: 1.1.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/unhandled
  <br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/unhandled">
    <img src="https://img.shields.io/npm/v/@rill/unhandled.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/unhandled">
    <img src="https://img.shields.io/npm/dm/@rill/unhandled.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Utility to create Rill middleware that only runs on unhandled requests.

# Installation

```console
npm install @rill/unhandled
```

## Example

```js
const app = require('rill')()
const redirect = require('@rill/redirect')
const unhandled = require('@rill/unhandled')

// Redirect to 404 when page is unhandled.
app.get(unhandled(redirect('/404')))

// Example routes.
app.get('/home', render(homePage))
app.get('/404', render(notFoungPage))
```

## Details
The middleware provided to `unhandled` will only be invoked when the following conditions are met.

1. `res.body` is `undefined`.
2. `res.status` is `404`.
3. `res.get('Location')` is `undefined`.
4. `res.get('Content-Type')` is `undefined`.

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/webpack
Description: Webpack dev middleware for Rill.
Author: Dylan Piercey
Latest version: 1.3.0

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/webpack
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/refresh-with">
    <img src="https://img.shields.io/npm/v/@rill/refresh-with.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/refresh-with">
    <img src="https://img.shields.io/npm/dm/@rill/refresh-with.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

Webpack dev and hot reload middleware for Rill. (Automatically removed in the browser)

# Installation

```console
npm install @rill/webpack
```

# Example

```js
const app = require('rill')()
const devMiddleware = require('@rill/webpack')
const hotMiddleware = require('@rill/webpack/hot?overlay=false&timeout=1000') // pass in client side options via query string.

// Setup the dev middleware (provide config path relative to project root).
app.use(devMiddleware('webpack.config.js', {
  quiet: true
}))

// Setup the hot middleware (provide config path relative to project root).
app.use(hotMiddleware('webpack.config.js', {
  heartbeat: 2000
}))
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rill/webpack-router
Description: Rill middleware for automatic routing using Webpack require contexts.
Author: Dylan Piercey
Latest version: 2.0.2

<h1 align="center">
  <!-- Logo -->
  <img src="https://raw.githubusercontent.com/rill-js/rill/master/Rill-Icon.jpg" alt="Rill"/>
  <br/>
  @rill/webpack-router
	<br/>

  <!-- Stability -->
  <a href="https://nodejs.org/api/documentation.html#documentation_stability_index">
    <img src="https://img.shields.io/badge/stability-stable-brightgreen.svg?style=flat-square" alt="API stability"/>
  </a>
  <!-- Standard -->
  <a href="https://github.com/feross/standard">
    <img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square" alt="Standard"/>
  </a>
  <!-- NPM version -->
  <a href="https://npmjs.org/package/@rill/webpack-router">
    <img src="https://img.shields.io/npm/v/@rill/webpack-router.svg?style=flat-square" alt="NPM version"/>
  </a>
  <!-- Downloads -->
  <a href="https://npmjs.org/package/@rill/webpack-router">
    <img src="https://img.shields.io/npm/dm/@rill/webpack-router.svg?style=flat-square" alt="Downloads"/>
  </a>
  <!-- Gitter Chat -->
  <a href="https://gitter.im/rill-js/rill">
    <img src="https://img.shields.io/gitter/room/rill-js/rill.svg?style=flat-square" alt="Gitter Chat"/>
  </a>
</h1>

A tool to automatically build a middleware for Rill based on a webpack require.context. Automatically routes all files required.

# Installation

```console
npm install @rill/webpack-router
```

# Example App

```js
const app = require('rill')()
const router = require('@rill/webpack-router')

// Setup all of your custom middleware (automatically routed based on file system path.)
app.use(router(require.context('./controllers', true, /\.js$/)))
```

# Example Middleware

```js
exports.get = ({ res }) => {
  // Export the methods you wish to handle (in this case a get request).
  res.body = 'hello world'
}

exports.post = ({ res }) => {
  // Handle other methods as well.
}
```

---

### Contributions

* Use `npm test` to run tests.

Please feel free to create a PR!
npm package: @rillrate/rillrate
Description: rillrate bindings for node.js
Latest version: 0.23.1

# rillrate-js

[![npm][npm-badge]][npm-url]

[npm-badge]: https://img.shields.io/npm/v/rillrate.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@rillrate/rillrate

Dynamic tracing system that tends to be real-time.

Node.js bindings.

## How to use

Add it as a dependency to your `node.js` project:

```sh
npm install --save @rillrate/rillrate
```

Import it in your code and install a tracer:

```js
rillrate = require('@rillrate/rillrate')
rillrate.install()
```

Add a metric and use methods to update it:

```js
gauge = new rillrate.Gauge('my.gauge', 0, 100)
gauge.set(55.0)

histogram = new rillrate.Histogram('my.histogram', [10, 20, 50, 100, 200, 500])
histogram.add(128.0)
```
npm package: @rily/components
Description: storybook component library for rily.co
Latest version: 1.0.70

# rily-components

<a href="https://www.chromatic.com/builds?appId=6142403e942d2b003a0308db" target="_blank"><img src="https://raw.githubusercontent.com/storybooks/brand/master/badge/badge-storybook.svg"></a>

To run the library locally: `yarn storybook`

To install the library in another project: `yarn add @rily/components`

After install, import components like this: `import { Button } from "@rily/components"`