Skip to content

inconsistent patterns in getSubPatternFromSpec #1006

@joshcartme

Description

@joshcartme

I don't fully understand the impact of this (perhaps none since the comments indicate this is just an optimization) but this code

// Patterns should not include subfolders like node_modules unless they are
// explicitly included as part of the path.
//
// As an optimization, if the component pattern is the same as the component,
// then there definitely were no wildcard characters and we do not need to
// add the exclusion pattern.
if componentPattern.String() != component {
subpattern.WriteString(implicitExcludePathRegexPattern)
}

will produce different results depending on if the directory name, for example, has dashes in it or not. If it's this-directory componentPattern.String() will be this\\-directory and it will enter the condition. If it's thisdirectory the condition will not be true because componentPattern.String() will be thisdirectory

Again, not sure if this has an impact, but I was trying to debug something else and noticed that when launch tsgo with a config at /some/projects/this-directory I was seeing: "^((/some/projects/(?!(node_modules|bower_components|jspm_packages)(/|$))this\\-directory (snipped the end) which looked odd since it's putting the node_modules et al. exclude before the actual directory that the config is in.

If I launch it with a config in /some/projects/thisdirectory I get "^((/some/projects/thisdirectory(/(?!(node_modules|bower_components|jspm_packages)(/|$))[^/.][^/]*)*?/(?!(node_modules|bower_components|jspm_packages)(/|$))([^./]([^./]|(\\.(?!min\\.js$))?)*)?))$", i.e. thisdirectory comes before the exclude.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: tsconfigRelated to tsconfig parsing, loading

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions