lat.md 0.4.2 → 0.4.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/dist/src/lattice.js +7 -21
- package/dist/src/walk.d.ts +0 -4
- package/dist/src/walk.js +1 -17
- package/package.json +1 -1
package/dist/src/lattice.js
CHANGED
|
@@ -131,28 +131,14 @@ export function parseSections(filePath, content, latticeDir) {
|
|
|
131
131
|
}
|
|
132
132
|
return roots;
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (cached)
|
|
141
|
-
return cached;
|
|
134
|
+
export async function loadAllSections(latticeDir) {
|
|
135
|
+
const files = await listLatticeFiles(latticeDir);
|
|
136
|
+
const all = [];
|
|
137
|
+
for (const file of files) {
|
|
138
|
+
const content = await readFile(file, 'utf-8');
|
|
139
|
+
all.push(...parseSections(file, content, latticeDir));
|
|
142
140
|
}
|
|
143
|
-
|
|
144
|
-
const files = await listLatticeFiles(latticeDir);
|
|
145
|
-
const all = [];
|
|
146
|
-
for (const file of files) {
|
|
147
|
-
const content = await readFile(file, 'utf-8');
|
|
148
|
-
all.push(...parseSections(file, content, latticeDir));
|
|
149
|
-
}
|
|
150
|
-
return all;
|
|
151
|
-
})();
|
|
152
|
-
if (!noCache) {
|
|
153
|
-
sectionsCache.set(key, result);
|
|
154
|
-
}
|
|
155
|
-
return result;
|
|
141
|
+
return all;
|
|
156
142
|
}
|
|
157
143
|
export function flattenSections(sections) {
|
|
158
144
|
const result = [];
|
package/dist/src/walk.d.ts
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
* Walk a directory tree respecting .gitignore rules. Returns relative paths
|
|
3
3
|
* of all non-ignored files, excluding .git/ and dotfiles (e.g. .gitignore).
|
|
4
4
|
*
|
|
5
|
-
* Results are memoized by resolved directory path — safe because CLI commands
|
|
6
|
-
* don't modify the filesystem during a run. Set _LAT_TEST_DISABLE_FS_CACHE=1
|
|
7
|
-
* to bypass caching in tests that mutate the filesystem mid-run.
|
|
8
|
-
*
|
|
9
5
|
* This is the single entry point for all directory walking in lat.md — both
|
|
10
6
|
* code-ref scanning and lat.md/ index validation use it so .gitignore rules
|
|
11
7
|
* are consistently honored.
|
package/dist/src/walk.js
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
1
|
// @ts-expect-error -- no type declarations
|
|
3
2
|
import walk from 'ignore-walk';
|
|
4
|
-
const cache = new Map();
|
|
5
3
|
/**
|
|
6
4
|
* Walk a directory tree respecting .gitignore rules. Returns relative paths
|
|
7
5
|
* of all non-ignored files, excluding .git/ and dotfiles (e.g. .gitignore).
|
|
8
6
|
*
|
|
9
|
-
* Results are memoized by resolved directory path — safe because CLI commands
|
|
10
|
-
* don't modify the filesystem during a run. Set _LAT_TEST_DISABLE_FS_CACHE=1
|
|
11
|
-
* to bypass caching in tests that mutate the filesystem mid-run.
|
|
12
|
-
*
|
|
13
7
|
* This is the single entry point for all directory walking in lat.md — both
|
|
14
8
|
* code-ref scanning and lat.md/ index validation use it so .gitignore rules
|
|
15
9
|
* are consistently honored.
|
|
16
10
|
*/
|
|
17
11
|
export function walkEntries(dir) {
|
|
18
|
-
|
|
19
|
-
if (!noCache) {
|
|
20
|
-
const cached = cache.get(resolve(dir));
|
|
21
|
-
if (cached)
|
|
22
|
-
return cached;
|
|
23
|
-
}
|
|
24
|
-
const result = walk({
|
|
12
|
+
return walk({
|
|
25
13
|
path: dir,
|
|
26
14
|
ignoreFiles: ['.gitignore'],
|
|
27
15
|
}).then((entries) => entries.filter((e) => !e.startsWith('.git/') && !e.startsWith('.')));
|
|
28
|
-
if (!noCache) {
|
|
29
|
-
cache.set(resolve(dir), result);
|
|
30
|
-
}
|
|
31
|
-
return result;
|
|
32
16
|
}
|