feat: replace npm live-server with pure-Lua HTTP server (#29)

## Problem

The plugin requires users to install Node.js and the `live-server` npm
package globally. This is a heavyweight external dependency for what
amounts to a simple local dev-server workflow, and it creates friction
for users who don't otherwise need Node.js.

## Solution

Replace the npm shell-out with a pure-Lua HTTP server built on `vim.uv`
(libuv bindings), eliminating all external dependencies. The new server
supports static file serving, SSE-based live reload, CSS hot-swap
without full page reload, directory listings, and recursive file
watching with configurable debounce.

Minimum Neovim version is bumped to 0.10 for `vim.uv` and `vim.ui.open`.
The old `args`-based config is automatically migrated with a deprecation
warning.

Closes #28.
This commit is contained in:
Barrett Ruth 2026-03-02 23:16:35 -05:00 committed by GitHub
parent baeb211719
commit f42f958c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1097 additions and 298 deletions

View file

@ -1,14 +1,11 @@
if vim.fn.has('nvim-0.10') == 0 then
local marker = vim.fn.stdpath('data') .. '/live-server-version-notice'
if vim.fn.filereadable(marker) == 0 then
vim.notify(
'live-server.nvim v0.2.0 will require Neovim >= 0.10.\n'
.. 'To keep using this plugin, pin to the v0.1.6 tag:\n\n'
.. ' { "barrettruth/live-server.nvim", tag = "v0.1.6" }',
vim.log.levels.WARN
)
vim.fn.writefile({}, marker)
end
vim.api.nvim_echo({
{
'live-server.nvim requires Neovim >= 0.10. ' .. 'Pin to v0.1.6 or upgrade Neovim.',
'ErrorMsg',
},
}, true, {})
return
end
if vim.g.loaded_live_server then