@danielsimonjr/memoryjs 1.2.1 → 1.2.2
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/dist/index.cjs +5 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -5225,7 +5225,9 @@ declare function escapeCsvFormula(field: string | undefined | null): string;
|
|
|
5225
5225
|
*/
|
|
5226
5226
|
declare function validateFilePath(filePath: string, baseDir?: string): string;
|
|
5227
5227
|
/**
|
|
5228
|
-
* Default memory file path (in
|
|
5228
|
+
* Default memory file path (in current working directory).
|
|
5229
|
+
* Uses process.cwd() to ensure the path is relative to the consuming project,
|
|
5230
|
+
* not the library's installed location.
|
|
5229
5231
|
*/
|
|
5230
5232
|
declare const defaultMemoryPath: string;
|
|
5231
5233
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -5225,7 +5225,9 @@ declare function escapeCsvFormula(field: string | undefined | null): string;
|
|
|
5225
5225
|
*/
|
|
5226
5226
|
declare function validateFilePath(filePath: string, baseDir?: string): string;
|
|
5227
5227
|
/**
|
|
5228
|
-
* Default memory file path (in
|
|
5228
|
+
* Default memory file path (in current working directory).
|
|
5229
|
+
* Uses process.cwd() to ensure the path is relative to the consuming project,
|
|
5230
|
+
* not the library's installed location.
|
|
5229
5231
|
*/
|
|
5230
5232
|
declare const defaultMemoryPath: string;
|
|
5231
5233
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1704,7 +1704,6 @@ function getPaginationMeta(totalCount, offset = 0, limit = SEARCH_LIMITS.DEFAULT
|
|
|
1704
1704
|
// src/utils/entityUtils.ts
|
|
1705
1705
|
import { promises as fs2 } from "fs";
|
|
1706
1706
|
import path from "path";
|
|
1707
|
-
import { fileURLToPath } from "url";
|
|
1708
1707
|
function fnv1aHash(text) {
|
|
1709
1708
|
let hash = 2166136261;
|
|
1710
1709
|
for (let i = 0; i < text.length; i++) {
|
|
@@ -1965,20 +1964,13 @@ function validateFilePath(filePath, baseDir = process.cwd()) {
|
|
|
1965
1964
|
}
|
|
1966
1965
|
return finalNormalized;
|
|
1967
1966
|
}
|
|
1968
|
-
var defaultMemoryPath = path.join(
|
|
1969
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
1970
|
-
"../../memory.jsonl"
|
|
1971
|
-
);
|
|
1967
|
+
var defaultMemoryPath = path.join(process.cwd(), "memory.jsonl");
|
|
1972
1968
|
async function ensureMemoryFilePath() {
|
|
1973
1969
|
if (process.env.MEMORY_FILE_PATH) {
|
|
1974
|
-
const
|
|
1975
|
-
const validatedPath = validateFilePath(process.env.MEMORY_FILE_PATH, baseDir);
|
|
1970
|
+
const validatedPath = validateFilePath(process.env.MEMORY_FILE_PATH, process.cwd());
|
|
1976
1971
|
return validatedPath;
|
|
1977
1972
|
}
|
|
1978
|
-
const oldMemoryPath = path.join(
|
|
1979
|
-
path.dirname(fileURLToPath(import.meta.url)),
|
|
1980
|
-
"../../memory.json"
|
|
1981
|
-
);
|
|
1973
|
+
const oldMemoryPath = path.join(process.cwd(), "memory.json");
|
|
1982
1974
|
const newMemoryPath = defaultMemoryPath;
|
|
1983
1975
|
try {
|
|
1984
1976
|
await fs2.access(oldMemoryPath);
|
|
@@ -9874,7 +9866,7 @@ var BooleanSearch = class {
|
|
|
9874
9866
|
|
|
9875
9867
|
// src/search/FuzzySearch.ts
|
|
9876
9868
|
import workerpool4 from "@danielsimonjr/workerpool";
|
|
9877
|
-
import { fileURLToPath
|
|
9869
|
+
import { fileURLToPath } from "url";
|
|
9878
9870
|
import { dirname as dirname3, join as join3, sep } from "path";
|
|
9879
9871
|
var DEFAULT_FUZZY_THRESHOLD = 0.7;
|
|
9880
9872
|
var FUZZY_CACHE_MAX_SIZE = 100;
|
|
@@ -9886,7 +9878,7 @@ var FuzzySearch = class {
|
|
|
9886
9878
|
this.storage = storage;
|
|
9887
9879
|
this.useWorkerPool = options.useWorkerPool ?? true;
|
|
9888
9880
|
const currentFileUrl = import.meta.url;
|
|
9889
|
-
const currentDir = dirname3(
|
|
9881
|
+
const currentDir = dirname3(fileURLToPath(currentFileUrl));
|
|
9890
9882
|
const isRunningFromSrc = currentDir.includes(`${sep}src${sep}`);
|
|
9891
9883
|
if (isRunningFromSrc) {
|
|
9892
9884
|
const projectRoot = join3(currentDir, "..", "..");
|