diff --git a/.github/workflows/ci-stable.yml b/.github/workflows/ci-stable.yml index e5807f50672c..60d6abb9a0c8 100644 --- a/.github/workflows/ci-stable.yml +++ b/.github/workflows/ci-stable.yml @@ -7,7 +7,7 @@ on: push: branches: [master] pull_request: - branches: [master] + branches: [master, 3.3] permissions: contents: read diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc17ba99dd0e..29b96700c8e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,9 @@ name: CI — Oxide on: push: - branches: [master] + branches: [master, 3.3] pull_request: - branches: [master] + branches: [master, 3.3] permissions: contents: read diff --git a/.github/workflows/integration-tests-oxide.yml b/.github/workflows/integration-tests-oxide.yml index 27cd8f562417..b9b3e513d6f2 100644 --- a/.github/workflows/integration-tests-oxide.yml +++ b/.github/workflows/integration-tests-oxide.yml @@ -2,9 +2,9 @@ name: Integration Tests — Oxide on: push: - branches: [master] + branches: [master, 3.3] pull_request: - branches: [master] + branches: [master, 3.3] permissions: contents: read diff --git a/.github/workflows/integration-tests-stable.yml b/.github/workflows/integration-tests-stable.yml index 547d20f1c283..86329d4044bd 100644 --- a/.github/workflows/integration-tests-stable.yml +++ b/.github/workflows/integration-tests-stable.yml @@ -2,9 +2,9 @@ name: Integration Tests — Stable on: push: - branches: [master] + branches: [master, 3.3] pull_request: - branches: [master] + branches: [master, 3.3] permissions: contents: read diff --git a/CHANGELOG.md b/CHANGELOG.md index 879ed210eea2..b654143f46d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Nothing yet! +## [3.3.1] - 2023-03-30 + +### Fixed + +- Try resolving `config.default` before `config` to ensure the config file is resolved correctly ([#10898](https://github.com/tailwindlabs/tailwindcss/pull/10898)) +- Pull pseudo elements outside of `:is` and `:has` when using `@apply` ([#10903](https://github.com/tailwindlabs/tailwindcss/pull/10903)) +- Update the types for the `safelist` config ([#10901](https://github.com/tailwindlabs/tailwindcss/pull/10901)) +- Fix `@tailwindcss/line-clamp` warning ([#10915](https://github.com/tailwindlabs/tailwindcss/pull/10915), [#10919](https://github.com/tailwindlabs/tailwindcss/pull/10919)) +- Fix `process` is not defined error ([#10919](https://github.com/tailwindlabs/tailwindcss/pull/10919)) + ## [3.3.0] - 2023-03-27 ### Added @@ -2211,7 +2221,8 @@ No release notes - Everything! -[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.0...HEAD +[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.1...HEAD +[3.3.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.3.0...v3.3.1 [3.3.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.7...v3.3.0 [3.2.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.6...v3.2.7 [3.2.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.5...v3.2.6 diff --git a/integrations/execute.js b/integrations/execute.js index f5ab2131804a..6c5f2036327d 100644 --- a/integrations/execute.js +++ b/integrations/execute.js @@ -3,6 +3,8 @@ let path = require('path') let { spawn } = require('child_process') let resolveToolRoot = require('./resolve-tool-root') +let SHOW_OUTPUT = false + let runningProcessess = [] afterEach(() => { @@ -92,6 +94,9 @@ module.exports = function $(command, options = {}) { let combined = '' child.stdout.on('data', (data) => { + if (SHOW_OUTPUT) { + console.log(data.toString()) + } stdoutMessages.push(data.toString()) notifyNextStdoutActor() stdout += data @@ -99,6 +104,9 @@ module.exports = function $(command, options = {}) { }) child.stderr.on('data', (data) => { + if (SHOW_OUTPUT) { + console.error(data.toString()) + } stderrMessages.push(data.toString()) notifyNextStderrActor() stderr += data diff --git a/integrations/parcel/tests/integration.test.js b/integrations/parcel/tests/integration.test.js index 0fc539f37eec..55e7f83a38b0 100644 --- a/integrations/parcel/tests/integration.test.js +++ b/integrations/parcel/tests/integration.test.js @@ -3,11 +3,12 @@ let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') let { - readOutputFile, appendToInputFile, - writeInputFile, - waitForOutputFileCreation, + readOutputFile, + removeFile, waitForOutputFileChange, + waitForOutputFileCreation, + writeInputFile, } = require('../../io')({ output: 'dist', input: 'src' }) describe('static build', () => { @@ -32,6 +33,132 @@ describe('static build', () => { ` ) }) + + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await removeFile('tailwind.config.js') + await writeInputFile( + 'index.html', + html` + +
+ ` + ) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.js', + javascript` + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('parcel build ./src/index.html --no-cache', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await removeFile('tailwind.config.js') + await writeInputFile( + 'index.html', + html` + + + ` + ) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('parcel build ./src/index.html --no-cache', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile(/index\.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) }) describe('watcher', () => { diff --git a/integrations/rollup/tests/integration.test.js b/integrations/rollup/tests/integration.test.js index 1daea888a875..dbbfcc8d11f1 100644 --- a/integrations/rollup/tests/integration.test.js +++ b/integrations/rollup/tests/integration.test.js @@ -2,7 +2,7 @@ let $ = require('../../execute') let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') -let { readOutputFile, appendToInputFile, writeInputFile } = require('../../io')({ +let { readOutputFile, appendToInputFile, writeInputFile, removeFile } = require('../../io')({ output: 'dist', input: 'src', }) @@ -27,6 +27,120 @@ describe('static build', () => { ` ) }) + + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.js', + javascript` + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('rollup -c', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile('index.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('index.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('rollup -c', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile('index.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('index.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) }) describe('watcher', () => { diff --git a/integrations/tailwindcss-cli/tests/integration.test.js b/integrations/tailwindcss-cli/tests/integration.test.js index ff8db20b8a2d..6efa9fdf5e44 100644 --- a/integrations/tailwindcss-cli/tests/integration.test.js +++ b/integrations/tailwindcss-cli/tests/integration.test.js @@ -3,7 +3,7 @@ let $ = require('../../execute') let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') -let { readOutputFile, appendToInputFile, writeInputFile } = require('../../io')({ +let { readOutputFile, appendToInputFile, writeInputFile, removeFile } = require('../../io')({ output: 'dist', input: 'src', }) @@ -111,6 +111,120 @@ describe('static build', () => { } }) + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.js', + javascript` + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('node ../../lib/cli.js -i ./src/index.css -o ./dist/main.css', { + env: { NODE_ENV: 'production' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + it('can read from a config file from an @config directive', async () => { await writeInputFile('index.html', html``) await writeInputFile( diff --git a/integrations/vite/tests/integration.test.js b/integrations/vite/tests/integration.test.js index 1e5cd2d3345e..a07a2a9a6efc 100644 --- a/integrations/vite/tests/integration.test.js +++ b/integrations/vite/tests/integration.test.js @@ -4,7 +4,7 @@ let $ = require('../../execute') let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') -let { readOutputFile, appendToInputFile, writeInputFile } = require('../../io')({ +let { readOutputFile, appendToInputFile, writeInputFile, removeFile } = require('../../io')({ output: 'dist', input: '.', }) @@ -42,6 +42,116 @@ describe('static build', () => { ` ) }) + + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await writeInputFile( + 'index.html', + html` + + + ` + ) + await removeFile('tailwind.config.js') + await writeInputFile( + 'tailwind.config.js', + javascript` + export default { + content: ['index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('vite build', { + env: { NODE_ENV: 'production', NO_COLOR: '1' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await writeInputFile( + 'index.html', + html` + + + ` + ) + await removeFile('tailwind.config.js') + await writeInputFile( + 'tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('vite build', { + env: { NODE_ENV: 'production', NO_COLOR: '1' }, + }) + + if (!env.OXIDE) { + expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile(/index.\w+\.css$/)).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) }) describe('watcher', () => { diff --git a/integrations/webpack-4/tests/integration.test.js b/integrations/webpack-4/tests/integration.test.js index 6bbf3f879fcd..a666721bbdc1 100644 --- a/integrations/webpack-4/tests/integration.test.js +++ b/integrations/webpack-4/tests/integration.test.js @@ -3,11 +3,12 @@ let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') let { - readOutputFile, appendToInputFile, - writeInputFile, - waitForOutputFileCreation, + readOutputFile, + removeFile, waitForOutputFileChange, + waitForOutputFileCreation, + writeInputFile, } = require('../../io')({ output: 'dist', input: 'src' }) describe('static build', () => { @@ -24,6 +25,116 @@ describe('static build', () => { ` ) }) + + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.js', + javascript` + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('webpack --mode=production') + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('webpack --mode=production') + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) }) describe('watcher', () => { diff --git a/integrations/webpack-5/tests/integration.test.js b/integrations/webpack-5/tests/integration.test.js index fde0d60c5364..ae493fbdbb66 100644 --- a/integrations/webpack-5/tests/integration.test.js +++ b/integrations/webpack-5/tests/integration.test.js @@ -3,11 +3,12 @@ let { css, html, javascript } = require('../../syntax') let { env } = require('../../../lib/lib/sharedState') let { - readOutputFile, appendToInputFile, - writeInputFile, - waitForOutputFileCreation, + readOutputFile, + removeFile, waitForOutputFileChange, + waitForOutputFileCreation, + writeInputFile, } = require('../../io')({ output: 'dist', input: 'src' }) describe('static build', () => { @@ -24,6 +25,116 @@ describe('static build', () => { ` ) }) + + it('can use a tailwind.config.js configuration file with ESM syntax', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.js', + javascript` + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } + ` + ) + + await $('webpack --mode=production') + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) + + it('can use a tailwind.config.ts configuration file', async () => { + await removeFile('tailwind.config.js') + await writeInputFile('index.html', html``) + await writeInputFile( + 'index.css', + css` + @tailwind base; + @tailwind components; + @tailwind utilities; + ` + ) + await writeInputFile( + '../tailwind.config.ts', + javascript` + import type { Config } from 'tailwindcss' + + export default { + content: ['./src/index.html'], + theme: { + extend: { + colors: { + primary: 'black', + }, + }, + }, + corePlugins: { + preflight: false, + }, + } satisfies Config + ` + ) + + await $('webpack --mode=production') + + if (!env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + --tw-bg-opacity: 1; + background-color: rgb(0 0 0 / var(--tw-bg-opacity)); + } + ` + ) + } + + if (env.OXIDE) { + expect(await readOutputFile('main.css')).toIncludeCss( + css` + .bg-primary { + background-color: black; + } + ` + ) + } + }) }) describe('watcher', () => { diff --git a/package-lock.json b/package-lock.json index ed1615e6b1a1..10608712006b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "license": "MIT", "workspaces": [ "integrations/*", diff --git a/package-lock.stable.json b/package-lock.stable.json index 1c419c1855ac..4fda6babf23b 100644 --- a/package-lock.stable.json +++ b/package-lock.stable.json @@ -1,12 +1,12 @@ { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "license": "MIT", "dependencies": { "arg": "^5.0.2", diff --git a/package.json b/package.json index e2093e183061..6a240fd5c697 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "description": "A utility-first CSS framework for rapidly building custom user interfaces.", "license": "MIT", "main": "lib/index.js", diff --git a/package.stable.json b/package.stable.json index 26cca2eea1f4..f758ded10e78 100644 --- a/package.stable.json +++ b/package.stable.json @@ -1,6 +1,6 @@ { "name": "tailwindcss", - "version": "3.3.0", + "version": "3.3.1", "description": "A utility-first CSS framework for rapidly building custom user interfaces.", "license": "MIT", "main": "lib/index.js", diff --git a/src/lib/expandApplyAtRules.js b/src/lib/expandApplyAtRules.js index cdcd0b5688c9..c6d53d80e29f 100644 --- a/src/lib/expandApplyAtRules.js +++ b/src/lib/expandApplyAtRules.js @@ -4,6 +4,7 @@ import parser from 'postcss-selector-parser' import { resolveMatches } from './generateRules' import escapeClassName from '../util/escapeClassName' import { applyImportantSelector } from '../util/applyImportantSelector' +import { collectPseudoElements, sortSelector } from '../util/formatVariantSelector.js' /** @typedef {Map