File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -506,7 +506,22 @@ <h2>Partnered Projects</h2>
506506 case 'amd64' : arch = 'x64' ; break ;
507507 case 'arm64' : arch = 'arm64' ; break ;
508508 case 'ia32' : arch = 'x32' ; break ;
509- default : return 'other' ;
509+ default :
510+ if ( os === 'macos' ) {
511+ // Best-effort Apple Silicon detection, lifted from:
512+ // https://github.com/faisalman/ua-parser-js/blob/72c59b53/src/helpers/ua-parser-helpers.js#L21-L42
513+ try {
514+ const canvas = document . createElement ( 'canvas' ) ;
515+ const webgl = canvas . getContext ( 'webgl2' ) || canvas . getContext ( 'webgl' ) || canvas . getContext ( 'experimental-webgl' ) ;
516+ const debug = webgl . getExtension ( 'WEBGL_debug_renderer_info' ) ;
517+ const renderer = webgl . getParameter ( debug . UNMASKED_RENDERER_WEBGL ) ;
518+ if ( renderer . match ( / a p p l e m \d / i) ) {
519+ return 'macos_arm64' ;
520+ }
521+ } catch { }
522+ return 'macos_x64' ;
523+ }
524+ arch = 'x64' ;
510525 }
511526
512527 return `${ os } _${ arch } ` ;
You can’t perform that action at this time.
0 commit comments