fix: make fileTrie last-write-wins; warn on slug collisions

This commit is contained in:
saberzero1
2026-04-10 21:14:23 +02:00
parent 9d26e48dc5
commit afa63033cc
5 changed files with 306 additions and 7 deletions
+6 -1
View File
@@ -69,7 +69,12 @@ export class FileTrieNode<T extends FileTrieData = ContentDetails> {
if (path.length === 1) {
// base case, we are at the end of the path
if (segment === "index") {
this.data ??= file
// Last-insert-wins on collision. Matches the emitter's last-write-wins
// semantics at plugins/emitters/helpers.ts so the trie's data and the
// file on disk agree on which source file "owns" a colliding slug.
// Collision detection happens upstream in build.ts; this assignment is
// the fallback for any duplicates that still reach the trie.
this.data = file
} else {
this.makeChild(path, file)
}