npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

laroux

v4.1.55

Published

Core runtime and utilities for [laroux.js](https://github.com/eser/stack) - A React Server Components framework for Deno.

Readme

@eser/laroux-core

Core runtime and utilities for laroux.js - A React Server Components framework for Deno.

Overview

This package contains the core runtime logic and utilities for laroux.js, including:

  • HTTP Server - Request handling, routing, and static file serving
  • RSC Handler - React Server Components rendering and streaming
  • Server Actions - Server-side function invocation from client components
  • HTML Shell - Initial HTML document generation
  • Configuration System - Type-safe config loading with 3-layer merging
  • Error Formatting - Beautiful error messages with hints and stack traces
  • CLI Formatting - Colored output, banners, spinners, and progress indicators

Installation

deno add @eser/laroux-core

Usage

This package is typically used by the eser laroux CLI commands (from @eser/cli), but can also be used directly for custom server implementations:

import { startServer } from "@eser/laroux-core/runtime/server";
import { RuntimeBundler } from "@eser/laroux-bundler";

const server = await startServer({
  config: {
    port: 8000,
    srcDir: "./src",
    distDir: "./dist",
    // ... other config
  },
  bundler: new RuntimeBundler({ srcDir: "./src" }),
});

API Reference

Runtime Modules

runtime/server.ts

HTTP server with routing and static file serving.

import { startServer } from "@eser/laroux-core/runtime/server";

const server = await startServer({
  config: AppConfig,
  bundler: RuntimeBundler,
});

@eser/laroux-react/runtime/rsc-handler

React Server Components rendering and streaming.

import { handleRSC } from "@eser/laroux-react/runtime/rsc-handler";

const response = await handleRSC(request, {
  config: AppConfig,
  bundler: RuntimeBundler,
});

runtime/action-handler.ts

Server Actions registry and invocation.

import {
  handleServerAction,
  registerServerAction,
} from "@eser/laroux-core/runtime/action-handler";

// Register a server action
registerServerAction("myAction", async (data) => {
  // Server-side logic
  return { success: true };
});

// Handle action request
const response = await handleServerAction(request, config);

runtime/html-shell.ts

HTML shell generation for initial page load.

import { generateHtmlShell } from "@eser/laroux-core/runtime/html-shell";

const html = generateHtmlShell({
  config: AppConfig,
  rscPayload: "...",
  moduleMap: { ... },
});

Configuration System

Type-safe configuration loading with 3-layer merging (defaults → user config → CLI args).

import { loadConfig } from "@eser/laroux-core/config";
import type { UserConfig } from "@eser/laroux-core/config/schema";

// Load configuration
const config = await loadConfig({
  configPath: "./laroux.config.ts",
  cliOptions: {
    port: 3000,
    logLevel: "info",
  },
});

Configuration Schema:

interface UserConfig {
  port?: number;
  srcDir?: string;
  distDir?: string;
  publicDir?: string;
  logLevel?: "trace" | "debug" | "info" | "warn" | "error";
  enableHMR?: boolean;
  // ... see config/schema.ts for full schema
}

Example laroux.config.ts:

import type { UserConfig } from "@eser/laroux-core/config/schema";

export default {
  port: 3000,
  srcDir: "./src",
  distDir: "./dist",
  publicDir: "./public",
  logLevel: "info",
  enableHMR: true,
} satisfies UserConfig;

CLI Formatting

Beautiful colored terminal output with progress indicators.

import {
  c,
  printBanner,
  printServerInfo,
  printSuccess,
  Spinner,
} from "@eser/laroux-core/cli-formatting";

// Print banner
printBanner("3.0.0");

// Colored output
console.log(c.success("Build completed!"));
console.log(c.error("Build failed!"));
console.log(c.brand("laroux.js"));

// Progress spinner
const spinner = new Spinner("Building...");
spinner.start();
// ... do work
spinner.succeed("Build complete!");

// Utility functions
printServerInfo(config);
printSuccess("Server started!");

Color Utilities:

c.brand(text); // Cyan
c.success(text); // Green
c.error(text); // Red
c.warning(text); // Yellow
c.info(text); // Blue
c.dim(text); // Gray
c.bold(text); // Bold
c.code(text); // Code block
c.path(text); // File path

Error Formatting

Structured error classes with helpful hints and beautiful formatting.

import {
  BuildError,
  ConfigError,
  errors,
  formatError,
  LarouxError,
  RuntimeError,
  setupErrorHandlers,
} from "@eser/laroux-core/error-formatting";

// Setup global error handlers (for CLI)
setupErrorHandlers();

// Use error factories
throw errors.invalidConfig(
  "./laroux.config.ts",
  "Export must be a default export",
);

throw errors.portInUse(3000);

throw errors.buildFailed("TypeScript compilation failed");

// Custom errors
throw new ConfigError(
  "Invalid port number",
  "Port must be between 1024 and 65535",
);

// Format errors for display
const formatted = formatError(error);
console.error(formatted);

Available Error Factories:

  • errors.invalidConfig(path, reason) - Config file issues
  • errors.missingDirectory(dir, purpose) - Required directory missing
  • errors.portInUse(port) - Port already in use
  • errors.moduleNotFound(path) - Module import failed
  • errors.buildFailed(reason) - Build process failed
  • errors.actionFailed(actionId, reason) - Server action error
  • errors.componentError(name, reason) - Component render error

Related Packages

Documentation

License

Apache-2.0 © Eser Ozvataf