tailwindcss 3.0.23 → 3.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -3
- package/lib/cli-peer-dependencies.js +3 -3
- package/lib/cli.js +183 -161
- package/lib/constants.js +8 -8
- package/lib/corePlugins.js +1572 -1523
- package/lib/featureFlags.js +9 -9
- package/lib/index.js +19 -6
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/collapseAdjacentRules.js +26 -13
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/defaultExtractor.js +6 -6
- package/lib/lib/detectNesting.js +9 -9
- package/lib/lib/evaluateTailwindFunctions.js +16 -16
- package/lib/lib/expandApplyAtRules.js +180 -27
- package/lib/lib/expandTailwindAtRules.js +132 -122
- package/lib/lib/generateRules.js +90 -72
- package/lib/lib/getModuleDependencies.js +14 -14
- package/lib/lib/normalizeTailwindDirectives.js +35 -35
- package/lib/lib/partitionApplyAtRules.js +7 -7
- package/lib/lib/resolveDefaultsAtRules.js +81 -77
- package/lib/lib/setupContextUtils.js +78 -87
- package/lib/lib/setupTrackingContext.js +57 -57
- package/lib/lib/sharedState.js +10 -8
- package/lib/lib/substituteScreenAtRules.js +2 -2
- package/lib/postcss-plugins/nesting/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +1 -1
- package/lib/postcss-plugins/nesting/plugin.js +41 -9
- package/lib/processTailwindFeatures.js +7 -7
- package/lib/public/colors.js +241 -241
- package/lib/public/resolve-config.js +5 -5
- package/lib/util/buildMediaQuery.js +2 -2
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +12 -1
- package/lib/util/color.js +21 -20
- package/lib/util/createUtilityPlugin.js +6 -6
- package/lib/util/dataTypes.js +77 -75
- package/lib/util/escapeClassName.js +5 -5
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +19 -19
- package/lib/util/getAllConfigs.js +5 -5
- package/lib/util/hashConfig.js +5 -5
- package/lib/util/isKeyframeRule.js +1 -1
- package/lib/util/isPlainObject.js +1 -1
- package/lib/util/isValidArbitraryValue.js +27 -27
- package/lib/util/log.js +8 -8
- package/lib/util/nameClass.js +7 -7
- package/lib/util/negateValue.js +4 -4
- package/lib/util/normalizeConfig.js +39 -39
- package/lib/util/normalizeScreens.js +4 -4
- package/lib/util/parseAnimationValue.js +56 -56
- package/lib/util/parseBoxShadowValue.js +60 -20
- package/lib/util/parseDependency.js +32 -32
- package/lib/util/parseObjectStyles.js +6 -6
- package/lib/util/pluginUtils.js +9 -9
- package/lib/util/prefixSelector.js +1 -1
- package/lib/util/resolveConfig.js +28 -28
- package/lib/util/resolveConfigPath.js +16 -16
- package/lib/util/responsive.js +6 -6
- package/lib/util/toColorValue.js +1 -1
- package/lib/util/toPath.js +2 -2
- package/lib/util/transformThemeValue.js +27 -27
- package/lib/util/withAlphaVariable.js +19 -19
- package/package.json +24 -23
- package/peers/index.js +4777 -4831
- package/scripts/generate-types.js +52 -0
- package/src/cli.js +41 -11
- package/src/corePlugins.js +67 -5
- package/src/featureFlags.js +2 -2
- package/src/index.js +17 -1
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +16 -1
- package/src/lib/defaultExtractor.js +4 -4
- package/src/lib/expandApplyAtRules.js +179 -6
- package/src/lib/expandTailwindAtRules.js +25 -5
- package/src/lib/generateRules.js +68 -46
- package/src/lib/resolveDefaultsAtRules.js +6 -2
- package/src/lib/setupContextUtils.js +25 -26
- package/src/lib/setupTrackingContext.js +3 -3
- package/src/lib/sharedState.js +1 -0
- package/src/postcss-plugins/nesting/README.md +2 -2
- package/src/postcss-plugins/nesting/plugin.js +36 -0
- package/src/util/cloneNodes.js +14 -1
- package/src/util/color.js +7 -5
- package/src/util/dataTypes.js +3 -1
- package/src/util/log.js +7 -7
- package/src/util/parseBoxShadowValue.js +50 -2
- package/src/util/resolveConfig.js +32 -0
- package/stubs/defaultConfig.stub.js +5 -0
|
@@ -15,6 +15,57 @@ var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPa
|
|
|
15
15
|
var _sharedState = require("./sharedState");
|
|
16
16
|
var _setupContextUtils = require("./setupContextUtils");
|
|
17
17
|
var _parseDependency = _interopRequireDefault(require("../util/parseDependency"));
|
|
18
|
+
function setupTrackingContext(configOrPath) {
|
|
19
|
+
return ({ tailwindDirectives , registerDependency })=>{
|
|
20
|
+
return (root, result)=>{
|
|
21
|
+
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
22
|
+
let contextDependencies = new Set(configDependencies);
|
|
23
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
24
|
+
// file or its dependencies to be dependencies of the context. Can reuse
|
|
25
|
+
// the context even if they change. We may want to think about `@layer`
|
|
26
|
+
// being part of this trigger too, but it's tough because it's impossible
|
|
27
|
+
// for a layer in one file to end up in the actual @tailwind rule in
|
|
28
|
+
// another file since independent sources are effectively isolated.
|
|
29
|
+
if (tailwindDirectives.size > 0) {
|
|
30
|
+
// Add current css file as a context dependencies.
|
|
31
|
+
contextDependencies.add(result.opts.from);
|
|
32
|
+
// Add all css @import dependencies as context dependencies.
|
|
33
|
+
for (let message of result.messages){
|
|
34
|
+
if (message.type === "dependency") {
|
|
35
|
+
contextDependencies.add(message.file);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
40
|
+
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
41
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
42
|
+
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
43
|
+
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
44
|
+
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
45
|
+
// in another file since independent sources are effectively isolated.
|
|
46
|
+
if (tailwindDirectives.size > 0) {
|
|
47
|
+
let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
|
|
48
|
+
// Add template paths as postcss dependencies.
|
|
49
|
+
for (let fileOrGlob of candidateFiles){
|
|
50
|
+
let dependency = (0, _parseDependency).default(fileOrGlob);
|
|
51
|
+
if (dependency) {
|
|
52
|
+
registerDependency(dependency);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)){
|
|
56
|
+
context.changedContent.push(changedContent);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (let file of configDependencies){
|
|
60
|
+
registerDependency({
|
|
61
|
+
type: "dependency",
|
|
62
|
+
file
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return context;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
}
|
|
18
69
|
function _interopRequireDefault(obj) {
|
|
19
70
|
return obj && obj.__esModule ? obj : {
|
|
20
71
|
default: obj
|
|
@@ -28,7 +79,7 @@ function getCandidateFiles(context, tailwindConfig) {
|
|
|
28
79
|
if (candidateFilesCache.has(context)) {
|
|
29
80
|
return candidateFilesCache.get(context);
|
|
30
81
|
}
|
|
31
|
-
let candidateFiles = tailwindConfig.content.files.filter((item)=>typeof item ===
|
|
82
|
+
let candidateFiles = tailwindConfig.content.files.filter((item)=>typeof item === "string"
|
|
32
83
|
).map((contentPath)=>(0, _normalizePath).default(contentPath)
|
|
33
84
|
);
|
|
34
85
|
return candidateFilesCache.set(context, candidateFiles).get(context);
|
|
@@ -87,14 +138,14 @@ function getTailwindConfig(configOrPath) {
|
|
|
87
138
|
];
|
|
88
139
|
}
|
|
89
140
|
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
90
|
-
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw ===
|
|
91
|
-
).map(({ raw , extension =
|
|
141
|
+
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string"
|
|
142
|
+
).map(({ raw , extension ="html" })=>({
|
|
92
143
|
content: raw,
|
|
93
144
|
extension
|
|
94
145
|
})
|
|
95
146
|
);
|
|
96
147
|
for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
|
|
97
|
-
let content = _fs.default.readFileSync(changedFile,
|
|
148
|
+
let content = _fs.default.readFileSync(changedFile, "utf8");
|
|
98
149
|
let extension = _path.default.extname(changedFile).slice(1);
|
|
99
150
|
changedContent.push({
|
|
100
151
|
content,
|
|
@@ -105,7 +156,7 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
105
156
|
}
|
|
106
157
|
function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
107
158
|
let changedFiles = new Set();
|
|
108
|
-
_sharedState.env.DEBUG && console.time(
|
|
159
|
+
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
109
160
|
let files = _fastGlob.default.sync(candidateFiles);
|
|
110
161
|
for (let file of files){
|
|
111
162
|
let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
|
|
@@ -115,57 +166,6 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
|
115
166
|
fileModifiedMap.set(file, modified);
|
|
116
167
|
}
|
|
117
168
|
}
|
|
118
|
-
_sharedState.env.DEBUG && console.timeEnd(
|
|
169
|
+
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
|
|
119
170
|
return changedFiles;
|
|
120
171
|
}
|
|
121
|
-
function setupTrackingContext(configOrPath) {
|
|
122
|
-
return ({ tailwindDirectives , registerDependency , applyDirectives })=>{
|
|
123
|
-
return (root, result)=>{
|
|
124
|
-
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
125
|
-
let contextDependencies = new Set(configDependencies);
|
|
126
|
-
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
127
|
-
// file or its dependencies to be dependencies of the context. Can reuse
|
|
128
|
-
// the context even if they change. We may want to think about `@layer`
|
|
129
|
-
// being part of this trigger too, but it's tough because it's impossible
|
|
130
|
-
// for a layer in one file to end up in the actual @tailwind rule in
|
|
131
|
-
// another file since independent sources are effectively isolated.
|
|
132
|
-
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
133
|
-
// Add current css file as a context dependencies.
|
|
134
|
-
contextDependencies.add(result.opts.from);
|
|
135
|
-
// Add all css @import dependencies as context dependencies.
|
|
136
|
-
for (let message of result.messages){
|
|
137
|
-
if (message.type === 'dependency') {
|
|
138
|
-
contextDependencies.add(message.file);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
143
|
-
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
144
|
-
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
145
|
-
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
146
|
-
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
147
|
-
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
148
|
-
// in another file since independent sources are effectively isolated.
|
|
149
|
-
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
150
|
-
let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
|
|
151
|
-
// Add template paths as postcss dependencies.
|
|
152
|
-
for (let fileOrGlob of candidateFiles){
|
|
153
|
-
let dependency = (0, _parseDependency).default(fileOrGlob);
|
|
154
|
-
if (dependency) {
|
|
155
|
-
registerDependency(dependency);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)){
|
|
159
|
-
context.changedContent.push(changedContent);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
for (let file of configDependencies){
|
|
163
|
-
registerDependency({
|
|
164
|
-
type: 'dependency',
|
|
165
|
-
file
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
return context;
|
|
169
|
-
};
|
|
170
|
-
};
|
|
171
|
-
}
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.resolveDebug = resolveDebug;
|
|
6
|
-
exports.NOT_ON_DEMAND = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
6
|
+
exports.NOT_ON_DEMAND = exports.sourceHashMap = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
7
7
|
const env = {
|
|
8
8
|
NODE_ENV: process.env.NODE_ENV,
|
|
9
9
|
DEBUG: resolveDebug(process.env.DEBUG)
|
|
@@ -15,17 +15,19 @@ const configContextMap = new Map();
|
|
|
15
15
|
exports.configContextMap = configContextMap;
|
|
16
16
|
const contextSourcesMap = new Map();
|
|
17
17
|
exports.contextSourcesMap = contextSourcesMap;
|
|
18
|
-
const
|
|
18
|
+
const sourceHashMap = new Map();
|
|
19
|
+
exports.sourceHashMap = sourceHashMap;
|
|
20
|
+
const NOT_ON_DEMAND = new String("*");
|
|
19
21
|
exports.NOT_ON_DEMAND = NOT_ON_DEMAND;
|
|
20
22
|
function resolveDebug(debug) {
|
|
21
23
|
if (debug === undefined) {
|
|
22
24
|
return false;
|
|
23
25
|
}
|
|
24
26
|
// Environment variables are strings, so convert to boolean
|
|
25
|
-
if (debug ===
|
|
27
|
+
if (debug === "true" || debug === "1") {
|
|
26
28
|
return true;
|
|
27
29
|
}
|
|
28
|
-
if (debug ===
|
|
30
|
+
if (debug === "false" || debug === "0") {
|
|
29
31
|
return false;
|
|
30
32
|
}
|
|
31
33
|
// Keep the debug convention into account:
|
|
@@ -33,17 +35,17 @@ function resolveDebug(debug) {
|
|
|
33
35
|
// DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
|
|
34
36
|
// DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
|
|
35
37
|
// DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
|
|
36
|
-
if (debug ===
|
|
38
|
+
if (debug === "*") {
|
|
37
39
|
return true;
|
|
38
40
|
}
|
|
39
|
-
let debuggers = debug.split(
|
|
41
|
+
let debuggers = debug.split(",").map((d)=>d.split(":")[0]
|
|
40
42
|
);
|
|
41
43
|
// Ignoring tailwindcss
|
|
42
|
-
if (debuggers.includes(
|
|
44
|
+
if (debuggers.includes("-tailwindcss")) {
|
|
43
45
|
return false;
|
|
44
46
|
}
|
|
45
47
|
// Including tailwindcss
|
|
46
|
-
if (debuggers.includes(
|
|
48
|
+
if (debuggers.includes("tailwindcss")) {
|
|
47
49
|
return true;
|
|
48
50
|
}
|
|
49
51
|
return false;
|
|
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
}
|
|
13
13
|
function _default({ tailwindConfig: { theme } }) {
|
|
14
14
|
return function(css) {
|
|
15
|
-
css.walkAtRules(
|
|
15
|
+
css.walkAtRules("screen", (atRule)=>{
|
|
16
16
|
let screen = atRule.params;
|
|
17
17
|
let screens = (0, _normalizeScreens).normalizeScreens(theme.screens);
|
|
18
18
|
let screenDefinition = screens.find(({ name })=>name === screen
|
|
@@ -20,7 +20,7 @@ function _default({ tailwindConfig: { theme } }) {
|
|
|
20
20
|
if (!screenDefinition) {
|
|
21
21
|
throw atRule.error(`No \`${screen}\` screen found.`);
|
|
22
22
|
}
|
|
23
|
-
atRule.name =
|
|
23
|
+
atRule.name = "media";
|
|
24
24
|
atRule.params = (0, _buildMediaQuery).default(screenDefinition);
|
|
25
25
|
});
|
|
26
26
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tailwindcss/nesting
|
|
2
2
|
|
|
3
|
-
This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/
|
|
3
|
+
This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
|
|
4
4
|
|
|
5
5
|
Add it to your PostCSS configuration, somewhere before Tailwind itself:
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
|
|
19
19
|
By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
|
|
20
20
|
|
|
21
|
-
If you'd rather use [postcss-nesting](https://github.com/
|
|
21
|
+
If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
|
|
22
22
|
|
|
23
23
|
```shell
|
|
24
24
|
npm install postcss-nesting
|
|
@@ -6,7 +6,7 @@ exports.default = void 0;
|
|
|
6
6
|
var _plugin = require("./plugin");
|
|
7
7
|
var _default = Object.assign(function(opts) {
|
|
8
8
|
return {
|
|
9
|
-
postcssPlugin:
|
|
9
|
+
postcssPlugin: "tailwindcss/nesting",
|
|
10
10
|
Once (root, { result }) {
|
|
11
11
|
return (0, _plugin).nesting(opts)(root, result);
|
|
12
12
|
}
|
|
@@ -12,13 +12,13 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
}
|
|
13
13
|
function nesting(opts = _postcssNested.default) {
|
|
14
14
|
return (root, result)=>{
|
|
15
|
-
root.walkAtRules(
|
|
16
|
-
rule.name =
|
|
15
|
+
root.walkAtRules("screen", (rule)=>{
|
|
16
|
+
rule.name = "media";
|
|
17
17
|
rule.params = `screen(${rule.params})`;
|
|
18
18
|
});
|
|
19
|
-
root.walkAtRules(
|
|
19
|
+
root.walkAtRules("apply", (rule)=>{
|
|
20
20
|
rule.before(_postcss.default.decl({
|
|
21
|
-
prop:
|
|
21
|
+
prop: "__apply",
|
|
22
22
|
value: rule.params,
|
|
23
23
|
source: rule.source
|
|
24
24
|
}));
|
|
@@ -26,28 +26,60 @@ function nesting(opts = _postcssNested.default) {
|
|
|
26
26
|
});
|
|
27
27
|
let plugin = (()=>{
|
|
28
28
|
var ref;
|
|
29
|
-
if (typeof opts ===
|
|
29
|
+
if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, "postcssPlugin"))) {
|
|
30
30
|
return opts;
|
|
31
31
|
}
|
|
32
|
-
if (typeof opts ===
|
|
32
|
+
if (typeof opts === "string") {
|
|
33
33
|
return require(opts);
|
|
34
34
|
}
|
|
35
35
|
if (Object.keys(opts).length <= 0) {
|
|
36
36
|
return _postcssNested.default;
|
|
37
37
|
}
|
|
38
|
-
throw new Error(
|
|
38
|
+
throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
|
|
39
39
|
})();
|
|
40
40
|
(0, _postcss).default([
|
|
41
41
|
plugin
|
|
42
42
|
]).process(root, result.opts).sync();
|
|
43
|
-
root.walkDecls(
|
|
43
|
+
root.walkDecls("__apply", (decl)=>{
|
|
44
44
|
decl.before(_postcss.default.atRule({
|
|
45
|
-
name:
|
|
45
|
+
name: "apply",
|
|
46
46
|
params: decl.value,
|
|
47
47
|
source: decl.source
|
|
48
48
|
}));
|
|
49
49
|
decl.remove();
|
|
50
50
|
});
|
|
51
|
+
/**
|
|
52
|
+
* Use a private PostCSS API to remove the "clean" flag from the entire AST.
|
|
53
|
+
* This is done because running process() on the AST will set the "clean"
|
|
54
|
+
* flag on all nodes, which we don't want.
|
|
55
|
+
*
|
|
56
|
+
* This causes downstream plugins using the visitor API to be skipped.
|
|
57
|
+
*
|
|
58
|
+
* This is guarded because the PostCSS API is not public
|
|
59
|
+
* and may change in future versions of PostCSS.
|
|
60
|
+
*
|
|
61
|
+
* See https://github.com/postcss/postcss/issues/1712 for more details
|
|
62
|
+
*
|
|
63
|
+
* @param {import('postcss').Node} node
|
|
64
|
+
*/ function markDirty(node) {
|
|
65
|
+
if (!("markDirty" in node)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
// Traverse the tree down to the leaf nodes
|
|
69
|
+
if (node.nodes) {
|
|
70
|
+
node.nodes.forEach((n)=>markDirty(n)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
// If it's a leaf node mark it as dirty
|
|
74
|
+
// We do this here because marking a node as dirty
|
|
75
|
+
// will walk up the tree and mark all parents as dirty
|
|
76
|
+
// resulting in a lot of unnecessary work if we did this
|
|
77
|
+
// for every single node
|
|
78
|
+
if (!node.nodes) {
|
|
79
|
+
node.markDirty();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
markDirty(root);
|
|
51
83
|
return root;
|
|
52
84
|
};
|
|
53
85
|
}
|
|
@@ -15,11 +15,6 @@ var _partitionApplyAtRules = _interopRequireDefault(require("./lib/partitionAppl
|
|
|
15
15
|
var _detectNesting = _interopRequireDefault(require("./lib/detectNesting"));
|
|
16
16
|
var _setupContextUtils = require("./lib/setupContextUtils");
|
|
17
17
|
var _featureFlags = require("./featureFlags");
|
|
18
|
-
function _interopRequireDefault(obj) {
|
|
19
|
-
return obj && obj.__esModule ? obj : {
|
|
20
|
-
default: obj
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
18
|
function processTailwindFeatures(setupContext) {
|
|
24
19
|
return function(root, result) {
|
|
25
20
|
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
|
|
@@ -32,7 +27,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
32
27
|
applyDirectives,
|
|
33
28
|
registerDependency (dependency) {
|
|
34
29
|
result.messages.push({
|
|
35
|
-
plugin:
|
|
30
|
+
plugin: "tailwindcss",
|
|
36
31
|
parent: result.opts.from,
|
|
37
32
|
...dependency
|
|
38
33
|
});
|
|
@@ -41,7 +36,7 @@ function processTailwindFeatures(setupContext) {
|
|
|
41
36
|
return (0, _setupContextUtils).createContext(tailwindConfig, changedContent, root);
|
|
42
37
|
}
|
|
43
38
|
})(root, result);
|
|
44
|
-
if (context.tailwindConfig.separator ===
|
|
39
|
+
if (context.tailwindConfig.separator === "-") {
|
|
45
40
|
throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
|
|
46
41
|
}
|
|
47
42
|
(0, _featureFlags).issueFlagNotices(context.tailwindConfig);
|
|
@@ -57,3 +52,8 @@ function processTailwindFeatures(setupContext) {
|
|
|
57
52
|
(0, _collapseDuplicateDeclarations).default(context)(root, result);
|
|
58
53
|
};
|
|
59
54
|
}
|
|
55
|
+
function _interopRequireDefault(obj) {
|
|
56
|
+
return obj && obj.__esModule ? obj : {
|
|
57
|
+
default: obj
|
|
58
|
+
};
|
|
59
|
+
}
|