Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

teawithfruit
Copy link

Current Behavior

Due to this PR swc-project/pkgs#53 at SWC, it is not possible to use the latest version of @swc/cli in NX.

Expected Behavior

stdout and stderr are now handled more precisely, allowing you to update to the latest version of @swc/cli.

@teawithfruit teawithfruit requested a review from a team as a code owner September 10, 2025 16:11
Copy link

vercel bot commented Sep 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Sep 10, 2025 4:32pm

await postCompilationCallback();
initialPostCompile = false;
handleCallback = async (type: string, data?: string) => {
if (type === 'stdout' || data.includes('Successfully')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

The condition type === 'stdout' || data.includes('Successfully') creates a logical issue where stderr output containing "Successfully" would be processed as stdout data. This could cause error messages to be misinterpreted as success indicators.

Consider restructuring the condition to first check the stream type, then check the content:

if (type === 'stdout') {
  // Process stdout data
  process.stdout.write(data);
  if (data.includes('Successfully')) {
    // Handle success case
  }
} else if (type === 'stderr') {
  // Process stderr data appropriately
}

This would maintain proper separation between stdout and stderr handling while still detecting success messages.

Suggested change
if (type === 'stdout' || data.includes('Successfully')) {
if (type === 'stdout') {
process.stdout.write(data);
if (data.includes('Successfully')) {
// Handle success case
}
} else if (type === 'stderr') {
// Process stderr data appropriately
}

Spotted by Diamond

Fix in Graphite


Is this helpful? React πŸ‘ or πŸ‘Ž to let us know.

await postCompilationCallback();
initialPostCompile = false;
handleCallback = async (type: string, data?: string) => {
if (type === 'stdout' || data.includes('Successfully')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a potential issue with the conditional logic in this line. If data is undefined, calling data.includes('Successfully') will throw an error. Consider adding a null check to prevent runtime errors:

if (type === 'stdout' || (data && data.includes('Successfully'))) {

This ensures the code safely handles cases where data might be undefined or null.

Suggested change
if (type === 'stdout' || data.includes('Successfully')) {
if (type === 'stdout' || (data && data.includes('Successfully'))) {

Spotted by Diamond

Fix in Graphite


Is this helpful? React πŸ‘ or πŸ‘Ž to let us know.

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.

1 participant