or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

tessl/npm-rollup--rollup-linux-x64-gnu

Native bindings for Rollup specifically compiled for x86_64 Linux systems with glibc

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@rollup/rollup-linux-x64-gnu@4.50.x

To install, run

npx @tessl/cli install tessl/npm-rollup--rollup-linux-x64-gnu@4.50.0

index.mddocs/

@rollup/rollup-linux-x64-gnu

@rollup/rollup-linux-x64-gnu is a platform-specific native binary addon package for Rollup, providing high-performance native implementations of core bundling operations specifically compiled for x86_64 Linux systems with glibc. This package enhances Rollup's performance by providing native implementations of performance-critical parsing and hashing functionality implemented in Rust.

Package Information

  • Package Name: @rollup/rollup-linux-x64-gnu
  • Package Type: npm
  • Language: Native (Rust-compiled binary)
  • Installation: Automatically installed as optional dependency with rollup
  • Platform: Linux x86_64 (glibc only)

Core Imports

This package cannot be imported directly. It is automatically loaded by the main rollup package when available on compatible systems.

The native functionality is accessed through rollup's native loader:

// Automatic loading - no direct import needed
const rollup = require('rollup');
// or
import * as rollup from 'rollup';

For direct access to native functions (advanced usage):

const native = require('@rollup/rollup-linux-x64-gnu');
// Note: This will only work if the package is manually installed
// and the native binary is available

Basic Usage

This package is designed to work transparently with rollup. When rollup is installed on a compatible Linux x86_64 system, this package is automatically selected and used for enhanced performance:

import { rollup } from 'rollup';

// The native parsing functions are used automatically
const bundle = await rollup({
  input: 'src/main.js',
  plugins: []
});

const { output } = await bundle.generate({
  format: 'esm'
});

Architecture

This package integrates with Rollup's native loading architecture:

  • Platform Detection: Automatically selected based on process.platform, process.arch, and glibc detection
  • Fallback Mechanism: If unavailable, Rollup falls back to JavaScript/WASM implementations
  • Performance Layer: Provides native implementations of CPU-intensive operations
  • Binary Format: Single native Node.js addon file (rollup.linux-x64-gnu.node)

Capabilities

Code Parsing

High-performance parsing of JavaScript/TypeScript source code into Abstract Syntax Tree (AST) format.

/**
 * Synchronously parses JavaScript/TypeScript code into AST format
 * @param code - Source code string to parse
 * @param allowReturnOutsideFunction - Allow return statements outside functions
 * @param jsx - Enable JSX parsing support
 * @returns Buffer containing parsed AST data
 */
function parse(code: string, allowReturnOutsideFunction: boolean, jsx: boolean): Buffer;

/**
 * Asynchronously parses JavaScript/TypeScript code into AST format
 * @param code - Source code string to parse  
 * @param allowReturnOutsideFunction - Allow return statements outside functions
 * @param jsx - Enable JSX parsing support
 * @param signal - Optional AbortSignal for cancellation
 * @returns Promise resolving to Buffer containing parsed AST data
 */
function parseAsync(
  code: string, 
  allowReturnOutsideFunction: boolean, 
  jsx: boolean, 
  signal?: AbortSignal | undefined | null
): Promise<Buffer>;

Usage Example:

// Direct usage (advanced - not typical)
const { parse } = require('@rollup/rollup-linux-x64-gnu');

const sourceCode = `
  import { foo } from './foo.js';
  export default foo();
`;

const astBuffer = parse(sourceCode, false, false);
// astBuffer contains the parsed AST data

Hash Functions

High-performance hashing functions using xxHash algorithm with different encoding formats.

/**
 * Computes xxHash of input data and returns base16 encoded result
 * @param input - Input data as Uint8Array
 * @returns Base16 (hexadecimal) encoded hash string
 */
function xxhashBase16(input: Uint8Array): string;

/**
 * Computes xxHash of input data and returns base36 encoded result  
 * @param input - Input data as Uint8Array
 * @returns Base36 encoded hash string
 */
function xxhashBase36(input: Uint8Array): string;

/**
 * Computes xxHash of input data and returns base64url encoded result
 * @param input - Input data as Uint8Array
 * @returns Base64url encoded hash string
 */
function xxhashBase64Url(input: Uint8Array): string;

Usage Examples:

// Direct usage (advanced - not typical)
const { xxhashBase16, xxhashBase36, xxhashBase64Url } = require('@rollup/rollup-linux-x64-gnu');

const data = new TextEncoder().encode('Hello, world!');

const hex = xxhashBase16(data);      // "a8b4b9174b5076cb"
const base36 = xxhashBase36(data);   // "9x4x7g3tbsl5mb"
const base64 = xxhashBase64Url(data); // "qLS5F0tQdss"

Platform Requirements

{
  "os": ["linux"],
  "cpu": ["x64"],
  "libc": ["glibc"]
}

System Compatibility

  • Operating System: Linux only
  • Architecture: x86_64 (64-bit Intel/AMD)
  • C Library: glibc (GNU C Library) - not compatible with musl
  • Node.js: >= 18.0.0

Installation Behavior

This package is installed automatically as an optional dependency when installing rollup on compatible systems. If the system is incompatible or the package fails to install, rollup will automatically fall back to JavaScript/WASM implementations without affecting functionality.

Error Handling

When the native module cannot be loaded, rollup's native loader provides detailed error messages:

  • Missing Visual C++ Redistributable (Windows): Provides download link for required runtime
  • Platform Incompatibility: Suggests using @rollup/wasm-node as alternative
  • Installation Issues: Recommends removing package-lock.json and node_modules to resolve npm dependency bugs

Integration Points

  • Loaded by: Main rollup package via native.js loader
  • Detection: Automatic platform/architecture detection
  • Fallback: WASM/JavaScript implementations when unavailable
  • Performance: Significant speed improvements for large codebases
  • Transparency: No API changes required - works with existing rollup code