Releases: okikio/undent
Releases · okikio/undent
undent@0.2.1
Changes
Fixed
- Regex cache now has a bounded size, preventing unbounded memory growth in
long-running processes that process many distinct strings.
Docs
- Corrected output comments in README examples for
undent,align(), and
trim modes — several expected outputs were wrong or incomplete. - Added before/after examples for core indent stripping and trim modes to make
the behavior immediately clear without reading prose.
Details
undent@0.2.0
Changes
Added
- Package is now published to npm as
@okikio/undent. Node.js and Bun users can install directly withnpm install @okikio/undentin addition to the existingnpx jsr add @okikio/undentpath. The package ships both CJS (require) and ESM (import) builds with full TypeScript declarations.
Changed
- Memory regression tests now use a two-phase growth-rate check instead of a single before/after snapshot, catching leaks that one-time initialization overhead (JIT compilation, WeakMap warming) would previously mask.
Details
undent@0.1.1
undent@0.1.0
Initial release
- Tagged template dedenting — use
undentas a template tag to strip source-code indentation from multi-line template literals. Interpolated values pass through untouched. - Plain string dedenting —
.string()method and standalonededentString()for strings without template structure (SQL files, config snippets, runtime-built text). - Multi-line value alignment —
align()pads subsequent lines of an interpolated value to match the insertion column.embed()strips a value's own indentation first, then aligns. - Configurable trimming — strip all leading/trailing blank lines (default), strip one, keep everything, or control each side independently.
- Two indent strategies —
"common"(minimum indent across all lines) and"first"(first content line sets the reference). Pre-builtoutdentexport for first-line behavior. - Instance composition —
.with(options)derives new instances without mutation.createUndent(options)builds from scratch. - Newline preservation —
\n,\r\n, and\rsequences pass through byte-for-byte. Optionalnewlinesetting normalizes segment newlines. - Indent anchors —
${undent.indent}sets an explicit zero-indent reference for deeply nested templates. - Utility exports —
splitLines,rejoinLines,columnOffset,newlineLengthAt,alignText,resolveOptions, andDEFAULTSfor building custom pipelines. - Caching — per-call-site segment cache for zero-cost repeated calls. Bounded caches for
embed()and alignment memoization.