@aria-cli/fastripgrep 1.0.3
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/README.md +55 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/src/types.d.ts +96 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/fastripgrep.darwin-arm64.node +0 -0
- package/index.cjs +579 -0
- package/index.d.ts +44 -0
- package/index.js +579 -0
- package/npm/darwin-arm64/fastripgrep.darwin-arm64.node +0 -0
- package/npm/darwin-arm64/package.json +9 -0
- package/npm/darwin-x64/package.json +9 -0
- package/npm/linux-arm64-gnu/package.json +9 -0
- package/npm/linux-x64-gnu/package.json +9 -0
- package/npm/win32-x64-msvc/package.json +9 -0
- package/package.json +60 -0
- package/scripts/prepare-package.mjs +73 -0
- package/wrapper.cjs +19 -0
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aria-cli/fastripgrep",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "Native napi-rs bindings for vendored fastripgrep used by ARIA",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./wrapper.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./native": {
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"require": "./index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"napi": {
|
|
20
|
+
"binaryName": "fastripgrep",
|
|
21
|
+
"targets": [
|
|
22
|
+
"aarch64-apple-darwin",
|
|
23
|
+
"x86_64-apple-darwin",
|
|
24
|
+
"x86_64-unknown-linux-gnu",
|
|
25
|
+
"aarch64-unknown-linux-gnu",
|
|
26
|
+
"x86_64-pc-windows-msvc"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@napi-rs/cli": "^3.0.0",
|
|
31
|
+
"@types/node": "^25.3.0",
|
|
32
|
+
"typescript": "^5.9.3",
|
|
33
|
+
"vitest": "^4.0.18"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"index.js",
|
|
37
|
+
"index.cjs",
|
|
38
|
+
"wrapper.cjs",
|
|
39
|
+
"index.d.ts",
|
|
40
|
+
"dist/",
|
|
41
|
+
"*.node",
|
|
42
|
+
"npm/",
|
|
43
|
+
"scripts/"
|
|
44
|
+
],
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@aria-cli/fastripgrep-darwin-arm64": "1.0.2",
|
|
47
|
+
"@aria-cli/fastripgrep-darwin-x64": "1.0.2",
|
|
48
|
+
"@aria-cli/fastripgrep-linux-x64-gnu": "1.0.2",
|
|
49
|
+
"@aria-cli/fastripgrep-linux-arm64-gnu": "1.0.2",
|
|
50
|
+
"@aria-cli/fastripgrep-win32-x64-msvc": "1.0.2"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc -b --force tsconfig.json && napi build --platform --release && node ./scripts/prepare-package.mjs",
|
|
54
|
+
"build:debug": "napi build --platform && node ./scripts/prepare-package.mjs",
|
|
55
|
+
"prepare:package": "node ./scripts/prepare-package.mjs",
|
|
56
|
+
"test": "vitest run --config vitest.config.ts",
|
|
57
|
+
"test:native": "vitest run --config vitest.native.config.ts",
|
|
58
|
+
"bench": "vitest bench --config vitest.native.config.ts"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const loaderJsPath = path.join(packageDir, "index.js");
|
|
9
|
+
const loaderCjsPath = path.join(packageDir, "index.cjs");
|
|
10
|
+
const wrapperCjsPath = path.join(packageDir, "wrapper.cjs");
|
|
11
|
+
const npmDir = path.join(packageDir, "npm");
|
|
12
|
+
|
|
13
|
+
if (!existsSync(loaderJsPath)) {
|
|
14
|
+
throw new Error(`Expected generated napi loader at ${loaderJsPath}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
copyFileSync(loaderJsPath, loaderCjsPath);
|
|
18
|
+
|
|
19
|
+
const wrapperSource = `"use strict";
|
|
20
|
+
|
|
21
|
+
const native = require("./index.cjs");
|
|
22
|
+
|
|
23
|
+
function assertNativeAddonAvailable() {
|
|
24
|
+
if (!native || typeof native.frg !== "function") {
|
|
25
|
+
throw new Error("@aria-cli/fastripgrep: native loader did not export frg()");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function frg(input) {
|
|
30
|
+
assertNativeAddonAvailable();
|
|
31
|
+
return JSON.parse(native.frg(input));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = {
|
|
35
|
+
frg,
|
|
36
|
+
assertNativeAddonAvailable,
|
|
37
|
+
};
|
|
38
|
+
`;
|
|
39
|
+
writeFileSync(wrapperCjsPath, wrapperSource);
|
|
40
|
+
|
|
41
|
+
const targetDirByBinary = new Map([
|
|
42
|
+
["fastripgrep.darwin-arm64.node", path.join(npmDir, "darwin-arm64")],
|
|
43
|
+
["fastripgrep.darwin-x64.node", path.join(npmDir, "darwin-x64")],
|
|
44
|
+
["fastripgrep.linux-x64-gnu.node", path.join(npmDir, "linux-x64-gnu")],
|
|
45
|
+
["fastripgrep.linux-arm64-gnu.node", path.join(npmDir, "linux-arm64-gnu")],
|
|
46
|
+
["fastripgrep.win32-x64-msvc.node", path.join(npmDir, "win32-x64-msvc")],
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
for (const dir of targetDirByBinary.values()) {
|
|
50
|
+
mkdirSync(dir, { recursive: true });
|
|
51
|
+
for (const entry of readdirSync(dir)) {
|
|
52
|
+
if (entry.endsWith('.node')) {
|
|
53
|
+
rmSync(path.join(dir, entry), { force: true });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const entry of readdirSync(packageDir)) {
|
|
59
|
+
if (!entry.endsWith('.node')) continue;
|
|
60
|
+
const targetDir = targetDirByBinary.get(entry);
|
|
61
|
+
if (!targetDir) continue;
|
|
62
|
+
copyFileSync(path.join(packageDir, entry), path.join(targetDir, entry));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log("Prepared fastripgrep package artifacts:");
|
|
66
|
+
console.log(`- ${path.relative(packageDir, loaderCjsPath)}`);
|
|
67
|
+
console.log(`- ${path.relative(packageDir, wrapperCjsPath)}`);
|
|
68
|
+
for (const [binary, targetDir] of targetDirByBinary) {
|
|
69
|
+
const copiedPath = path.join(targetDir, binary);
|
|
70
|
+
if (existsSync(copiedPath)) {
|
|
71
|
+
console.log(`- ${path.relative(packageDir, copiedPath)}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
package/wrapper.cjs
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const native = require("./index.cjs");
|
|
4
|
+
|
|
5
|
+
function assertNativeAddonAvailable() {
|
|
6
|
+
if (!native || typeof native.frg !== "function") {
|
|
7
|
+
throw new Error("@aria-cli/fastripgrep: native loader did not export frg()");
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function frg(input) {
|
|
12
|
+
assertNativeAddonAvailable();
|
|
13
|
+
return JSON.parse(native.frg(input));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
module.exports = {
|
|
17
|
+
frg,
|
|
18
|
+
assertNativeAddonAvailable,
|
|
19
|
+
};
|