This repository was archived by the owner on Oct 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -168,21 +168,29 @@ function main() {
168168 */
169169function getNativeBinary ( ) {
170170 let nativeBinary ;
171-
172- if ( os . platform ( ) === 'win32' ) {
171+ const platform = os . platform ( ) ;
172+ const arch = os . arch ( ) ;
173+ if ( platform === 'win32' ) {
173174 nativeBinary = `${ __dirname } /bin/win32/clang-format.exe` ;
174175 } else {
175- nativeBinary = `${ __dirname } /bin/${ os . platform ( ) } _${ os . arch ( ) } /clang-format` ;
176+ nativeBinary = `${ __dirname } /bin/${ platform } _${ arch } /clang-format` ;
176177 }
177178
178- if ( ! fs . existsSync ( nativeBinary ) ) {
179- const message = 'This module doesn\'t bundle the clang-format executable for your platform. ' +
180- `(${ os . platform ( ) } _${ os . arch ( ) } )\n` +
181- 'Consider installing it with your native package manager instead.\n' ;
182- throw new Error ( message ) ;
179+ if ( fs . existsSync ( nativeBinary ) ) {
180+ return nativeBinary ;
183181 }
184182
185- return nativeBinary ;
183+ // Let arm64 macOS fall back to x64
184+ if ( platform === 'darwin' && arch === 'arm64' ) {
185+ nativeBinary = `${ __dirname } /bin/darwin_x64/clang-format` ;
186+ if ( fs . existsSync ( nativeBinary ) ) {
187+ return nativeBinary ;
188+ }
189+ }
190+ const message = 'This module doesn\'t bundle the clang-format executable for your platform. ' +
191+ `(${ platform } _${ arch } )\n` +
192+ 'Consider installing it with your native package manager instead.\n' ;
193+ throw new Error ( message ) ;
186194}
187195
188196/**
You can’t perform that action at this time.
0 commit comments