@ff-labs/fff-node 0.11.1-nightly.89c1927 → 0.11.1-nightly.a377069
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 +14 -0
- package/dist/binary.d.ts +4 -2
- package/dist/binary.d.ts.map +1 -1
- package/dist/fff-api.d.ts +10 -12
- package/dist/fff-api.d.ts.map +1 -1
- package/dist/ffi.d.ts +3 -3
- package/dist/ffi.d.ts.map +1 -1
- package/dist/index.cjs +40 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -5
- package/dist/index.js.map +1 -1
- package/dist/platform.d.ts.map +1 -1
- package/package.json +12 -11
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
*/
|
|
41
41
|
export { binaryExists, findBinary } from "./binary.js";
|
|
42
42
|
export { closeLibrary } from "./ffi.js";
|
|
43
|
-
export type { DbHealth, DirItem, DirSearchOptions, DirSearchResult, FileFinderApi, FileItem, GrepCursor, GrepMatch, GrepMode, GrepOptions, GrepResult, HealthCheck, InitOptions, Location, MixedItem, MixedSearchResult, MultiGrepOptions, Result, ScanProgress, Score, SearchOptions, SearchResult, WatchBatchCallback, WatchEvent, WatchEventKind, WatchOptions, WatchUnsubscribe, } from "./fff-api.js";
|
|
43
|
+
export type { DbHealth, DirItem, DirSearchOptions, DirSearchResult, FileFinderApi, FileItem, GrepCursor, GrepMatch, GrepMode, DefinitionMode, GrepOptions, GrepResult, HealthCheck, InitOptions, Location, MixedItem, MixedSearchResult, MultiGrepOptions, Result, ScanProgress, Score, SearchOptions, SearchResult, WatchBatchCallback, WatchEvent, WatchEventKind, WatchOptions, WatchUnsubscribe, } from "./fff-api.js";
|
|
44
44
|
export { err, ok } from "./fff-api.js";
|
|
45
45
|
export { FileFinder } from "./finder.js";
|
|
46
46
|
export { getLibExtension, getLibFilename, getNpmPackageName, getTriple, } from "./platform.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,SAAS,GACV,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,EACV,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,QAAQ,EACR,UAAU,EACV,SAAS,EACT,QAAQ,EACR,cAAc,EACd,WAAW,EACX,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,SAAS,GACV,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,8 @@ function getTriple() {
|
|
|
18
18
|
osName = detectLinuxLibc();
|
|
19
19
|
} else if (platform === "win32") {
|
|
20
20
|
osName = "pc-windows-msvc";
|
|
21
|
+
} else if (platform === "freebsd") {
|
|
22
|
+
osName = "unknown-freebsd";
|
|
21
23
|
} else {
|
|
22
24
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
23
25
|
}
|
|
@@ -121,7 +123,12 @@ function binaryExists() {
|
|
|
121
123
|
return findBinary() !== null;
|
|
122
124
|
}
|
|
123
125
|
function resolveFromNpmPackage() {
|
|
124
|
-
|
|
126
|
+
let packageName;
|
|
127
|
+
try {
|
|
128
|
+
packageName = getNpmPackageName();
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
125
132
|
try {
|
|
126
133
|
const require2 = createRequire(join(getPackageDir(), "package.json"));
|
|
127
134
|
const packageJsonPath = require2.resolve(`${packageName}/package.json`);
|
|
@@ -154,6 +161,13 @@ function isDevWorkspace() {
|
|
|
154
161
|
return existsSync(join(workspaceRoot, "Cargo.toml"));
|
|
155
162
|
}
|
|
156
163
|
function findBinary() {
|
|
164
|
+
const override = process.env["FFF_C_LIB"];
|
|
165
|
+
if (override) {
|
|
166
|
+
if (!existsSync(override)) {
|
|
167
|
+
throw new Error(`FFF_C_LIB points to a file that does not exist: ${override}`);
|
|
168
|
+
}
|
|
169
|
+
return override;
|
|
170
|
+
}
|
|
157
171
|
if (isDevWorkspace()) {
|
|
158
172
|
const binPath = join(getPackageDir(), "bin", getLibFilename());
|
|
159
173
|
if (existsSync(binPath)) return binPath;
|
|
@@ -194,6 +208,23 @@ function err(error) {
|
|
|
194
208
|
function createGrepCursor(offset) {
|
|
195
209
|
return { __brand: "GrepCursor", _offset: offset };
|
|
196
210
|
}
|
|
211
|
+
function definitionModeToInt(mode) {
|
|
212
|
+
switch (mode) {
|
|
213
|
+
case void 0:
|
|
214
|
+
case false:
|
|
215
|
+
case "off":
|
|
216
|
+
return 0;
|
|
217
|
+
case true:
|
|
218
|
+
case "classify":
|
|
219
|
+
return 1;
|
|
220
|
+
case "definition_only":
|
|
221
|
+
return 2;
|
|
222
|
+
case "usage_only":
|
|
223
|
+
return 3;
|
|
224
|
+
default:
|
|
225
|
+
return void 0;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
197
228
|
|
|
198
229
|
// src/ffi.ts
|
|
199
230
|
var LIBRARY_KEY = "fff_c";
|
|
@@ -1061,6 +1092,8 @@ function ffiSearchMixed(handle, query, currentFile, maxThreads, pageIndex, pageS
|
|
|
1061
1092
|
return parseMixedSearchResult(rawPtr);
|
|
1062
1093
|
}
|
|
1063
1094
|
function ffiLiveGrep(handle, query, mode, maxFileSize, maxMatchesPerFile, smartCase, fileOffset, pageLimit, timeBudgetMs, enforceTimeBudget, beforeContext, afterContext, classifyDefinitions) {
|
|
1095
|
+
const definitionMode = definitionModeToInt(classifyDefinitions);
|
|
1096
|
+
if (definitionMode === void 0) return err("Invalid classifyDefinitions mode");
|
|
1064
1097
|
loadLibrary();
|
|
1065
1098
|
const rawPtr = load({
|
|
1066
1099
|
library: LIBRARY_KEY,
|
|
@@ -1091,7 +1124,7 @@ function ffiLiveGrep(handle, query, mode, maxFileSize, maxMatchesPerFile, smartC
|
|
|
1091
1124
|
// before_context
|
|
1092
1125
|
DataType.U32,
|
|
1093
1126
|
// after_context
|
|
1094
|
-
DataType.
|
|
1127
|
+
DataType.U8
|
|
1095
1128
|
// classify_definitions
|
|
1096
1129
|
],
|
|
1097
1130
|
paramsValue: [
|
|
@@ -1107,13 +1140,15 @@ function ffiLiveGrep(handle, query, mode, maxFileSize, maxMatchesPerFile, smartC
|
|
|
1107
1140
|
enforceTimeBudget,
|
|
1108
1141
|
beforeContext,
|
|
1109
1142
|
afterContext,
|
|
1110
|
-
|
|
1143
|
+
definitionMode
|
|
1111
1144
|
],
|
|
1112
1145
|
freeResultMemory: false
|
|
1113
1146
|
});
|
|
1114
1147
|
return parseGrepResult(rawPtr);
|
|
1115
1148
|
}
|
|
1116
1149
|
function ffiMultiGrep(handle, patternsJoined, constraints, maxFileSize, maxMatchesPerFile, smartCase, fileOffset, pageLimit, timeBudgetMs, enforceTimeBudget, beforeContext, afterContext, classifyDefinitions) {
|
|
1150
|
+
const definitionMode = definitionModeToInt(classifyDefinitions);
|
|
1151
|
+
if (definitionMode === void 0) return err("Invalid classifyDefinitions mode");
|
|
1117
1152
|
loadLibrary();
|
|
1118
1153
|
const rawPtr = load({
|
|
1119
1154
|
library: LIBRARY_KEY,
|
|
@@ -1144,7 +1179,7 @@ function ffiMultiGrep(handle, patternsJoined, constraints, maxFileSize, maxMatch
|
|
|
1144
1179
|
// before_context
|
|
1145
1180
|
DataType.U32,
|
|
1146
1181
|
// after_context
|
|
1147
|
-
DataType.
|
|
1182
|
+
DataType.U8
|
|
1148
1183
|
// classify_definitions
|
|
1149
1184
|
],
|
|
1150
1185
|
paramsValue: [
|
|
@@ -1160,7 +1195,7 @@ function ffiMultiGrep(handle, patternsJoined, constraints, maxFileSize, maxMatch
|
|
|
1160
1195
|
enforceTimeBudget,
|
|
1161
1196
|
beforeContext,
|
|
1162
1197
|
afterContext,
|
|
1163
|
-
|
|
1198
|
+
definitionMode
|
|
1164
1199
|
],
|
|
1165
1200
|
freeResultMemory: false
|
|
1166
1201
|
});
|