From defc3e76b46e72db7f3f798d9ef5fad741b3c360 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Wed, 27 Mar 2024 14:58:06 -0400 Subject: [PATCH 1/2] Revert "Improve glob handling for folders with `(`, `)`, `[` or `]` in the file path (#12715)" This reverts commit f2a7c2c4532b76d61351f1ca7e26ec8c93729b5d. --- src/lib/content.js | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/src/lib/content.js b/src/lib/content.js index 97bef6afadce..e814efe4d34e 100644 --- a/src/lib/content.js +++ b/src/lib/content.js @@ -4,47 +4,10 @@ import fs from 'fs' import path from 'path' import isGlob from 'is-glob' import fastGlob from 'fast-glob' +import normalizePath from 'normalize-path' import { parseGlob } from '../util/parseGlob' import { env } from './sharedState' -/*! - * Modified version of normalize-path, original license below - * - * normalize-path - * - * Copyright (c) 2014-2018, Jon Schlinkert. - * Released under the MIT License. - */ - -function normalizePath(path) { - if (typeof path !== 'string') { - throw new TypeError('expected path to be a string') - } - - if (path === '\\' || path === '/') return '/' - - var len = path.length - if (len <= 1) return path - - // ensure that win32 namespaces has two leading slashes, so that the path is - // handled properly by the win32 version of path.parse() after being normalized - // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces - var prefix = '' - if (len > 4 && path[3] === '\\') { - var ch = path[2] - if ((ch === '?' || ch === '.') && path.slice(0, 2) === '\\\\') { - path = path.slice(2) - prefix = '//' - } - } - - // Modified part: instead of purely splitting on `\\` and `/`, we split on - // `/` and `\\` that is _not_ followed by any of the following characters: ()[] - // This is to ensure that we keep the escaping of brackets and parentheses - let segs = path.split(/[/\\]+(?![\(\)\[\]])/) - return prefix + segs.join('/') -} - /** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ @@ -110,10 +73,6 @@ export function parseCandidateFiles(context, tailwindConfig) { * @returns {ContentPath} */ function parseFilePath(filePath, ignore) { - // Escape special characters in the file path such as: ()[] - // But only if the special character isn't already escaped - filePath = filePath.replace(/(? Date: Wed, 27 Mar 2024 15:03:48 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed7dc164e235..ace6cbdc3c09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- Revert changes to glob handling ([#13384](https://github.com/tailwindlabs/tailwindcss/pull/13384)) ## [3.4.2] - 2024-03-27