File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,15 @@ module Make<InputSig Input> {
267267 * - Complex patterns like `foo-*.txt` are also supported
268268 */
269269 default predicate allowGlobs ( ) { none ( ) }
270+
271+ /**
272+ * Gets an alternative path segment to try if `segment` did not match a child.
273+ *
274+ * The motivating use-case is to map compiler-generated file names back to their sources files,
275+ * for example, `foo.min.js` could be mapped to `foo.ts`.
276+ */
277+ bindingset [ segment]
278+ default string rewritePathSegment ( string segment ) { none ( ) }
270279 }
271280
272281 /**
@@ -317,9 +326,13 @@ module Make<InputSig Input> {
317326 segment = ".." and
318327 result = current .getParentContainer ( )
319328 or
320- isOptionalPathComponent ( segment ) and
321329 not exists ( getChild ( current , segment ) ) and
322- result = current
330+ (
331+ isOptionalPathComponent ( segment ) and
332+ result = current
333+ or
334+ result = getChild ( current , rewritePathSegment ( segment ) )
335+ )
323336 or
324337 allowGlobs ( ) and
325338 (
You can’t perform that action at this time.
0 commit comments