or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

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

0

# @rollup/rollup-linux-x64-gnu

1

2

@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.

3

4

## Package Information

5

6

- **Package Name**: @rollup/rollup-linux-x64-gnu

7

- **Package Type**: npm

8

- **Language**: Native (Rust-compiled binary)

9

- **Installation**: Automatically installed as optional dependency with rollup

10

- **Platform**: Linux x86_64 (glibc only)

11

12

## Core Imports

13

14

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

15

16

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

17

18

```javascript

19

// Automatic loading - no direct import needed

20

const rollup = require('rollup');

21

// or

22

import * as rollup from 'rollup';

23

```

24

25

For direct access to native functions (advanced usage):

26

27

```javascript

28

const native = require('@rollup/rollup-linux-x64-gnu');

29

// Note: This will only work if the package is manually installed

30

// and the native binary is available

31

```

32

33

## Basic Usage

34

35

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:

36

37

```javascript

38

import { rollup } from 'rollup';

39

40

// The native parsing functions are used automatically

41

const bundle = await rollup({

42

input: 'src/main.js',

43

plugins: []

44

});

45

46

const { output } = await bundle.generate({

47

format: 'esm'

48

});

49

```

50

51

## Architecture

52

53

This package integrates with Rollup's native loading architecture:

54

55

- **Platform Detection**: Automatically selected based on `process.platform`, `process.arch`, and glibc detection

56

- **Fallback Mechanism**: If unavailable, Rollup falls back to JavaScript/WASM implementations

57

- **Performance Layer**: Provides native implementations of CPU-intensive operations

58

- **Binary Format**: Single native Node.js addon file (`rollup.linux-x64-gnu.node`)

59

60

## Capabilities

61

62

### Code Parsing

63

64

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

65

66

```typescript { .api }

67

/**

68

* Synchronously parses JavaScript/TypeScript code into AST format

69

* @param code - Source code string to parse

70

* @param allowReturnOutsideFunction - Allow return statements outside functions

71

* @param jsx - Enable JSX parsing support

72

* @returns Buffer containing parsed AST data

73

*/

74

function parse(code: string, allowReturnOutsideFunction: boolean, jsx: boolean): Buffer;

75

76

/**

77

* Asynchronously parses JavaScript/TypeScript code into AST format

78

* @param code - Source code string to parse

79

* @param allowReturnOutsideFunction - Allow return statements outside functions

80

* @param jsx - Enable JSX parsing support

81

* @param signal - Optional AbortSignal for cancellation

82

* @returns Promise resolving to Buffer containing parsed AST data

83

*/

84

function parseAsync(

85

code: string,

86

allowReturnOutsideFunction: boolean,

87

jsx: boolean,

88

signal?: AbortSignal | undefined | null

89

): Promise<Buffer>;

90

```

91

92

**Usage Example:**

93

94

```javascript

95

// Direct usage (advanced - not typical)

96

const { parse } = require('@rollup/rollup-linux-x64-gnu');

97

98

const sourceCode = `

99

import { foo } from './foo.js';

100

export default foo();

101

`;

102

103

const astBuffer = parse(sourceCode, false, false);

104

// astBuffer contains the parsed AST data

105

```

106

107

### Hash Functions

108

109

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

110

111

```typescript { .api }

112

/**

113

* Computes xxHash of input data and returns base16 encoded result

114

* @param input - Input data as Uint8Array

115

* @returns Base16 (hexadecimal) encoded hash string

116

*/

117

function xxhashBase16(input: Uint8Array): string;

118

119

/**

120

* Computes xxHash of input data and returns base36 encoded result

121

* @param input - Input data as Uint8Array

122

* @returns Base36 encoded hash string

123

*/

124

function xxhashBase36(input: Uint8Array): string;

125

126

/**

127

* Computes xxHash of input data and returns base64url encoded result

128

* @param input - Input data as Uint8Array

129

* @returns Base64url encoded hash string

130

*/

131

function xxhashBase64Url(input: Uint8Array): string;

132

```

133

134

**Usage Examples:**

135

136

```javascript

137

// Direct usage (advanced - not typical)

138

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

139

140

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

141

142

const hex = xxhashBase16(data); // "a8b4b9174b5076cb"

143

const base36 = xxhashBase36(data); // "9x4x7g3tbsl5mb"

144

const base64 = xxhashBase64Url(data); // "qLS5F0tQdss"

145

```

146

147

## Platform Requirements

148

149

```json { .api }

150

{

151

"os": ["linux"],

152

"cpu": ["x64"],

153

"libc": ["glibc"]

154

}

155

```

156

157

### System Compatibility

158

159

- **Operating System**: Linux only

160

- **Architecture**: x86_64 (64-bit Intel/AMD)

161

- **C Library**: glibc (GNU C Library) - **not compatible with musl**

162

- **Node.js**: >= 18.0.0

163

164

### Installation Behavior

165

166

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.

167

168

## Error Handling

169

170

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

171

172

- **Missing Visual C++ Redistributable** (Windows): Provides download link for required runtime

173

- **Platform Incompatibility**: Suggests using `@rollup/wasm-node` as alternative

174

- **Installation Issues**: Recommends removing `package-lock.json` and `node_modules` to resolve npm dependency bugs

175

176

## Integration Points

177

178

- **Loaded by**: Main rollup package via `native.js` loader

179

- **Detection**: Automatic platform/architecture detection

180

- **Fallback**: WASM/JavaScript implementations when unavailable

181

- **Performance**: Significant speed improvements for large codebases

182

- **Transparency**: No API changes required - works with existing rollup code