Repository navigation
fix: preserve stop-node paths in updateTag callbacks - #886
Draft
vhinayindia wants to merge 1 commit into
Draft
vhinayindia wants to merge 1 commit into
vhinayindia wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Goal
Keep the current stop node in the path matcher until
updateTaghas run. It is currently popped first, so the callback receives the parent's path. WithjPath: false, matcher predicates also inspect the parent instead of the stop node. Path-based skipping and renaming therefore fail when combined withstopNodes.No existing issue describes this exact case, so here is a reproduction as requested by the PR template:
Actual:
{ root: { skip: '<nested/>', keep: 'ok' } }Expected:
{ root: { keep: 'ok' } }The fix moves
addChild, which invokesupdateTag, before the matcher pop. It leaves the raw stop-node content and subsequent sibling paths unchanged.Tests
jPath: false, and following siblings.npm test: 336 specs, 0 failures, 2 existing pending specs on Node 24.19.0.npm run test-types: passes.git diff --check: passes.npm run lintis blocked on both baseline and final source becausebenchmark/**/*.jsmatches no files. Focused ESLint with ECMAScript 2022 reports only the same existing unused variables in the two files.Performance
Ran the documented
node benchmark/XmlParser.mjsbefore and after on the same shared VM. Requests/second in the consecutive comparison:These are noisy single-run observations, not a performance claim. The default benchmark does not use stop nodes; this change only reorders the existing callback and matcher pop in the stop-node branch.
Type