detect-avx 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
- package/prebuilds/darwin-arm64/detect-avx.node +0 -0
- package/prebuilds/darwin-x64/detect-avx.node +0 -0
- package/prebuilds/linux-x64/detect-avx.node +0 -0
- package/prebuilds/win32-x64/detect-avx.node +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ben Williams
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# detect-avx
|
|
2
|
+
|
|
3
|
+
[](https://github.com/biw/detect-avx/actions)
|
|
4
|
+
[](https://www.npmjs.com/package/detect-avx)
|
|
5
|
+
[](https://www.npmjs.com/package/detect-avx)
|
|
6
|
+
|
|
7
|
+
A Node.js package for detecting AVX instruction set support on x86 processors.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
yarn add detect-avx
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import detectAvx from "detect-avx";
|
|
19
|
+
|
|
20
|
+
const result = detectAvx();
|
|
21
|
+
console.log(result); // 'avx2', 'avx', or 'none'
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Return Values
|
|
25
|
+
|
|
26
|
+
- `'avx2'` - CPU supports AVX2 instructions
|
|
27
|
+
- `'avx'` - CPU supports AVX instructions (but not AVX2)
|
|
28
|
+
- `'none'` - CPU does not support AVX instructions (or running on non-x86 platform like ARM)
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
MIT
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createRequire as t}from"module";import e from"path";import{fileURLToPath as o}from"url";var r=t(import.meta.url),n=e.dirname(o(import.meta.url)),a=r("node-gyp-build")(e.join(n,".."));function i(){return a.detectAvx()}export{i as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { createRequire } from \"node:module\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst require = createRequire(import.meta.url);\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\n\ninterface NativeAddon {\n detectAvx(): \"avx2\" | \"avx\" | \"none\";\n}\n\n// Load the native addon using node-gyp-build\nconst addon: NativeAddon = require(\"node-gyp-build\")(\n path.join(__dirname, \"..\")\n);\n\n/**\n * Detects AVX instruction set support on the current CPU.\n * @returns The highest supported AVX version: 'avx2', 'avx', or 'none'\n */\nexport default function detectAvx(): \"avx2\" | \"avx\" | \"none\" {\n return addon.detectAvx();\n}\n"],"mappings":"AAAA,OAAS,iBAAAA,MAAqB,SAC9B,OAAOC,MAAU,OACjB,OAAS,iBAAAC,MAAqB,MAE9B,IAAMC,EAAUH,EAAc,YAAY,GAAG,EACvCI,EAAYH,EAAK,QAAQC,EAAc,YAAY,GAAG,CAAC,EAOvDG,EAAqBF,EAAQ,gBAAgB,EACjDF,EAAK,KAAKG,EAAW,IAAI,CAC3B,EAMe,SAARE,GAAsD,CAC3D,OAAOD,EAAM,UAAU,CACzB","names":["createRequire","path","fileURLToPath","require","__dirname","addon","detectAvx"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "detect-avx",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"packageManager": "yarn@4.6.0",
|
|
5
|
+
"description": "Detect AVX instruction set support on Intel processors",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"prebuilds"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"build:native": "node-gyp rebuild",
|
|
22
|
+
"clean": "node-gyp clean && rm -rf dist",
|
|
23
|
+
"lint": "tsc --noEmit",
|
|
24
|
+
"prebuild": "prebuildify --napi --strip",
|
|
25
|
+
"test": "vitest run",
|
|
26
|
+
"prepublishOnly": "yarn build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"avx",
|
|
30
|
+
"avx2",
|
|
31
|
+
"cpu",
|
|
32
|
+
"simd",
|
|
33
|
+
"intel",
|
|
34
|
+
"native",
|
|
35
|
+
"addon",
|
|
36
|
+
"napi"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/biw/detect-avx.git"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"node-addon-api": "^8.0.0",
|
|
48
|
+
"node-gyp-build": "^4.8.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.0.0",
|
|
52
|
+
"node-gyp": "^12.1.0",
|
|
53
|
+
"prebuildify": "^6.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"typescript": "^5.0.0",
|
|
56
|
+
"vitest": "^3.0.0"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|