Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Commit e73604f

Browse files
committed
Don't store options on actual PostCSS node
1 parent 697b244 commit e73604f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/lib/expandApplyAtRules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function expandApplyAtRules(context) {
6666

6767
let rules = context.classCache.get(applyCandidate)
6868

69-
for (let [meta, node] of rules) {
69+
for (let [meta, [node]] of rules) {
7070
let root = postcss.root({ nodes: [node] })
7171

7272
root.walkRules((rule) => {

src/lib/generateRules.js

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ function applyVariant(variant, matches, { variantMap }) {
3737
let [variantSort, applyThisVariant] = variantMap.get(variant)
3838
let result = []
3939

40-
for (let [{ sort, layer }, rule] of matches) {
41-
let options = rule.__tailwind ?? {}
42-
40+
for (let [{ sort, layer }, [rule, options]] of matches) {
4341
if (options.respectVariants === false) {
44-
result.push([{ sort, layer }, rule])
42+
result.push([{ sort, layer }, [rule, options]])
4543
continue
4644
}
4745

@@ -53,7 +51,7 @@ function applyVariant(variant, matches, { variantMap }) {
5351
continue
5452
}
5553

56-
let withOffset = [{ sort: variantSort | sort, layer }, container.nodes[0]]
54+
let withOffset = [{ sort: variantSort | sort, layer }, [container.nodes[0], options]]
5755
result.push(withOffset)
5856
}
5957

@@ -115,16 +113,20 @@ function generateRules(tailwindConfig, candidates, context) {
115113
for (let [sort, plugin] of plugins) {
116114
if (typeof plugin === 'function') {
117115
for (let result of plugin(modifier, pluginHelpers)) {
116+
let options = {}
118117
if (Array.isArray(result)) {
118+
;[, , options = {}] = result
119119
result = toPostCssNode(result, context.postCssNodeCache)
120120
}
121-
matches.push([sort, result])
121+
matches.push([sort, [result, options]])
122122
}
123123
} else {
124+
let options = {}
124125
if (Array.isArray(plugin)) {
126+
;[, , options = {}] = plugin
125127
plugin = toPostCssNode(plugin, context.postCssNodeCache)
126128
}
127-
matches.push([sort, plugin])
129+
matches.push([sort, [plugin, options]])
128130
}
129131
}
130132

@@ -136,7 +138,9 @@ function generateRules(tailwindConfig, candidates, context) {
136138
allRules.push(matches)
137139
}
138140

139-
return allRules.flat(1).map(([{ sort, layer }, rule]) => [sort | context.layerOrder[layer], rule])
141+
return allRules
142+
.flat(1)
143+
.map(([{ sort, layer }, [rule]]) => [sort | context.layerOrder[layer], rule])
140144
}
141145

142146
module.exports = generateRules

src/lib/utils.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function toPostCssNode(rule, postCssNodeCache) {
1111
return postCssNodeCache.get(rule)
1212
}
1313

14-
let [selector, childRule, options = {}] = rule
14+
let [selector, childRule] = rule
1515
let node
1616

1717
if (selector[0] === '@') {
@@ -48,10 +48,6 @@ function toPostCssNode(rule, postCssNodeCache) {
4848
})
4949
}
5050

51-
if (options.respectVariants === false) {
52-
node.__tailwind = Object.assign({}, node.__tailwind, { respectVariants: false })
53-
}
54-
5551
postCssNodeCache.set(rule, node)
5652

5753
return node

0 commit comments

Comments
 (0)