tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea4e1cd
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/lib/cli/build/deps.js +17 -9
- package/lib/cli/build/index.js +20 -10
- package/lib/cli/build/plugin.js +86 -70
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +16 -12
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +222 -10
- package/lib/cli/init/index.js +29 -12
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +4 -226
- package/lib/corePluginList.js +7 -1
- package/lib/corePlugins.js +348 -75
- package/lib/css/preflight.css +2 -0
- package/lib/featureFlags.js +27 -15
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +5 -3
- package/lib/lib/collapseDuplicateDeclarations.js +12 -10
- package/lib/lib/content.js +34 -30
- package/lib/lib/defaultExtractor.js +15 -8
- package/lib/lib/detectNesting.js +10 -2
- package/lib/lib/evaluateTailwindFunctions.js +22 -20
- package/lib/lib/expandApplyAtRules.js +43 -35
- package/lib/lib/expandTailwindAtRules.js +46 -19
- package/lib/lib/findAtConfigPath.js +9 -7
- package/lib/lib/generateRules.js +157 -92
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +93 -4
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +28 -24
- package/lib/lib/setupContextUtils.js +190 -131
- package/lib/lib/setupTrackingContext.js +49 -26
- package/lib/lib/sharedState.js +37 -10
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +89 -0
- package/lib/oxide/cli/build/index.js +53 -0
- package/lib/oxide/cli/build/plugin.js +375 -0
- package/lib/oxide/cli/build/utils.js +87 -0
- package/lib/oxide/cli/build/watching.js +179 -0
- package/lib/oxide/cli/help/index.js +72 -0
- package/lib/oxide/cli/index.js +214 -0
- package/lib/oxide/cli/init/index.js +52 -0
- package/lib/oxide/cli.js +5 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +98 -0
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +10 -8
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +49 -25
- 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 +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +5 -3
- package/lib/util/color.js +30 -12
- 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 +7 -5
- package/lib/util/dataTypes.js +74 -17
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +138 -160
- package/lib/util/getAllConfigs.js +8 -6
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +4 -2
- package/lib/util/normalizeConfig.js +28 -27
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +54 -54
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +229 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +17 -15
- package/lib/util/resolveConfigPath.js +26 -10
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +10 -2
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +16 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +45 -37
- package/peers/index.js +63324 -46417
- package/resolveConfig.d.ts +11 -2
- package/scripts/swap-engines.js +40 -0
- package/src/cli/build/index.js +13 -9
- package/src/cli/build/plugin.js +42 -32
- package/src/cli/build/watching.js +4 -2
- package/src/cli/index.js +216 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +4 -220
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +207 -32
- package/src/css/preflight.css +2 -0
- package/src/featureFlags.js +6 -0
- package/src/index.js +1 -47
- package/src/lib/content.js +12 -17
- package/src/lib/defaultExtractor.js +9 -3
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/expandApplyAtRules.js +8 -1
- package/src/lib/expandTailwindAtRules.js +36 -7
- package/src/lib/generateRules.js +124 -42
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +31 -0
- package/src/lib/offsets.js +104 -1
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +103 -54
- package/src/lib/setupTrackingContext.js +36 -11
- package/src/lib/sharedState.js +15 -4
- package/src/oxide/cli/build/deps.ts +91 -0
- package/src/oxide/cli/build/index.ts +47 -0
- package/src/oxide/cli/build/plugin.ts +442 -0
- package/src/oxide/cli/build/utils.ts +74 -0
- package/src/oxide/cli/build/watching.ts +225 -0
- package/src/oxide/cli/help/index.ts +69 -0
- package/src/oxide/cli/index.ts +204 -0
- package/src/oxide/cli/init/index.ts +59 -0
- package/src/oxide/cli.ts +1 -0
- package/src/oxide/postcss-plugin.ts +1 -0
- package/src/plugin.js +107 -0
- 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 +18 -3
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +33 -4
- package/src/util/formatVariantSelector.js +160 -163
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +2 -1
- package/src/util/pluginUtils.js +16 -31
- package/src/util/prefixSelector.js +28 -10
- package/src/util/pseudoElements.js +170 -0
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +13 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
- package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
- package/stubs/postcss.config.js +6 -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 +15 -9
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +108 -79
- package/CHANGELOG.md +0 -2336
- package/lib/cli/shared.js +0 -12
- package/lib/constants.js +0 -44
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/shared.js +0 -5
- package/src/constants.js +0 -17
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
|
@@ -4,13 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return expandApplyAtRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _postcss = /*#__PURE__*/
|
|
10
|
-
const
|
|
11
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
12
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
11
13
|
const _generateRules = require("./generateRules");
|
|
12
|
-
const _escapeClassName = /*#__PURE__*/
|
|
13
|
-
|
|
14
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
15
|
+
const _applyImportantSelector = require("../util/applyImportantSelector");
|
|
16
|
+
const _pseudoElements = require("../util/pseudoElements");
|
|
17
|
+
function _interop_require_default(obj) {
|
|
14
18
|
return obj && obj.__esModule ? obj : {
|
|
15
19
|
default: obj
|
|
16
20
|
};
|
|
@@ -23,7 +27,7 @@ function _interopRequireDefault(obj) {
|
|
|
23
27
|
]
|
|
24
28
|
});
|
|
25
29
|
container.walkRules((rule)=>{
|
|
26
|
-
(0,
|
|
30
|
+
(0, _postcssselectorparser.default)((selectors)=>{
|
|
27
31
|
selectors.walkClasses((classSelector)=>{
|
|
28
32
|
let parentSelector = classSelector.parent.toString();
|
|
29
33
|
let classes = groups.get(parentSelector);
|
|
@@ -40,7 +44,7 @@ function _interopRequireDefault(obj) {
|
|
|
40
44
|
groups: normalizedGroups
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
let selectorExtractor = (0,
|
|
47
|
+
let selectorExtractor = (0, _postcssselectorparser.default)();
|
|
44
48
|
/**
|
|
45
49
|
* @param {string} ruleSelectors
|
|
46
50
|
*/ function extractSelectors(ruleSelectors) {
|
|
@@ -139,8 +143,8 @@ function* pathToRoot(node) {
|
|
|
139
143
|
root.walkRules((rule)=>{
|
|
140
144
|
// Ignore rules generated by Tailwind
|
|
141
145
|
for (let node of pathToRoot(rule)){
|
|
142
|
-
var
|
|
143
|
-
if (((
|
|
146
|
+
var _node_raws_tailwind;
|
|
147
|
+
if (((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.layer) !== undefined) {
|
|
144
148
|
return;
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -309,11 +313,11 @@ function processApply(root, context, localCache) {
|
|
|
309
313
|
// Sort tag names before class names (but only sort each group (separated by a combinator)
|
|
310
314
|
// separately and not in total)
|
|
311
315
|
// This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
|
|
312
|
-
for (let
|
|
316
|
+
for (let sel of replaced){
|
|
313
317
|
let groups = [
|
|
314
318
|
[]
|
|
315
319
|
];
|
|
316
|
-
for (let node of
|
|
320
|
+
for (let node of sel.nodes){
|
|
317
321
|
if (node.type === "combinator") {
|
|
318
322
|
groups.push(node);
|
|
319
323
|
groups.push([]);
|
|
@@ -322,7 +326,7 @@ function processApply(root, context, localCache) {
|
|
|
322
326
|
last.push(node);
|
|
323
327
|
}
|
|
324
328
|
}
|
|
325
|
-
|
|
329
|
+
sel.nodes = [];
|
|
326
330
|
for (let group of groups){
|
|
327
331
|
if (Array.isArray(group)) {
|
|
328
332
|
group.sort((a, b)=>{
|
|
@@ -338,7 +342,7 @@ function processApply(root, context, localCache) {
|
|
|
338
342
|
return 0;
|
|
339
343
|
});
|
|
340
344
|
}
|
|
341
|
-
|
|
345
|
+
sel.nodes = sel.nodes.concat(group);
|
|
342
346
|
}
|
|
343
347
|
}
|
|
344
348
|
sel.replaceWith(...replaced);
|
|
@@ -356,15 +360,15 @@ function processApply(root, context, localCache) {
|
|
|
356
360
|
candidates,
|
|
357
361
|
apply.source
|
|
358
362
|
]);
|
|
359
|
-
let [
|
|
363
|
+
let [applyCandidates, important] = extractApplyCandidates(apply.params);
|
|
360
364
|
if (apply.parent.type === "atrule") {
|
|
361
365
|
if (apply.parent.name === "screen") {
|
|
362
366
|
let screenType = apply.parent.params;
|
|
363
|
-
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${
|
|
367
|
+
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates.map((c)=>`${screenType}:${c}`).join(" ")} instead.`);
|
|
364
368
|
}
|
|
365
369
|
throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
|
|
366
370
|
}
|
|
367
|
-
for (let applyCandidate of
|
|
371
|
+
for (let applyCandidate of applyCandidates){
|
|
368
372
|
if ([
|
|
369
373
|
prefix(context, "group"),
|
|
370
374
|
prefix(context, "peer")
|
|
@@ -383,16 +387,16 @@ function processApply(root, context, localCache) {
|
|
|
383
387
|
]);
|
|
384
388
|
}
|
|
385
389
|
}
|
|
386
|
-
for (let [parent, [
|
|
390
|
+
for (let [parent, [candidates, atApplySource]] of perParentApplies){
|
|
387
391
|
let siblings = [];
|
|
388
|
-
for (let [
|
|
392
|
+
for (let [applyCandidate, important, rules] of candidates){
|
|
389
393
|
let potentialApplyCandidates = [
|
|
390
|
-
|
|
394
|
+
applyCandidate,
|
|
391
395
|
...extractBaseCandidates([
|
|
392
|
-
|
|
396
|
+
applyCandidate
|
|
393
397
|
], context.tailwindConfig.separator)
|
|
394
398
|
];
|
|
395
|
-
for (let [meta, node] of
|
|
399
|
+
for (let [meta, node] of rules){
|
|
396
400
|
let parentClasses = extractClasses(parent);
|
|
397
401
|
let nodeClasses = extractClasses(node);
|
|
398
402
|
// When we encounter a rule like `.dark .a, .b { … }` we only want to be left with `[.dark, .a]` if the base applyCandidate is `.a` or with `[.b]` if the base applyCandidate is `.b`
|
|
@@ -423,20 +427,20 @@ function processApply(root, context, localCache) {
|
|
|
423
427
|
nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
|
|
424
428
|
let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
|
|
425
429
|
if (intersects) {
|
|
426
|
-
throw node.error(`You cannot \`@apply\` the \`${
|
|
430
|
+
throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
|
|
427
431
|
}
|
|
428
|
-
let
|
|
432
|
+
let root = _postcss.default.root({
|
|
429
433
|
nodes: [
|
|
430
434
|
node.clone()
|
|
431
435
|
]
|
|
432
436
|
});
|
|
433
437
|
// Make sure every node in the entire tree points back at the @apply rule that generated it
|
|
434
|
-
|
|
438
|
+
root.walk((node)=>{
|
|
435
439
|
node.source = atApplySource;
|
|
436
440
|
});
|
|
437
441
|
let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
|
|
438
442
|
if (canRewriteSelector) {
|
|
439
|
-
|
|
443
|
+
root.walkRules((rule)=>{
|
|
440
444
|
// Let's imagine you have the following structure:
|
|
441
445
|
//
|
|
442
446
|
// .foo {
|
|
@@ -468,7 +472,7 @@ function processApply(root, context, localCache) {
|
|
|
468
472
|
// would have replaced this with something that didn't exist and
|
|
469
473
|
// therefore it removed the selector altogether. In this specific
|
|
470
474
|
// case it would result in `{}` instead of `.something-unrelated {}`
|
|
471
|
-
if (!extractClasses(rule).some((candidate)=>candidate ===
|
|
475
|
+
if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate)) {
|
|
472
476
|
rule.remove();
|
|
473
477
|
return;
|
|
474
478
|
}
|
|
@@ -478,25 +482,29 @@ function processApply(root, context, localCache) {
|
|
|
478
482
|
// We do *not* want to do this for user CSS that happens to be structured the same
|
|
479
483
|
let isGenerated = parent.raws.tailwind !== undefined;
|
|
480
484
|
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
|
481
|
-
rule.selector = replaceSelector(parentSelector, rule.selector,
|
|
485
|
+
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
|
|
482
486
|
// And then re-add it if it was removed
|
|
483
487
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
484
|
-
rule.selector =
|
|
488
|
+
rule.selector = (0, _applyImportantSelector.applyImportantSelector)(rule.selector, importantSelector);
|
|
485
489
|
}
|
|
486
490
|
rule.walkDecls((d)=>{
|
|
487
|
-
d.important = meta.important ||
|
|
491
|
+
d.important = meta.important || important;
|
|
488
492
|
});
|
|
493
|
+
// Move pseudo elements to the end of the selector (if necessary)
|
|
494
|
+
let selector = (0, _postcssselectorparser.default)().astSync(rule.selector);
|
|
495
|
+
selector.each((sel)=>(0, _pseudoElements.movePseudos)(sel));
|
|
496
|
+
rule.selector = selector.toString();
|
|
489
497
|
});
|
|
490
498
|
}
|
|
491
499
|
// It could be that the node we were inserted was removed because the class didn't match
|
|
492
500
|
// If that was the *only* rule in the parent, then we have nothing add so we skip it
|
|
493
|
-
if (!
|
|
501
|
+
if (!root.nodes[0]) {
|
|
494
502
|
continue;
|
|
495
503
|
}
|
|
496
504
|
// Insert it
|
|
497
505
|
siblings.push([
|
|
498
506
|
meta.sort,
|
|
499
|
-
|
|
507
|
+
root.nodes[0]
|
|
500
508
|
]);
|
|
501
509
|
}
|
|
502
510
|
}
|
|
@@ -505,13 +513,13 @@ function processApply(root, context, localCache) {
|
|
|
505
513
|
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
|
|
506
514
|
parent.after(nodes);
|
|
507
515
|
}
|
|
508
|
-
for (let
|
|
516
|
+
for (let apply of applies){
|
|
509
517
|
// If there are left-over declarations, just remove the @apply
|
|
510
|
-
if (
|
|
511
|
-
|
|
518
|
+
if (apply.parent.nodes.length > 1) {
|
|
519
|
+
apply.remove();
|
|
512
520
|
} else {
|
|
513
521
|
// The node is empty, drop the full node
|
|
514
|
-
|
|
522
|
+
apply.parent.remove();
|
|
515
523
|
}
|
|
516
524
|
}
|
|
517
525
|
// Do it again, in case we have other `@apply` rules
|
|
@@ -4,15 +4,18 @@ 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 _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
11
14
|
const _generateRules = require("./generateRules");
|
|
12
|
-
const _log = /*#__PURE__*/
|
|
13
|
-
const _cloneNodes = /*#__PURE__*/
|
|
15
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
16
|
+
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
|
|
14
17
|
const _defaultExtractor = require("./defaultExtractor");
|
|
15
|
-
function
|
|
18
|
+
function _interop_require_default(obj) {
|
|
16
19
|
return obj && obj.__esModule ? obj : {
|
|
17
20
|
default: obj
|
|
18
21
|
};
|
|
@@ -25,7 +28,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
25
28
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
26
29
|
})(nodeInterop);
|
|
27
30
|
}
|
|
28
|
-
function
|
|
31
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
29
32
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
30
33
|
return obj;
|
|
31
34
|
}
|
|
@@ -78,7 +81,7 @@ let extractorCache = new WeakMap();
|
|
|
78
81
|
// up these regexes by 50% that could cut initial build time by like 20%.
|
|
79
82
|
function getClassCandidates(content, extractor, candidates, seen) {
|
|
80
83
|
if (!extractorCache.has(extractor)) {
|
|
81
|
-
extractorCache.set(extractor, new
|
|
84
|
+
extractorCache.set(extractor, new _quicklru.default({
|
|
82
85
|
maxSize: 25000
|
|
83
86
|
}));
|
|
84
87
|
}
|
|
@@ -95,8 +98,8 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
95
98
|
} else {
|
|
96
99
|
let extractorMatches = extractor(line).filter((s)=>s !== "!*");
|
|
97
100
|
let lineMatchesSet = new Set(extractorMatches);
|
|
98
|
-
for (let
|
|
99
|
-
candidates.add(
|
|
101
|
+
for (let match of lineMatchesSet){
|
|
102
|
+
candidates.add(match);
|
|
100
103
|
}
|
|
101
104
|
extractorCache.get(extractor).set(line, lineMatchesSet);
|
|
102
105
|
}
|
|
@@ -142,24 +145,48 @@ function expandTailwindAtRules(context) {
|
|
|
142
145
|
if (Object.values(layerNodes).every((n)=>n === null)) {
|
|
143
146
|
return root;
|
|
144
147
|
}
|
|
148
|
+
var _context_candidates;
|
|
145
149
|
// ---
|
|
146
150
|
// Find potential rules in changed files
|
|
147
151
|
let candidates = new Set([
|
|
152
|
+
...(_context_candidates = context.candidates) !== null && _context_candidates !== void 0 ? _context_candidates : [],
|
|
148
153
|
_sharedState.NOT_ON_DEMAND
|
|
149
154
|
]);
|
|
150
155
|
let seen = new Set();
|
|
151
156
|
env.DEBUG && console.time("Reading changed files");
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let
|
|
155
|
-
|
|
157
|
+
if (false) {
|
|
158
|
+
// TODO: Pass through or implement `extractor`
|
|
159
|
+
for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
|
|
160
|
+
candidates.add(candidate);
|
|
161
|
+
}
|
|
162
|
+
// for (let { file, content, extension } of context.changedContent) {
|
|
163
|
+
// let transformer = getTransformer(context.tailwindConfig, extension)
|
|
164
|
+
// let extractor = getExtractor(context, extension)
|
|
165
|
+
// getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
|
|
166
|
+
// }
|
|
167
|
+
} else {
|
|
168
|
+
for (let { file , content , extension } of context.changedContent){
|
|
169
|
+
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
170
|
+
let extractor = getExtractor(context, extension);
|
|
171
|
+
content = file ? _fs.default.readFileSync(file, "utf8") : content;
|
|
172
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
173
|
+
}
|
|
156
174
|
}
|
|
157
175
|
env.DEBUG && console.timeEnd("Reading changed files");
|
|
158
176
|
// ---
|
|
159
177
|
// Generate the actual CSS
|
|
160
178
|
let classCacheCount = context.classCache.size;
|
|
161
179
|
env.DEBUG && console.time("Generate rules");
|
|
162
|
-
|
|
180
|
+
env.DEBUG && console.time("Sorting candidates");
|
|
181
|
+
let sortedCandidates = false ? candidates : new Set([
|
|
182
|
+
...candidates
|
|
183
|
+
].sort((a, z)=>{
|
|
184
|
+
if (a === z) return 0;
|
|
185
|
+
if (a < z) return -1;
|
|
186
|
+
return 1;
|
|
187
|
+
}));
|
|
188
|
+
env.DEBUG && console.timeEnd("Sorting candidates");
|
|
189
|
+
(0, _generateRules.generateRules)(sortedCandidates, context);
|
|
163
190
|
env.DEBUG && console.timeEnd("Generate rules");
|
|
164
191
|
// We only ever add to the classCache, so if it didn't grow, there is nothing new.
|
|
165
192
|
env.DEBUG && console.time("Build stylesheet");
|
|
@@ -199,8 +226,8 @@ function expandTailwindAtRules(context) {
|
|
|
199
226
|
}
|
|
200
227
|
// We do post-filtering to not alter the emitted order of the variants
|
|
201
228
|
const variantNodes = Array.from(screenNodes).filter((node)=>{
|
|
202
|
-
var
|
|
203
|
-
const parentLayer = (
|
|
229
|
+
var _node_raws_tailwind;
|
|
230
|
+
const parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer;
|
|
204
231
|
if (parentLayer === "components") {
|
|
205
232
|
return layerNodes.components !== null;
|
|
206
233
|
}
|
|
@@ -221,8 +248,8 @@ function expandTailwindAtRules(context) {
|
|
|
221
248
|
}
|
|
222
249
|
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
223
250
|
const hasUtilityVariants = variantNodes.some((node)=>{
|
|
224
|
-
var
|
|
225
|
-
return ((
|
|
251
|
+
var _node_raws_tailwind;
|
|
252
|
+
return ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) === "utilities";
|
|
226
253
|
});
|
|
227
254
|
if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
|
|
228
255
|
_log.default.warn("content-problems", [
|
|
@@ -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
|
};
|
|
@@ -17,9 +19,9 @@ function findAtConfigPath(root, result) {
|
|
|
17
19
|
let configPath = null;
|
|
18
20
|
let relativeTo = null;
|
|
19
21
|
root.walkAtRules("config", (rule)=>{
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
relativeTo = (
|
|
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
26
|
throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
|
|
25
27
|
}
|