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

fix(core): include more binary extensions #16639

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 254 additions & 36 deletions packages/devkit/src/utils/binary-extensions.ts
Original file line number Diff line number Diff line change
@@ -1,50 +1,268 @@
import { extname } from 'path';

const binaryExtensions = new Set([
// // Image types originally from https:/sindresorhus/image-type/blob/5541b6a/index.js
'.jpg',
'.jpeg',
'.png',
'.gif',
'.webp',
'.flif',
'.cr2',
'.tif',
// types originally from https:/sindresorhus/binary-extensions/blob/40e44b510d87a63dcf42300bc8fbcb105f45a61c/binary-extensions.json
'.3dm',
'.3ds',
'.3g2',
'.3gp',
'.7z',
'.a',
'.aac',
'.adp',
'.ai',
'.aif',
'.aiff',
'.alz',
'.ape',
'.apk',
'.appimage',
'.ar',
'.arj',
'.asf',
'.au',
'.avi',
'.bak',
'.baml',
'.bh',
'.bin',
'.bk',
'.bmp',
'.jxr',
'.psd',
'.ico',
'.bpg',
'.jp2',
'.jpm',
'.jpx',
'.heic',
'.btif',
'.bz2',
'.bzip2',
'.cab',
'.caf',
'.cgm',
'.class',
'.cmx',
'.cpio',
'.cr2',
'.cur',
'.avif',
'.dat',
'.dcm',

// Compressed files
'.tgz',
'.deb',
'.dex',
'.djvu',
'.dll',
'.dmg',
'.dng',
'.doc',
'.docm',
'.docx',
'.dot',
'.dotm',
'.dra',
'.DS_Store',
'.dsk',
'.dts',
'.dtshd',
'.dvb',
'.dwg',
'.dxf',
'.ecelp4800',
'.ecelp7470',
'.ecelp9600',
'.egg',
'.eol',
'.eot',
'.epub',
'.exe',
'.f4v',
'.fbs',
'.fh',
'.fla',
'.flac',
'.flatpak',
'.fli',
'.flv',
'.fpx',
'.fst',
'.fvt',
'.g3',
'.gh',
'.gif',
'.graffle',
'.gz',
'.zip',

// Documents
'.pdf',

// Java files
'.gzip',
'.h261',
'.h263',
'.h264',
'.icns',
'.ico',
'.ief',
'.img',
'.ipa',
'.iso',
'.jar',
'.keystore',

// Font files
'.ttf',
'.jpeg',
'.jpg',
'.jpgv',
'.jpm',
'.jxr',
'.key',
'.ktx',
'.lha',
'.lib',
'.lvp',
'.lz',
'.lzh',
'.lzma',
'.lzo',
'.m3u',
'.m4a',
'.m4v',
'.mar',
'.mdi',
'.mht',
'.mid',
'.midi',
'.mj2',
'.mka',
'.mkv',
'.mmr',
'.mng',
'.mobi',
'.mov',
'.movie',
'.mp3',
'.mp4',
'.mp4a',
'.mpeg',
'.mpg',
'.mpga',
'.msi',
'.mxu',
'.nef',
'.npx',
'.numbers',
'.nupkg',
'.o',
'.odp',
'.ods',
'.odt',
'.oga',
'.ogg',
'.ogv',
'.otf',
'.woff',
'.woff2',
'.eot',

// Misc files
'.ott',
'.pages',
'.pbm',
'.pcx',
'.pdb',
'.pdf',
'.pea',
'.pgm',
'.pic',
'.png',
'.pnm',
'.pot',
'.potm',
'.potx',
'.ppa',
'.ppam',
'.ppm',
'.pps',
'.ppsm',
'.ppsx',
'.ppt',
'.pptm',
'.pptx',
'.psd',
'.pxd',
'.pxz',
'.pya',
'.pyc',
'.pyo',
'.pyv',
'.qt',
'.rar',
'.ras',
'.raw',
'.resources',
'.rgb',
'.rip',
'.rlc',
'.rmf',
'.rmvb',
'.rpm',
'.rtf',
'.rz',
'.s3m',
'.s7z',
'.scpt',
'.sgi',
'.shar',
'.snap',
'.sil',
'.sketch',
'.slk',
'.smv',
'.snk',
'.so',
'.stl',
'.suo',
'.sub',
'.swf',
'.tar',
'.tbz',
'.tbz2',
'.tga',
'.tgz',
'.thmx',
'.tif',
'.tiff',
'.tlz',
'.ttc',
'.ttf',
'.txz',
'.udf',
'.uvh',
'.uvi',
'.uvm',
'.uvp',
'.uvs',
'.uvu',
'.viv',
'.vob',
'.war',
'.wav',
'.wax',
'.wbmp',
'.wdp',
'.weba',
'.webm',
'.webp',
'.whl',
'.wim',
'.wm',
'.wma',
'.wmv',
'.wmx',
'.woff',
'.woff2',
'.wrm',
'.wvx',
'.xbm',
'.xif',
'.xla',
'.xlam',
'.xls',
'.xlsb',
'.xlsm',
'.xlsx',
'.xlt',
'.xltm',
'.xltx',
'.xm',
'.xmind',
'.xpi',
'.xpm',
'.xwd',
'.xz',
'.z',
'.zip',
'.zipx',
]);

export function isBinaryPath(path: string): boolean {
Expand Down