dexin-content 0.1.0 → 0.1.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/collection.ts +2 -2
- package/core/frontmatter.ts +1 -1
- package/core/markdown.ts +1 -1
- package/package.json +1 -1
package/collection.ts
CHANGED
|
@@ -104,7 +104,7 @@ export function createMemorySource (files: Record<string, string>): SourceAdapte
|
|
|
104
104
|
list: async () => Object.keys(files).sort(),
|
|
105
105
|
read: async (rel) => {
|
|
106
106
|
if (!(rel in files)) throw new Error(`[MemorySource] Not found: ${rel}`)
|
|
107
|
-
return files[rel]
|
|
107
|
+
return files[rel]!
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -143,7 +143,7 @@ export async function discover (
|
|
|
143
143
|
const all = await source.list()
|
|
144
144
|
const files: ContentFile[] = []
|
|
145
145
|
for (const rel of all) {
|
|
146
|
-
const top = rel.split('/')[0]
|
|
146
|
+
const top = rel.split('/')[0]!
|
|
147
147
|
const col = byDir.get(top)
|
|
148
148
|
if (!col) {
|
|
149
149
|
throw new Error(
|
package/core/frontmatter.ts
CHANGED
|
@@ -39,7 +39,7 @@ export function splitFrontmatter (source: string): SplitResult {
|
|
|
39
39
|
const lines = rest.split('\n')
|
|
40
40
|
let closeIdx = -1
|
|
41
41
|
for (let i = 0; i < lines.length; i++) {
|
|
42
|
-
if (lines[i].trimEnd() === '---') {
|
|
42
|
+
if ((lines[i] ?? '').trimEnd() === '---') {
|
|
43
43
|
closeIdx = i
|
|
44
44
|
break
|
|
45
45
|
}
|
package/core/markdown.ts
CHANGED
|
@@ -192,7 +192,7 @@ function walkTable (n: MdNode, file: string): TableBlock {
|
|
|
192
192
|
const headers: TableCell[] = []
|
|
193
193
|
const rows: TableCell[][] = []
|
|
194
194
|
for (let i = 0; i < kids.length; i++) {
|
|
195
|
-
const row = kids[i]
|
|
195
|
+
const row = kids[i]!
|
|
196
196
|
const rowCells: TableCell[] = []
|
|
197
197
|
const cells = row.children ?? []
|
|
198
198
|
for (const cell of cells) rowCells.push(walkInlines(cell.children ?? [], file))
|
package/package.json
CHANGED