Skip to content

feat(codegen): Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553)#10569

Merged
Boshen merged 1 commit intomainfrom
revert-raw
Apr 23, 2025
Merged

feat(codegen): Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553)#10569
Boshen merged 1 commit intomainfrom
revert-raw

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Apr 23, 2025

This reverts commit 10e1018.

After experimenting with downstream crates like Rolldown, I discovered this introduces a footgun.

It's really easy to change StringLiteral::value without also changing StringLiteral::raw, which results in incorrect codegen.

After some consideration, I've decided against introducing an extra option for printing the raw value, it adds a significant amount of maintenance burden. (This issue alone is already consuming a lot of our time). We will need to three modes in the codegen: normal, minify and raw.

For now, let's assume our codegen will not preserve the original source text. If preserving the original source text is a requirement, please use magic string or any other direct string manipulation methods.

@graphite-app
Copy link
Contributor

graphite-app bot commented Apr 23, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@codspeed-hq
Copy link

codspeed-hq bot commented Apr 23, 2025

CodSpeed Instrumentation Performance Report

Merging #10569 will not alter performance

Comparing revert-raw (7c1075b) with main (f5332bf)

Summary

✅ 36 untouched benchmarks

@Boshen Boshen changed the title Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553) feat: Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553) Apr 23, 2025
@Boshen Boshen changed the title feat: Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553) feat(codegen): Revert "feat(codegen)!: print StringLiteral raw if minify option disabled (#10553) Apr 23, 2025
@github-actions github-actions bot added the C-enhancement Category - New feature or request label Apr 23, 2025
@Boshen Boshen merged commit d78c04e into main Apr 23, 2025
28 of 30 checks passed
@Boshen Boshen deleted the revert-raw branch April 23, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant