live-server.nvim/lua/live-server/health.lua
Barrett Ruth f42f958c24
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.
2026-03-02 23:16:35 -05:00

42 lines
1 KiB
Lua

local M = {}
function M.check()
vim.health.start('live-server.nvim')
if vim.fn.has('nvim-0.10') == 1 then
vim.health.ok('Neovim >= 0.10')
else
vim.health.error(
'Neovim >= 0.10 is required',
{ 'Upgrade Neovim or pin live-server.nvim to v0.1.6' }
)
end
if vim.uv then
vim.health.ok('vim.uv is available')
else
vim.health.error('vim.uv is not available', { 'Neovim >= 0.10 provides vim.uv' })
end
local user_config = vim.g.live_server or {}
if user_config.args then
vim.health.warn(
'deprecated `args` config detected',
{ 'See `:h live-server-config` for the new format' }
)
else
vim.health.ok('no deprecated config detected')
end
if jit.os == 'Linux' then
vim.health.warn('recursive file watching is not supported on Linux', {
'Only files in the root directory will trigger reload. See `:h live-server-linux-recursive`',
})
end
if vim.fn.executable('live-server') == 1 then
vim.health.info('npm `live-server` is installed but no longer required')
end
end
return M