-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add names and originalFileNames to assets #5686
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thank you for your contribution! ❤️You can try out this pull request locally by installing Rollup via npm install rollup/rollup#original-file-names-array Notice: Ensure you have installed the latest stable Rust toolchain. If you haven't installed it yet, please see https://www.rust-lang.org/tools/install to learn how to download Rustup and install Rust. or load it into the REPL: |
Performance report!Rough benchmark
Internal benchmark
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5686 +/- ##
=======================================
Coverage 99.04% 99.05%
=======================================
Files 242 242
Lines 9352 9387 +35
Branches 2473 2482 +9
=======================================
+ Hits 9263 9298 +35
Misses 58 58
Partials 31 31 ☔ View full report in Codecov by Sentry. |
Thanks! I tried this PR at vitejs/vite#18240. It works for Vite's case 👍 |
Co-authored-by: 翠 / green <green@sapphi.red>
This PR has been released as part of rollup@4.23.0. You can test it via |
Hey @lukastaegert, how does the migration looks like from example:
with |
Technically you would need to check all entries, though it will be one entry most of the time anyway. I usually would not expect the extensions to differ if the content is the same, and there is probably no reason to pick any but the first name if your just need a name and do not want to compare it to anything. |
<!-- Thank you for contributing! --> ### Description close #2496 refs #2046, rollup/rollup#5686, vitejs/vite#18240 <!-- Please insert your description here and provide especially info about the "what" this PR is solving -->
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
When no explicit "fileName" is provided when emitting an asset, Rollup will associate assets with the same content. At the moment, however, this is not reflected in the bundle and the
output.assetFileNames
option. While every file emission can have a differentname
andoriginalFileName
property, only one of them is visible via the.name
and.originalFileName
properties, see #5596 (comment)This PR adds new
.names
and.originalFileNames
properties that are arrays and contain all emitted names. At the same time, the old properties are soft-deprecated, meaning that accessing them will cause a warning in the next major version of Rollup.cc @sapphi-red