Skip to content

Commit 4f18f90

Browse files
Add legacy type exports to tailwindcss/plugin export (#16505)
Closes #16209 This PR exposes the following types that were accessible via `tailwindcss/types/config` in v3 now via the `tailwindcss/plugin` export: ```ts import type {Cofig, PluginAPI, PluginCreator, PluginsConfig, ThemeConfig } from 'tailwindcss/plugin' ``` Note that these types will not be the same as the v3 and just approximations, however it should be enough to upgrade plugins to work with v4. ## Test plan Tested in a standalone project importing a dev build of tailwindcss: <img width="1784" alt="Screenshot 2025-02-13 at 14 50 48" src="https://github.com/user-attachments/assets/27c04666-0106-414d-ba25-1a853f9d53d1" />
1 parent 6164783 commit 4f18f90

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- Don’t replace `_` in suggested theme keys ([#16433](https://github.com/tailwindlabs/tailwindcss/pull/16433))
2020
- Ensure `--default-outline-width` can be used to change the `outline-width` value of the `outline` utility
2121
- Ensure drop shadow utilities don't inherit unexpectedly ([#16471](https://github.com/tailwindlabs/tailwindcss/pull/16471))
22+
- Export backwards compatible config and plugin types from `tailwindcss/plugin` ([#16505](https://github.com/tailwindlabs/tailwindcss/pull/16505))
2223

2324
## [4.0.6] - 2025-02-10
2425

packages/tailwindcss/src/plugin.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
import type { Config, PluginFn, PluginWithConfig, PluginWithOptions } from './compat/plugin-api'
1+
import type { ThemeConfig } from './compat/config/types'
2+
import type {
3+
Config,
4+
Plugin,
5+
PluginAPI,
6+
PluginFn,
7+
PluginWithConfig,
8+
PluginWithOptions,
9+
} from './compat/plugin-api'
210

311
function createPlugin(handler: PluginFn, config?: Partial<Config>): PluginWithConfig {
412
return {
@@ -24,3 +32,6 @@ createPlugin.withOptions = function <T>(
2432
}
2533

2634
export default createPlugin
35+
36+
// v3 compatible types previously exported via `tailwindcss/types/config`
37+
export type { Config, PluginAPI, PluginFn as PluginCreator, Plugin as PluginsConfig, ThemeConfig }

0 commit comments

Comments
 (0)