@@ -39,12 +39,7 @@ cfg_if! {
3939 pub const NODE_DISTRO_EXTENSION : & str = "zip" ;
4040 /// The file identifier in the Node index `files` array
4141 pub const NODE_DISTRO_IDENTIFIER : & str = "win-x64-zip" ;
42- } else if #[ cfg( all( target_os = "macos" , any( target_arch = "x86_64" , target_arch = "aarch64" ) ) ) ] {
43- // NOTE: Currently, Node does not provide prebuilt binaries for Apple M1 machines, so we
44- // fall back to using the x64 binaries through Rosetta 2. When Node starts shipping M1
45- // binaries, then we will need to adjust our logic to search for those first and only fall
46- // back if they aren't found
47-
42+ } else if #[ cfg( all( target_os = "macos" , target_arch = "x86_64" ) ) ] {
4843 /// The OS component of a Node distro filename
4944 pub const NODE_DISTRO_OS : & str = "darwin" ;
5045 /// The architecture component of a Node distro filename
@@ -53,6 +48,23 @@ cfg_if! {
5348 pub const NODE_DISTRO_EXTENSION : & str = "tar.gz" ;
5449 /// The file identifier in the Node index `files` array
5550 pub const NODE_DISTRO_IDENTIFIER : & str = "osx-x64-tar" ;
51+ } else if #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ] {
52+ /// The OS component of a Node distro filename
53+ pub const NODE_DISTRO_OS : & str = "darwin" ;
54+ /// The architecture component of a Node distro filename
55+ pub const NODE_DISTRO_ARCH : & str = "arm64" ;
56+ /// The extension for Node distro files
57+ pub const NODE_DISTRO_EXTENSION : & str = "tar.gz" ;
58+ /// The file identifier in the Node index `files` array
59+ pub const NODE_DISTRO_IDENTIFIER : & str = "osx-arm64-tar" ;
60+
61+ // NOTE: Node support for pre-built Apple Silicon binaries was added in major version 16
62+ // For versions prior to that, we need to fall back on the x64 binaries via Rosetta 2
63+
64+ /// The fallback architecture component of a Node distro filename
65+ pub const NODE_DISTRO_ARCH_FALLBACK : & str = "x64" ;
66+ /// The fallback file identifier in the Node index `files` array
67+ pub const NODE_DISTRO_IDENTIFIER_FALLBACK : & str = "osx-x64-tar" ;
5668 } else if #[ cfg( all( target_os = "linux" , target_arch = "x86_64" ) ) ] {
5769 /// The OS component of a Node distro filename
5870 pub const NODE_DISTRO_OS : & str = "linux" ;
0 commit comments