Skip to content

refactor(estree-ast-utils): enhance input and output types using Meriyah ESTree defs #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 30, 2025

Conversation

fraxken
Copy link
Member

@fraxken fraxken commented Jun 30, 2025

No description provided.

Copy link

changeset-bot bot commented Jun 30, 2025

🦋 Changeset detected

Latest commit: 2e8479b

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

This PR includes changesets to release 1 package
Name Type
@nodesecure/estree-ast-utils 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 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

This PR refactors the ESTree AST utilities to enhance input/output types by using Meriyah ESTree definitions and removes deprecated functionality. Key changes include:

  • Removal of the isLiteralRegex function and its associated test.
  • Updated function signatures and type annotations to use ESTree.Node and related types.
  • Enhanced documentation and in-code comments to reflect the new type definitions.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workspaces/estree-ast-utils/test/isLiteralRegex.spec.ts Removed tests for isLiteralRegex as the function has been retired.
workspaces/estree-ast-utils/src/types.ts Removed the outdated NodeAst type in favor of standard ESTree types.
workspaces/estree-ast-utils/src/isLiteralRegex.ts Removed the isLiteralRegex function.
workspaces/estree-ast-utils/src/index.ts Removed export of isLiteralRegex.
workspaces/estree-ast-utils/src/getVariableDeclarationIdentifiers.ts Updated parameter and return types to ESTree types; added JSDoc for prefix.
workspaces/estree-ast-utils/src/getMemberExpressionIdentifier.ts Updated to include type guards for literal values.
workspaces/estree-ast-utils/src/getCallExpressionIdentifier.ts Updated parameter type to ESTree.Node.
workspaces/estree-ast-utils/src/getCallExpressionArguments.ts Added type-check guards for Literal nodes.
workspaces/estree-ast-utils/src/extractLogicalExpression.ts Updated parameter/return types to ESTree types.
workspaces/estree-ast-utils/src/concatBinaryExpression.ts Updated parameter type to ESTree.BinaryExpression and added a type-check for literal values.
workspaces/estree-ast-utils/src/arrayExpressionToString.ts Added null guards and updated type annotations.
workspaces/estree-ast-utils/package.json Added meriyah dependency.
workspaces/estree-ast-utils/README.md Updated API documentation to reflect new type signatures.
.changeset/mean-waves-retire.md Created changeset file documenting the minor release.
Comments suppressed due to low confidence (2)

workspaces/estree-ast-utils/src/extractLogicalExpression.ts:6

  • [nitpick] Changing the operator type from the specific union ('||' | '&&' | '??') to string may reduce type safety. Consider preserving the union type for valid logical operators to maintain stricter type checks.
): IterableIterator<{ operator: string; node: ESTree.Expression; }> {

@fraxken fraxken force-pushed the estree-ast-utils-ts-enhance branch from 2e8479b to a410d97 Compare June 30, 2025 16:38
@fraxken fraxken merged commit 8b72326 into master Jun 30, 2025
6 checks passed
@fraxken fraxken deleted the estree-ast-utils-ts-enhance branch June 30, 2025 16:51
@github-actions github-actions bot mentioned this pull request Jun 30, 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.

2 participants