mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
* Prevent nesting plugin from breaking other plugins This uses a private API but it’s the only solution we have right now. It’s guarded to hopefully be less breaking if the API disappears. * Update changelog
43 lines
674 B
JavaScript
43 lines
674 B
JavaScript
export function visitorSpyPlugin() {
|
|
let Once = jest.fn()
|
|
let OnceExit = jest.fn()
|
|
let Root = jest.fn()
|
|
let AtRule = jest.fn()
|
|
let Rule = jest.fn()
|
|
let Comment = jest.fn()
|
|
let Declaration = jest.fn()
|
|
|
|
let plugin = Object.assign(
|
|
function () {
|
|
return {
|
|
postcssPlugin: 'visitor-test',
|
|
|
|
// These work fine
|
|
Once,
|
|
OnceExit,
|
|
|
|
// These break
|
|
Root,
|
|
Rule,
|
|
AtRule,
|
|
Declaration,
|
|
Comment,
|
|
}
|
|
},
|
|
{ postcss: true }
|
|
)
|
|
|
|
return {
|
|
plugin,
|
|
spies: {
|
|
Once,
|
|
OnceExit,
|
|
Root,
|
|
AtRule,
|
|
Rule,
|
|
Comment,
|
|
Declaration,
|
|
},
|
|
}
|
|
}
|