0
# TailwindCSS Oxide Darwin ARM64
1
2
TailwindCSS Oxide Darwin ARM64 is the native binary component for macOS ARM64 (Apple Silicon) systems that provides high-performance CSS scanning and candidate extraction capabilities for TailwindCSS v4. This package contains the compiled Rust-based native binary that enables TailwindCSS to leverage native performance for file scanning, pattern matching, and CSS generation operations.
3
4
## Package Information
5
6
- **Package Name**: @tailwindcss/oxide-darwin-arm64
7
- **Package Type**: npm (native binary)
8
- **Language**: Rust (Node.js binding)
9
- **Platform**: darwin (macOS)
10
- **Architecture**: arm64 (Apple Silicon)
11
- **Installation**: Automatically installed as optional dependency of @tailwindcss/oxide when running on compatible macOS ARM64 systems
12
13
## Core Imports
14
15
This package contains only the native binary file (`tailwindcss-oxide.darwin-arm64.node`). The JavaScript API is provided by the main `@tailwindcss/oxide` package:
16
17
```javascript
18
// The native binary is automatically loaded by the main package
19
const { Scanner } = require("@tailwindcss/oxide");
20
```
21
22
For ESM:
23
24
```javascript
25
import { Scanner } from "@tailwindcss/oxide";
26
```
27
28
## Basic Usage
29
30
```javascript
31
import { Scanner } from "@tailwindcss/oxide";
32
33
// Initialize scanner with source patterns
34
const scanner = new Scanner({
35
sources: [
36
{
37
base: "./src",
38
pattern: "**/*.{js,jsx,ts,tsx,html}",
39
negated: false
40
}
41
]
42
});
43
44
// Scan for CSS candidates from configured sources
45
const candidates = scanner.scan();
46
console.log("Found candidates:", candidates);
47
48
// Scan specific content
49
const contentCandidates = scanner.scan_files([
50
{
51
file: null,
52
content: '<div class="bg-blue-500 text-white p-4">Hello</div>',
53
extension: "html"
54
}
55
]);
56
```
57
58
## Architecture
59
60
The native binary provides a high-performance Rust implementation that:
61
62
- **File System Operations**: Fast recursive directory scanning and file reading
63
- **Pattern Matching**: Efficient regex-based candidate extraction from file contents
64
- **Memory Management**: Optimized memory usage for large codebases
65
- **Platform Integration**: Seamless Node.js integration via napi-rs bindings
66
- **UTF-16 Handling**: Proper position mapping for JavaScript string compatibility
67
68
## Capabilities
69
70
### Scanner Class
71
72
Core scanner class for extracting TailwindCSS candidates from files and content.
73
74
```typescript { .api }
75
class Scanner {
76
constructor(opts: ScannerOptions);
77
scan(): string[];
78
scan_files(input: ChangedContent[]): string[];
79
get_candidates_with_positions(input: ChangedContent): CandidateWithPosition[];
80
readonly files: string[];
81
readonly globs: GlobEntry[];
82
readonly normalized_sources: GlobEntry[];
83
}
84
```
85
86
**Usage Example:**
87
88
```javascript
89
const scanner = new Scanner({
90
sources: [
91
{ base: "./src", pattern: "**/*.jsx", negated: false },
92
{ base: "./pages", pattern: "**/*.tsx", negated: false }
93
]
94
});
95
96
// Get all candidates from configured sources
97
const allCandidates = scanner.scan();
98
99
// Get tracked files
100
const trackedFiles = scanner.files;
101
102
// Get normalized glob patterns
103
const patterns = scanner.globs;
104
```
105
106
### Content Scanning
107
108
Scan specific content or files for TailwindCSS candidates.
109
110
```typescript { .api }
111
/**
112
* Scan multiple files or content strings for CSS candidates
113
* @param input - Array of content items to scan
114
* @returns Array of found CSS class candidates
115
*/
116
scan_files(input: ChangedContent[]): string[];
117
118
/**
119
* Get candidates with their positions in the content
120
* @param input - Single content item to analyze
121
* @returns Array of candidates with position information
122
*/
123
get_candidates_with_positions(input: ChangedContent): CandidateWithPosition[];
124
```
125
126
**Usage Example:**
127
128
```javascript
129
// Scan specific content
130
const htmlContent = {
131
file: null,
132
content: '<div class="flex items-center justify-between p-4 bg-gray-100">Content</div>',
133
extension: "html"
134
};
135
136
const candidates = scanner.scan_files([htmlContent]);
137
// Result: ["flex", "items-center", "justify-between", "p-4", "bg-gray-100"]
138
139
// Get candidates with positions
140
const candidatesWithPos = scanner.get_candidates_with_positions(htmlContent);
141
// Result: [
142
// { candidate: "flex", position: 12n },
143
// { candidate: "items-center", position: 17n },
144
// ...
145
// ]
146
```
147
148
### File System Scanning
149
150
Scan configured source patterns for candidates.
151
152
```typescript { .api }
153
/**
154
* Scan all configured sources for CSS candidates
155
* @returns Array of unique CSS class candidates found
156
*/
157
scan(): string[];
158
159
/**
160
* Get list of files being tracked by the scanner
161
* @returns Array of file paths
162
*/
163
readonly files: string[];
164
165
/**
166
* Get glob patterns being used for scanning
167
* @returns Array of glob entries with base and pattern
168
*/
169
readonly globs: GlobEntry[];
170
171
/**
172
* Get normalized source patterns
173
* @returns Array of normalized glob entries
174
*/
175
readonly normalized_sources: GlobEntry[];
176
```
177
178
## Types
179
180
```typescript { .api }
181
interface ScannerOptions {
182
sources?: SourceEntry[];
183
}
184
185
interface SourceEntry {
186
/** Base directory path for the glob pattern */
187
base: string;
188
/** Glob pattern to match files */
189
pattern: string;
190
/** Whether this is a negated pattern (exclude matching files) */
191
negated: boolean;
192
}
193
194
interface ChangedContent {
195
/** File path (when scanning files) - required for file scanning, optional for content scanning */
196
file?: string | null;
197
/** Content string (when scanning content directly) - required for content scanning, optional for file scanning */
198
content?: string | null;
199
/** File extension to determine parsing mode */
200
extension: string;
201
}
202
203
interface GlobEntry {
204
/** Base directory path */
205
base: string;
206
/** Glob pattern */
207
pattern: string;
208
}
209
210
interface CandidateWithPosition {
211
/** The CSS class candidate */
212
candidate: string;
213
/** UTF-16 position in the content (64-bit integer) */
214
position: bigint;
215
}
216
```
217
218
## Platform Integration
219
220
This package provides the native binary implementation specifically for:
221
222
- **Operating System**: macOS (darwin)
223
- **Architecture**: ARM64 (Apple Silicon - M1, M2, M3+ chips)
224
- **Node.js Version**: >= 10
225
- **Integration**: Automatic fallback when main package detects compatible platform
226
227
The binary (`tailwindcss-oxide.darwin-arm64.node`) is automatically selected by the main `@tailwindcss/oxide` package when running on compatible macOS ARM64 systems, providing significant performance improvements over WASM or other fallback implementations for:
228
229
- Large codebase scanning
230
- Pattern matching operations
231
- File system traversal
232
- Memory-intensive CSS candidate extraction
233
234
When this package is unavailable, the main package falls back to other platform binaries or WASM implementation as appropriate.