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:
parent
26602e4197
commit
2c3e28b8d1
|
|
@ -80,7 +80,7 @@ export async function POST(request: NextRequest) {
|
||||||
|
|
||||||
// Phase 1: Extract assets
|
// Phase 1: Extract assets
|
||||||
const assetFiles = new Map<string, string>(); // original path → storageKey
|
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) {
|
if (name.startsWith('assets/') && data.length > 0) {
|
||||||
const assetName = name.replace('assets/', '');
|
const assetName = name.replace('assets/', '');
|
||||||
const ext = path.extname(assetName);
|
const ext = path.extname(assetName);
|
||||||
|
|
@ -106,7 +106,7 @@ export async function POST(request: NextRequest) {
|
||||||
// Phase 2: Parse pages
|
// Phase 2: Parse pages
|
||||||
const importedNotes: { filename: string; parsed: ReturnType<typeof logseqPageToNote>; noteId?: string }[] = [];
|
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) {
|
if (name.startsWith('pages/') && name.endsWith('.md') && data.length > 0) {
|
||||||
const filename = name.replace('pages/', '');
|
const filename = name.replace('pages/', '');
|
||||||
const content = data.toString('utf8');
|
const content = data.toString('utf8');
|
||||||
|
|
|
||||||
|
|
@ -123,8 +123,9 @@ export function logseqPageToNote(filename: string, content: string): ImportedNot
|
||||||
cardType = value.trim();
|
cardType = value.trim();
|
||||||
} else if (key === 'tags') {
|
} else if (key === 'tags') {
|
||||||
// Parse #tag1, #tag2
|
// Parse #tag1, #tag2
|
||||||
const tagMatches = value.matchAll(/#([a-zA-Z0-9_-]+)/g);
|
const tagRegex = /#([a-zA-Z0-9_-]+)/g;
|
||||||
for (const m of tagMatches) {
|
let m;
|
||||||
|
while ((m = tagRegex.exec(value)) !== null) {
|
||||||
tags.push(m[1].toLowerCase());
|
tags.push(m[1].toLowerCase());
|
||||||
}
|
}
|
||||||
} else if (key === 'visibility') {
|
} else if (key === 'visibility') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue