On this page
Overview
Parses terminal ANSI sequences into display spans or strips them to plain text.
- Artifact
AnsiText.js· esm - Classification
public first party - Availability
Cross-host - Normalization
Normalized text/span output.
Import and lifecycle
import * as module from '/arcane/modules/AnsiText.js';
Pure ANSI parsing and stripping with no terminal I/O.
Application-facing behavior: parseAnsi(), stripAnsi().
Protocol and host implementation
In-process only This detail does not widen the application-facing API or grant authority.
Exports, signatures, parameters, and results
| Binding | Form | Declaration or signature | Parameter syntax |
|---|---|---|---|
parseAnsi | function | function parseAnsi(input='') | input='' |
stripAnsi | function | function stripAnsi(input='') | input='' |
| Callable | Kind | Exact public signature | Parameter syntax |
|---|---|---|---|
parseAnsi | exported-function | function parseAnsi(input='') | input='' |
stripAnsi | exported-function | function stripAnsi(input='') | input='' |
Parameter meanings and results
parseAnsi(input) returns a frozen token array of {text, style}; stripAnsi(input) returns plain text and supports standard SGR styling plus indexed colors.
Events, side effects, and errors
Source-literal CustomEvent dispatches
No source-literal CustomEvent dispatch is part of this artifact.
Lifecycle and event flow
This artifact has no additional documented lifecycle event flow.
Direct coded failures
This artifact directly assigns no stable coded failure.
Exported Error subclasses
This artifact exports no Error subclass.
Documented failure behavior
No additional module-specific rejection behavior is documented.
Availability and capabilities
Cross-host. Normalized text/span output.
Normalizes terminal display text; it does not invoke the Core shell.
Contract example
import {parseAnsi, stripAnsi} from '/arcane/modules/AnsiText.js';
const input='\u001b[31mError\u001b[0m';
console.log(parseAnsi(input),stripAnsi(input));
Related reference
No direct Core call is claimed for this artifact. Any injected provider or consuming module retains its own documented authority.