2.1 KiB
Architecture
Regex Tools is a static browser application with framework-neutral regex boundaries.
React workbench
├─ Pattern SyntaxSupervisor → syntax.worker → Regexpp provider → normalized AST
├─ Replacement SyntaxSupervisor → syntax.worker → typed replacement tokens
├─ EngineSupervisor → ecmascript.worker → native RegExp → match DTOs
├─ Test SyntaxSupervisor + EngineSupervisor → isolated cancellable test runs
└─ project validator / serializer / IndexedDB persistence
Provider AST objects never cross the worker boundary. The syntax worker emits application-owned nodes, tokens, diagnostics, capture definitions and explicit provenance. React never imports or traverses regexpp's cyclic AST.
Every engine request carries a protocol version, monotonically increasing request ID and worker generation. A supervisor allows one active request, rejects stale responses, terminates on timeout/crash/cancel, and lazily creates a new generation. Timeout is a distinct error state.
Pattern and replacement syntax use independent supervisors. A pattern snapshot is bound to its exact pattern, ordered flags and revision; execution cannot use acceptance or capture metadata from an earlier input. Replacement output is built while the native engine produces the same bounded authoritative match sequence that is returned to the UI.
Per-match replacement ranges and token contributions are deterministic mappings over those actual matches, the complete replacement-token model and the bounded output. They execute no replacement callback or user code and have separate presentation and token-evaluation limits.
Native ranges are retained in the engine's declared unit. Browser editor ranges are half-open UTF-16 code-unit ranges. Reusable converters cover UTF-8 byte and Unicode code-point offsets for later flavours, including invalid-boundary rejection and lone-surrogate detection.
The release boundary is dist/ plus checked-in legal/source documents. The
Portal consumes the resulting immutable ZIP and never imports React source.