Skip to content

Conversation

@EricGhildyal
Copy link
Contributor

No description provided.

@EricGhildyal EricGhildyal self-assigned this Jul 24, 2025
Copy link
Contributor

@RobbieMcKinstry RobbieMcKinstry left a comment

Choose a reason for hiding this comment

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

Speedy work! I have some change requests though

Cargo.toml Outdated
] }
url = "2.5.4"
uuid = { version = "1.9", features = ["serde", "v4"] }
swc_common = { version = "14.0.2", features = ["tty-emitter", "sourcemap"] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably don't need tty-emitter anymore!

Comment on lines 197 to 199
if extension == "js" || extension == "ts" {
// Use processed/transformed bytes for JS/TS files
process_file(file_path)?
Copy link
Contributor

Choose a reason for hiding this comment

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

nuh uh, you should use the TypeBuilder like I did to construct a matcher that understands the filetypes. Burntsushi knows what he's doin', his code is a little more robust.

Copy link
Contributor

Choose a reason for hiding this comment

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

That is to say, you'll have to make that change in manifest.files(), not at this location.

Comment on lines 201 to 202
// Use original bytes for other file types
read(file_path).await.into_diagnostic()?
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't have to update code that isn't ts or js.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about Python and Rust workers?

let file_bytes = if let Some(extension) = file_path.extension() {
if extension == "js" || extension == "ts" {
// Use processed/transformed bytes for JS/TS files
process_file(file_path)?
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this result just get thrown away? It looks like it doesn't have any side effects. Same with read below. In the red diff, read returned a byte vec, but now its return type is unused.

Comment on lines 626 to 631
let handler = Handler::with_tty_emitter(
swc_common::errors::ColorConfig::Auto,
true,
false,
Some(cm.clone()),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I suspected we were going to drop the tty emitter. Is that just for errors or something? What's actually responsible for dumping the output file?

// Ensure that we have enough parenthesis.
let program = module.apply(fixer(Some(&comments)));

to_code_default(cm.clone(), Some(&comments), &program)
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it's to_code_default?

let manifest_filenames = manifest_filenames();

// Build the file tree walker.
// let walker = walk_builder(directory.clone());
Copy link
Contributor

Choose a reason for hiding this comment

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

This is where the TypeBuilder should be used.

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