Skip to content

Commit

Permalink
fix(core): include more binary extensions (#16639)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored Apr 28, 2023
1 parent 341c916 commit deee934
Showing 1 changed file with 254 additions and 36 deletions.
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://github.com/sindresorhus/image-type/blob/5541b6a/index.js
'.jpg',
'.jpeg',
'.png',
'.gif',
'.webp',
'.flif',
'.cr2',
'.tif',
// types originally from https://github.com/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

1 comment on commit deee934

@vercel
Copy link

@vercel vercel bot commented on deee934 Apr 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-git-master-nrwl.vercel.app
nx.dev
nx-dev-nrwl.vercel.app
nx-five.vercel.app

Please sign in to comment.