Skip to content

Conversation

@fraxken
Copy link
Member

@fraxken fraxken commented Jul 16, 2025

No description provided.

@fraxken fraxken requested review from clemgbld and Copilot July 16, 2025 23:27
@changeset-bot
Copy link

changeset-bot bot commented Jul 16, 2025

🦋 Changeset detected

Latest commit: d31d13d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@nodesecure/js-x-ray Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactor JS-Xray and Tracer workspaces to remove the external estree-walker dependency and introduce a native synchronous walker built on Meriyah’s ESTree types.

  • Remove estree-walker from production dependencies and add it only as a devDependency where needed.
  • Add WalkerBase and SyncWalker implementations along with walk/walkEnter entrypoints.
  • Update all source files and tests to import and use the new walker and tighten type annotations.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
workspaces/tracer/package.json Add estree-walker to devDependencies
workspaces/js-x-ray/package.json Remove estree-walker from dependencies
workspaces/js-x-ray/src/walker/walker.base.ts Introduce WalkerBase for core AST node operations
workspaces/js-x-ray/src/walker/walker.sync.ts Implement SyncWalker for synchronous AST traversal
workspaces/js-x-ray/src/walker/index.ts Provide public walk and walkEnter helper functions
workspaces/js-x-ray/src/types/estree.ts Refine type guard signatures from any to unknown
workspaces/js-x-ray/src/probes/isRequire/RequireCallExpressionWalker.ts Swap external walker import for walkEnter usage
workspaces/js-x-ray/src/AstAnalyser.ts Update AST analysis to use new walker API
workspaces/js-x-ray/test/walker.spec.ts Update tests to cover new walker behaviors
workspaces/js-x-ray/test/utils/index.ts Import walk from new walker and remove old import
workspaces/js-x-ray/test/NodeCounter.spec.ts Switch to walkEnter and improve type annotations
workspaces/js-x-ray/test/Deobfuscator.spec.ts Replace external walker with local walk and tighten types
workspaces/js-x-ray/test/AstAnalyser.spec.ts Minor formatting tweaks and new walker import
.changeset/open-lines-own.md Bump package version and add PR summary
Comments suppressed due to low confidence (3)

workspaces/js-x-ray/src/walker/index.ts:9

  • [nitpick] Add JSDoc comments for walk and walkEnter to explain their parameters, return type, and when to use each helper function.
export function walk(

workspaces/js-x-ray/src/walker/walker.sync.ts:20

  • [nitpick] Consider adding JSDoc to the SyncWalker class and its visit method to clarify how handlers (enter/leave), skipping, replacement, and removal work.
export class SyncWalker extends WalkerBase {

workspaces/js-x-ray/test/walker.spec.ts:145

  • Add a test case to verify that calling this.skip() in an enter handler correctly prevents recursion into child nodes.
      }

@fraxken fraxken force-pushed the reimplement-walker branch from 14d534b to d31d13d Compare July 16, 2025 23:33
@fraxken fraxken force-pushed the reimplement-walker branch from d31d13d to 77efae1 Compare July 17, 2025 01:13
@fraxken fraxken merged commit 283d5b6 into master Jul 17, 2025
6 checks passed
@fraxken fraxken deleted the reimplement-walker branch July 17, 2025 14:36
@github-actions github-actions bot mentioned this pull request Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants