fix: use Array.from for Map iteration (ES5 target compat)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jeff Emmett 2026-02-22 22:37:45 +00:00
parent 26602e4197
commit 2c3e28b8d1
2 changed files with 5 additions and 4 deletions

View File

@ -80,7 +80,7 @@ export async function POST(request: NextRequest) {
// Phase 1: Extract assets
const assetFiles = new Map<string, string>(); // 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<typeof logseqPageToNote>; 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');

View File

@ -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') {