diff --git a/CHANGELOG.md b/CHANGELOG.md index 465c062dc8ba..a79f5f245cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,11 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improve types for `resolveConfig` ([#12272](https://github.com/tailwindlabs/tailwindcss/pull/12272)) - Don’t add spaces to negative numbers following a comma ([#12324](https://github.com/tailwindlabs/tailwindcss/pull/12324)) - Don't emit `@config` in CSS when watching via the CLI ([#12327](https://github.com/tailwindlabs/tailwindcss/pull/12327)) +- Ensure configured `font-feature-settings` for `mono` are included in Preflight ([#12342](https://github.com/tailwindlabs/tailwindcss/pull/12342)) +- Improve candidate detection in minified JS arrays (without spaces) ([#12396](https://github.com/tailwindlabs/tailwindcss/pull/12396)) - [Oxide] Remove `autoprefixer` dependency ([#11315](https://github.com/tailwindlabs/tailwindcss/pull/11315)) - [Oxide] Fix source maps issue resulting in a crash ([#11319](https://github.com/tailwindlabs/tailwindcss/pull/11319)) - [Oxide] Fallback to RegEx based parser when using custom transformers or extractors ([#11335](https://github.com/tailwindlabs/tailwindcss/pull/11335)) - [Oxide] Bump `lightningcss` and reflect related improvements in tests ([#11550](https://github.com/tailwindlabs/tailwindcss/pull/11550)) -- Ensure configured `font-feature-settings` for `mono` are included in Preflight ([#12342](https://github.com/tailwindlabs/tailwindcss/pull/12342)) ### Added diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 0751c1acba7e..75ee8af50f81 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -47,7 +47,7 @@ function* buildRegExps(context) { regex.any([ regex.pattern([ // Arbitrary values - /-(?:\w+-)*\[[^\s:]+\]/, + /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/, // Not immediately followed by an `{[(` /(?![{([]])/, @@ -58,7 +58,7 @@ function* buildRegExps(context) { regex.pattern([ // Arbitrary values - /-(?:\w+-)*\[[^\s]+\]/, + /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/, // Not immediately followed by an `{[(` /(?![{([]])/, diff --git a/tests/parse-candidate-strings.test.js b/tests/parse-candidate-strings.test.js index 5a9f00c3e5bb..e9fe78c271e2 100644 --- a/tests/parse-candidate-strings.test.js +++ b/tests/parse-candidate-strings.test.js @@ -482,5 +482,19 @@ describe.each([ expect(extractions).toContain(value) } }) + + it.each([ + ['["min-w-[17rem]","max-w-[17rem]"]', ['min-w-[17rem]', 'max-w-[17rem]']], + [ + '["w-[calc(theme(spacing[2]*-1px))]","h-[calc(theme(spacing[2]*-1px))]"]', + ['w-[calc(theme(spacing[2]*-1px))]', 'h-[calc(theme(spacing[2]*-1px))]'], + ], + ])('should work for issue #12371 (%#)', async (content, expectations) => { + let extractions = parse(content) + + for (let value of expectations) { + expect(extractions).toContain(value) + } + }) }) })