MCPcopy
hub / github.com/vitejs/vite / globEntries

Function globEntries

packages/vite/src/node/optimizer/scan.ts:313–349  ·  view source on GitHub ↗
(
  patterns: string | string[],
  environment: ScanEnvironment,
)

Source from the content-addressed store, hash-verified

311}
312
313async 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
351type Loader = 'js' | 'ts' | 'jsx' | 'tsx'
352

Callers 1

computeEntriesFunction · 0.85

Calls 2

arraifyFunction · 0.90
globFunction · 0.85

Tested by

no test coverage detected