Skip to content

Commit b7cb878

Browse files
committed
linting errors
1 parent 2a5c896 commit b7cb878

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

packages/@ngtools/webpack/src/plugin.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,21 +111,23 @@ export class AotPlugin implements Tapable {
111111
? [options.exclude as string] : (options.exclude as string[]);
112112

113113
exclude.forEach((pattern: string) => {
114-
pattern = pattern
115-
// Replace windows path separators to forward slashes.
116-
.replace(/\\/g, '/')
117-
// Escape characters that are used normally in regexes, except stars.
118-
.replace(/[\-\[\]{}()+?.\\^$|]/g, '\\$&')
119-
// Two stars replacement.
120-
.replace(/\*\*/g, '(?:.*)')
121-
// One star replacement.
122-
.replace(/\*/g, '(?:[^/]*)')
123-
// Escape characters from the basePath and make sure it's forward slashes.
124-
.replace(/^/, `(${basePath.replace(/\\/g, '/').replace(/[\-\[\]\/{}()+?.\\^$|*]/g, '\\$&')})?`);
125-
126-
const re = new RegExp('^' + pattern + '$');
127-
fileNames = fileNames.filter(x => !x.replace(/\\/g, '/').match(re));
128-
});
114+
const basePathPattern = '(' + basePath.replace(/\\/g, '/')
115+
.replace(/[\-\[\]\/{}()+?.\\^$|*]/g, '\\$&') + ')?';
116+
pattern = pattern
117+
// Replace windows path separators to forward slashes.
118+
.replace(/\\/g, '/')
119+
// Escape characters that are used normally in regexes, except stars.
120+
.replace(/[\-\[\]{}()+?.\\^$|]/g, '\\$&')
121+
// Two stars replacement.
122+
.replace(/\*\*/g, '(?:.*)')
123+
// One star replacement.
124+
.replace(/\*/g, '(?:[^/]*)')
125+
// Escape characters from the basePath and make sure it's forward slashes.
126+
.replace(/^/, basePathPattern);
127+
128+
const re = new RegExp('^' + pattern + '$');
129+
fileNames = fileNames.filter(x => !x.replace(/\\/g, '/').match(re));
130+
});
129131
} else {
130132
fileNames = fileNames.filter(fileName => !/\.spec\.ts$/.test(fileName));
131133
}

0 commit comments

Comments
 (0)