seekstone 0.24.1 → 0.24.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.js +47 -31
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4017,6 +4017,25 @@ async function walkVault(vaultRoot2, opts = {}) {
|
|
|
4017
4017
|
import MiniSearch from "minisearch";
|
|
4018
4018
|
async function buildIndex(vaultRoot2, scope) {
|
|
4019
4019
|
const t0 = Date.now();
|
|
4020
|
+
const entries = await walkVault(vaultRoot2, scope);
|
|
4021
|
+
const files = [];
|
|
4022
|
+
await Promise.all(
|
|
4023
|
+
entries.filter((e) => e.kind === "note").map(async (entry) => {
|
|
4024
|
+
try {
|
|
4025
|
+
const raw = await readFile15(entry.absPath, "utf8");
|
|
4026
|
+
files.push({
|
|
4027
|
+
relPath: entry.relPath,
|
|
4028
|
+
raw,
|
|
4029
|
+
sizeBytes: entry.sizeBytes,
|
|
4030
|
+
mtimeMs: entry.mtimeMs
|
|
4031
|
+
});
|
|
4032
|
+
} catch {
|
|
4033
|
+
}
|
|
4034
|
+
})
|
|
4035
|
+
);
|
|
4036
|
+
return { ...indexNotes(files), buildMs: Date.now() - t0 };
|
|
4037
|
+
}
|
|
4038
|
+
function indexNotes(files) {
|
|
4020
4039
|
const index2 = new MiniSearch({
|
|
4021
4040
|
idField: "id",
|
|
4022
4041
|
fields: ["title", "body", "tags", "fmKeys"],
|
|
@@ -4027,40 +4046,37 @@ async function buildIndex(vaultRoot2, scope) {
|
|
|
4027
4046
|
prefix: true
|
|
4028
4047
|
}
|
|
4029
4048
|
});
|
|
4030
|
-
const entries = await walkVault(vaultRoot2, scope);
|
|
4031
|
-
const noteEntries = entries.filter((e) => e.kind === "note");
|
|
4032
4049
|
const docs = [];
|
|
4033
4050
|
const notes2 = /* @__PURE__ */ new Map();
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
try {
|
|
4037
|
-
const raw = await readFile15(entry.absPath, "utf8");
|
|
4038
|
-
const fm = parseFrontmatter(raw);
|
|
4039
|
-
const inlineTags = extractInlineTags(fm.body);
|
|
4040
|
-
const fmTags = frontmatterTags(fm.data);
|
|
4041
|
-
const allTags = [.../* @__PURE__ */ new Set([...inlineTags, ...fmTags])];
|
|
4042
|
-
const title = typeof fm.data?.title === "string" && fm.data.title ? fm.data.title : basename3(entry.relPath, extname4(entry.relPath));
|
|
4043
|
-
const doc = {
|
|
4044
|
-
id: entry.relPath,
|
|
4045
|
-
title,
|
|
4046
|
-
body: fm.body,
|
|
4047
|
-
tags: allTags.join(" "),
|
|
4048
|
-
fmKeys: fm.keys.join(" "),
|
|
4049
|
-
fm: fm.data,
|
|
4050
|
-
raw,
|
|
4051
|
-
tasks: extractTasks(raw),
|
|
4052
|
-
sizeBytes: entry.sizeBytes,
|
|
4053
|
-
mtimeMs: entry.mtimeMs
|
|
4054
|
-
};
|
|
4055
|
-
docs.push(doc);
|
|
4056
|
-
notes2.set(entry.relPath, doc);
|
|
4057
|
-
} catch {
|
|
4058
|
-
}
|
|
4059
|
-
})
|
|
4051
|
+
const sorted = [...files].sort(
|
|
4052
|
+
(a, b) => a.relPath < b.relPath ? -1 : a.relPath > b.relPath ? 1 : 0
|
|
4060
4053
|
);
|
|
4054
|
+
for (const file of sorted) {
|
|
4055
|
+
try {
|
|
4056
|
+
const fm = parseFrontmatter(file.raw);
|
|
4057
|
+
const inlineTags = extractInlineTags(fm.body);
|
|
4058
|
+
const fmTags = frontmatterTags(fm.data);
|
|
4059
|
+
const allTags = [.../* @__PURE__ */ new Set([...inlineTags, ...fmTags])];
|
|
4060
|
+
const title = typeof fm.data?.title === "string" && fm.data.title ? fm.data.title : basename3(file.relPath, extname4(file.relPath));
|
|
4061
|
+
const doc = {
|
|
4062
|
+
id: file.relPath,
|
|
4063
|
+
title,
|
|
4064
|
+
body: fm.body,
|
|
4065
|
+
tags: allTags.join(" "),
|
|
4066
|
+
fmKeys: fm.keys.join(" "),
|
|
4067
|
+
fm: fm.data,
|
|
4068
|
+
raw: file.raw,
|
|
4069
|
+
tasks: extractTasks(file.raw),
|
|
4070
|
+
sizeBytes: file.sizeBytes,
|
|
4071
|
+
mtimeMs: file.mtimeMs
|
|
4072
|
+
};
|
|
4073
|
+
docs.push(doc);
|
|
4074
|
+
notes2.set(file.relPath, doc);
|
|
4075
|
+
} catch {
|
|
4076
|
+
}
|
|
4077
|
+
}
|
|
4061
4078
|
index2.addAll(docs);
|
|
4062
|
-
|
|
4063
|
-
return { index: index2, notes: notes2, backlinks: backlinks2, buildMs: Date.now() - t0 };
|
|
4079
|
+
return { index: index2, notes: notes2, backlinks: buildBacklinks(notes2) };
|
|
4064
4080
|
}
|
|
4065
4081
|
function buildBacklinks(notes2) {
|
|
4066
4082
|
const result = /* @__PURE__ */ new Map();
|
|
@@ -6306,7 +6322,7 @@ function startWatcher(ctx2, log2, opts) {
|
|
|
6306
6322
|
}
|
|
6307
6323
|
|
|
6308
6324
|
// src/index.ts
|
|
6309
|
-
var VERSION = true ? "0.24.
|
|
6325
|
+
var VERSION = true ? "0.24.2" : "0.0.0-dev";
|
|
6310
6326
|
var intent = parseCliIntent(process.argv.slice(2));
|
|
6311
6327
|
if (intent === "version") {
|
|
6312
6328
|
process.stdout.write(`${VERSION}
|