Skip to content

refactor: use oxc's built-in legal comment support#2

Open
Boshen wants to merge 1 commit intomainfrom
feat/use-oxc-legal-comments
Open

refactor: use oxc's built-in legal comment support#2
Boshen wants to merge 1 commit intomainfrom
feat/use-oxc-legal-comments

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Mar 14, 2026

Summary

  • Replace regex-based extractLicenseComments/isLicenseComment with oxc's native legalComments: "linked" codegen option
  • When extractComments is enabled, set codegen.legalComments = "linked" with the .LICENSE.txt path so oxc handles comment stripping and banner insertion
  • When extractComments is disabled, set codegen.legalComments = "none" to strip legal comments
  • Use result.legalComments from the minify result to build .LICENSE.txt content

Depends on oxc-project/oxc#20361 (or whichever PR number is assigned).

🤖 Generated with Claude Code

Replace the regex-based `extractLicenseComments`/`isLicenseComment`
helpers with oxc's native `legalComments: "linked"` codegen option.
This delegates comment extraction, deduplication, and banner insertion
to oxc's codegen, which has proper AST-aware comment handling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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