tailwindcss 3.3.1 → 3.3.3

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.
Files changed (148) hide show
  1. package/CHANGELOG.md +47 -6
  2. package/lib/cli/build/deps.js +17 -9
  3. package/lib/cli/build/index.js +10 -8
  4. package/lib/cli/build/plugin.js +29 -27
  5. package/lib/cli/build/utils.js +18 -8
  6. package/lib/cli/build/watching.js +12 -10
  7. package/lib/cli/help/index.js +6 -4
  8. package/lib/cli/index.js +4 -4
  9. package/lib/cli/init/index.js +8 -6
  10. package/lib/cli-peer-dependencies.js +12 -4
  11. package/lib/cli.js +1 -1
  12. package/lib/corePluginList.js +3 -1
  13. package/lib/corePlugins.js +52 -42
  14. package/lib/css/preflight.css +9 -0
  15. package/lib/featureFlags.js +14 -9
  16. package/lib/index.js +1 -5
  17. package/lib/lib/cacheInvalidation.js +7 -5
  18. package/lib/lib/collapseAdjacentRules.js +3 -1
  19. package/lib/lib/collapseDuplicateDeclarations.js +10 -8
  20. package/lib/lib/content.js +18 -14
  21. package/lib/lib/defaultExtractor.js +6 -4
  22. package/lib/lib/detectNesting.js +3 -1
  23. package/lib/lib/evaluateTailwindFunctions.js +20 -16
  24. package/lib/lib/expandApplyAtRules.js +37 -40
  25. package/lib/lib/expandTailwindAtRules.js +19 -17
  26. package/lib/lib/findAtConfigPath.js +6 -4
  27. package/lib/lib/generateRules.js +52 -38
  28. package/lib/lib/getModuleDependencies.js +10 -8
  29. package/lib/lib/load-config.js +5 -3
  30. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  31. package/lib/lib/offsets.js +7 -5
  32. package/lib/lib/partitionApplyAtRules.js +3 -1
  33. package/lib/lib/regex.js +21 -7
  34. package/lib/lib/remap-bitfield.js +3 -1
  35. package/lib/lib/resolveDefaultsAtRules.js +24 -20
  36. package/lib/lib/setupContextUtils.js +91 -63
  37. package/lib/lib/setupTrackingContext.js +27 -24
  38. package/lib/lib/sharedState.js +28 -24
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/oxide/cli/build/deps.js +16 -8
  41. package/lib/oxide/cli/build/index.js +6 -4
  42. package/lib/oxide/cli/build/plugin.js +19 -17
  43. package/lib/oxide/cli/build/utils.js +18 -8
  44. package/lib/oxide/cli/build/watching.js +10 -8
  45. package/lib/oxide/cli/help/index.js +6 -4
  46. package/lib/oxide/cli/index.js +4 -4
  47. package/lib/oxide/cli/init/index.js +6 -4
  48. package/lib/plugin.js +9 -9
  49. package/lib/postcss-plugins/nesting/index.js +3 -1
  50. package/lib/postcss-plugins/nesting/plugin.js +8 -6
  51. package/lib/processTailwindFeatures.js +16 -14
  52. package/lib/public/colors.js +5 -3
  53. package/lib/public/create-plugin.js +5 -3
  54. package/lib/public/default-config.js +6 -4
  55. package/lib/public/default-theme.js +6 -4
  56. package/lib/public/load-config.js +5 -3
  57. package/lib/public/resolve-config.js +6 -4
  58. package/lib/util/applyImportantSelector.js +9 -10
  59. package/lib/util/bigSign.js +3 -1
  60. package/lib/util/buildMediaQuery.js +3 -1
  61. package/lib/util/cloneDeep.js +3 -1
  62. package/lib/util/cloneNodes.js +3 -1
  63. package/lib/util/color.js +10 -6
  64. package/lib/util/colorNames.js +752 -0
  65. package/lib/util/configurePlugins.js +3 -1
  66. package/lib/util/createPlugin.js +3 -1
  67. package/lib/util/createUtilityPlugin.js +5 -3
  68. package/lib/util/dataTypes.js +59 -21
  69. package/lib/util/defaults.js +6 -4
  70. package/lib/util/escapeClassName.js +7 -5
  71. package/lib/util/escapeCommas.js +3 -1
  72. package/lib/util/flattenColorPalette.js +3 -1
  73. package/lib/util/formatVariantSelector.js +30 -110
  74. package/lib/util/getAllConfigs.js +6 -4
  75. package/lib/util/hashConfig.js +6 -4
  76. package/lib/util/isKeyframeRule.js +3 -1
  77. package/lib/util/isPlainObject.js +3 -1
  78. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  79. package/lib/util/log.js +8 -4
  80. package/lib/util/nameClass.js +12 -6
  81. package/lib/util/negateValue.js +3 -1
  82. package/lib/util/normalizeConfig.js +7 -5
  83. package/lib/util/normalizeScreens.js +12 -4
  84. package/lib/util/parseAnimationValue.js +3 -1
  85. package/lib/util/parseBoxShadowValue.js +6 -2
  86. package/lib/util/parseDependency.js +3 -1
  87. package/lib/util/parseGlob.js +6 -4
  88. package/lib/util/parseObjectStyles.js +9 -7
  89. package/lib/util/pluginUtils.js +30 -18
  90. package/lib/util/prefixSelector.js +6 -4
  91. package/lib/util/pseudoElements.js +209 -0
  92. package/lib/util/removeAlphaVariables.js +3 -1
  93. package/lib/util/resolveConfig.js +10 -8
  94. package/lib/util/resolveConfigPath.js +9 -5
  95. package/lib/util/responsive.js +6 -4
  96. package/lib/util/splitAtTopLevelOnly.js +3 -1
  97. package/lib/util/tap.js +3 -1
  98. package/lib/util/toColorValue.js +3 -1
  99. package/lib/util/toPath.js +3 -1
  100. package/lib/util/transformThemeValue.js +6 -4
  101. package/lib/util/validateConfig.js +5 -3
  102. package/lib/util/validateFormalSyntax.js +3 -1
  103. package/lib/util/withAlphaVariable.js +6 -2
  104. package/lib/value-parser/LICENSE +22 -0
  105. package/lib/value-parser/README.md +3 -0
  106. package/lib/value-parser/index.d.js +2 -0
  107. package/lib/value-parser/index.js +22 -0
  108. package/lib/value-parser/parse.js +259 -0
  109. package/lib/value-parser/stringify.js +38 -0
  110. package/lib/value-parser/unit.js +86 -0
  111. package/lib/value-parser/walk.js +16 -0
  112. package/package.json +30 -35
  113. package/peers/index.js +65828 -48819
  114. package/src/cli/build/plugin.js +3 -3
  115. package/src/cli.js +1 -1
  116. package/src/corePlugins.js +29 -24
  117. package/src/css/preflight.css +9 -0
  118. package/src/featureFlags.js +2 -3
  119. package/src/index.js +1 -5
  120. package/src/lib/defaultExtractor.js +1 -1
  121. package/src/lib/evaluateTailwindFunctions.js +4 -1
  122. package/src/lib/expandApplyAtRules.js +2 -8
  123. package/src/lib/expandTailwindAtRules.js +12 -10
  124. package/src/lib/generateRules.js +15 -8
  125. package/src/lib/setupContextUtils.js +18 -5
  126. package/src/lib/setupTrackingContext.js +2 -4
  127. package/src/lib/sharedState.js +0 -15
  128. package/src/oxide/cli/build/plugin.ts +1 -1
  129. package/src/plugin.js +4 -4
  130. package/src/processTailwindFeatures.js +3 -2
  131. package/src/util/applyImportantSelector.js +2 -5
  132. package/src/util/color.js +1 -1
  133. package/src/util/colorNames.js +150 -0
  134. package/src/util/dataTypes.js +17 -6
  135. package/src/util/formatVariantSelector.js +4 -126
  136. package/src/util/pluginUtils.js +1 -5
  137. package/src/util/prefixSelector.js +1 -0
  138. package/src/util/pseudoElements.js +167 -0
  139. package/src/value-parser/LICENSE +22 -0
  140. package/src/value-parser/README.md +3 -0
  141. package/src/value-parser/index.d.ts +177 -0
  142. package/src/value-parser/index.js +28 -0
  143. package/src/value-parser/parse.js +303 -0
  144. package/src/value-parser/stringify.js +41 -0
  145. package/src/value-parser/unit.js +118 -0
  146. package/src/value-parser/walk.js +18 -0
  147. package/stubs/config.full.js +1 -0
  148. package/types/generated/default-theme.d.ts +1 -0
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>expandApplyAtRules
7
+ get: function() {
8
+ return expandApplyAtRules;
9
+ }
8
10
  });
