Registry / http-networking / mini-lr

mini-lr

JSON →
library0.1.9jsnpmunverified

mini-lr is a JavaScript package that provides a lightweight LiveReload server implementation. It was originally forked from the `tiny-lr` project to address perceived inactivity and provide support for `npm v3` during a period when `tiny-lr` was not being actively maintained. The package exposes an HTTP server and can be used as Express/Connect middleware, offering a basic REST API to notify the server of file changes, which are then broadcast to connected LiveReload clients. It does not include file watching capabilities itself, requiring external build processes or application logic to trigger change notifications. The current stable version is 0.1.9, though the project is explicitly deprecated, with its author recommending users switch back to the now-active `tiny-lr` package. Therefore, there is no active release cadence planned for `mini-lr`.

npm install mini-lr
INSTALL
IMPORT
SIG · MINI-LR
M
mini-lr
http-networkingjavascriptv0.1.9
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

minilr
const minilr = require('mini-lr');
import minilr from 'mini-lr';
Primarily designed for CommonJS; direct ESM import might require a wrapper or bundler due to its older architecture.
Server
const { Server } = require('mini-lr');
const Server = require('mini-lr').Server;
The `minilr()` function is a factory for `new minilr.Server()`. Accessing `Server` directly allows more explicit instantiation.
middleware
const minilr = require('mini-lr'); const lrMiddleware = minilr.middleware;
import { middleware } from 'mini-lr';
The middleware function is a property of the main `minilr` export, not a top-level named export. Use CommonJS `require`.

Demonstrates setting up a mini-lr server as Express middleware, serving static files and listening for LiveReload notifications.

const path = require('path'); const express = require('express'); const minilr = require('mini-lr'); const body = require('body-parser'); const port = process.env.LR_PORT || process.env.PORT || 35729; const app = express(); app .use(body.urlencoded({ extended: true })) .use(body.json()) .use(minilr.middleware({ app: app })) .use(express.static(path.resolve('./'))) .listen(port, function() { console.log(`LiveReload server listening on port ${port}`); console.log('To trigger a reload, run: curl http://localhost:35729/changed?files=index.html'); });
Debug
Known issues
deprecatedThe `mini-lr` package is officially deprecated by its author. Users are strongly advised to migrate back to the `tiny-lr` package, which is now actively maintained and has added contributors. Continued use of `mini-lr` is not recommended for new projects or ongoing development.
fix
Replace `mini-lr` with `tiny-lr` in your project's dependencies and update `require` statements accordingly. Refer to the `tiny-lr` documentation for correct usage.
affects: >=0.1.0
breakingWhen `mini-lr` was originally forked, it was to provide `npm v3` support and address `tiny-lr`'s inactivity. While `mini-lr` itself aimed for compatibility, switching between `tiny-lr` versions or forks might have required manual updates to dependencies or `require` paths, especially if projects were locked into older `tiny-lr` versions.
fix
Ensure `mini-lr` is at least `0.1.7` for `npm v3` compatibility. For current projects, the recommended fix is to migrate to the latest `tiny-lr`.
affects: <0.1.7
gotchaA debug module vulnerability was patched in version `0.1.9`. While this was a patch version to address a security concern in an internal dependency, it underscores the importance of staying updated or migrating to the recommended, actively maintained `tiny-lr`.
fix
Upgrade to `mini-lr@0.1.9` if you absolutely must continue using this deprecated package, or preferably, migrate to `tiny-lr`.
affects: <0.1.9
gotchaThe LiveReload browser extension typically expects the server to run on port `35729`. Using a different port will prevent the browser extension from connecting automatically. If you choose a custom port, you must manually include the LiveReload script tag in your HTML and specify the custom port.
fix
Always run `mini-lr` on port `35729` if relying on the browser extension. If a different port is required, add `<script src="http://localhost:YOUR_PORT/livereload.js?snipver=1"></script>` to your HTML.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'mini-lr'
The package is not installed or the `require` path is incorrect.
fix
Run `npm install mini-lr` or `yarn add mini-lr` to install the package. Ensure your `require('mini-lr')` statement is correct.
TypeError: app.use is not a function
`mini-lr.middleware` expects an Express/Connect `app` instance with `use` method when used with the `{ app: app }` option.
fix
Ensure you are passing a valid Express or Connect application instance to the `middleware` function, as shown in the integration examples: `minilr.middleware({ app: app })`.
Error: body-parser deprecated undefined extended: provide extended option node_modules/mini-lr/index.js:77:21
`mini-lr`'s middleware integration relies on `body-parser`. Old versions of `body-parser` or incorrect usage might trigger deprecation warnings.
fix
Ensure `body-parser` is correctly configured before `mini-lr.middleware`. For Express, use `app.use(body.urlencoded({ extended: true }))` and `app.use(body.json())` with the `extended` option explicitly set to `true` or `false` (recommended `true` for general use, or `false` for simple key-value pairs).
Upgrade
Version history
0.1.9latest on npm
Audit
Dependencies
body-parserrequiredRequired for the `mini-lr` middleware to parse POST request bodies, especially for bulk file change notifications.
debugrequiredInternal dependency, patched in 0.1.9 for a vulnerability fix.
Agent activity
2 hits · last 30 days
node
2
Resources