( patterns: string | string[], environment: ScanEnvironment, )
| 311 | } |
| 312 | |
| 313 | async function globEntries( |
| 314 | patterns: string | string[], |
| 315 | environment: ScanEnvironment, |
| 316 | ) { |
| 317 | const nodeModulesPatterns: string[] = [] |
| 318 | const regularPatterns: string[] = [] |
| 319 | |
| 320 | for (const pattern of arraify(patterns)) { |
| 321 | if (pattern.includes('node_modules')) { |
| 322 | nodeModulesPatterns.push(pattern) |
| 323 | } else { |
| 324 | regularPatterns.push(pattern) |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | const sharedOptions = { |
| 329 | absolute: true, |
| 330 | cwd: environment.config.root, |
| 331 | ignore: [ |
| 332 | `**/${environment.config.build.outDir}/**`, |
| 333 | // if there aren't explicit entries, also ignore other common folders |
| 334 | ...(environment.config.optimizeDeps.entries |
| 335 | ? [] |
| 336 | : [`**/__tests__/**`, `**/coverage/**`]), |
| 337 | ], |
| 338 | } |
| 339 | |
| 340 | const results = await Promise.all([ |
| 341 | glob(nodeModulesPatterns, sharedOptions), |
| 342 | glob(regularPatterns, { |
| 343 | ...sharedOptions, |
| 344 | ignore: [...sharedOptions.ignore, '**/node_modules/**'], |
| 345 | }), |
| 346 | ]) |
| 347 | |
| 348 | return results.flat() |
| 349 | } |
| 350 | |
| 351 | type Loader = 'js' | 'ts' | 'jsx' | 'tsx' |
| 352 |
no test coverage detected