tailwindcss 0.0.0-insiders.d2b53cd → 0.0.0-insiders.d2fdf9e
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 +364 -2
- package/LICENSE +1 -2
- package/README.md +8 -4
- package/colors.d.ts +3 -0
- package/colors.js +2 -1
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -1
- package/defaultTheme.d.ts +3 -0
- package/defaultTheme.js +2 -1
- package/lib/cli-peer-dependencies.js +10 -5
- package/lib/cli.js +306 -203
- package/lib/constants.js +9 -9
- package/lib/corePluginList.js +10 -1
- package/lib/corePlugins.js +1835 -1760
- package/lib/css/preflight.css +19 -13
- package/lib/featureFlags.js +18 -15
- package/lib/index.js +17 -8
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/collapseAdjacentRules.js +30 -14
- package/lib/lib/collapseDuplicateDeclarations.js +80 -0
- package/lib/lib/defaultExtractor.js +187 -0
- package/lib/lib/detectNesting.js +17 -2
- package/lib/lib/evaluateTailwindFunctions.js +40 -24
- package/lib/lib/expandApplyAtRules.js +414 -157
- package/lib/lib/expandTailwindAtRules.js +145 -126
- package/lib/lib/generateRules.js +403 -103
- package/lib/lib/getModuleDependencies.js +14 -14
- package/lib/lib/normalizeTailwindDirectives.js +43 -35
- package/lib/lib/partitionApplyAtRules.js +53 -0
- package/lib/lib/regex.js +53 -0
- package/lib/lib/resolveDefaultsAtRules.js +83 -65
- package/lib/lib/setupContextUtils.js +315 -204
- package/lib/lib/setupTrackingContext.js +60 -56
- package/lib/lib/sharedState.js +38 -5
- package/lib/lib/substituteScreenAtRules.js +9 -6
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +17 -0
- package/lib/postcss-plugins/nesting/plugin.js +85 -0
- package/lib/processTailwindFeatures.js +19 -9
- package/lib/public/colors.js +241 -241
- package/lib/public/resolve-config.js +5 -5
- package/lib/util/buildMediaQuery.js +13 -24
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +12 -1
- package/lib/util/color.js +43 -32
- package/lib/util/createPlugin.js +1 -2
- package/lib/util/createUtilityPlugin.js +11 -15
- package/lib/util/dataTypes.js +114 -74
- package/lib/util/defaults.js +6 -0
- package/lib/util/escapeClassName.js +5 -5
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -4
- package/lib/util/formatVariantSelector.js +194 -0
- package/lib/util/getAllConfigs.js +13 -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 +64 -0
- package/lib/util/log.js +11 -7
- package/lib/util/nameClass.js +7 -6
- package/lib/util/negateValue.js +4 -4
- package/lib/util/normalizeConfig.js +84 -45
- package/lib/util/normalizeScreens.js +59 -0
- package/lib/util/parseAnimationValue.js +56 -56
- package/lib/util/parseBoxShadowValue.js +76 -0
- package/lib/util/parseDependency.js +32 -32
- package/lib/util/parseObjectStyles.js +6 -6
- package/lib/util/pluginUtils.js +34 -165
- package/lib/util/prefixSelector.js +4 -7
- package/lib/util/resolveConfig.js +115 -66
- package/lib/util/resolveConfigPath.js +17 -18
- package/lib/util/responsive.js +6 -6
- package/lib/util/splitAtTopLevelOnly.js +72 -0
- package/lib/util/toColorValue.js +1 -2
- package/lib/util/toPath.js +6 -1
- package/lib/util/transformThemeValue.js +42 -34
- package/lib/util/validateConfig.js +21 -0
- package/lib/util/withAlphaVariable.js +19 -19
- package/nesting/index.js +2 -12
- package/package.json +39 -40
- package/peers/index.js +11511 -10819
- package/plugin.d.ts +11 -0
- package/plugin.js +2 -1
- package/resolveConfig.js +2 -1
- package/scripts/generate-types.js +52 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +164 -30
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +540 -535
- package/src/css/preflight.css +19 -13
- package/src/featureFlags.js +5 -5
- package/src/index.js +14 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/defaultExtractor.js +192 -0
- package/src/lib/detectNesting.js +22 -3
- package/src/lib/evaluateTailwindFunctions.js +24 -7
- package/src/lib/expandApplyAtRules.js +442 -154
- package/src/lib/expandTailwindAtRules.js +79 -37
- package/src/lib/generateRules.js +400 -83
- package/src/lib/normalizeTailwindDirectives.js +7 -1
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +35 -10
- package/src/lib/setupContextUtils.js +273 -112
- package/src/lib/setupTrackingContext.js +12 -7
- package/src/lib/sharedState.js +42 -4
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +14 -2
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/cloneNodes.js +14 -1
- package/src/util/color.js +31 -14
- package/src/util/dataTypes.js +56 -16
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +213 -0
- package/src/util/getAllConfigs.js +7 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +10 -6
- package/src/util/nameClass.js +1 -1
- package/src/util/normalizeConfig.js +32 -3
- package/src/util/normalizeScreens.js +45 -0
- package/src/util/parseBoxShadowValue.js +72 -0
- package/src/util/pluginUtils.js +15 -138
- package/src/util/prefixSelector.js +7 -8
- package/src/util/resolveConfig.js +97 -15
- package/src/util/splitAtTopLevelOnly.js +71 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +24 -7
- package/src/util/validateConfig.js +13 -0
- package/stubs/defaultConfig.stub.js +47 -17
- package/types/config.d.ts +325 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types.d.ts +1 -0
- package/lib/lib/setupWatchingContext.js +0 -284
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -304
|
@@ -7,7 +7,138 @@ var _quickLru = _interopRequireDefault(require("quick-lru"));
|
|
|
7
7
|
var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
8
8
|
var _generateRules = require("./generateRules");
|
|
9
9
|
var _bigSign = _interopRequireDefault(require("../util/bigSign"));
|
|
10
|
+
var _log = _interopRequireDefault(require("../util/log"));
|
|
10
11
|
var _cloneNodes = _interopRequireDefault(require("../util/cloneNodes"));
|
|
12
|
+
var _defaultExtractor = require("./defaultExtractor");
|
|
13
|
+
function expandTailwindAtRules(context) {
|
|
14
|
+
return (root)=>{
|
|
15
|
+
let layerNodes = {
|
|
16
|
+
base: null,
|
|
17
|
+
components: null,
|
|
18
|
+
utilities: null,
|
|
19
|
+
variants: null
|
|
20
|
+
};
|
|
21
|
+
root.walkAtRules((rule)=>{
|
|
22
|
+
// Make sure this file contains Tailwind directives. If not, we can save
|
|
23
|
+
// a lot of work and bail early. Also we don't have to register our touch
|
|
24
|
+
// file as a dependency since the output of this CSS does not depend on
|
|
25
|
+
// the source of any templates. Think Vue <style> blocks for example.
|
|
26
|
+
if (rule.name === "tailwind") {
|
|
27
|
+
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
28
|
+
layerNodes[rule.params] = rule;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
if (Object.values(layerNodes).every((n)=>n === null
|
|
33
|
+
)) {
|
|
34
|
+
return root;
|
|
35
|
+
}
|
|
36
|
+
// ---
|
|
37
|
+
// Find potential rules in changed files
|
|
38
|
+
let candidates = new Set([
|
|
39
|
+
sharedState.NOT_ON_DEMAND
|
|
40
|
+
]);
|
|
41
|
+
let seen = new Set();
|
|
42
|
+
env.DEBUG && console.time("Reading changed files");
|
|
43
|
+
for (let { content , extension } of context.changedContent){
|
|
44
|
+
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
45
|
+
let extractor = getExtractor(context, extension);
|
|
46
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
47
|
+
}
|
|
48
|
+
env.DEBUG && console.timeEnd("Reading changed files");
|
|
49
|
+
// ---
|
|
50
|
+
// Generate the actual CSS
|
|
51
|
+
let classCacheCount = context.classCache.size;
|
|
52
|
+
env.DEBUG && console.time("Generate rules");
|
|
53
|
+
let rules = (0, _generateRules).generateRules(candidates, context);
|
|
54
|
+
env.DEBUG && console.timeEnd("Generate rules");
|
|
55
|
+
// We only ever add to the classCache, so if it didn't grow, there is nothing new.
|
|
56
|
+
env.DEBUG && console.time("Build stylesheet");
|
|
57
|
+
if (context.stylesheetCache === null || context.classCache.size !== classCacheCount) {
|
|
58
|
+
for (let rule of rules){
|
|
59
|
+
context.ruleCache.add(rule);
|
|
60
|
+
}
|
|
61
|
+
context.stylesheetCache = buildStylesheet([
|
|
62
|
+
...context.ruleCache
|
|
63
|
+
], context);
|
|
64
|
+
}
|
|
65
|
+
env.DEBUG && console.timeEnd("Build stylesheet");
|
|
66
|
+
let { defaults: defaultNodes , base: baseNodes , components: componentNodes , utilities: utilityNodes , variants: screenNodes , } = context.stylesheetCache;
|
|
67
|
+
// ---
|
|
68
|
+
// Replace any Tailwind directives with generated CSS
|
|
69
|
+
if (layerNodes.base) {
|
|
70
|
+
layerNodes.base.before((0, _cloneNodes).default([
|
|
71
|
+
...baseNodes,
|
|
72
|
+
...defaultNodes
|
|
73
|
+
], layerNodes.base.source, {
|
|
74
|
+
layer: "base"
|
|
75
|
+
}));
|
|
76
|
+
layerNodes.base.remove();
|
|
77
|
+
}
|
|
78
|
+
if (layerNodes.components) {
|
|
79
|
+
layerNodes.components.before((0, _cloneNodes).default([
|
|
80
|
+
...componentNodes
|
|
81
|
+
], layerNodes.components.source, {
|
|
82
|
+
layer: "components"
|
|
83
|
+
}));
|
|
84
|
+
layerNodes.components.remove();
|
|
85
|
+
}
|
|
86
|
+
if (layerNodes.utilities) {
|
|
87
|
+
layerNodes.utilities.before((0, _cloneNodes).default([
|
|
88
|
+
...utilityNodes
|
|
89
|
+
], layerNodes.utilities.source, {
|
|
90
|
+
layer: "utilities"
|
|
91
|
+
}));
|
|
92
|
+
layerNodes.utilities.remove();
|
|
93
|
+
}
|
|
94
|
+
// We do post-filtering to not alter the emitted order of the variants
|
|
95
|
+
const variantNodes = Array.from(screenNodes).filter((node)=>{
|
|
96
|
+
var ref;
|
|
97
|
+
const parentLayer = (ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer;
|
|
98
|
+
if (parentLayer === "components") {
|
|
99
|
+
return layerNodes.components !== null;
|
|
100
|
+
}
|
|
101
|
+
if (parentLayer === "utilities") {
|
|
102
|
+
return layerNodes.utilities !== null;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
});
|
|
106
|
+
if (layerNodes.variants) {
|
|
107
|
+
layerNodes.variants.before((0, _cloneNodes).default(variantNodes, layerNodes.variants.source, {
|
|
108
|
+
layer: "variants"
|
|
109
|
+
}));
|
|
110
|
+
layerNodes.variants.remove();
|
|
111
|
+
} else if (variantNodes.length > 0) {
|
|
112
|
+
root.append((0, _cloneNodes).default(variantNodes, root.source, {
|
|
113
|
+
layer: "variants"
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
117
|
+
const hasUtilityVariants = variantNodes.some((node)=>{
|
|
118
|
+
var ref;
|
|
119
|
+
return ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer) === "utilities";
|
|
120
|
+
});
|
|
121
|
+
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
|
|
122
|
+
_log.default.warn("content-problems", [
|
|
123
|
+
"No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.",
|
|
124
|
+
"https://tailwindcss.com/docs/content-configuration",
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
// ---
|
|
128
|
+
if (env.DEBUG) {
|
|
129
|
+
console.log("Potential classes: ", candidates.size);
|
|
130
|
+
console.log("Active contexts: ", sharedState.contextSourcesMap.size);
|
|
131
|
+
}
|
|
132
|
+
// Clear the cache for the changed files
|
|
133
|
+
context.changedContent = [];
|
|
134
|
+
// Cleanup any leftover @layer atrules
|
|
135
|
+
root.walkAtRules("layer", (rule)=>{
|
|
136
|
+
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
137
|
+
rule.remove();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
}
|
|
11
142
|
function _interopRequireDefault(obj) {
|
|
12
143
|
return obj && obj.__esModule ? obj : {
|
|
13
144
|
default: obj
|
|
@@ -17,13 +148,11 @@ function _interopRequireWildcard(obj) {
|
|
|
17
148
|
if (obj && obj.__esModule) {
|
|
18
149
|
return obj;
|
|
19
150
|
} else {
|
|
20
|
-
var newObj = {
|
|
21
|
-
};
|
|
151
|
+
var newObj = {};
|
|
22
152
|
if (obj != null) {
|
|
23
153
|
for(var key in obj){
|
|
24
154
|
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
25
|
-
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
|
|
26
|
-
};
|
|
155
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
27
156
|
if (desc.get || desc.set) {
|
|
28
157
|
Object.defineProperty(newObj, key, desc);
|
|
29
158
|
} else {
|
|
@@ -37,36 +166,17 @@ function _interopRequireWildcard(obj) {
|
|
|
37
166
|
}
|
|
38
167
|
}
|
|
39
168
|
let env = sharedState.env;
|
|
40
|
-
const PATTERNS = [
|
|
41
|
-
/([^<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
|
|
42
|
-
/([^<>"'`\s]*\[\w*"[^"`\s]*"?\])/.source,
|
|
43
|
-
/([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
|
|
44
|
-
/([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
|
|
45
|
-
/([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
|
|
46
|
-
/([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
|
|
47
|
-
/([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
|
|
48
|
-
/([^<>"'`\s]*[^"'`\s:])/.source
|
|
49
|
-
].join('|');
|
|
50
|
-
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
|
|
51
|
-
const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g;
|
|
52
169
|
const builtInExtractors = {
|
|
53
|
-
DEFAULT:
|
|
54
|
-
let broadMatches = content.match(BROAD_MATCH_GLOBAL_REGEXP) || [];
|
|
55
|
-
let innerMatches = content.match(INNER_MATCH_GLOBAL_REGEXP) || [];
|
|
56
|
-
return [
|
|
57
|
-
...broadMatches,
|
|
58
|
-
...innerMatches
|
|
59
|
-
];
|
|
60
|
-
}
|
|
170
|
+
DEFAULT: _defaultExtractor.defaultExtractor
|
|
61
171
|
};
|
|
62
172
|
const builtInTransformers = {
|
|
63
173
|
DEFAULT: (content)=>content
|
|
64
174
|
,
|
|
65
|
-
svelte: (content)=>content.replace(/(?:^|\s)class:/g,
|
|
175
|
+
svelte: (content)=>content.replace(/(?:^|\s)class:/g, " ")
|
|
66
176
|
};
|
|
67
|
-
function getExtractor(
|
|
68
|
-
let extractors = tailwindConfig.content.extract;
|
|
69
|
-
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT;
|
|
177
|
+
function getExtractor(context, fileExtension) {
|
|
178
|
+
let extractors = context.tailwindConfig.content.extract;
|
|
179
|
+
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT(context);
|
|
70
180
|
}
|
|
71
181
|
function getTransformer(tailwindConfig, fileExtension) {
|
|
72
182
|
let transformers = tailwindConfig.content.transform;
|
|
@@ -82,7 +192,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
82
192
|
maxSize: 25000
|
|
83
193
|
}));
|
|
84
194
|
}
|
|
85
|
-
for (let line of content.split(
|
|
195
|
+
for (let line of content.split("\n")){
|
|
86
196
|
line = line.trim();
|
|
87
197
|
if (seen.has(line)) {
|
|
88
198
|
continue;
|
|
@@ -93,7 +203,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
93
203
|
candidates.add(match);
|
|
94
204
|
}
|
|
95
205
|
} else {
|
|
96
|
-
let extractorMatches = extractor(line).filter((s)=>s !==
|
|
206
|
+
let extractorMatches = extractor(line).filter((s)=>s !== "!*"
|
|
97
207
|
);
|
|
98
208
|
let lineMatchesSet = new Set(extractorMatches);
|
|
99
209
|
for (let match of lineMatchesSet){
|
|
@@ -108,6 +218,7 @@ function buildStylesheet(rules, context) {
|
|
|
108
218
|
);
|
|
109
219
|
let returnValue = {
|
|
110
220
|
base: new Set(),
|
|
221
|
+
defaults: new Set(),
|
|
111
222
|
components: new Set(),
|
|
112
223
|
utilities: new Set(),
|
|
113
224
|
variants: new Set(),
|
|
@@ -130,6 +241,10 @@ function buildStylesheet(rules, context) {
|
|
|
130
241
|
returnValue.base.add(rule);
|
|
131
242
|
continue;
|
|
132
243
|
}
|
|
244
|
+
if (sort & context.layerOrder.defaults) {
|
|
245
|
+
returnValue.defaults.add(rule);
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
133
248
|
if (sort & context.layerOrder.components) {
|
|
134
249
|
returnValue.components.add(rule);
|
|
135
250
|
continue;
|
|
@@ -145,99 +260,3 @@ function buildStylesheet(rules, context) {
|
|
|
145
260
|
}
|
|
146
261
|
return returnValue;
|
|
147
262
|
}
|
|
148
|
-
function expandTailwindAtRules(context) {
|
|
149
|
-
return (root)=>{
|
|
150
|
-
let layerNodes = {
|
|
151
|
-
base: null,
|
|
152
|
-
components: null,
|
|
153
|
-
utilities: null,
|
|
154
|
-
variants: null
|
|
155
|
-
};
|
|
156
|
-
// Make sure this file contains Tailwind directives. If not, we can save
|
|
157
|
-
// a lot of work and bail early. Also we don't have to register our touch
|
|
158
|
-
// file as a dependency since the output of this CSS does not depend on
|
|
159
|
-
// the source of any templates. Think Vue <style> blocks for example.
|
|
160
|
-
root.walkAtRules('tailwind', (rule)=>{
|
|
161
|
-
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
162
|
-
layerNodes[rule.params] = rule;
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
if (Object.values(layerNodes).every((n)=>n === null
|
|
166
|
-
)) {
|
|
167
|
-
return root;
|
|
168
|
-
}
|
|
169
|
-
// ---
|
|
170
|
-
// Find potential rules in changed files
|
|
171
|
-
let candidates = new Set([
|
|
172
|
-
'*'
|
|
173
|
-
]);
|
|
174
|
-
let seen = new Set();
|
|
175
|
-
env.DEBUG && console.time('Reading changed files');
|
|
176
|
-
for (let { content , extension } of context.changedContent){
|
|
177
|
-
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
178
|
-
let extractor = getExtractor(context.tailwindConfig, extension);
|
|
179
|
-
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
180
|
-
}
|
|
181
|
-
// ---
|
|
182
|
-
// Generate the actual CSS
|
|
183
|
-
let classCacheCount = context.classCache.size;
|
|
184
|
-
env.DEBUG && console.time('Generate rules');
|
|
185
|
-
let rules = (0, _generateRules).generateRules(candidates, context);
|
|
186
|
-
env.DEBUG && console.timeEnd('Generate rules');
|
|
187
|
-
// We only ever add to the classCache, so if it didn't grow, there is nothing new.
|
|
188
|
-
env.DEBUG && console.time('Build stylesheet');
|
|
189
|
-
if (context.stylesheetCache === null || context.classCache.size !== classCacheCount) {
|
|
190
|
-
for (let rule of rules){
|
|
191
|
-
context.ruleCache.add(rule);
|
|
192
|
-
}
|
|
193
|
-
context.stylesheetCache = buildStylesheet([
|
|
194
|
-
...context.ruleCache
|
|
195
|
-
], context);
|
|
196
|
-
}
|
|
197
|
-
env.DEBUG && console.timeEnd('Build stylesheet');
|
|
198
|
-
let { base: baseNodes , components: componentNodes , utilities: utilityNodes , variants: screenNodes , } = context.stylesheetCache;
|
|
199
|
-
// ---
|
|
200
|
-
// Replace any Tailwind directives with generated CSS
|
|
201
|
-
if (layerNodes.base) {
|
|
202
|
-
layerNodes.base.before((0, _cloneNodes).default([
|
|
203
|
-
...baseNodes
|
|
204
|
-
], layerNodes.base.source));
|
|
205
|
-
layerNodes.base.remove();
|
|
206
|
-
}
|
|
207
|
-
if (layerNodes.components) {
|
|
208
|
-
layerNodes.components.before((0, _cloneNodes).default([
|
|
209
|
-
...componentNodes
|
|
210
|
-
], layerNodes.components.source));
|
|
211
|
-
layerNodes.components.remove();
|
|
212
|
-
}
|
|
213
|
-
if (layerNodes.utilities) {
|
|
214
|
-
layerNodes.utilities.before((0, _cloneNodes).default([
|
|
215
|
-
...utilityNodes
|
|
216
|
-
], layerNodes.utilities.source));
|
|
217
|
-
layerNodes.utilities.remove();
|
|
218
|
-
}
|
|
219
|
-
if (layerNodes.variants) {
|
|
220
|
-
layerNodes.variants.before((0, _cloneNodes).default([
|
|
221
|
-
...screenNodes
|
|
222
|
-
], layerNodes.variants.source));
|
|
223
|
-
layerNodes.variants.remove();
|
|
224
|
-
} else {
|
|
225
|
-
root.append((0, _cloneNodes).default([
|
|
226
|
-
...screenNodes
|
|
227
|
-
], root.source));
|
|
228
|
-
}
|
|
229
|
-
// ---
|
|
230
|
-
if (env.DEBUG) {
|
|
231
|
-
console.log('Potential classes: ', candidates.size);
|
|
232
|
-
console.log('Active contexts: ', sharedState.contextSourcesMap.size);
|
|
233
|
-
}
|
|
234
|
-
// Clear the cache for the changed files
|
|
235
|
-
context.changedContent = [];
|
|
236
|
-
// Cleanup any leftover @layer atrules
|
|
237
|
-
root.walkAtRules('layer', (rule)=>{
|
|
238
|
-
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
239
|
-
rule.remove();
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
}
|