Skip to main content

Module dependent_version_text

Module dependent_version_text 

Source
Expand description

The byte-preserving rewrite of a manifest’s top-level version. What: Rewrite the top-level version value in a manifest’s text, leaving every other byte unchanged. Why: The bump is delivered as a full-content patch, so indentation, key order, line endings and the trailing newline must survive exactly. This is the incumbent’s scanner (manifest-text.ts:184-333) over bytes: it tracks {/[ depth outside strings, finds the first "version" key at depth one, and requires its raw value to be exactly the JSON quoting of the expected version.

In TS you’d write (pseudocode):

// replaceManifestVersion({ path, text, from, to });

Functions§

replace_manifest_version
What: Replace the value of the first top-level "version" key, which must be exactly from quoted, with to quoted. &str borrows text; the result is owned. Why: Only the version changes; a manifest whose first top-level version holds something else (an escaped spelling, a different value, a duplicate key whose first value differs) is refused rather than guessed at.