tailwindcss 3.4.7 → 3.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.4.9] - 2024-08-08
13
+
14
+ ### Fixed
15
+
16
+ - No longer warns when broad glob patterns are detecting `vendor` folders
17
+
18
+ ## [3.4.8] - 2024-08-07
19
+
20
+ ### Fixed
21
+
22
+ - Fix minification when using nested CSS ([#14105](https://github.com/tailwindlabs/tailwindcss/pull/14105))
23
+ - Warn when broad glob patterns are used in the content configuration ([#14140](https://github.com/tailwindlabs/tailwindcss/pull/14140))
24
+
12
25
  ## [3.4.7] - 2024-07-25
13
26
 
14
27
  ### Fixed
@@ -2412,7 +2425,9 @@ No release notes
2412
2425
 
2413
2426
  - Everything!
2414
2427
 
2415
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.7...HEAD
2428
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.9...HEAD
2429
+ [3.4.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.8...v3.4.9
2430
+ [3.4.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.7...v3.4.8
2416
2431
  [3.4.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.6...v3.4.7
2417
2432
  [3.4.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.5...v3.4.6
2418
2433
  [3.4.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.4.4...v3.4.5
package/README.md CHANGED
@@ -13,10 +13,10 @@
13
13
  </p>
14
14
 
15
15
  <p align="center">
16
- <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=master" alt="Build Status"></a>
16
+ <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=main" alt="Build Status"></a>
17
17
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
18
18
  <a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
19
- <a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
19
+ <a href="https://github.com/tailwindcss/tailwindcss/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
20
20
  </p>
21
21
 
22
22
  ---
@@ -37,4 +37,4 @@ For casual chit-chat with others using the framework:
37
37
 
38
38
  ## Contributing
39
39
 
40
- If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/master/.github/CONTRIBUTING.md) **before submitting a pull request**.
40
+ If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**.
@@ -166,7 +166,9 @@ let state = {
166
166
  // Resolve globs from the content config
167
167
  // TODO: When we make the postcss plugin async-capable this can become async
168
168
  let files = _fastglob.default.sync(this.contentPatterns.all);
169
+ let checkBroadPattern = (0, _content.createBroadPatternCheck)(this.contentPatterns.all);
169
170
  for (let file of files){
171
+ checkBroadPattern(file);
170
172
  content.push({
171
173
  content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
172
174
  extension: _path.default.extname(file).slice(1)
@@ -277,7 +279,7 @@ async function createProcessor(args, cliConfigPath) {
277
279
  if (input) {
278
280
  return _fs.default.promises.readFile(_path.default.resolve(input), "utf8");
279
281
  }
280
- // No input file provided, fallback to default atrules
282
+ // No input file provided, fallback to default at-rules
281
283
  return "@tailwind base; @tailwind components; @tailwind utilities";
282
284
  }
283
285
  async function build() {
@@ -15,6 +15,9 @@ _export(exports, {
15
15
  },
16
16
  resolvedChangedContent: function() {
17
17
  return resolvedChangedContent;
18
+ },
19
+ createBroadPatternCheck: function() {
20
+ return createBroadPatternCheck;
18
21
  }
19
22
  });
20
23
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
@@ -24,6 +27,8 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
24
27
  const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
25
28
  const _parseGlob = require("../util/parseGlob");
26
29
  const _sharedState = require("./sharedState");
30
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
31
+ const _micromatch = /*#__PURE__*/ _interop_require_default(require("micromatch"));
27
32
  function _interop_require_default(obj) {
28
33
  return obj && obj.__esModule ? obj : {
29
34
  default: obj
@@ -152,6 +157,54 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
152
157
  mTimesToCommit
153
158
  ];
154
159
  }
160
+ const LARGE_DIRECTORIES = [
161
+ "node_modules"
162
+ ];
163
+ // Ensures that `node_modules` has to match as-is, otherwise `mynode_modules`
164
+ // would match as well, but that is not a known large directory.
165
+ const LARGE_DIRECTORIES_REGEX = new RegExp(`(${LARGE_DIRECTORIES.map((dir)=>String.raw`\b${dir}\b`).join("|")})`);
166
+ function createBroadPatternCheck(paths) {
167
+ // Detect whether a glob pattern might be too broad. This means that it:
168
+ // - Includes `**`
169
+ // - Does not include any of the known large directories (e.g.: node_modules)
170
+ let maybeBroadPattern = paths.some((path)=>path.includes("**") && !LARGE_DIRECTORIES_REGEX.test(path));
171
+ // Didn't detect any potentially broad patterns, so we can skip further
172
+ // checks.
173
+ if (!maybeBroadPattern) {
174
+ return ()=>{};
175
+ }
176
+ // All globs that explicitly contain any of the known large directories (e.g.:
177
+ // node_modules).
178
+ let explicitGlobs = paths.filter((path)=>LARGE_DIRECTORIES_REGEX.test(path));
179
+ // Keep track of whether we already warned about the broad pattern issue or
180
+ // not. The `log.warn` function already does something similar where we only
181
+ // output the log once. However, with this we can also skip the other checks
182
+ // when we already warned about the broad pattern.
183
+ let warned = false;
184
+ /**
185
+ * @param {string} file
186
+ */ return (file)=>{
187
+ if (warned) return; // Already warned about the broad pattern
188
+ if (_micromatch.default.isMatch(file, explicitGlobs)) return; // Explicitly included, so we can skip further checks
189
+ // When a broad pattern is used, we have to double check that the file was
190
+ // not explicitly included in the globs.
191
+ let matchingGlob = paths.find((path)=>_micromatch.default.isMatch(file, path));
192
+ if (!matchingGlob) return; // This should never happen
193
+ // Create relative paths to make the output a bit more readable.
194
+ let relativeMatchingGlob = _path.default.relative(process.cwd(), matchingGlob);
195
+ if (relativeMatchingGlob[0] !== ".") relativeMatchingGlob = `./${relativeMatchingGlob}`;
196
+ let largeDirectory = LARGE_DIRECTORIES.find((directory)=>file.includes(directory));
197
+ if (largeDirectory) {
198
+ warned = true;
199
+ _log.default.warn("broad-content-glob-pattern", [
200
+ `Your \`content\` configuration includes a pattern which looks like it's accidentally matching all of \`${largeDirectory}\` and can cause serious performance issues.`,
201
+ `Pattern: \`${relativeMatchingGlob}\``,
202
+ `See our documentation for recommendations:`,
203
+ "https://tailwindcss.com/docs/content-configuration#pattern-recommendations"
204
+ ]);
205
+ }
206
+ };
207
+ }
155
208
  /**
156
209
  *
157
210
  * @param {ContentPath[]} candidateFiles
@@ -160,12 +213,14 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
160
213
  */ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
161
214
  let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
162
215
  let mTimesToCommit = new Map();
216
+ let checkBroadPattern = createBroadPatternCheck(paths);
163
217
  let changedFiles = new Set();
164
218
  _sharedState.env.DEBUG && console.time("Finding changed files");
165
219
  let files = _fastglob.default.sync(paths, {
166
220
  absolute: true
167
221
  });
168
222
  for (let file of files){
223
+ checkBroadPattern(file);
169
224
  let prevModified = fileModifiedMap.get(file) || -Infinity;
170
225
  let modified = _fs.default.statSync(file).mtimeMs;
171
226
  if (modified > prevModified) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.4.7",
3
+ "version": "3.4.9",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -50,7 +50,7 @@
50
50
  "autoprefixer": "^10.4.14",
51
51
  "browserslist": "^4.21.5",
52
52
  "concurrently": "^8.0.1",
53
- "cssnano": "^6.0.0",
53
+ "cssnano": "^6.1.2",
54
54
  "esbuild": "^0.20.2",
55
55
  "eslint": "^8.39.0",
56
56
  "eslint-config-prettier": "^8.8.0",