Skip to content

Commit 7ce1546

Browse files
committed
fix resolve-path-update-node
1 parent 79cd0c6 commit 7ce1546

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/utils/resolve-path-update-node.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ import { isURL, maybeAddRelativeLocalPrefix } from "./general-utils";
44
import { isModulePathsMatch } from "./ts-helpers";
55
import { resolveModuleName } from "./resolve-module-name";
66

7-
/* ****************************************************************************************************************** */
8-
// region: Node Updater Utility
9-
/* ****************************************************************************************************************** */
10-
117
/** Gets proper path and calls updaterFn to get the new node if it should be updated */
128
export function resolvePathAndUpdateNode(
139
context: VisitorContext,
@@ -69,7 +65,8 @@ export function resolvePathAndUpdateNode(
6965
const trivia = targetNode.getFullText(sourceFile).slice(0, targetNode.getLeadingTriviaWidth(sourceFile));
7066
const regex = /^\s*\/\/\/?\s*@(transform-path|no-transform-path)(?:[^\S\r\n](.+?))?$/gim;
7167

72-
for (let match = regex.exec(trivia); match; match = regex.exec(trivia)) commentTags.set(match[1], match[2]);
68+
for (let match = regex.exec(trivia); match; match = regex.exec(trivia))
69+
if (match[1]) commentTags.set(match[1], match[2]);
7370
} catch {}
7471
}
7572

@@ -83,7 +80,7 @@ export function resolvePathAndUpdateNode(
8380

8481
function findTag(expected: string): boolean | string | undefined {
8582
if (commentTags.has(expected)) return commentTags.get(expected) || true;
86-
if (!jsDocTags?.length) return void 0;
83+
if (!jsDocTags?.length) return undefined;
8784

8885
for (const tag of jsDocTags) {
8986
const tagName = tag.tagName.text.toLowerCase();
@@ -103,8 +100,8 @@ export function resolvePathAndUpdateNode(
103100
: void 0;
104101
}
105102
}
103+
104+
return undefined;
106105
}
107106
}
108107
}
109-
110-
// endregion

0 commit comments

Comments
 (0)