A modern, high-performance companion watch server for the A-Frame Inspector, built with Bun.
This project is a modernization of the original aframe-watcher, designed for better performance, easier integration, and single-binary distribution.
- Blazing Fast: Built on the Bun runtime for minimal overhead.
- Single Binary: Can be compiled into a standalone executable.
- Easy Integration: Use it as a CLI tool or a library in your Bun project.
- Configurable: Support for custom ports, file patterns, and more.
bun install @cmcrobotics/aframe-watcher-bunRun the watcher in your project directory:
bunx @cmcrobotics/aframe-watcher-bunOr with custom options:
bunx @cmcrobotics/aframe-watcher-bun --port=3000 src/**/*.htmlOr install it globally:
bun install -g @cmcrobotics/aframe-watcher-bun
aframe-watcher-bun --port=51234Integrate the watcher into your existing Bun server:
import { createServer } from "@cmcrobotics/aframe-watcher-bun";
const server = createServer({
port: 51234,
filePatterns: ["tests/**/*.html"]
});
console.log(`Watcher listening on ${server.url}`);The A-Frame Inspector (running in your browser) sends component changes via POST requests to this server. aframe-watcher-bun then:
- Receives the JSON payload of changes.
- Scans your local HTML files for entities with matching
ids. - Intelligently updates the raw HTML content with the new attribute values.
- Saves the changes back to disk.
To create a self-contained binary:
bun build src/cli.ts --compile --outfile aframe-watcherbun testTo run the provided example project:
bun run examples/server.tsThen visit http://localhost:3000 to see the A-Frame scene and test the inspector.
For more details on the example project and building it as a standalone executable, see the Examples README.
This project vendors a pre-built version of the A-Frame Inspector in vendor/aframe-inspector.min.js. This ensures that the watcher can be distributed and committed without external dependencies.
To update the vendored inspector from a local checkout of the aframe-inspector repository:
- Ensure
aframe-inspectoris checked out as a sibling directory to this project (../aframe-inspector). - Run the update script:
This will install dependencies in the inspector project, build it, and copy the resulting
bun run build:inspector
aframe-inspector.min.jsinto thevendor/directory.
Alternatively, if you already have a built inspector and just want to re-copy it:
bun run vendor:inspectorThis project is a modernized version of:
- aframe-watcher by Supermedium.
- aframe-inspector by A-Frame authors.
License: MIT