From 1979d8e4ed9d66e2ab3972ff176b1e67fad3c4b2 Mon Sep 17 00:00:00 2001 From: Kodai Nakamura Date: Sun, 16 Feb 2025 17:42:31 +0900 Subject: [PATCH] chore: update buildCandidateTrie signature --- src/main.ts | 2 +- src/replace-links/index.ts | 2 +- src/trie.ts | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index 41012bf..099502d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -72,7 +72,7 @@ export default class AutomaticLinkerPlugin extends Plugin { body: fileContent.slice(contentStart), linkResolverContext: { filePath: activeFile.path.replace(/\.md$/, ""), - trie: this.trie ?? buildCandidateTrie([]).trie, + trie: this.trie ?? buildCandidateTrie([], undefined).trie, candidateMap: this.candidateMap ?? new Map(), }, settings: { diff --git a/src/replace-links/index.ts b/src/replace-links/index.ts index 0740738..06ffc6c 100644 --- a/src/replace-links/index.ts +++ b/src/replace-links/index.ts @@ -1,2 +1,2 @@ -export { getEffectiveNamespace, replaceLinks } from "./replace-links"; +export { replaceLinks } from "./replace-links"; export type { ReplaceLinksOptions } from "./types"; diff --git a/src/trie.ts b/src/trie.ts index ba70753..59049e9 100644 --- a/src/trie.ts +++ b/src/trie.ts @@ -25,7 +25,10 @@ export interface TrieNode { * If the path starts with one of the baseDir (e.g. "pages/"), the directory immediately * under the baseDir is considered the effective namespace. */ -export const getEffectiveNamespace = (path: string, baseDir?: string): string => { +export const getEffectiveNamespace = ( + path: string, + baseDir?: string, +): string => { const prefix = baseDir + "/"; if (baseDir) { if (path.startsWith(prefix)) { @@ -67,7 +70,7 @@ export interface CandidateData { export const buildCandidateTrie = ( allFiles: PathAndAliases[], - baseDir?: string, + baseDir: string | undefined, ) => { // Process candidate strings from file paths. type Candidate = {