lens-content-processor 0.1.0 → 0.2.1
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/cli.js +5 -1
- package/dist/cli.js.map +1 -1
- package/dist/flattener/index.js +25 -7
- package/dist/flattener/index.js.map +1 -1
- package/dist/index.js +23 -2
- package/dist/index.js.map +1 -1
- package/dist/parser/learning-outcome.js +16 -1
- package/dist/parser/learning-outcome.js.map +1 -1
- package/dist/parser/lens.js +18 -0
- package/dist/parser/lens.js.map +1 -1
- package/dist/parser/wikilink.d.ts +28 -0
- package/dist/parser/wikilink.js +154 -0
- package/dist/parser/wikilink.js.map +1 -1
- package/package.json +1 -1
- package/dist/bundler/article.test.d.ts +0 -1
- package/dist/bundler/article.test.js +0 -212
- package/dist/bundler/article.test.js.map +0 -1
- package/dist/bundler/video.test.d.ts +0 -1
- package/dist/bundler/video.test.js +0 -95
- package/dist/bundler/video.test.js.map +0 -1
- package/dist/cli.test.d.ts +0 -1
- package/dist/cli.test.js +0 -45
- package/dist/cli.test.js.map +0 -1
- package/dist/flattener/index.test.d.ts +0 -1
- package/dist/flattener/index.test.js +0 -547
- package/dist/flattener/index.test.js.map +0 -1
- package/dist/fs/read-vault.test.d.ts +0 -1
- package/dist/fs/read-vault.test.js +0 -37
- package/dist/fs/read-vault.test.js.map +0 -1
- package/dist/parser/course.test.d.ts +0 -1
- package/dist/parser/course.test.js +0 -117
- package/dist/parser/course.test.js.map +0 -1
- package/dist/parser/frontmatter.test.d.ts +0 -1
- package/dist/parser/frontmatter.test.js +0 -54
- package/dist/parser/frontmatter.test.js.map +0 -1
- package/dist/parser/learning-outcome.test.d.ts +0 -1
- package/dist/parser/learning-outcome.test.js +0 -75
- package/dist/parser/learning-outcome.test.js.map +0 -1
- package/dist/parser/lens.test.d.ts +0 -1
- package/dist/parser/lens.test.js +0 -453
- package/dist/parser/lens.test.js.map +0 -1
- package/dist/parser/module.test.d.ts +0 -1
- package/dist/parser/module.test.js +0 -99
- package/dist/parser/module.test.js.map +0 -1
- package/dist/parser/sections.test.d.ts +0 -1
- package/dist/parser/sections.test.js +0 -297
- package/dist/parser/sections.test.js.map +0 -1
- package/dist/parser/wikilink.test.d.ts +0 -1
- package/dist/parser/wikilink.test.js +0 -76
- package/dist/parser/wikilink.test.js.map +0 -1
- package/dist/validator/field-typos.test.d.ts +0 -1
- package/dist/validator/field-typos.test.js +0 -41
- package/dist/validator/field-typos.test.js.map +0 -1
- package/dist/validator/field-values.test.d.ts +0 -1
- package/dist/validator/field-values.test.js +0 -45
- package/dist/validator/field-values.test.js.map +0 -1
- package/dist/validator/segment-fields.test.d.ts +0 -1
- package/dist/validator/segment-fields.test.js +0 -73
- package/dist/validator/segment-fields.test.js.map +0 -1
- package/dist/validator/standalone.test.d.ts +0 -1
- package/dist/validator/standalone.test.js +0 -190
- package/dist/validator/standalone.test.js.map +0 -1
- package/dist/validator/uuid.test.d.ts +0 -1
- package/dist/validator/uuid.test.js +0 -229
- package/dist/validator/uuid.test.js.map +0 -1
|
@@ -1,547 +0,0 @@
|
|
|
1
|
-
// src/flattener/index.test.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { flattenModule } from './index.js';
|
|
4
|
-
describe('flattenModule', () => {
|
|
5
|
-
it('resolves learning outcome references', () => {
|
|
6
|
-
// LO with 2 lenses should produce 2 sections (one per lens)
|
|
7
|
-
const files = new Map([
|
|
8
|
-
['modules/intro.md', `---
|
|
9
|
-
slug: intro
|
|
10
|
-
title: Intro
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Learning Outcome: Topic
|
|
14
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
15
|
-
`],
|
|
16
|
-
['Learning Outcomes/lo1.md', `---
|
|
17
|
-
id: 550e8400-e29b-41d4-a716-446655440001
|
|
18
|
-
---
|
|
19
|
-
|
|
20
|
-
## Lens:
|
|
21
|
-
source:: [[../Lenses/video-lens.md|Video Lens]]
|
|
22
|
-
|
|
23
|
-
## Lens:
|
|
24
|
-
source:: [[../Lenses/article-lens.md|Article Lens]]
|
|
25
|
-
`],
|
|
26
|
-
['Lenses/video-lens.md', `---
|
|
27
|
-
id: 550e8400-e29b-41d4-a716-446655440002
|
|
28
|
-
---
|
|
29
|
-
|
|
30
|
-
### Video: Introduction Video
|
|
31
|
-
source:: [[../video_transcripts/intro.md|Intro Video]]
|
|
32
|
-
|
|
33
|
-
#### Video-excerpt
|
|
34
|
-
from:: 0:00
|
|
35
|
-
to:: 1:00
|
|
36
|
-
`],
|
|
37
|
-
['Lenses/article-lens.md', `---
|
|
38
|
-
id: 550e8400-e29b-41d4-a716-446655440003
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
### Article: Deep Dive
|
|
42
|
-
source:: [[../articles/deep-dive.md|Article]]
|
|
43
|
-
|
|
44
|
-
#### Article-excerpt
|
|
45
|
-
from:: "Start here"
|
|
46
|
-
to:: "end here"
|
|
47
|
-
`],
|
|
48
|
-
['video_transcripts/intro.md', `---
|
|
49
|
-
title: Intro Video
|
|
50
|
-
channel: Test Channel
|
|
51
|
-
url: https://youtube.com/watch?v=abc123
|
|
52
|
-
---
|
|
53
|
-
|
|
54
|
-
0:00 - Welcome to the video.
|
|
55
|
-
1:00 - End of excerpt.
|
|
56
|
-
`],
|
|
57
|
-
['articles/deep-dive.md', `---
|
|
58
|
-
title: Deep Dive Article
|
|
59
|
-
author: Jane Doe
|
|
60
|
-
sourceUrl: https://example.com/article
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
Start here with some content and end here.
|
|
64
|
-
`],
|
|
65
|
-
]);
|
|
66
|
-
const result = flattenModule('modules/intro.md', files);
|
|
67
|
-
expect(result.module).toBeDefined();
|
|
68
|
-
expect(result.module?.slug).toBe('intro');
|
|
69
|
-
expect(result.module?.title).toBe('Intro');
|
|
70
|
-
expect(result.errors).toHaveLength(0);
|
|
71
|
-
// Each lens should become its own section
|
|
72
|
-
expect(result.module?.sections).toHaveLength(2);
|
|
73
|
-
// First section: video lens
|
|
74
|
-
expect(result.module?.sections[0].type).toBe('lens-video');
|
|
75
|
-
expect(result.module?.sections[0].learningOutcomeId).toBe('550e8400-e29b-41d4-a716-446655440001');
|
|
76
|
-
expect(result.module?.sections[0].meta.title).toBe('Intro Video');
|
|
77
|
-
expect(result.module?.sections[0].meta.channel).toBe('Test Channel');
|
|
78
|
-
// Second section: article lens
|
|
79
|
-
expect(result.module?.sections[1].type).toBe('lens-article');
|
|
80
|
-
expect(result.module?.sections[1].learningOutcomeId).toBe('550e8400-e29b-41d4-a716-446655440001');
|
|
81
|
-
expect(result.module?.sections[1].meta.title).toBe('Deep Dive Article');
|
|
82
|
-
expect(result.module?.sections[1].meta.author).toBe('Jane Doe');
|
|
83
|
-
});
|
|
84
|
-
it('returns error for missing reference', () => {
|
|
85
|
-
const files = new Map([
|
|
86
|
-
['modules/broken.md', `---
|
|
87
|
-
slug: broken
|
|
88
|
-
title: Broken
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
# Learning Outcome: Missing
|
|
92
|
-
source:: [[../Learning Outcomes/nonexistent.md|Missing]]
|
|
93
|
-
`],
|
|
94
|
-
]);
|
|
95
|
-
const result = flattenModule('modules/broken.md', files);
|
|
96
|
-
expect(result.errors.length).toBeGreaterThan(0);
|
|
97
|
-
expect(result.errors[0].message).toContain('not found');
|
|
98
|
-
// Module should still be returned for partial success (with empty sections)
|
|
99
|
-
expect(result.module).toBeDefined();
|
|
100
|
-
expect(result.module?.slug).toBe('broken');
|
|
101
|
-
expect(result.module?.sections).toHaveLength(0);
|
|
102
|
-
});
|
|
103
|
-
it('resolves article excerpt references', () => {
|
|
104
|
-
const files = new Map([
|
|
105
|
-
['modules/reading.md', `---
|
|
106
|
-
slug: reading
|
|
107
|
-
title: Reading Module
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
# Learning Outcome: Reading Topic
|
|
111
|
-
source:: [[../Learning Outcomes/lo-reading.md|Reading LO]]
|
|
112
|
-
`],
|
|
113
|
-
['Learning Outcomes/lo-reading.md', `---
|
|
114
|
-
id: 550e8400-e29b-41d4-a716-446655440010
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
## Lens: Article Lens
|
|
118
|
-
source:: [[../Lenses/lens-article.md|Article Lens]]
|
|
119
|
-
`],
|
|
120
|
-
['Lenses/lens-article.md', `---
|
|
121
|
-
id: 550e8400-e29b-41d4-a716-446655440011
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
### Article: Deep Dive
|
|
125
|
-
source:: [[../articles/sample.md|Sample Article]]
|
|
126
|
-
|
|
127
|
-
#### Article-excerpt
|
|
128
|
-
from:: "The key insight"
|
|
129
|
-
to:: "this concept."
|
|
130
|
-
`],
|
|
131
|
-
['articles/sample.md', `# Sample Article
|
|
132
|
-
|
|
133
|
-
Introduction paragraph.
|
|
134
|
-
|
|
135
|
-
The key insight is that AI alignment requires careful
|
|
136
|
-
consideration of human values. Understanding
|
|
137
|
-
this concept.
|
|
138
|
-
|
|
139
|
-
Conclusion.
|
|
140
|
-
`],
|
|
141
|
-
]);
|
|
142
|
-
const result = flattenModule('modules/reading.md', files);
|
|
143
|
-
expect(result.module).toBeDefined();
|
|
144
|
-
expect(result.errors).toHaveLength(0);
|
|
145
|
-
expect(result.module?.sections[0].type).toBe('lens-article');
|
|
146
|
-
expect(result.module?.sections[0].segments[0].type).toBe('article-excerpt');
|
|
147
|
-
const excerpt = result.module?.sections[0].segments[0];
|
|
148
|
-
expect(excerpt.content).toContain('AI alignment');
|
|
149
|
-
});
|
|
150
|
-
it('resolves video excerpt references', () => {
|
|
151
|
-
const files = new Map([
|
|
152
|
-
['modules/video.md', `---
|
|
153
|
-
slug: video
|
|
154
|
-
title: Video Module
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
# Learning Outcome: Video Topic
|
|
158
|
-
source:: [[../Learning Outcomes/lo-video.md|Video LO]]
|
|
159
|
-
`],
|
|
160
|
-
['Learning Outcomes/lo-video.md', `---
|
|
161
|
-
id: 550e8400-e29b-41d4-a716-446655440020
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
## Lens: Video Lens
|
|
165
|
-
source:: [[../Lenses/lens-video.md|Video Lens]]
|
|
166
|
-
`],
|
|
167
|
-
['Lenses/lens-video.md', `---
|
|
168
|
-
id: 550e8400-e29b-41d4-a716-446655440021
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
### Video: Expert Interview
|
|
172
|
-
source:: [[../video_transcripts/interview.md|Interview]]
|
|
173
|
-
|
|
174
|
-
#### Video-excerpt
|
|
175
|
-
from:: 1:30
|
|
176
|
-
to:: 2:00
|
|
177
|
-
`],
|
|
178
|
-
['video_transcripts/interview.md', `0:00 - Welcome to the video.
|
|
179
|
-
0:30 - Today we discuss AI safety.
|
|
180
|
-
1:00 - Let's start with basics.
|
|
181
|
-
1:30 - The first key point is alignment.
|
|
182
|
-
2:00 - Moving on to the next topic.
|
|
183
|
-
2:30 - More content here.
|
|
184
|
-
`],
|
|
185
|
-
]);
|
|
186
|
-
const result = flattenModule('modules/video.md', files);
|
|
187
|
-
expect(result.module).toBeDefined();
|
|
188
|
-
expect(result.errors).toHaveLength(0);
|
|
189
|
-
expect(result.module?.sections[0].type).toBe('lens-video');
|
|
190
|
-
expect(result.module?.sections[0].segments[0].type).toBe('video-excerpt');
|
|
191
|
-
const excerpt = result.module?.sections[0].segments[0];
|
|
192
|
-
expect(excerpt.from).toBe(90); // 1:30 = 90 seconds
|
|
193
|
-
expect(excerpt.to).toBe(120); // 2:00 = 120 seconds
|
|
194
|
-
expect(excerpt.transcript).toContain('alignment');
|
|
195
|
-
});
|
|
196
|
-
it('handles missing lens file gracefully', () => {
|
|
197
|
-
const files = new Map([
|
|
198
|
-
['modules/broken-lens.md', `---
|
|
199
|
-
slug: broken-lens
|
|
200
|
-
title: Broken Lens
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
# Learning Outcome: Topic
|
|
204
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
205
|
-
`],
|
|
206
|
-
['Learning Outcomes/lo1.md', `---
|
|
207
|
-
id: 550e8400-e29b-41d4-a716-446655440001
|
|
208
|
-
---
|
|
209
|
-
|
|
210
|
-
## Lens: Missing Lens
|
|
211
|
-
source:: [[../Lenses/nonexistent.md|Missing]]
|
|
212
|
-
`],
|
|
213
|
-
]);
|
|
214
|
-
const result = flattenModule('modules/broken-lens.md', files);
|
|
215
|
-
expect(result.errors.length).toBeGreaterThan(0);
|
|
216
|
-
expect(result.errors.some(e => e.message.includes('not found'))).toBe(true);
|
|
217
|
-
});
|
|
218
|
-
it('handles optional learning outcomes', () => {
|
|
219
|
-
const files = new Map([
|
|
220
|
-
['modules/optional.md', `---
|
|
221
|
-
slug: optional
|
|
222
|
-
title: Optional Module
|
|
223
|
-
---
|
|
224
|
-
|
|
225
|
-
# Learning Outcome: Required Topic
|
|
226
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
227
|
-
|
|
228
|
-
# Learning Outcome: Optional Topic
|
|
229
|
-
source:: [[../Learning Outcomes/lo2.md|LO2]]
|
|
230
|
-
optional:: true
|
|
231
|
-
`],
|
|
232
|
-
['Learning Outcomes/lo1.md', `---
|
|
233
|
-
id: 550e8400-e29b-41d4-a716-446655440001
|
|
234
|
-
---
|
|
235
|
-
|
|
236
|
-
## Lens: Lens 1
|
|
237
|
-
source:: [[../Lenses/lens1.md|Lens]]
|
|
238
|
-
`],
|
|
239
|
-
['Learning Outcomes/lo2.md', `---
|
|
240
|
-
id: 550e8400-e29b-41d4-a716-446655440002
|
|
241
|
-
---
|
|
242
|
-
|
|
243
|
-
## Lens: Lens 2
|
|
244
|
-
source:: [[../Lenses/lens2.md|Lens]]
|
|
245
|
-
`],
|
|
246
|
-
['Lenses/lens1.md', `---
|
|
247
|
-
id: 550e8400-e29b-41d4-a716-446655440010
|
|
248
|
-
---
|
|
249
|
-
|
|
250
|
-
### Text: Content 1
|
|
251
|
-
|
|
252
|
-
#### Text
|
|
253
|
-
content:: First content.
|
|
254
|
-
`],
|
|
255
|
-
['Lenses/lens2.md', `---
|
|
256
|
-
id: 550e8400-e29b-41d4-a716-446655440011
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
### Text: Content 2
|
|
260
|
-
|
|
261
|
-
#### Text
|
|
262
|
-
content:: Second content.
|
|
263
|
-
`],
|
|
264
|
-
]);
|
|
265
|
-
const result = flattenModule('modules/optional.md', files);
|
|
266
|
-
expect(result.module).toBeDefined();
|
|
267
|
-
expect(result.module?.sections).toHaveLength(2);
|
|
268
|
-
expect(result.module?.sections[0].optional).toBe(false);
|
|
269
|
-
expect(result.module?.sections[1].optional).toBe(true);
|
|
270
|
-
});
|
|
271
|
-
it('flattens Page section with ## Text content segments', () => {
|
|
272
|
-
const files = new Map([
|
|
273
|
-
['modules/page-test.md', `---
|
|
274
|
-
slug: page-test
|
|
275
|
-
title: Page Test Module
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
# Page: Welcome
|
|
279
|
-
id:: d1e2f3a4-5678-90ab-cdef-1234567890ab
|
|
280
|
-
|
|
281
|
-
## Text
|
|
282
|
-
content::
|
|
283
|
-
This is the welcome text.
|
|
284
|
-
It spans multiple lines.
|
|
285
|
-
`],
|
|
286
|
-
]);
|
|
287
|
-
const result = flattenModule('modules/page-test.md', files);
|
|
288
|
-
expect(result.module).toBeDefined();
|
|
289
|
-
expect(result.module?.sections).toHaveLength(1);
|
|
290
|
-
expect(result.module?.sections[0].type).toBe('page');
|
|
291
|
-
expect(result.module?.sections[0].contentId).toBe('d1e2f3a4-5678-90ab-cdef-1234567890ab');
|
|
292
|
-
expect(result.module?.sections[0].segments).toHaveLength(1);
|
|
293
|
-
expect(result.module?.sections[0].segments[0].type).toBe('text');
|
|
294
|
-
const textSegment = result.module?.sections[0].segments[0];
|
|
295
|
-
expect(textSegment.content).toContain('welcome text');
|
|
296
|
-
expect(textSegment.content).toContain('multiple lines');
|
|
297
|
-
});
|
|
298
|
-
it('flattens Page section with multiple ## Text subsections', () => {
|
|
299
|
-
const files = new Map([
|
|
300
|
-
['modules/multi-text.md', `---
|
|
301
|
-
slug: multi-text
|
|
302
|
-
title: Multi Text Module
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
# Page: Introduction
|
|
306
|
-
id:: aaaa-bbbb-cccc-dddd
|
|
307
|
-
|
|
308
|
-
## Text
|
|
309
|
-
content::
|
|
310
|
-
First paragraph of text.
|
|
311
|
-
|
|
312
|
-
## Text
|
|
313
|
-
content::
|
|
314
|
-
Second paragraph of text.
|
|
315
|
-
`],
|
|
316
|
-
]);
|
|
317
|
-
const result = flattenModule('modules/multi-text.md', files);
|
|
318
|
-
expect(result.module).toBeDefined();
|
|
319
|
-
expect(result.module?.sections).toHaveLength(1);
|
|
320
|
-
expect(result.module?.sections[0].segments).toHaveLength(2);
|
|
321
|
-
const seg0 = result.module?.sections[0].segments[0];
|
|
322
|
-
const seg1 = result.module?.sections[0].segments[1];
|
|
323
|
-
expect(seg0.content).toContain('First paragraph');
|
|
324
|
-
expect(seg1.content).toContain('Second paragraph');
|
|
325
|
-
});
|
|
326
|
-
it('flattens Uncategorized section with Lens references', () => {
|
|
327
|
-
const files = new Map([
|
|
328
|
-
['modules/test.md', `---
|
|
329
|
-
slug: test
|
|
330
|
-
title: Test
|
|
331
|
-
---
|
|
332
|
-
|
|
333
|
-
# Uncategorized:
|
|
334
|
-
## Lens:
|
|
335
|
-
source:: [[../Lenses/lens1.md|Lens 1]]
|
|
336
|
-
`],
|
|
337
|
-
['Lenses/lens1.md', `---
|
|
338
|
-
id: lens-1-id
|
|
339
|
-
---
|
|
340
|
-
|
|
341
|
-
### Text: Content
|
|
342
|
-
|
|
343
|
-
#### Text
|
|
344
|
-
content:: This is lens content.
|
|
345
|
-
`],
|
|
346
|
-
]);
|
|
347
|
-
const result = flattenModule('modules/test.md', files);
|
|
348
|
-
expect(result.module?.sections).toHaveLength(1);
|
|
349
|
-
expect(result.module?.sections[0].segments[0].content).toBe('This is lens content.');
|
|
350
|
-
});
|
|
351
|
-
it('extracts article metadata into section meta', () => {
|
|
352
|
-
const files = new Map([
|
|
353
|
-
['modules/test.md', `---
|
|
354
|
-
slug: test
|
|
355
|
-
title: Test
|
|
356
|
-
---
|
|
357
|
-
|
|
358
|
-
# Learning Outcome: Read Article
|
|
359
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
360
|
-
`],
|
|
361
|
-
['Learning Outcomes/lo1.md', `---
|
|
362
|
-
id: lo-id
|
|
363
|
-
---
|
|
364
|
-
|
|
365
|
-
## Lens:
|
|
366
|
-
source:: [[../Lenses/article-lens.md|Lens]]
|
|
367
|
-
`],
|
|
368
|
-
['Lenses/article-lens.md', `---
|
|
369
|
-
id: lens-id
|
|
370
|
-
---
|
|
371
|
-
|
|
372
|
-
### Article: Good Article
|
|
373
|
-
source:: [[../articles/test-article.md|Article]]
|
|
374
|
-
|
|
375
|
-
#### Article-excerpt
|
|
376
|
-
from:: "Start here"
|
|
377
|
-
to:: "End here"
|
|
378
|
-
`],
|
|
379
|
-
['articles/test-article.md', `---
|
|
380
|
-
title: The Article Title
|
|
381
|
-
author: John Doe
|
|
382
|
-
sourceUrl: https://example.com/article
|
|
383
|
-
---
|
|
384
|
-
|
|
385
|
-
Start here with some content. End here with more.
|
|
386
|
-
`],
|
|
387
|
-
]);
|
|
388
|
-
const result = flattenModule('modules/test.md', files);
|
|
389
|
-
expect(result.module?.sections[0].meta.title).toBe('The Article Title');
|
|
390
|
-
expect(result.module?.sections[0].meta.author).toBe('John Doe');
|
|
391
|
-
expect(result.module?.sections[0].meta.sourceUrl).toBe('https://example.com/article');
|
|
392
|
-
});
|
|
393
|
-
it('extracts video metadata into section meta', () => {
|
|
394
|
-
const files = new Map([
|
|
395
|
-
['modules/test.md', `---
|
|
396
|
-
slug: test
|
|
397
|
-
title: Test
|
|
398
|
-
---
|
|
399
|
-
|
|
400
|
-
# Learning Outcome: Watch Video
|
|
401
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
402
|
-
`],
|
|
403
|
-
['Learning Outcomes/lo1.md', `---
|
|
404
|
-
id: lo-id
|
|
405
|
-
---
|
|
406
|
-
|
|
407
|
-
## Lens:
|
|
408
|
-
source:: [[../Lenses/video-lens.md|Lens]]
|
|
409
|
-
`],
|
|
410
|
-
['Lenses/video-lens.md', `---
|
|
411
|
-
id: lens-id
|
|
412
|
-
---
|
|
413
|
-
|
|
414
|
-
### Video: Good Video
|
|
415
|
-
source:: [[../video_transcripts/test-video.md|Video]]
|
|
416
|
-
|
|
417
|
-
#### Video-excerpt
|
|
418
|
-
from:: 0:00
|
|
419
|
-
to:: 5:00
|
|
420
|
-
`],
|
|
421
|
-
['video_transcripts/test-video.md', `---
|
|
422
|
-
title: The Video Title
|
|
423
|
-
channel: Kurzgesagt
|
|
424
|
-
url: https://youtube.com/watch?v=abc123
|
|
425
|
-
---
|
|
426
|
-
|
|
427
|
-
0:00 - Start of video content.
|
|
428
|
-
5:00 - End of excerpt.
|
|
429
|
-
`],
|
|
430
|
-
]);
|
|
431
|
-
const result = flattenModule('modules/test.md', files);
|
|
432
|
-
expect(result.module?.sections[0].meta.title).toBe('The Video Title');
|
|
433
|
-
expect(result.module?.sections[0].meta.channel).toBe('Kurzgesagt');
|
|
434
|
-
});
|
|
435
|
-
it('sets section contentId from lens frontmatter id', () => {
|
|
436
|
-
const files = new Map([
|
|
437
|
-
['modules/test.md', `---
|
|
438
|
-
slug: test
|
|
439
|
-
title: Test
|
|
440
|
-
---
|
|
441
|
-
|
|
442
|
-
# Learning Outcome: Topic
|
|
443
|
-
source:: [[../Learning Outcomes/lo1.md|LO1]]
|
|
444
|
-
`],
|
|
445
|
-
['Learning Outcomes/lo1.md', `---
|
|
446
|
-
id: lo-id
|
|
447
|
-
---
|
|
448
|
-
|
|
449
|
-
## Lens:
|
|
450
|
-
source:: [[../Lenses/lens1.md|Lens]]
|
|
451
|
-
`],
|
|
452
|
-
['Lenses/lens1.md', `---
|
|
453
|
-
id: 3dd47fce-a0fe-4e03-916d-a160fe697dd0
|
|
454
|
-
---
|
|
455
|
-
|
|
456
|
-
### Text: Content
|
|
457
|
-
|
|
458
|
-
#### Text
|
|
459
|
-
content:: Some content.
|
|
460
|
-
`],
|
|
461
|
-
]);
|
|
462
|
-
const result = flattenModule('modules/test.md', files);
|
|
463
|
-
expect(result.module?.sections[0].contentId).toBe('3dd47fce-a0fe-4e03-916d-a160fe697dd0');
|
|
464
|
-
});
|
|
465
|
-
it('flattens Uncategorized section with multiline source fields', () => {
|
|
466
|
-
// Bug: when source:: has no inline value and the wikilink is on the next line,
|
|
467
|
-
// the lens refs aren't being collected properly because the field value isn't
|
|
468
|
-
// finalized before checking if source exists.
|
|
469
|
-
const files = new Map([
|
|
470
|
-
['modules/test.md', `---
|
|
471
|
-
slug: test
|
|
472
|
-
title: Test
|
|
473
|
-
---
|
|
474
|
-
|
|
475
|
-
# Uncategorized:
|
|
476
|
-
## Lens:
|
|
477
|
-
source::
|
|
478
|
-
![[../Lenses/lens1.md]]
|
|
479
|
-
|
|
480
|
-
## Lens:
|
|
481
|
-
source::
|
|
482
|
-
![[../Lenses/lens2.md]]
|
|
483
|
-
`],
|
|
484
|
-
['Lenses/lens1.md', `---
|
|
485
|
-
id: lens-1-id
|
|
486
|
-
---
|
|
487
|
-
|
|
488
|
-
### Text: Content 1
|
|
489
|
-
|
|
490
|
-
#### Text
|
|
491
|
-
content:: First lens content.
|
|
492
|
-
`],
|
|
493
|
-
['Lenses/lens2.md', `---
|
|
494
|
-
id: lens-2-id
|
|
495
|
-
---
|
|
496
|
-
|
|
497
|
-
### Text: Content 2
|
|
498
|
-
|
|
499
|
-
#### Text
|
|
500
|
-
content:: Second lens content.
|
|
501
|
-
`],
|
|
502
|
-
]);
|
|
503
|
-
const result = flattenModule('modules/test.md', files);
|
|
504
|
-
// Each lens should become its own section
|
|
505
|
-
expect(result.errors).toHaveLength(0);
|
|
506
|
-
expect(result.module?.sections).toHaveLength(2);
|
|
507
|
-
expect(result.module?.sections[0].segments).toHaveLength(1);
|
|
508
|
-
expect(result.module?.sections[1].segments).toHaveLength(1);
|
|
509
|
-
expect((result.module?.sections[0].segments[0]).content).toBe('First lens content.');
|
|
510
|
-
expect((result.module?.sections[1].segments[0]).content).toBe('Second lens content.');
|
|
511
|
-
});
|
|
512
|
-
it('detects circular reference and returns error', () => {
|
|
513
|
-
// Create a cycle: Module -> LO-A -> Lens-B -> (references back to LO-A)
|
|
514
|
-
// The lens has an article section that points back to the LO file
|
|
515
|
-
const files = new Map([
|
|
516
|
-
['modules/circular.md', `---
|
|
517
|
-
slug: circular
|
|
518
|
-
title: Circular
|
|
519
|
-
---
|
|
520
|
-
|
|
521
|
-
# Learning Outcome: Loop
|
|
522
|
-
source:: [[../Learning Outcomes/lo-a.md|LO A]]
|
|
523
|
-
`],
|
|
524
|
-
['Learning Outcomes/lo-a.md', `---
|
|
525
|
-
id: lo-a-id
|
|
526
|
-
---
|
|
527
|
-
|
|
528
|
-
## Lens:
|
|
529
|
-
source:: [[../Lenses/lens-b.md|Lens B]]
|
|
530
|
-
`],
|
|
531
|
-
['Lenses/lens-b.md', `---
|
|
532
|
-
id: lens-b-id
|
|
533
|
-
---
|
|
534
|
-
|
|
535
|
-
### Article: Back to LO
|
|
536
|
-
source:: [[../Learning Outcomes/lo-a.md|Back to A]]
|
|
537
|
-
|
|
538
|
-
#### Article-excerpt
|
|
539
|
-
from:: "Start"
|
|
540
|
-
to:: "End"
|
|
541
|
-
`],
|
|
542
|
-
]);
|
|
543
|
-
const result = flattenModule('modules/circular.md', files);
|
|
544
|
-
expect(result.errors.some(e => e.message.toLowerCase().includes('circular'))).toBe(true);
|
|
545
|
-
});
|
|
546
|
-
});
|
|
547
|
-
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/flattener/index.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9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E;;;;;;;CAO7B,CAAC;YACI,CAAC,2BAA2B,EAAE;;;;;;CAMnC,CAAC;YACI,CAAC,kBAAkB,EAAE;;;;;;;;;;CAU1B,CAAC;SACG,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,aAAa,CAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;QAE3D,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// src/fs/read-vault.test.ts
|
|
2
|
-
import { describe, it, expect } from 'vitest';
|
|
3
|
-
import { readVaultFiles } from './read-vault.js';
|
|
4
|
-
import { join } from 'path';
|
|
5
|
-
import { mkdtempSync, rmSync } from 'fs';
|
|
6
|
-
import { tmpdir } from 'os';
|
|
7
|
-
describe('readVaultFiles', () => {
|
|
8
|
-
it('reads all .md files from fixture directory', async () => {
|
|
9
|
-
const fixturesDir = join(import.meta.dirname, '../../fixtures/valid/minimal-module/input');
|
|
10
|
-
const files = await readVaultFiles(fixturesDir);
|
|
11
|
-
expect(files.has('modules/intro.md')).toBe(true);
|
|
12
|
-
expect(files.get('modules/intro.md')).toContain('slug: intro');
|
|
13
|
-
});
|
|
14
|
-
it('reads files from nested directories with correct relative paths', async () => {
|
|
15
|
-
const fixturesDir = join(import.meta.dirname, '../../fixtures/golden/actual-content/input');
|
|
16
|
-
const files = await readVaultFiles(fixturesDir);
|
|
17
|
-
// Should have files in nested paths like "modules/intro.md", "Lenses/..."
|
|
18
|
-
const paths = Array.from(files.keys());
|
|
19
|
-
expect(paths.some(p => p.includes('/'))).toBe(true);
|
|
20
|
-
// Paths should NOT start with leading slash
|
|
21
|
-
expect(paths.every(p => !p.startsWith('/'))).toBe(true);
|
|
22
|
-
});
|
|
23
|
-
it('returns empty map for directory with no .md files', async () => {
|
|
24
|
-
const tempDir = mkdtempSync(join(tmpdir(), 'empty-vault-'));
|
|
25
|
-
try {
|
|
26
|
-
const files = await readVaultFiles(tempDir);
|
|
27
|
-
expect(files.size).toBe(0);
|
|
28
|
-
}
|
|
29
|
-
finally {
|
|
30
|
-
rmSync(tempDir, { recursive: true });
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
it('throws descriptive error for non-existent directory', async () => {
|
|
34
|
-
await expect(readVaultFiles('/nonexistent/path')).rejects.toThrow(/ENOENT|no such file/i);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=read-vault.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"read-vault.test.js","sourceRoot":"","sources":["../../src/fs/read-vault.test.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAE5B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;QAC1D,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,2CAA2C,CAAC,CAAC;QAE3F,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;QAEhD,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CA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