feat: init

This commit is contained in:
2026-02-13 22:02:30 +01:00
commit 8f9ff830fb
16711 changed files with 3307340 additions and 0 deletions

29
node_modules/system-architecture/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
export type CpuArchitecture = 'arm64' | 'x64' | 'arm' | 'ia32' | 'mips' | 'mipsel' | 'ppc' | 'ppc64' | 'riscv64' | 's390' | 's390x';
/**
Get the operating system CPU architecture.
@example
```
import {systemArchitecture} from 'system-architecture';
// On ARM64 macOS
console.log(await systemArchitecture());
//=> 'arm64'
```
*/
export function systemArchitecture(): Promise<CpuArchitecture>;
/**
Get the operating system CPU architecture.
@example
```
import {systemArchitectureSync} from 'system-architecture';
// On ARM64 macOS
console.log(systemArchitectureSync());
//=> 'arm64'
```
*/
export function systemArchitectureSync(): CpuArchitecture;

59
node_modules/system-architecture/index.js generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import {promisify} from 'node:util';
import process from 'node:process';
import childProcess from 'node:child_process';
const execFilePromises = promisify(childProcess.execFile);
export async function systemArchitecture() {
const {arch, platform, env} = process;
// Detect Node.js x64 binary running under Rosetta 2 on a ARM64 Mac.
if (platform === 'darwin' && arch === 'x64') {
const {stdout} = await execFilePromises('sysctl', ['-inq', 'sysctl.proc_translated'], {encoding: 'utf8'});
return stdout.trim() === '1' ? 'arm64' : 'x64';
}
if (arch === 'arm64' || arch === 'x64') {
return arch;
}
if (platform === 'win32' && Object.hasOwn(env, 'PROCESSOR_ARCHITEW6432')) {
return 'x64';
}
if (platform === 'linux') {
const {stdout} = await execFilePromises('getconf', ['LONG_BIT'], {encoding: 'utf8'});
if (stdout.trim() === '64') {
return 'x64';
}
}
return arch;
}
export function systemArchitectureSync() {
const {arch, platform, env} = process;
// Detect Node.js x64 binary running under Rosetta 2 on a ARM64 Mac.
if (platform === 'darwin' && arch === 'x64') {
const stdout = childProcess.execFileSync('sysctl', ['-inq', 'sysctl.proc_translated'], {encoding: 'utf8'});
return stdout.trim() === '1' ? 'arm64' : 'x64';
}
if (arch === 'arm64' || arch === 'x64') {
return arch;
}
if (platform === 'win32' && Object.hasOwn(env, 'PROCESSOR_ARCHITEW6432')) {
return 'x64';
}
if (platform === 'linux') {
const stdout = childProcess.execFileSync('getconf', ['LONG_BIT'], {encoding: 'utf8'});
if (stdout.trim() === '64') {
return 'x64';
}
}
return arch;
}

9
node_modules/system-architecture/license generated vendored Normal file
View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

47
node_modules/system-architecture/package.json generated vendored Normal file
View File

@@ -0,0 +1,47 @@
{
"name": "system-architecture",
"version": "0.1.0",
"description": "Get the operating system CPU architecture",
"license": "MIT",
"repository": "sindresorhus/system-architecture",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"engines": {
"node": ">=18"
},
"sideEffects": false,
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"arch",
"architecture",
"cpu",
"arm64",
"arm",
"x64",
"x86",
"64-bit",
"32-bit",
"bitness",
"detect",
"check"
],
"devDependencies": {
"ava": "^5.3.1",
"xo": "^0.56.0"
}
}

41
node_modules/system-architecture/readme.md generated vendored Normal file
View File

@@ -0,0 +1,41 @@
# system-architecture
> Get the operating system CPU architecture
[`process.arch` / `os.arch()`](https://nodejs.org/api/process.html#processarch) is generally not useful as it returns the CPU architecture for which the Node.js binary was compiled, not the actual system architecture.
For browser usage, you probably want [`is64bit`](https://github.com/sindresorhus/is64bit) instead.
## Install
```sh
npm install system-architecture
```
## Usage
```js
import {systemArchitecture} from 'system-architecture';
// On ARM64 macOS
console.log(await systemArchitecture());
//=> 'arm64'
```
## API
### systemArchitecture()
Returns a promise for a CPU architecture name. See [`process.arch`](https://nodejs.org/api/process.html#processarch) for possible values.
### systemArchitectureSync()
Returns a CPU architecture name. See [`process.arch`](https://nodejs.org/api/process.html#processarch) for possible values.
## Note
This should really be in Node.js core, but they are [not pragmatic](https://github.com/nodejs/node/issues/17036).
## Related
- [is64bit](https://github.com/sindresorhus/is64bit) - Check whether operating system CPU architecture is 64-bit or 32-bit