Implementation:20000419 Fauxnix supportsNode
| Knowledge Sources | |
|---|---|
| Domains | Runtime_Support, Versioning |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
Concrete version-gate function that checks whether a given Node version satisfies the package's single inclusive stable-version engine floor.
Description
The supportsNode function (src/runtime-support.ts) parses the engines.node range from package.json (or a bundled SEA banner global) — which fauxnix keeps as a single >=x.y.z floor — and compares a given version string against it. It returns true only when the version meets or exceeds the floor. nodeEngineRange is the raw range string, exported for diagnostics (fauxnix doctor). The entry point (src/index.ts) uses this to guard the process before dispatching to runCli.
Usage
Called by collectDoctorReport → mcpLines to report the Node status, and by src/index.ts to fail fast on an unsupported Node version.
Code Reference
Source Location
- Repository: fauxnix
- File: src/runtime-support.ts
- Lines: L1-28; nodeEngineRange L7-13; supportsNode L19-28
Signature
export let nodeEngineRange: string;
export function supportsNode(version: string): boolean;
Import
import { supportsNode, nodeEngineRange } from './runtime-support.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| version | string | Yes | Node version string (e.g. process.version → "v22.20.0") |
Outputs
| Name | Type | Description |
|---|---|---|
| (return) | boolean | true when the version meets the >=x.y.z floor |
Usage Examples
Entry-Point Guard
import { supportsNode } from './runtime-support.js';
if (!supportsNode(process.version)) {
console.error('fauxnix: requires Node ' + nodeEngineRange);
process.exit(1);
}
await runCli(process.argv.slice(2));
Doctor Report
const nodeOk = supportsNode(nodeVersion);
// included in the doctor report line: "node : v22.20.0 (>=22.20.0 required)"