Files
kucherenko__jscpd/fixtures/parse-errors-demo/valid.js
apk e286818c92 fix(tokenizer): keep oxc tokens for JS/TS files with recoverable parse errors
A JavaScript/TypeScript file with any parse diagnostic (a redeclaration,
a recoverable syntax error) was handed to the word-split fallback
tokenizer. Its tokens then never matched an oxc-tokenized file, so every
cross-file clone involving it vanished while its self-clones survived —
the symptom reported in #1023, where a second copy of a function in one
file made all a↔b clones disappear.

Tokens come from the lexer, not the parser: only `panicked` (or an empty
token stream) now triggers the fallback. Function extraction for
--similarity uses the partial AST on recoverable errors the same way.

Closes #1023.
2026-09-06 21:12:26 +02:00

12 lines
610 B
JavaScript

export async function saveProfile(profile, store, clock) {
const record = toRecord(profile);
record.updatedAt = clock.now();
record.version = (record.version || 0) + 1;
record.normalizedEmail = profile.email.trim().toLowerCase();
record.displayName = [profile.firstName, profile.lastName].filter(Boolean).join(" ");
await store.put("profiles", record.id, record);
await audit("save-profile", record.id, record.version, clock.now());
await notify(profile.email, "profile-updated", { version: record.version });
return { id: record.id, version: record.version, updatedAt: record.updatedAt };
}