Skip to content

Commit 4e219dc

Browse files
Revert "Warn on use of plugin parameters as function" (#14662)
Reverts #14661
1 parent f2ebb8e commit 4e219dc

File tree

2 files changed

+6
-27
lines changed

2 files changed

+6
-27
lines changed

packages/tailwindcss/src/compat/config/resolve-config.test.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { expect, test, vi } from 'vitest'
1+
import { expect, test } from 'vitest'
22
import { buildDesignSystem } from '../../design-system'
33
import { Theme } from '../../theme'
44
import { resolveConfig } from './resolve-config'
@@ -172,12 +172,7 @@ test('theme keys can reference other theme keys using the theme function regardl
172172
})
173173
})
174174

175-
test('theme keys can read from the CSS theme', ({ onTestFinished }) => {
176-
let warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined)
177-
onTestFinished(() => {
178-
warn.mockReset()
179-
})
180-
175+
test('theme keys can read from the CSS theme', () => {
181176
let theme = new Theme()
182177
theme.add('--color-green', 'green')
183178

@@ -252,7 +247,4 @@ test('theme keys can read from the CSS theme', ({ onTestFinished }) => {
252247
},
253248
},
254249
})
255-
expect(warn).toHaveBeenCalledWith(
256-
'Using the plugin object parameter as the theme function is deprecated. Please use the `theme` property instead.',
257-
)
258250
})

packages/tailwindcss/src/compat/config/resolve-config.ts

+4-17
Original file line numberDiff line numberDiff line change
@@ -175,25 +175,12 @@ function extractConfigs(ctx: ResolutionContext, { config, base, path }: ConfigFi
175175
ctx.configs.push(config)
176176
}
177177

178-
let didWarnAboutUsingObjectArgumentAsThemeFn = false
179-
180178
function mergeTheme(ctx: ResolutionContext) {
181179
let themeFn = createThemeFn(ctx.design, () => ctx.theme, resolveValue)
182-
let theme = Object.assign(
183-
(path: string, defaultValue?: any) => {
184-
if (!didWarnAboutUsingObjectArgumentAsThemeFn) {
185-
didWarnAboutUsingObjectArgumentAsThemeFn = true
186-
console.warn(
187-
'Using the plugin object parameter as the theme function is deprecated. Please use the `theme` property instead.',
188-
)
189-
}
190-
return themeFn(path, defaultValue)
191-
},
192-
{
193-
theme: themeFn,
194-
colors,
195-
},
196-
)
180+
let theme = Object.assign(themeFn, {
181+
theme: themeFn,
182+
colors,
183+
})
197184

198185
function resolveValue(value: ThemeValue | null | undefined): ResolvedThemeValue {
199186
if (typeof value === 'function') {

0 commit comments

Comments
 (0)