From 2c3e28b8d1d04f4423b9b81301a9ebd9a895f68e Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Sun, 22 Feb 2026 22:37:45 +0000 Subject: [PATCH] fix: use Array.from for Map iteration (ES5 target compat) Co-Authored-By: Claude Opus 4.6 --- src/app/api/import/logseq/route.ts | 4 ++-- src/lib/logseq-format.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/api/import/logseq/route.ts b/src/app/api/import/logseq/route.ts index b2d075b..14da754 100644 --- a/src/app/api/import/logseq/route.ts +++ b/src/app/api/import/logseq/route.ts @@ -80,7 +80,7 @@ export async function POST(request: NextRequest) { // Phase 1: Extract assets const assetFiles = new Map(); // original path → storageKey - for (const [name, data] of entries) { + for (const [name, data] of Array.from(entries.entries())) { if (name.startsWith('assets/') && data.length > 0) { const assetName = name.replace('assets/', ''); const ext = path.extname(assetName); @@ -106,7 +106,7 @@ export async function POST(request: NextRequest) { // Phase 2: Parse pages const importedNotes: { filename: string; parsed: ReturnType; noteId?: string }[] = []; - for (const [name, data] of entries) { + for (const [name, data] of Array.from(entries.entries())) { if (name.startsWith('pages/') && name.endsWith('.md') && data.length > 0) { const filename = name.replace('pages/', ''); const content = data.toString('utf8'); diff --git a/src/lib/logseq-format.ts b/src/lib/logseq-format.ts index 83a1423..54f3357 100644 --- a/src/lib/logseq-format.ts +++ b/src/lib/logseq-format.ts @@ -123,8 +123,9 @@ export function logseqPageToNote(filename: string, content: string): ImportedNot cardType = value.trim(); } else if (key === 'tags') { // Parse #tag1, #tag2 - const tagMatches = value.matchAll(/#([a-zA-Z0-9_-]+)/g); - for (const m of tagMatches) { + const tagRegex = /#([a-zA-Z0-9_-]+)/g; + let m; + while ((m = tagRegex.exec(value)) !== null) { tags.push(m[1].toLowerCase()); } } else if (key === 'visibility') {