Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform API to support legal comment extraction #2390

Closed
privatenumber opened this issue Jul 15, 2022 · 3 comments
Closed

Transform API to support legal comment extraction #2390

privatenumber opened this issue Jul 15, 2022 · 3 comments

Comments

@privatenumber
Copy link
Contributor

privatenumber commented Jul 15, 2022

Feature request

For the Transform API to support legalComments: 'external' and return a legalComments property with a string of legal comments extracted.

Context

We're trying to support legalComments: 'external' | 'linked' in esbuild-loader, but it seems much more complicated than expected (overriding legalComments to eof, slow/unsafe regex comments extraction, sourcemap compatible code manipulation with magic-string, etc.).

@evanw
Copy link
Owner

evanw commented Jul 15, 2022

I could see supporting external, but linked is supposed to have the JavaScript reference the generated output file name and the transform API has no output files. Implementing linked is best done by the caller IMO since the caller will put the returned JavaScript string in an output file, and can then append a comment with the correct file name for the associated comment file. This same rationale is applied for source maps and the transform API too (you can't use linked in that case either).

@privatenumber
Copy link
Contributor Author

privatenumber commented Jul 15, 2022

Gotcha, that makes sense. Updated the feature request to external instead of linked.

@evanw evanw closed this as completed in 1ec8085 Dec 19, 2022
@privatenumber
Copy link
Contributor Author

Thank you @evanw !

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

No branches or pull requests

2 participants