tailwindcss 0.0.0-insiders.d33b650 → 0.0.0-insiders.d3f2221
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/README.md +1 -1
- package/index.css +5 -0
- package/lib/cli/build/index.js +32 -19
- package/lib/cli/build/plugin.js +228 -148
- package/lib/cli/build/utils.js +31 -21
- package/lib/cli/build/watching.js +99 -30
- package/lib/cli/help/index.js +17 -15
- package/lib/cli/index.js +223 -10
- package/lib/cli/init/index.js +31 -14
- package/lib/cli.js +1 -227
- package/lib/corePluginList.js +8 -1
- package/lib/corePlugins.js +2128 -1823
- package/lib/css/preflight.css +17 -4
- package/lib/featureFlags.js +39 -25
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +10 -8
- package/lib/lib/collapseAdjacentRules.js +10 -8
- package/lib/lib/collapseDuplicateDeclarations.js +13 -11
- package/lib/lib/content.js +65 -28
- package/lib/lib/defaultExtractor.js +24 -32
- package/lib/lib/detectNesting.js +18 -10
- package/lib/lib/evaluateTailwindFunctions.js +45 -41
- package/lib/lib/expandApplyAtRules.js +60 -52
- package/lib/lib/expandTailwindAtRules.js +115 -47
- package/lib/lib/findAtConfigPath.js +14 -12
- package/lib/lib/generateRules.js +206 -146
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +26 -39
- package/lib/lib/offsets.js +136 -47
- package/lib/lib/partitionApplyAtRules.js +5 -3
- package/lib/lib/regex.js +26 -12
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +53 -49
- package/lib/lib/setupContextUtils.js +337 -250
- package/lib/lib/setupTrackingContext.js +54 -29
- package/lib/lib/sharedState.js +36 -17
- package/lib/lib/substituteScreenAtRules.js +9 -7
- package/lib/plugin.js +164 -0
- package/lib/postcss-plugins/nesting/index.js +5 -3
- package/lib/postcss-plugins/nesting/plugin.js +19 -17
- package/lib/processTailwindFeatures.js +19 -17
- package/lib/public/colors.js +269 -245
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +5 -3
- package/lib/util/cloneDeep.js +4 -2
- package/lib/util/cloneNodes.js +6 -4
- package/lib/util/color.js +46 -28
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +9 -7
- package/lib/util/dataTypes.js +215 -96
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +4 -2
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +149 -169
- package/lib/util/getAllConfigs.js +12 -9
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +4 -2
- package/lib/util/isPlainObject.js +4 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +14 -12
- package/lib/util/log.js +31 -10
- package/lib/util/nameClass.js +16 -10
- package/lib/util/negateValue.js +12 -10
- package/lib/util/normalizeConfig.js +123 -77
- package/lib/util/normalizeScreens.js +30 -22
- package/lib/util/parseAnimationValue.js +41 -39
- package/lib/util/parseBoxShadowValue.js +24 -20
- package/lib/util/parseDependency.js +7 -5
- package/lib/util/parseGlob.js +10 -8
- package/lib/util/parseObjectStyles.js +10 -8
- package/lib/util/pluginUtils.js +92 -96
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +4 -2
- package/lib/util/resolveConfig.js +28 -24
- package/lib/util/resolveConfigPath.js +28 -12
- package/lib/util/responsive.js +7 -5
- package/lib/util/splitAtTopLevelOnly.js +12 -4
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +4 -2
- package/lib/util/toPath.js +5 -3
- package/lib/util/transformThemeValue.js +30 -28
- package/lib/util/validateConfig.js +31 -7
- package/lib/util/validateFormalSyntax.js +8 -6
- package/lib/util/withAlphaVariable.js +11 -7
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +49 -50
- package/resolveConfig.d.ts +11 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/index.js +17 -9
- package/src/cli/build/plugin.js +129 -77
- package/src/cli/build/watching.js +108 -13
- package/src/cli/index.js +217 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +1 -221
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +259 -46
- package/src/css/preflight.css +17 -4
- package/src/featureFlags.js +7 -7
- package/src/index.js +1 -47
- package/src/lib/content.js +44 -10
- package/src/lib/defaultExtractor.js +10 -14
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandApplyAtRules.js +10 -3
- package/src/lib/expandTailwindAtRules.js +78 -13
- package/src/lib/generateRules.js +140 -65
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +105 -2
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +145 -80
- package/src/lib/setupTrackingContext.js +37 -14
- package/src/lib/sharedState.js +11 -4
- package/src/plugin.js +133 -0
- package/src/processTailwindFeatures.js +3 -2
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/color.js +19 -4
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +97 -9
- package/src/util/formatVariantSelector.js +163 -165
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +24 -0
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +57 -11
- package/src/util/pluginUtils.js +38 -54
- package/src/util/prefixSelector.js +29 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/resolveConfig.js +0 -2
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +23 -0
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +203 -172
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
- package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
- package/stubs/postcss.config.js +5 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +20 -13
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +116 -80
- package/CHANGELOG.md +0 -2300
- package/lib/cli/build/deps.js +0 -54
- package/lib/cli/shared.js +0 -12
- package/lib/cli-peer-dependencies.js +0 -28
- package/lib/constants.js +0 -44
- package/peers/index.js +0 -79459
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/build/deps.js +0 -56
- package/src/cli/shared.js +0 -5
- package/src/cli-peer-dependencies.js +0 -15
- package/src/constants.js +0 -17
|
@@ -4,15 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return expandTailwindAtRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
13
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
14
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
11
15
|
const _generateRules = require("./generateRules");
|
|
12
|
-
const _log = /*#__PURE__*/
|
|
13
|
-
const _cloneNodes = /*#__PURE__*/
|
|
16
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
17
|
+
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
|
|
14
18
|
const _defaultExtractor = require("./defaultExtractor");
|
|
15
|
-
|
|
19
|
+
const _featureFlags = require("../featureFlags");
|
|
20
|
+
function _interop_require_default(obj) {
|
|
16
21
|
return obj && obj.__esModule ? obj : {
|
|
17
22
|
default: obj
|
|
18
23
|
};
|
|
@@ -25,7 +30,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
25
30
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
26
31
|
})(nodeInterop);
|
|
27
32
|
}
|
|
28
|
-
function
|
|
33
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
29
34
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
30
35
|
return obj;
|
|
31
36
|
}
|
|
@@ -62,11 +67,16 @@ const builtInExtractors = {
|
|
|
62
67
|
};
|
|
63
68
|
const builtInTransformers = {
|
|
64
69
|
DEFAULT: (content)=>content,
|
|
65
|
-
svelte: (content)=>content.replace(/(?:^|\s)class:/g,
|
|
70
|
+
svelte: (content)=>content.replace(/(?:^|\s)class:/g, ' ')
|
|
66
71
|
};
|
|
67
72
|
function getExtractor(context, fileExtension) {
|
|
68
73
|
let extractors = context.tailwindConfig.content.extract;
|
|
69
|
-
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] ||
|
|
74
|
+
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || // Because we call `DEFAULT(context)`, the returning function is always a new function without a
|
|
75
|
+
// stable identity. Marking it with `DEFAULT_EXTRACTOR` allows us to check if it is the default
|
|
76
|
+
// extractor without relying on the function identity.
|
|
77
|
+
Object.assign(builtInExtractors.DEFAULT(context), {
|
|
78
|
+
DEFAULT_EXTRACTOR: true
|
|
79
|
+
});
|
|
70
80
|
}
|
|
71
81
|
function getTransformer(tailwindConfig, fileExtension) {
|
|
72
82
|
let transformers = tailwindConfig.content.transform;
|
|
@@ -78,11 +88,11 @@ let extractorCache = new WeakMap();
|
|
|
78
88
|
// up these regexes by 50% that could cut initial build time by like 20%.
|
|
79
89
|
function getClassCandidates(content, extractor, candidates, seen) {
|
|
80
90
|
if (!extractorCache.has(extractor)) {
|
|
81
|
-
extractorCache.set(extractor, new
|
|
91
|
+
extractorCache.set(extractor, new _quicklru.default({
|
|
82
92
|
maxSize: 25000
|
|
83
93
|
}));
|
|
84
94
|
}
|
|
85
|
-
for (let line of content.split(
|
|
95
|
+
for (let line of content.split('\n')){
|
|
86
96
|
line = line.trim();
|
|
87
97
|
if (seen.has(line)) {
|
|
88
98
|
continue;
|
|
@@ -93,10 +103,10 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
93
103
|
candidates.add(match);
|
|
94
104
|
}
|
|
95
105
|
} else {
|
|
96
|
-
let extractorMatches = extractor(line).filter((s)=>s !==
|
|
106
|
+
let extractorMatches = extractor(line).filter((s)=>s !== '!*');
|
|
97
107
|
let lineMatchesSet = new Set(extractorMatches);
|
|
98
|
-
for (let
|
|
99
|
-
candidates.add(
|
|
108
|
+
for (let match of lineMatchesSet){
|
|
109
|
+
candidates.add(match);
|
|
100
110
|
}
|
|
101
111
|
extractorCache.get(extractor).set(line, lineMatchesSet);
|
|
102
112
|
}
|
|
@@ -121,7 +131,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
121
131
|
return returnValue;
|
|
122
132
|
}
|
|
123
133
|
function expandTailwindAtRules(context) {
|
|
124
|
-
return (root)=>{
|
|
134
|
+
return async (root)=>{
|
|
125
135
|
let layerNodes = {
|
|
126
136
|
base: null,
|
|
127
137
|
components: null,
|
|
@@ -133,7 +143,7 @@ function expandTailwindAtRules(context) {
|
|
|
133
143
|
// a lot of work and bail early. Also we don't have to register our touch
|
|
134
144
|
// file as a dependency since the output of this CSS does not depend on
|
|
135
145
|
// the source of any templates. Think Vue <style> blocks for example.
|
|
136
|
-
if (rule.name ===
|
|
146
|
+
if (rule.name === 'tailwind') {
|
|
137
147
|
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
138
148
|
layerNodes[rule.params] = rule;
|
|
139
149
|
}
|
|
@@ -142,34 +152,81 @@ function expandTailwindAtRules(context) {
|
|
|
142
152
|
if (Object.values(layerNodes).every((n)=>n === null)) {
|
|
143
153
|
return root;
|
|
144
154
|
}
|
|
155
|
+
var _context_candidates;
|
|
145
156
|
// ---
|
|
146
157
|
// Find potential rules in changed files
|
|
147
158
|
let candidates = new Set([
|
|
159
|
+
...(_context_candidates = context.candidates) !== null && _context_candidates !== void 0 ? _context_candidates : [],
|
|
148
160
|
_sharedState.NOT_ON_DEMAND
|
|
149
161
|
]);
|
|
150
162
|
let seen = new Set();
|
|
151
|
-
env.DEBUG && console.time(
|
|
152
|
-
|
|
153
|
-
let
|
|
154
|
-
let
|
|
155
|
-
|
|
163
|
+
env.DEBUG && console.time('Reading changed files');
|
|
164
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, 'oxideParser')) {
|
|
165
|
+
let rustParserContent = [];
|
|
166
|
+
let regexParserContent = [];
|
|
167
|
+
for (let item of context.changedContent){
|
|
168
|
+
var _extractor;
|
|
169
|
+
let transformer = getTransformer(context.tailwindConfig, item.extension);
|
|
170
|
+
let extractor = getExtractor(context, item.extension);
|
|
171
|
+
if (transformer === builtInTransformers.DEFAULT && ((_extractor = extractor) === null || _extractor === void 0 ? void 0 : _extractor.DEFAULT_EXTRACTOR) === true) {
|
|
172
|
+
rustParserContent.push(item);
|
|
173
|
+
} else {
|
|
174
|
+
regexParserContent.push([
|
|
175
|
+
item,
|
|
176
|
+
{
|
|
177
|
+
transformer,
|
|
178
|
+
extractor
|
|
179
|
+
}
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (rustParserContent.length > 0) {
|
|
184
|
+
for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
|
|
185
|
+
candidates.add(candidate);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (regexParserContent.length > 0) {
|
|
189
|
+
await Promise.all(regexParserContent.map(async ([{ file, content }, { transformer, extractor }])=>{
|
|
190
|
+
content = file ? await _fs.default.promises.readFile(file, 'utf8') : content;
|
|
191
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
} else {
|
|
195
|
+
await Promise.all(context.changedContent.map(async ({ file, content, extension })=>{
|
|
196
|
+
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
197
|
+
let extractor = getExtractor(context, extension);
|
|
198
|
+
content = file ? await _fs.default.promises.readFile(file, 'utf8') : content;
|
|
199
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
200
|
+
}));
|
|
156
201
|
}
|
|
157
|
-
env.DEBUG && console.timeEnd(
|
|
202
|
+
env.DEBUG && console.timeEnd('Reading changed files');
|
|
158
203
|
// ---
|
|
159
204
|
// Generate the actual CSS
|
|
160
205
|
let classCacheCount = context.classCache.size;
|
|
161
|
-
env.DEBUG && console.time(
|
|
162
|
-
|
|
163
|
-
|
|
206
|
+
env.DEBUG && console.time('Generate rules');
|
|
207
|
+
env.DEBUG && console.time('Sorting candidates');
|
|
208
|
+
// TODO: only sort if we are not using the oxide parser (flagEnabled(context.tailwindConfig,
|
|
209
|
+
// 'oxideParser')) AND if we got all the candidates form the oxideParser alone. This will not
|
|
210
|
+
// be the case currently if you have custom transformers / extractors.
|
|
211
|
+
let sortedCandidates = new Set([
|
|
212
|
+
...candidates
|
|
213
|
+
].sort((a, z)=>{
|
|
214
|
+
if (a === z) return 0;
|
|
215
|
+
if (a < z) return -1;
|
|
216
|
+
return 1;
|
|
217
|
+
}));
|
|
218
|
+
env.DEBUG && console.timeEnd('Sorting candidates');
|
|
219
|
+
(0, _generateRules.generateRules)(sortedCandidates, context);
|
|
220
|
+
env.DEBUG && console.timeEnd('Generate rules');
|
|
164
221
|
// We only ever add to the classCache, so if it didn't grow, there is nothing new.
|
|
165
|
-
env.DEBUG && console.time(
|
|
222
|
+
env.DEBUG && console.time('Build stylesheet');
|
|
166
223
|
if (context.stylesheetCache === null || context.classCache.size !== classCacheCount) {
|
|
167
224
|
context.stylesheetCache = buildStylesheet([
|
|
168
225
|
...context.ruleCache
|
|
169
226
|
], context);
|
|
170
227
|
}
|
|
171
|
-
env.DEBUG && console.timeEnd(
|
|
172
|
-
let { defaults: defaultNodes
|
|
228
|
+
env.DEBUG && console.timeEnd('Build stylesheet');
|
|
229
|
+
let { defaults: defaultNodes, base: baseNodes, components: componentNodes, utilities: utilityNodes, variants: screenNodes } = context.stylesheetCache;
|
|
173
230
|
// ---
|
|
174
231
|
// Replace any Tailwind directives with generated CSS
|
|
175
232
|
if (layerNodes.base) {
|
|
@@ -177,7 +234,7 @@ function expandTailwindAtRules(context) {
|
|
|
177
234
|
...baseNodes,
|
|
178
235
|
...defaultNodes
|
|
179
236
|
], layerNodes.base.source, {
|
|
180
|
-
layer:
|
|
237
|
+
layer: 'base'
|
|
181
238
|
}));
|
|
182
239
|
layerNodes.base.remove();
|
|
183
240
|
}
|
|
@@ -185,7 +242,7 @@ function expandTailwindAtRules(context) {
|
|
|
185
242
|
layerNodes.components.before((0, _cloneNodes.default)([
|
|
186
243
|
...componentNodes
|
|
187
244
|
], layerNodes.components.source, {
|
|
188
|
-
layer:
|
|
245
|
+
layer: 'components'
|
|
189
246
|
}));
|
|
190
247
|
layerNodes.components.remove();
|
|
191
248
|
}
|
|
@@ -193,52 +250,63 @@ function expandTailwindAtRules(context) {
|
|
|
193
250
|
layerNodes.utilities.before((0, _cloneNodes.default)([
|
|
194
251
|
...utilityNodes
|
|
195
252
|
], layerNodes.utilities.source, {
|
|
196
|
-
layer:
|
|
253
|
+
layer: 'utilities'
|
|
197
254
|
}));
|
|
198
255
|
layerNodes.utilities.remove();
|
|
199
256
|
}
|
|
200
257
|
// We do post-filtering to not alter the emitted order of the variants
|
|
201
258
|
const variantNodes = Array.from(screenNodes).filter((node)=>{
|
|
202
|
-
var
|
|
203
|
-
const parentLayer = (
|
|
204
|
-
if (parentLayer ===
|
|
259
|
+
var _node_raws_tailwind;
|
|
260
|
+
const parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer;
|
|
261
|
+
if (parentLayer === 'components') {
|
|
205
262
|
return layerNodes.components !== null;
|
|
206
263
|
}
|
|
207
|
-
if (parentLayer ===
|
|
264
|
+
if (parentLayer === 'utilities') {
|
|
208
265
|
return layerNodes.utilities !== null;
|
|
209
266
|
}
|
|
210
267
|
return true;
|
|
211
268
|
});
|
|
212
269
|
if (layerNodes.variants) {
|
|
213
270
|
layerNodes.variants.before((0, _cloneNodes.default)(variantNodes, layerNodes.variants.source, {
|
|
214
|
-
layer:
|
|
271
|
+
layer: 'variants'
|
|
215
272
|
}));
|
|
216
273
|
layerNodes.variants.remove();
|
|
217
274
|
} else if (variantNodes.length > 0) {
|
|
218
|
-
|
|
219
|
-
layer:
|
|
220
|
-
})
|
|
275
|
+
let cloned = (0, _cloneNodes.default)(variantNodes, undefined, {
|
|
276
|
+
layer: 'variants'
|
|
277
|
+
});
|
|
278
|
+
cloned.forEach((node)=>{
|
|
279
|
+
var _node_raws_tailwind;
|
|
280
|
+
var _node_raws_tailwind_parentLayer;
|
|
281
|
+
let parentLayer = (_node_raws_tailwind_parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) !== null && _node_raws_tailwind_parentLayer !== void 0 ? _node_raws_tailwind_parentLayer : null;
|
|
282
|
+
node.walk((n)=>{
|
|
283
|
+
if (!n.source) {
|
|
284
|
+
n.source = layerNodes[parentLayer].source;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
root.append(cloned);
|
|
221
289
|
}
|
|
222
290
|
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
223
291
|
const hasUtilityVariants = variantNodes.some((node)=>{
|
|
224
|
-
var
|
|
225
|
-
return ((
|
|
292
|
+
var _node_raws_tailwind;
|
|
293
|
+
return ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) === 'utilities';
|
|
226
294
|
});
|
|
227
295
|
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
|
|
228
|
-
_log.default.warn(
|
|
229
|
-
|
|
230
|
-
|
|
296
|
+
_log.default.warn('content-problems', [
|
|
297
|
+
'No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.',
|
|
298
|
+
'https://tailwindcss.com/docs/content-configuration'
|
|
231
299
|
]);
|
|
232
300
|
}
|
|
233
301
|
// ---
|
|
234
302
|
if (env.DEBUG) {
|
|
235
|
-
console.log(
|
|
236
|
-
console.log(
|
|
303
|
+
console.log('Potential classes: ', candidates.size);
|
|
304
|
+
console.log('Active contexts: ', _sharedState.contextSourcesMap.size);
|
|
237
305
|
}
|
|
238
306
|
// Clear the cache for the changed files
|
|
239
307
|
context.changedContent = [];
|
|
240
308
|
// Cleanup any leftover @layer atrules
|
|
241
|
-
root.walkAtRules(
|
|
309
|
+
root.walkAtRules('layer', (rule)=>{
|
|
242
310
|
if (Object.keys(layerNodes).includes(rule.params)) {
|
|
243
311
|
rule.remove();
|
|
244
312
|
}
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "findAtConfigPath", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return findAtConfigPath;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
-
function
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -16,23 +18,23 @@ function _interopRequireDefault(obj) {
|
|
|
16
18
|
function findAtConfigPath(root, result) {
|
|
17
19
|
let configPath = null;
|
|
18
20
|
let relativeTo = null;
|
|
19
|
-
root.walkAtRules(
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
relativeTo = (
|
|
21
|
+
root.walkAtRules('config', (rule)=>{
|
|
22
|
+
var _rule_source;
|
|
23
|
+
var _rule_source_input_file, _ref;
|
|
24
|
+
relativeTo = (_ref = (_rule_source_input_file = (_rule_source = rule.source) === null || _rule_source === void 0 ? void 0 : _rule_source.input.file) !== null && _rule_source_input_file !== void 0 ? _rule_source_input_file : result.opts.from) !== null && _ref !== void 0 ? _ref : null;
|
|
23
25
|
if (relativeTo === null) {
|
|
24
|
-
throw rule.error(
|
|
26
|
+
throw rule.error('The `@config` directive cannot be used without setting `from` in your PostCSS config.');
|
|
25
27
|
}
|
|
26
28
|
if (configPath) {
|
|
27
|
-
throw rule.error(
|
|
29
|
+
throw rule.error('Only one `@config` directive is allowed per file.');
|
|
28
30
|
}
|
|
29
31
|
let matches = rule.params.match(/(['"])(.*?)\1/);
|
|
30
32
|
if (!matches) {
|
|
31
|
-
throw rule.error(
|
|
33
|
+
throw rule.error('A path is required when using the `@config` directive.');
|
|
32
34
|
}
|
|
33
35
|
let inputPath = matches[2];
|
|
34
36
|
if (_path.default.isAbsolute(inputPath)) {
|
|
35
|
-
throw rule.error(
|
|
37
|
+
throw rule.error('The `@config` directive cannot be used with an absolute path.');
|
|
36
38
|
}
|
|
37
39
|
configPath = _path.default.resolve(_path.default.dirname(relativeTo), inputPath);
|
|
38
40
|
if (!_fs.default.existsSync(configPath)) {
|