9
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
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__*/ _interopRequireDefault(require("../util/escapeClassName"));
14
+ const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
13
15
  const _applyImportantSelector = require("../util/applyImportantSelector");
14
- const _formatVariantSelectorJs = require("../util/formatVariantSelector.js");
15
- function _interopRequireDefault(obj) {
16
+ const _pseudoElements = require("../util/pseudoElements");
17
+ function _interop_require_default(obj) {
16
18
  return obj && obj.__esModule ? obj : {
17
19
  default: obj
18
20
  };
@@ -25,7 +27,7 @@ function _interopRequireDefault(obj) {
25
27
  ]
26
28
  });
27
29
  container.walkRules((rule)=>{
28
- (0, _postcssSelectorParser.default)((selectors)=>{
30
+ (0, _postcssselectorparser.default)((selectors)=>{
29
31
  selectors.walkClasses((classSelector)=>{
30
32
  let parentSelector = classSelector.parent.toString();
31
33
  let classes = groups.get(parentSelector);
@@ -42,7 +44,7 @@ function _interopRequireDefault(obj) {
42
44
  groups: normalizedGroups
43
45
  });
44
46
  }
45
- let selectorExtractor = (0, _postcssSelectorParser.default)();
47
+ let selectorExtractor = (0, _postcssselectorparser.default)();
46
48
  /**
47
49
  * @param {string} ruleSelectors
48
50
  */ function extractSelectors(ruleSelectors) {
@@ -311,11 +313,11 @@ function processApply(root, context, localCache) {
311
313
  // Sort tag names before class names (but only sort each group (separated by a combinator)
312
314
  // separately and not in total)
313
315
  // This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
314
- for (let sel1 of replaced){
316
+ for (let sel of replaced){
315
317
  let groups = [
316
318
  []
317
319
  ];
318
- for (let node of sel1.nodes){
320
+ for (let node of sel.nodes){
319
321
  if (node.type === "combinator") {
320
322
  groups.push(node);
321
323
  groups.push([]);
@@ -324,7 +326,7 @@ function processApply(root, context, localCache) {
324
326
  last.push(node);
325
327
  }
326
328
  }
327
- sel1.nodes = [];
329
+ sel.nodes = [];
328
330
  for (let group of groups){
329
331
  if (Array.isArray(group)) {
330
332
  group.sort((a, b)=>{
@@ -340,7 +342,7 @@ function processApply(root, context, localCache) {
340
342
  return 0;
341
343
  });
342
344
  }
343
- sel1.nodes = sel1.nodes.concat(group);
345
+ sel.nodes = sel.nodes.concat(group);
344
346
  }
345
347
  }
346
348
  sel.replaceWith(...replaced);
@@ -358,15 +360,15 @@ function processApply(root, context, localCache) {
358
360
  candidates,
359
361
  apply.source
360
362
  ]);
361
- let [applyCandidates1, important] = extractApplyCandidates(apply.params);
363
+ let [applyCandidates, important] = extractApplyCandidates(apply.params);
362
364
  if (apply.parent.type === "atrule") {
363
365
  if (apply.parent.name === "screen") {
364
366
  let screenType = apply.parent.params;
365
- throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates1.map((c)=>`${screenType}:${c}`).join(" ")} instead.`);
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.`);
366
368
  }
367
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}.`);
368
370
  }
369
- for (let applyCandidate of applyCandidates1){
371
+ for (let applyCandidate of applyCandidates){
370
372
  if ([
371
373
  prefix(context, "group"),
372
374
  prefix(context, "peer")
@@ -385,16 +387,16 @@ function processApply(root, context, localCache) {
385
387
  ]);
386
388
  }
387
389
  }
388
- for (let [parent, [candidates1, atApplySource]] of perParentApplies){
390
+ for (let [parent, [candidates, atApplySource]] of perParentApplies){
389
391
  let siblings = [];
390
- for (let [applyCandidate1, important1, rules1] of candidates1){
392
+ for (let [applyCandidate, important, rules] of candidates){
391
393
  let potentialApplyCandidates = [
392
- applyCandidate1,
394
+ applyCandidate,
393
395
  ...extractBaseCandidates([
394
- applyCandidate1
396
+ applyCandidate
395
397
  ], context.tailwindConfig.separator)
396
398
  ];
397
- for (let [meta, node] of rules1){
399
+ for (let [meta, node] of rules){
398
400
  let parentClasses = extractClasses(parent);
399
401
  let nodeClasses = extractClasses(node);
400
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`
@@ -425,20 +427,20 @@ function processApply(root, context, localCache) {
425
427
  nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
426
428
  let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
427
429
  if (intersects) {
428
- throw node.error(`You cannot \`@apply\` the \`${applyCandidate1}\` utility here because it creates a circular dependency.`);
430
+ throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
429
431
  }
430
- let root1 = _postcss.default.root({
432
+ let root = _postcss.default.root({
431
433
  nodes: [
432
434
  node.clone()
433
435
  ]
434
436
  });
435
437
  // Make sure every node in the entire tree points back at the @apply rule that generated it
436
- root1.walk((node)=>{
438
+ root.walk((node)=>{
437
439
  node.source = atApplySource;
438
440
  });
439
441
  let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
440
442
  if (canRewriteSelector) {
441
- root1.walkRules((rule)=>{
443
+ root.walkRules((rule)=>{
442
444
  // Let's imagine you have the following structure:
443
445
  //
444
446
  // .foo {
@@ -470,7 +472,7 @@ function processApply(root, context, localCache) {
470
472
  // would have replaced this with something that didn't exist and
471
473
  // therefore it removed the selector altogether. In this specific
472
474
  // case it would result in `{}` instead of `.something-unrelated {}`
473
- if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate1)) {
475
+ if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate)) {
474
476
  rule.remove();
475
477
  return;
476
478
  }
@@ -480,34 +482,29 @@ function processApply(root, context, localCache) {
480
482
  // We do *not* want to do this for user CSS that happens to be structured the same
481
483
  let isGenerated = parent.raws.tailwind !== undefined;
482
484
  let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
483
- rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate1);
485
+ rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
484
486
  // And then re-add it if it was removed
485
487
  if (importantSelector && parentSelector !== parent.selector) {
486
488
  rule.selector = (0, _applyImportantSelector.applyImportantSelector)(rule.selector, importantSelector);
487
489
  }
488
490
  rule.walkDecls((d)=>{
489
- d.important = meta.important || important1;
491
+ d.important = meta.important || important;
490
492
  });
491
493
  // Move pseudo elements to the end of the selector (if necessary)
492
- let selector = (0, _postcssSelectorParser.default)().astSync(rule.selector);
493
- selector.each((sel)=>{
494
- let [pseudoElements] = (0, _formatVariantSelectorJs.collectPseudoElements)(sel);
495
- if (pseudoElements.length > 0) {
496
- sel.nodes.push(...pseudoElements.sort(_formatVariantSelectorJs.sortSelector));
497
- }
498
- });
494
+ let selector = (0, _postcssselectorparser.default)().astSync(rule.selector);
495
+ selector.each((sel)=>(0, _pseudoElements.movePseudos)(sel));
499
496
  rule.selector = selector.toString();
500
497
  });
501
498
  }
502
499
  // It could be that the node we were inserted was removed because the class didn't match
503
500
  // If that was the *only* rule in the parent, then we have nothing add so we skip it
504
- if (!root1.nodes[0]) {
501
+ if (!root.nodes[0]) {
505
502
  continue;
506
503
  }
507
504
  // Insert it
508
505
  siblings.push([
509
506
  meta.sort,
510
- root1.nodes[0]
507
+ root.nodes[0]
511
508
  ]);
512
509
  }
513
510
  }
@@ -516,13 +513,13 @@ function processApply(root, context, localCache) {
516
513
  // `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
517
514
  parent.after(nodes);
518
515
  }
519
- for (let apply1 of applies){
516
+ for (let apply of applies){
520
517
  // If there are left-over declarations, just remove the @apply
521
- if (apply1.parent.nodes.length > 1) {
522
- apply1.remove();
518
+ if (apply.parent.nodes.length > 1) {
519
+ apply.remove();
523
520
  } else {
524
521
  // The node is empty, drop the full node
525
- apply1.parent.remove();
522
+ apply.parent.remove();
526
523
  }
527
524
  }
528
525
  // Do it again, in case we have other `@apply` rules
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>expandTailwindAtRules
7
+ get: function() {
8
+ return expandTailwindAtRules;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
11
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
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"));
12
14
  const _generateRules = require("./generateRules");
13
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
14
- const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("../util/cloneNodes"));
15
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
16
+ const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
15
17
  const _defaultExtractor = require("./defaultExtractor");
16
- function _interopRequireDefault(obj) {
18
+ function _interop_require_default(obj) {
17
19
  return obj && obj.__esModule ? obj : {
18
20
  default: obj
19
21
  };
@@ -26,7 +28,7 @@ function _getRequireWildcardCache(nodeInterop) {
26
28
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
27
29
  })(nodeInterop);
28
30
  }
29
- function _interopRequireWildcard(obj, nodeInterop) {
31
+ function _interop_require_wildcard(obj, nodeInterop) {
30
32
  if (!nodeInterop && obj && obj.__esModule) {
31
33
  return obj;
32
34
  }
@@ -79,7 +81,7 @@ let extractorCache = new WeakMap();
79
81
  // up these regexes by 50% that could cut initial build time by like 20%.
80
82
  function getClassCandidates(content, extractor, candidates, seen) {
81
83
  if (!extractorCache.has(extractor)) {
82
- extractorCache.set(extractor, new _quickLru.default({
84
+ extractorCache.set(extractor, new _quicklru.default({
83
85
  maxSize: 25000
84
86
  }));
85
87
  }
@@ -96,8 +98,8 @@ function getClassCandidates(content, extractor, candidates, seen) {
96
98
  } else {
97
99
  let extractorMatches = extractor(line).filter((s)=>s !== "!*");
98
100
  let lineMatchesSet = new Set(extractorMatches);
99
- for (let match1 of lineMatchesSet){
100
- candidates.add(match1);
101
+ for (let match of lineMatchesSet){
102
+ candidates.add(match);
101
103
  }
102
104
  extractorCache.get(extractor).set(line, lineMatchesSet);
103
105
  }
@@ -122,7 +124,7 @@ function getClassCandidates(content, extractor, candidates, seen) {
122
124
  return returnValue;
123
125
  }
124
126
  function expandTailwindAtRules(context) {
125
- return (root)=>{
127
+ return async (root)=>{
126
128
  let layerNodes = {
127
129
  base: null,
128
130
  components: null,
@@ -152,7 +154,7 @@ function expandTailwindAtRules(context) {
152
154
  ]);
153
155
  let seen = new Set();
154
156
  env.DEBUG && console.time("Reading changed files");
155
- if (env.OXIDE) {
157
+ if (false) {
156
158
  // TODO: Pass through or implement `extractor`
157
159
  for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
158
160
  candidates.add(candidate);
@@ -163,12 +165,12 @@ function expandTailwindAtRules(context) {
163
165
  // getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
164
166
  // }
165
167
  } else {
166
- for (let { file , content , extension } of context.changedContent){
168
+ await Promise.all(context.changedContent.map(async ({ file , content , extension })=>{
167
169
  let transformer = getTransformer(context.tailwindConfig, extension);
168
170
  let extractor = getExtractor(context, extension);
169
- content = file ? _fs.default.readFileSync(file, "utf8") : content;
171
+ content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
170
172
  getClassCandidates(transformer(content), extractor, candidates, seen);
171
- }
173
+ }));
172
174
  }
173
175
  env.DEBUG && console.timeEnd("Reading changed files");
174
176
  // ---
@@ -176,7 +178,7 @@ function expandTailwindAtRules(context) {
176
178
  let classCacheCount = context.classCache.size;
177
179
  env.DEBUG && console.time("Generate rules");
178
180
  env.DEBUG && console.time("Sorting candidates");
179
- let sortedCandidates = env.OXIDE ? candidates : new Set([
181
+ let sortedCandidates = false ? candidates : new Set([
180
182
  ...candidates
181
183
  ].sort((a, z)=>{
182
184
  if (a === z) return 0;
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "findAtConfigPath", {
6
6
  enumerable: true,
7
- get: ()=>findAtConfigPath
7
+ get: function() {
8
+ return findAtConfigPath;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
11
- function _interopRequireDefault(obj) {
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
  };
@@ -9,27 +9,33 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getClassNameFromSelector: ()=>getClassNameFromSelector,
13
- resolveMatches: ()=>resolveMatches,
14
- generateRules: ()=>generateRules
12
+ getClassNameFromSelector: function() {
13
+ return getClassNameFromSelector;
14
+ },
15
+ resolveMatches: function() {
16
+ return resolveMatches;
17
+ },
18
+ generateRules: function() {
19
+ return generateRules;
20
+ }
15
21
  });
16
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
17
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
18
- const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
19
- const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
20
- const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
22
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
23
+ const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
24
+ const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
25
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
26
+ const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
21
27
  const _pluginUtils = require("../util/pluginUtils");
22
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
23
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
28
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
29
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
24
30
  const _formatVariantSelector = require("../util/formatVariantSelector");
25
31
  const _nameClass = require("../util/nameClass");
26
32
  const _dataTypes = require("../util/dataTypes");
27
33
  const _setupContextUtils = require("./setupContextUtils");
28
- const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
29
- const _splitAtTopLevelOnlyJs = require("../util/splitAtTopLevelOnly.js");
34
+ const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
35
+ const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly.js");
30
36
  const _featureFlags = require("../featureFlags");
31
37
  const _applyImportantSelector = require("../util/applyImportantSelector");
32
- function _interopRequireDefault(obj) {
38
+ function _interop_require_default(obj) {
33
39
  return obj && obj.__esModule ? obj : {
34
40
  default: obj
35
41
  };
@@ -42,7 +48,7 @@ function _getRequireWildcardCache(nodeInterop) {
42
48
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
43
49
  })(nodeInterop);
44
50
  }
45
- function _interopRequireWildcard(obj, nodeInterop) {
51
+ function _interop_require_wildcard(obj, nodeInterop) {
46
52
  if (!nodeInterop && obj && obj.__esModule) {
47
53
  return obj;
48
54
  }
@@ -73,7 +79,7 @@ function _interopRequireWildcard(obj, nodeInterop) {
73
79
  }
74
80
  return newObj;
75
81
  }
76
- let classNameParser = (0, _postcssSelectorParser.default)((selectors)=>{
82
+ let classNameParser = (0, _postcssselectorparser.default)((selectors)=>{
77
83
  return selectors.first.filter(({ type })=>type === "class").pop().value;
78
84
  });
79
85
  function getClassNameFromSelector(selector) {
@@ -163,7 +169,7 @@ function applyImportant(matches, classCandidate) {
163
169
  ]
164
170
  });
165
171
  container.walkRules((r)=>{
166
- let ast = (0, _postcssSelectorParser.default)().astSync(r.selector);
172
+ let ast = (0, _postcssselectorparser.default)().astSync(r.selector);
167
173
  // Remove extraneous selectors that do not include the base candidate
168
174
  ast.each((sel)=>(0, _formatVariantSelector.eliminateIrrelevantSelectors)(sel, classCandidate));
169
175
  // Update all instances of the base candidate to include the important marker
@@ -199,7 +205,7 @@ function applyVariant(variant, matches, context) {
199
205
  };
200
206
  // Retrieve "modifier"
201
207
  {
202
- let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(variant, "/");
208
+ let [baseVariant, ...modifiers] = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(variant, "/");
203
209
  // This is a hack to support variants with `/` in them, like `ar-1/10/20:text-red-500`
204
210
  // In this case 1/10 is a value but /20 is a modifier
205
211
  if (modifiers.length > 1) {
@@ -225,12 +231,12 @@ function applyVariant(variant, matches, context) {
225
231
  // group[:hover] (`-` is missing)
226
232
  let match = /(.)(-?)\[(.*)\]/g.exec(variant);
227
233
  if (match) {
228
- let [, char, seperator, value] = match;
234
+ let [, char, separator, value] = match;
229
235
  // @-[200px] case
230
- if (char === "@" && seperator === "-") return [];
236
+ if (char === "@" && separator === "-") return [];
231
237
  // group[:hover] case
232
- if (char !== "@" && seperator === "") return [];
233
- variant = variant.replace(`${seperator}[${value}]`, "");
238
+ if (char !== "@" && separator === "") return [];
239
+ variant = variant.replace(`${separator}[${value}]`, "");
234
240
  args.value = value;
235
241
  }
236
242
  }
@@ -238,7 +244,7 @@ function applyVariant(variant, matches, context) {
238
244
  if (isArbitraryValue(variant) && !context.variantMap.has(variant)) {
239
245
  let sort = context.offsets.recordVariant(variant);
240
246
  let selector = (0, _dataTypes.normalize)(variant.slice(1, -1));
241
- let selectors = (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(selector, ",");
247
+ let selectors = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(selector, ",");
242
248
  // We do not support multiple selectors for arbitrary variants
243
249
  if (selectors.length > 1) {
244
250
  return [];
@@ -253,9 +259,17 @@ function applyVariant(variant, matches, context) {
253
259
  context.variantMap.set(variant, records);
254
260
  }
255
261
  if (context.variantMap.has(variant)) {
262
+ var _context_variantOptions_get;
256
263
  let isArbitraryVariant = isArbitraryValue(variant);
264
+ var _context_variantOptions_get_INTERNAL_FEATURES;
265
+ let internalFeatures = (_context_variantOptions_get_INTERNAL_FEATURES = (_context_variantOptions_get = context.variantOptions.get(variant)) === null || _context_variantOptions_get === void 0 ? void 0 : _context_variantOptions_get[_setupContextUtils.INTERNAL_FEATURES]) !== null && _context_variantOptions_get_INTERNAL_FEATURES !== void 0 ? _context_variantOptions_get_INTERNAL_FEATURES : {};
257
266
  let variantFunctionTuples = context.variantMap.get(variant).slice();
258
267
  let result = [];
268
+ let respectPrefix = (()=>{
269
+ if (isArbitraryVariant) return false;
270
+ if (internalFeatures.respectPrefix === false) return false;
271
+ return true;
272
+ })();
259
273
  for (let [meta, rule] of matches){
260
274
  // Don't generate variants for user css
261
275
  if (meta.layer === "user") {
@@ -312,7 +326,7 @@ function applyVariant(variant, matches, context) {
312
326
  format (selectorFormat) {
313
327
  collectedFormats.push({
314
328
  format: selectorFormat,
315
- isArbitraryVariant
329
+ respectPrefix
316
330
  });
317
331
  },
318
332
  args
@@ -320,14 +334,14 @@ function applyVariant(variant, matches, context) {
320
334
  // It can happen that a list of format strings is returned from within the function. In that
321
335
  // case, we have to process them as well. We can use the existing `variantSort`.
322
336
  if (Array.isArray(ruleWithVariant)) {
323
- for (let [idx, variantFunction1] of ruleWithVariant.entries()){
337
+ for (let [idx, variantFunction] of ruleWithVariant.entries()){
324
338
  // This is a little bit scary since we are pushing to an array of items that we are
325
339
  // currently looping over. However, you can also think of it like a processing queue
326
340
  // where you keep handling jobs until everything is done and each job can queue more
327
341
  // jobs if needed.
328
342
  variantFunctionTuples.push([
329
343
  context.offsets.applyParallelOffset(variantSort, idx),
330
- variantFunction1,
344
+ variantFunction,
331
345
  // If the clone has been modified we have to pass that back
332
346
  // though so each rule can use the modified container
333
347
  clone.clone()
@@ -338,7 +352,7 @@ function applyVariant(variant, matches, context) {
338
352
  if (typeof ruleWithVariant === "string") {
339
353
  collectedFormats.push({
340
354
  format: ruleWithVariant,
341
- isArbitraryVariant
355
+ respectPrefix
342
356
  });
343
357
  }
344
358
  if (ruleWithVariant === null) {
@@ -359,7 +373,7 @@ function applyVariant(variant, matches, context) {
359
373
  // as well. E.g.: `${variant}${separator}${className}`.
360
374
  // However, plugin authors probably also prepend or append certain
361
375
  // classes, pseudos, ids, ...
362
- let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
376
+ let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
363
377
  selectors.walkClasses((classNode)=>{
364
378
  classNode.value = `${variant}${context.tailwindConfig.separator}${classNode.value}`;
365
379
  });
@@ -377,7 +391,7 @@ function applyVariant(variant, matches, context) {
377
391
  // format: .foo &
378
392
  collectedFormats.push({
379
393
  format: modified.replace(rebuiltBase, "&"),
380
- isArbitraryVariant
394
+ respectPrefix
381
395
  });
382
396
  rule.selector = before;
383
397
  });
@@ -550,7 +564,7 @@ function splitWithSeparator(input, separator) {
550
564
  _sharedState.NOT_ON_DEMAND
551
565
  ];
552
566
  }
553
- return (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(input, separator);
567
+ return (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(input, separator);
554
568
  }
555
569
  function* recordCandidates(matches, classCandidate) {
556
570
  for (const match of matches){
@@ -575,7 +589,7 @@ function* resolveMatches(candidate, context, original = candidate) {
575
589
  if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping")) {
576
590
  if (classCandidate.startsWith("(") && classCandidate.endsWith(")")) {
577
591
  let base = variants.slice().reverse().join(separator);
578
- for (let part of (0, _splitAtTopLevelOnlyJs.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
592
+ for (let part of (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(classCandidate.slice(1, -1), ",")){
579
593
  yield* resolveMatches(base + separator + part, context, original);
580
594
  }
581
595
  }
@@ -617,18 +631,18 @@ function* resolveMatches(candidate, context, original = candidate) {
617
631
  }
618
632
  }
619
633
  } else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
620
- let ruleSet1 = plugin;
621
- let [rules1, options1] = parseRules(ruleSet1, context.postCssNodeCache);
622
- for (let rule1 of rules1){
634
+ let ruleSet = plugin;
635
+ let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
636
+ for (let rule of rules){
623
637
  matchesPerPlugin.push([
624
638
  {
625
639
  ...sort,
626
640
  options: {
627
641
  ...sort.options,
628
- ...options1
642
+ ...options
629
643
  }
630
644
  },
631
- rule1
645
+ rule
632
646
  ]);
633
647
  }
634
648
  }
@@ -704,11 +718,11 @@ function* resolveMatches(candidate, context, original = candidate) {
704
718
  }
705
719
  let messages = [];
706
720
  for (let [idx, group] of typesPerPlugin.entries()){
707
- for (let type1 of group){
708
- let rules2 = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
721
+ for (let type of group){
722
+ let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
709
723
  .map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
710
724
  .join("\n")).join("\n\n");
711
- messages.push(` Use \`${candidate.replace("[", `[${type1}:`)}\` for \`${rules2.trim()}\``);
725
+ messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
712
726
  break;
713
727
  }
714
728
  }
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>getModuleDependencies
7
+ get: function() {
8
+ return getModuleDependencies;
9
+ }
8
10
  });
9
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
10
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
11
- function _interopRequireDefault(obj) {
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
  };
@@ -59,10 +61,10 @@ function resolveWithExtension(file, extensions) {
59
61
  }
60
62
  }
61
63
  // Try to find `./a/index.js` from `./a`
62
- for (let ext1 of extensions){
63
- let full1 = `${file}/index${ext1}`;
64
- if (_fs.default.existsSync(full1)) {
65
- return full1;
64
+ for (let ext of extensions){
65
+ let full = `${file}/index${ext}`;
66
+ if (_fs.default.existsSync(full)) {
67
+ return full;
66
68
  }
67
69
  }
68
70
  return null;
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "loadConfig", {
6
6
  enumerable: true,
7
- get: ()=>loadConfig
7
+ get: function() {
8
+ return loadConfig;
9
+ }
8
10
  });
9
- const _jiti = /*#__PURE__*/ _interopRequireDefault(require("jiti"));
11
+ const _jiti = /*#__PURE__*/ _interop_require_default(require("jiti"));
10
12
  const _sucrase = require("sucrase");
11
- function _interopRequireDefault(obj) {
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>normalizeTailwindDirectives
7
+ get: function() {
8
+ return normalizeTailwindDirectives;
9
+ }
8
10
  });
9
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
10
- function _interopRequireDefault(obj) {
11
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
12
+ function _interop_require_default(obj) {
11
13
  return obj && obj.__esModule ? obj : {
12
14
  default: obj
13
15
  };
@@ -5,11 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  Object.defineProperty(exports, "Offsets", {
7
7
  enumerable: true,
8
- get: ()=>Offsets
8
+ get: function() {
9
+ return Offsets;
10
+ }
9
11
  });
10
- const _bigSign = /*#__PURE__*/ _interopRequireDefault(require("../util/bigSign"));
11
- const _remapBitfieldJs = require("./remap-bitfield.js");
12
- function _interopRequireDefault(obj) {
12
+ const _bigSign = /*#__PURE__*/ _interop_require_default(require("../util/bigSign"));
13
+ const _remapbitfield = require("./remap-bitfield.js");
14
+ function _interop_require_default(obj) {
13
15
  return obj && obj.__esModule ? obj : {
14
16
  default: obj
15
17
  };
@@ -253,7 +255,7 @@ class Offsets {
253
255
  let [offset, rule] = item;
254
256
  offset = {
255
257
  ...offset,
256
- variants: (0, _remapBitfieldJs.remapBitfield)(offset.variants, mapping)
258
+ variants: (0, _remapbitfield.remapBitfield)(offset.variants, mapping)
257
259
  };
258
260
  return [
259
261
  offset,