Install @stackline/update-section
npm install @stackline/[email protected]Package version: 1.0.4. Metadata verified: 2026-11-12. This is separate from the framework version and demonstration runtime.
- Node.js requirement
- {"node": ">=12"}
- Accepted peer dependencies (declared ranges)
- {}
Tested environments are described in the versioned README and linked source checks. A declared peer range is not evidence that every version in it was tested.
Versioned reference
This reference comes from the published @stackline/[email protected] README. Its upstream attribution and license remain with the source. Benchmark and security statements describe the cited tests and advisories, not a guarantee for every application.
@stackline/update-section
Compatibility-first text section replacement with corrected marker metadata and first-party types.
Documentation | npm | Issues | Repository
Current package version: 1.0.4
Why this package?
Compatibility-first replacement of generated text sections. The package keeps
the callable [email protected] API, has no runtime dependencies, supports
CommonJS and ESM, and includes first-party TypeScript declarations.
Compatibility
| Item | Value |
|---|---|
| Package | @stackline/[email protected] |
| Node.js runtime | >=12 |
| CommonJS / primary entry | ./index.js |
| ES module entry | ./index.mjs |
| Type declarations | ./index.d.ts |
Installation
npm install @stackline/update-section
Usage
const updateSection = require('@stackline/update-section')
const result = updateSection(
'title\n<!-- START -->\nold\n<!-- END -->',
'<!-- START -->\ncurrent\n<!-- END -->',
(line) => line === '<!-- START -->',
(line) => line === '<!-- END -->'
)
The default export has this signature:
updateSection(content, section, matchesStart, matchesEnd, top?): string
It replaces the first start marker through the first following end marker. A
start without an end is replaced through EOF. If no start exists, the section
is appended with exactly two LF characters; pass true as top to prepend it
with the same separator.
updateSection.parse(lines, matchesStart, matchesEnd) returns hasStart,
hasEnd, startIdx, and endIdx. Indexes are inclusive. A missing end has
hasEnd: false and uses the final line as endIdx; end markers before the
selected start are ignored.
ESM provides default updateSection plus named updateSection and parse
exports. The historical update-section.js deep entry remains available.
Legacy consumers can migrate without changing their import key:
npm install update-section@npm:@stackline/update-section
Supported Node.js versions are 12 through 24. Input continues to split and join on LF exactly, so CR characters in CRLF content remain visible to marker callbacks. The package is an independent continuation and is not affiliated with the original author.
Security
Review inputs and the package-specific compatibility limits before processing untrusted data. Report suspected vulnerabilities as described in the security policy.
Local Development
git clone https://github.com/alexandroit/stackline-update-section.git
cd stackline-update-section
npm ci
npm run verify
Release tooling uses Node.js 24.20.0 and npm 11.19.0. The consumer runtime contract remains the one documented above.
Consumer Smoke Test
Run the repository's existing consumer/package check after installing development dependencies:
npm run test:smoke
Release Checklist
Run npm run verify and inspect the package contents before release. Publish a new version through the GitHub Actions publishing workflow, using the SHA-512 digest of the reviewed tarball. Verify the exact published version, tarball integrity, and npm provenance after the run.
License
MIT. See the license for the complete terms.
Original authorship and third-party attribution are preserved in NOTICE.
Credits and original authors
- Stackline Maintainers.
- Thorsten Lorenz.
- Copyright 2013 Thorsten Lorenz.
- Stackline maintenance: Alexandro Paixao Marques and Stackline contributors.
Original copyright, license notices and contributor acknowledgements remain part of this distribution. Stackline maintenance does not replace authorship of the original work.
Community and Links
Use this repository's issue tracker for reproducible bugs and feature requests. Join r/Stackline for examples, usage questions and release discussions.
Examples and compatibility
The original example runtime is preserved. Its build is identified by source commit 0e53be283c266cfff79cb3f76cef17d583fbc3df. Package version and runtime version must be checked independently.
Open the original exampleExamples load only when requested. They have their own runtime and are separate from this reference.
Compatibility Contract — @stackline/update-section