Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Patching: Correctly append to nested AOT (array of tables) ([#176]).
- Patching: Fixed `findByPath` scanning in AOT scope to continue looking at sibling entries after a partial prefix match fails ([#176]).
- Patching: Support replacement of a entire table section with a scalar value ([#176]).

## [1.2.0] - 2026-04-29

### Added
Expand Down
26 changes: 26 additions & 0 deletions src/__tests__/find-by-path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,29 @@ it('should find nodes within nested inline tables', () => {
expect(cache.type).toEqual('InlineItem');
expect(cache.item.value.type).toEqual('InlineTable');
});

it('should keep scanning AOT-scoped siblings after a shorter prefix match fails', () => {
const toml = dedent`
[[fruit]]
name = "apple"

[fruit.physical]
color = "red"

[fruit.physical.dimensions]
width = 10

[[fruit]]
name = "banana"
`;

const ast = parseTOML(toml);
const document: Document = {
type: NodeType.Document,
loc: { start: { line: 1, column: 0 }, end: { line: 1, column: 0 } },
items: [...ast]
};

const width = findByPath(document, ['fruit', 0, 'physical', 'dimensions', 'width']) as any;
expect(width.value.value).toEqual(10);
});
Loading
Loading