diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c2257cc373e..25edaad623a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nothing yet! +## [3.4.13] - 2024-09-23 + +### Fixed + +- Improve source glob verification performance ([#14481](https://github.com/tailwindlabs/tailwindcss/pull/14481)) + ## [3.4.12] - 2024-09-17 ### Fixed @@ -2443,7 +2449,8 @@ No release notes - Everything! -[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.12...HEAD +[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.13...HEAD +[3.4.13]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.12...v3.4.13 [3.4.12]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.11...v3.4.12 [3.4.11]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.10...v3.4.11 [3.4.10]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.9...v3.4.10 diff --git a/package-lock.json b/package-lock.json index 3446253881fb..2c0c92cd36da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tailwindcss", - "version": "3.4.12", + "version": "3.4.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tailwindcss", - "version": "3.4.12", + "version": "3.4.13", "license": "MIT", "dependencies": { "@alloc/quick-lru": "^5.2.0", diff --git a/package.json b/package.json index 556933bd3694..673e36db1e6c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tailwindcss", - "version": "3.4.12", + "version": "3.4.13", "description": "A utility-first CSS framework for rapidly building custom user interfaces.", "license": "MIT", "main": "lib/index.js", diff --git a/src/lib/content.js b/src/lib/content.js index 1a9d3c70e741..3e23f63c2e12 100644 --- a/src/lib/content.js +++ b/src/lib/content.js @@ -210,9 +210,22 @@ export function createBroadPatternCheck(paths) { return () => {} } - // All globs that explicitly contain any of the known large directories (e.g.: - // node_modules). - let explicitGlobs = paths.filter((path) => LARGE_DIRECTORIES_REGEX.test(path)) + // All glob matchers + let matchers = [] + + // All glob matchers that explicitly contain any of the known large + // directories (e.g.: node_modules). + let explicitMatchers = [] + + // Create matchers for all paths + for (let path of paths) { + let matcher = micromatch.matcher(path) + if (LARGE_DIRECTORIES_REGEX.test(path)) { + explicitMatchers.push(matcher) + } + + matchers.push(matcher) + } // Keep track of whether we already warned about the broad pattern issue or // not. The `log.warn` function already does something similar where we only @@ -225,12 +238,13 @@ export function createBroadPatternCheck(paths) { */ return (file) => { if (warned) return // Already warned about the broad pattern - if (micromatch.isMatch(file, explicitGlobs)) return // Explicitly included, so we can skip further checks + if (explicitMatchers.some((matcher) => matcher(file))) return // Explicitly included, so we can skip further checks // When a broad pattern is used, we have to double check that the file was // not explicitly included in the globs. - let matchingGlob = paths.find((path) => micromatch.isMatch(file, path)) - if (!matchingGlob) return // This should never happen + let matchingGlobIndex = matchers.findIndex((matcher) => matcher(file)) + if (matchingGlobIndex === -1) return // This should never happen + let matchingGlob = paths[matchingGlobIndex] // Create relative paths to make the output a bit more readable. let relativeMatchingGlob = path.relative(process.cwd(), matchingGlob)