File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,14 @@ export function resolvePathAndUpdateNode(
6666 } catch { }
6767
6868 const commentTags = new Map < string , string | undefined > ( ) ;
69- try {
70- const trivia = targetNode . getFullText ( sourceFile ) . slice ( 0 , targetNode . getLeadingTriviaWidth ( sourceFile ) ) ;
71- const regex = / ^ \s * \/ \/ \/ ? \s * @ ( t r a n s f o r m - p a t h | n o - t r a n s f o r m - p a t h ) (?: [ ^ \S \r \n ] ( .+ ?) ) ? $ / gim;
69+ if ( targetNode . pos >= 0 ) {
70+ try {
71+ const trivia = targetNode . getFullText ( sourceFile ) . slice ( 0 , targetNode . getLeadingTriviaWidth ( sourceFile ) ) ;
72+ const regex = / ^ \s * \/ \/ \/ ? \s * @ ( t r a n s f o r m - p a t h | n o - t r a n s f o r m - p a t h ) (?: [ ^ \S \r \n ] ( .+ ?) ) ? $ / gim;
7273
73- for ( let match = regex . exec ( trivia ) ; match ; match = regex . exec ( trivia ) ) commentTags . set ( match [ 1 ] , match [ 2 ] ) ;
74- } catch { }
74+ for ( let match = regex . exec ( trivia ) ; match ; match = regex . exec ( trivia ) ) commentTags . set ( match [ 1 ] , match [ 2 ] ) ;
75+ } catch { }
76+ }
7577
7678 const overridePath = findTag ( "transform-path" ) ;
7779 const shouldSkip = findTag ( "no-transform-path" ) ;
You can’t perform that action at this time.
0 commit comments