-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix(core): do not replace legacy package mentions in binary files #16547
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { extname } from 'path'; | ||
|
||
const binaryExtensions = new Set([ | ||
// // Image types originally from https://github.com/sindresorhus/image-type/blob/5541b6a/index.js | ||
'.jpg', | ||
'.jpeg', | ||
'.png', | ||
'.gif', | ||
'.webp', | ||
'.flif', | ||
'.cr2', | ||
'.tif', | ||
'.bmp', | ||
'.jxr', | ||
'.psd', | ||
'.ico', | ||
'.bpg', | ||
'.jp2', | ||
'.jpm', | ||
'.jpx', | ||
'.heic', | ||
'.cur', | ||
'.avif', | ||
'.dcm', | ||
|
||
// Compressed files | ||
'.tgz', | ||
'.gz', | ||
'.zip', | ||
|
||
// Documents | ||
'.pdf', | ||
|
||
// Java files | ||
'.jar', | ||
'.keystore', | ||
|
||
// Font files | ||
'.ttf', | ||
'.otf', | ||
'.woff', | ||
'.woff2', | ||
'.eot', | ||
]); | ||
|
||
export function isBinaryPath(path: string): boolean { | ||
return binaryExtensions.has(extname(path)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to list out more extensions like There's a long list here: https://github.com/sindresorhus/binary-extensions/blob/main/binary-extensions.json There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added these to the list.. let's see if we want to import this list differently in the future. 🤔 |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.avif
and.dcm
extensions is missing for imagesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pxz
andpxd
are also missing