Skip to content

Conversation

magic-akari
Copy link
Member

@magic-akari magic-akari commented Jul 30, 2025

Description:

BREAKING CHANGE:

Related issue (if exists):

@changeset-bot
Copy link

changeset-bot bot commented Jul 30, 2025

🦋 Changeset detected

Latest commit: 09f1dd1

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

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

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 30, 2025

CodSpeed Performance Report

Merging #10963 will not alter performance

Comparing magic-akari:feat/ast-viewer (09f1dd1) with main (89dcb36)1

Summary

✅ 140 untouched

Footnotes

  1. No successful run was found on main (6152958) during the generation of this report, so 89dcb36 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@magic-akari magic-akari force-pushed the feat/ast-viewer branch 2 times, most recently from 7df43cf to dd2a76b Compare July 30, 2025 14:36
@socket-security
Copy link

socket-security bot commented Sep 27, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcopyfiles@​2.4.110010010078100
Addedwebpack-cli@​3.3.129710010083100
Addedwebpack-dev-server@​3.11.3969310084100
Addedwebpack@​4.47.09710010093100

View full report

@socket-security
Copy link

socket-security bot commented Sep 27, 2025

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
[email protected] has a Critical CVE.

CVE: GHSA-fjxv-7rqg-78g4 form-data uses unsafe random function in form-data for choosing boundary (CRITICAL)

Affected versions: < 2.5.4; >= 3.0.0 < 3.0.4; >= 4.0.0 < 4.0.4

Patched version: 2.5.4

From: ?npm/[email protected]

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
[email protected] has Obfuscated code.

Confidence: 0.96

Location: Package overview

From: ?npm/[email protected]npm/[email protected]

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@magic-akari magic-akari marked this pull request as ready for review September 27, 2025 15:02
@Copilot Copilot AI review requested due to automatic review settings September 27, 2025 15:02
@magic-akari magic-akari requested review from a team as code owners September 27, 2025 15:02
Copy link

@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 introduces a new AST Viewer binding to improve the debugging experience by providing a way to parse JavaScript/TypeScript code and return both the AST and token information in a formatted debug output.

  • Adds a new WebAssembly binding binding_es_ast_viewer with parsing functionality
  • Integrates the new binding into the project's build and publish workflows
  • Enhances token debug output with more descriptive template literal token representations

Reviewed Changes

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

Show a summary per file
File Description
scripts/publish.sh Adds the new binding package to version management
crates/swc_ecma_parser/src/lib.rs Exposes additional parser utilities for unstable API
crates/swc_ecma_parser/src/lexer/token.rs Improves debug output for template literal tokens
bindings/binding_es_ast_viewer/src/lib.rs Main library implementing parse function for AST/token extraction
bindings/binding_es_ast_viewer/src/es_ast_viewer_node.js Node.js wrapper for the WASM module
bindings/binding_es_ast_viewer/scripts/* Build and packaging scripts
bindings/binding_es_ast_viewer/package.json Package configuration
bindings/binding_es_ast_viewer/jest.config.json Jest test configuration
bindings/binding_es_ast_viewer/examples/cli.rs CLI example for testing the parser
bindings/binding_es_ast_viewer/tests/parse.js Comprehensive test suite
bindings/binding_es_ast_viewer/Cargo.toml Rust package configuration
bindings/Cargo.toml Workspace member addition
.github/workflows/* CI and publish workflow updates

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.unwrap_or_default();

let is_d_ts =
is_ts && matches!(iter.next(), Some("d" | "D")) || matches!(iter.next(), Some("d" | "D"));
Copy link

Copilot AI Sep 27, 2025

Choose a reason for hiding this comment

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

The logic for detecting .d.ts files is incorrect. The second matches!(iter.next(), Some("d" | "D")) will always consume another element from the iterator regardless of the first condition's result, potentially leading to false positives. This should be: is_ts && matches!(iter.next(), Some("d" | "D"))

Suggested change
is_ts && matches!(iter.next(), Some("d" | "D")) || matches!(iter.next(), Some("d" | "D"));
is_ts && matches!(iter.next(), Some("d" | "D"));

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is the case of foo.d.css.ts.
See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#allowarbitraryextensions

Note that historically, a similar effect has often been achievable by adding a declaration file named app.css.d.ts instead of app.d.css.ts - however, this just worked through Node’s require resolution rules for CommonJS. Strictly speaking, the former is interpreted as a declaration file for a JavaScript file named app.css.js. Because relative files imports need to include extensions in Node’s ESM support, TypeScript would error on our example in an ESM file under --moduleResolution node16 or nodenext.

Added support for swc_core and swc_ecma_parser in the changeset.
@kdy1 kdy1 added this to the Planned milestone Sep 27, 2025
@kdy1 kdy1 merged commit fa3aacc into swc-project:main Sep 27, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants