File tree 1 file changed +7
-5
lines changed
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -66,12 +66,14 @@ export function resolvePathAndUpdateNode(
66
66
} catch { }
67
67
68
68
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;
72
73
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
+ }
75
77
76
78
const overridePath = findTag ( "transform-path" ) ;
77
79
const shouldSkip = findTag ( "no-transform-path" ) ;
You can’t perform that action at this time.
0 commit comments