Skip to content

Commit

Permalink
fix: fixes an issue where the included paths where missing symlinks a…
Browse files Browse the repository at this point in the history
…nd .dot directories (#1678)
  • Loading branch information
lukasholzer committed Dec 1, 2023
1 parent bc7b0b8 commit 81e451b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 34 deletions.
78 changes: 56 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -65,6 +65,7 @@
"es-module-lexer": "^1.0.0",
"esbuild": "0.19.6",
"execa": "^6.0.0",
"fast-glob": "^3.3.2",
"filter-obj": "^5.0.0",
"find-up": "^6.0.0",
"glob": "^8.0.3",
Expand Down Expand Up @@ -94,6 +95,7 @@
"@types/is-ci": "3.0.4",
"@types/node": "14.18.63",
"@types/normalize-path": "3.0.2",
"@types/picomatch": "^2.3.3",
"@types/resolve": "1.20.6",
"@types/semver": "7.5.6",
"@types/tmp": "0.2.6",
Expand Down
24 changes: 12 additions & 12 deletions src/runtimes/node/utils/included_files.ts
@@ -1,6 +1,8 @@
import { normalize, resolve } from 'path'

import { minimatch, glob } from '../../../utils/matching.js'
import fastGlob from 'fast-glob'

import { minimatch } from '../../../utils/matching.js'

// Returns the subset of `paths` that don't match any of the glob expressions
// from `exclude`.
Expand Down Expand Up @@ -46,16 +48,14 @@ export const getPathsOfIncludedFiles = async (
{ include: [], excludePatterns: [] },
)

const pathGroups = await Promise.all(
include.map((expression) =>
glob(expression, { absolute: true, cwd: basePath, ignore: excludePatterns, nodir: true }),
),
)

// `pathGroups` is an array containing the paths for each expression in the
// `include` array. We flatten it into a single dimension.
const paths = pathGroups.flat()
const normalizedPaths = paths.map(normalize)
const pathGroups = await fastGlob(include, {
absolute: true,
cwd: basePath,
dot: true,
ignore: excludePatterns,
followSymbolicLinks: true,
throwErrorOnBrokenSymbolicLink: true,
})

return { excludePatterns, paths: [...new Set(normalizedPaths)] }
return { excludePatterns, paths: pathGroups.map(normalize) }
}

1 comment on commit 81e451b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏱ Benchmark results

  • largeDepsEsbuild: 1.4s
  • largeDepsNft: 5.5s
  • largeDepsZisi: 9.9s

Please sign in to comment.