tailwindcss 3.0.7 → 3.0.11

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 CHANGED
@@ -9,6 +9,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  - Nothing yet!
11
11
 
12
+ ## [3.0.11] - 2022-01-05
13
+
14
+ ### Fixed
15
+
16
+ - Preserve case of css variables added by plugins ([#6888](https://github.com/tailwindlabs/tailwindcss/pull/6888))
17
+ - Ignore content files that don't exist ([#6901](https://github.com/tailwindlabs/tailwindcss/pull/6901))
18
+ - Revert apply defaults in isolation ([9fdc391](https://github.com/tailwindlabs/tailwindcss/commit/9fdc391d4ff93e7e350f5ce439060176b1f0162f))
19
+
20
+ ## [3.0.10] - 2022-01-04
21
+
22
+ ### Fixed
23
+
24
+ - Fix `@apply` in files without `@tailwind` directives ([#6580](https://github.com/tailwindlabs/tailwindcss/pull/6580), [#6875](https://github.com/tailwindlabs/tailwindcss/pull/6875))
25
+ - CLI: avoid unnecessary writes to output files ([#6550](https://github.com/tailwindlabs/tailwindcss/pull/6550))
26
+
27
+ ### Added
28
+
29
+ - Allow piping data into the CLI ([#6876](https://github.com/tailwindlabs/tailwindcss/pull/6876))
30
+
31
+ ## [3.0.9] - 2022-01-03
32
+
33
+ ### Fixed
34
+
35
+ - Improve `DEBUG` flag ([#6797](https://github.com/tailwindlabs/tailwindcss/pull/6797), [#6804](https://github.com/tailwindlabs/tailwindcss/pull/6804))
36
+ - Ensure we can use `<` and `>` characters in modifiers ([#6851](https://github.com/tailwindlabs/tailwindcss/pull/6851))
37
+ - Validate `theme()` works in arbitrary values ([#6852](https://github.com/tailwindlabs/tailwindcss/pull/6852))
38
+ - Properly detect `theme()` value usage in arbitrary properties ([#6854](https://github.com/tailwindlabs/tailwindcss/pull/6854))
39
+ - Improve collapsing of duplicate declarations ([#6856](https://github.com/tailwindlabs/tailwindcss/pull/6856))
40
+ - Remove support for `TAILWIND_MODE=watch` ([#6858](https://github.com/tailwindlabs/tailwindcss/pull/6858))
41
+
42
+ ## [3.0.8] - 2021-12-28
43
+
44
+ ### Fixed
45
+
46
+ - Reduce specificity of `abbr` rule in preflight ([#6671](https://github.com/tailwindlabs/tailwindcss/pull/6671))
47
+ - Support HSL with hue units in arbitrary values ([#6726](https://github.com/tailwindlabs/tailwindcss/pull/6726))
48
+ - Add `node16-linux-arm64` target for standalone CLI ([#6693](https://github.com/tailwindlabs/tailwindcss/pull/6693))
49
+
12
50
  ## [3.0.7] - 2021-12-17
13
51
 
14
52
  ### Fixed
@@ -1741,7 +1779,11 @@ No release notes
1741
1779
 
1742
1780
  - Everything!
1743
1781
 
1744
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...HEAD
1782
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.11...HEAD
1783
+ [3.0.11]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.10...v3.0.11
1784
+ [3.0.10]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.9...v3.0.10
1785
+ [3.0.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.8...v3.0.9
1786
+ [3.0.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...v3.0.8
1745
1787
  [3.0.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.6...v3.0.7
1746
1788
  [3.0.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.5...v3.0.6
1747
1789
  [3.0.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.4...v3.0.5
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
1
  <p>
2
- <a href="https://tailwindcss.com/" target="_blank">
3
- <img alt="Tailwind CSS" width="350" src="https://refactoringui.nyc3.cdn.digitaloceanspaces.com/tailwind-logo-sticker.svg">
4
- </a><br>
5
- A utility-first CSS framework for rapidly building custom user interfaces.
2
+ <a href="https://tailwindcss.com/#gh-light-mode-only" target="_blank">
3
+ <img src="./.github/logo-light.svg" alt="Tailwind CSS" width="350" height="70">
4
+ </a>
5
+ <a href="https://tailwindcss.com/#gh-dark-mode-only" target="_blank">
6
+ <img src="./.github/logo-dark.svg" alt="Tailwind CSS" width="350" height="70">
7
+ </a>
6
8
  </p>
7
9
 
10
+ A utility-first CSS framework for rapidly building custom user interfaces.
11
+
8
12
  <p>
9
13
  <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/workflow/status/tailwindlabs/tailwindcss/Node.js%20CI" alt="Build Status"></a>
10
14
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
package/lib/cli.js CHANGED
@@ -40,6 +40,25 @@ function formatNodes(root) {
40
40
  root.first.raws.before = '';
41
41
  }
42
42
  }
43
+ async function outputFile(file, contents) {
44
+ if (_fs.default.existsSync(file) && await _fs.default.promises.readFile(file, 'utf8') === contents) {
45
+ return; // Skip writing the file
46
+ }
47
+ // Write the file
48
+ await _fs.default.promises.writeFile(file, contents, 'utf8');
49
+ }
50
+ function drainStdin() {
51
+ return new Promise((resolve, reject)=>{
52
+ let result = '';
53
+ process.stdin.on('data', (chunk)=>{
54
+ result += chunk;
55
+ });
56
+ process.stdin.on('end', ()=>resolve(result)
57
+ );
58
+ process.stdin.on('error', (err)=>reject(err)
59
+ );
60
+ });
61
+ }
43
62
  function help({ message , usage , commands: commands1 , options }) {
44
63
  let indent = 2;
45
64
  // Render header
@@ -336,7 +355,7 @@ async function build() {
336
355
  console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
337
356
  input = args['--input'] = args['_'][1];
338
357
  }
339
- if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
358
+ if (input && input !== '-' && !_fs.default.existsSync(input = _path.default.resolve(input))) {
340
359
  console.error(`Specified input file ${args['--input']} does not exist.`);
341
360
  process.exit(9);
342
361
  }
@@ -499,10 +518,8 @@ async function build() {
499
518
  return process.stdout.write(result.css);
500
519
  }
501
520
  return Promise.all([
502
- _fs.default.promises.writeFile(output, result.css, ()=>true
503
- ),
504
- result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
505
- ),
521
+ outputFile(output, result.css),
522
+ result.map && outputFile(output + '.map', result.map.toString()),
506
523
  ].filter(Boolean));
507
524
  }).then(()=>{
508
525
  let end = process.hrtime.bigint();
@@ -510,7 +527,18 @@ async function build() {
510
527
  console.error('Done in', (end - start) / BigInt(1000000) + 'ms.');
511
528
  });
512
529
  }
513
- let css1 = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
530
+ let css1 = await (()=>{
531
+ // Piping in data, let's drain the stdin
532
+ if (input === '-') {
533
+ return drainStdin();
534
+ }
535
+ // Input file has been provided
536
+ if (input) {
537
+ return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
538
+ }
539
+ // No input file provided, fallback to default atrules
540
+ return '@tailwind base; @tailwind components; @tailwind utilities';
541
+ })();
514
542
  return processCSS(css1);
515
543
  }
516
544
  let context = null;
@@ -619,11 +647,9 @@ async function build() {
619
647
  if (!output) {
620
648
  return process.stdout.write(result.css);
621
649
  }
622
- await Promise.all([
623
- _fs.default.promises.writeFile(output, result.css, ()=>true
624
- ),
625
- result.map && _fs.default.writeFile(output + '.map', result.map.toString(), ()=>true
626
- ),
650
+ return Promise.all([
651
+ outputFile(output, result.css),
652
+ result.map && outputFile(output + '.map', result.map.toString()),
627
653
  ].filter(Boolean));
628
654
  }).then(()=>{
629
655
  let end = process.hrtime.bigint();
@@ -636,7 +662,18 @@ async function build() {
636
662
  }
637
663
  });
638
664
  }
639
- let css2 = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
665
+ let css2 = await (()=>{
666
+ // Piping in data, let's drain the stdin
667
+ if (input === '-') {
668
+ return drainStdin();
669
+ }
670
+ // Input file has been provided
671
+ if (input) {
672
+ return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
673
+ }
674
+ // No input file provided, fallback to default atrules
675
+ return '@tailwind base; @tailwind components; @tailwind utilities';
676
+ })();
640
677
  let result1 = await processCSS(css2);
641
678
  env.DEBUG && console.timeEnd('Finished in');
642
679
  return result1;
@@ -58,7 +58,7 @@ hr {
58
58
  Add the correct text decoration in Chrome, Edge, and Safari.
59
59
  */
60
60
 
61
- abbr[title] {
61
+ abbr:where([title]) {
62
62
  text-decoration: underline dotted;
63
63
  }
64
64
 
package/lib/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  var _setupTrackingContext = _interopRequireDefault(require("./lib/setupTrackingContext"));
3
- var _setupWatchingContext = _interopRequireDefault(require("./lib/setupWatchingContext"));
4
3
  var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
5
4
  var _sharedState = require("./lib/sharedState");
6
5
  function _interopRequireDefault(obj) {
@@ -18,8 +17,7 @@ module.exports = function tailwindcss(configOrPath) {
18
17
  return root;
19
18
  },
20
19
  function(root, result) {
21
- let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext).default(configOrPath) : (0, _setupTrackingContext).default(configOrPath);
22
- (0, _processTailwindFeatures).default(setupContext)(root, result);
20
+ (0, _processTailwindFeatures).default((0, _setupTrackingContext).default(configOrPath))(root, result);
23
21
  },
24
22
  _sharedState.env.DEBUG && function(root) {
25
23
  console.timeEnd('JIT TOTAL');
@@ -8,6 +8,7 @@ function collapseDuplicateDeclarations() {
8
8
  root.walkRules((node)=>{
9
9
  let seen = new Map();
10
10
  let droppable = new Set([]);
11
+ let byProperty = new Map();
11
12
  node.walkDecls((decl)=>{
12
13
  // This could happen if we have nested selectors. In that case the
13
14
  // parent will loop over all its declarations but also the declarations
@@ -17,13 +18,63 @@ function collapseDuplicateDeclarations() {
17
18
  return;
18
19
  }
19
20
  if (seen.has(decl.prop)) {
20
- droppable.add(seen.get(decl.prop));
21
+ // Exact same value as what we have seen so far
22
+ if (seen.get(decl.prop).value === decl.value) {
23
+ // Keep the last one, drop the one we've seen so far
24
+ droppable.add(seen.get(decl.prop));
25
+ // Override the existing one with the new value. This is necessary
26
+ // so that if we happen to have more than one declaration with the
27
+ // same value, that we keep removing the previous one. Otherwise we
28
+ // will only remove the *first* one.
29
+ seen.set(decl.prop, decl);
30
+ return;
31
+ }
32
+ // Not the same value, so we need to check if we can merge it so
33
+ // let's collect it first.
34
+ if (!byProperty.has(decl.prop)) {
35
+ byProperty.set(decl.prop, new Set());
36
+ }
37
+ byProperty.get(decl.prop).add(seen.get(decl.prop));
38
+ byProperty.get(decl.prop).add(decl);
21
39
  }
22
40
  seen.set(decl.prop, decl);
23
41
  });
42
+ // Drop all the duplicate declarations with the exact same value we've
43
+ // already seen so far.
24
44
  for (let decl1 of droppable){
25
45
  decl1.remove();
26
46
  }
47
+ // Analyze the declarations based on its unit, drop all the declarations
48
+ // with the same unit but the last one in the list.
49
+ for (let declarations of byProperty.values()){
50
+ let byUnit = new Map();
51
+ for (let decl of declarations){
52
+ let unit = resolveUnit(decl.value);
53
+ if (unit === null) {
54
+ continue;
55
+ }
56
+ if (!byUnit.has(unit)) {
57
+ byUnit.set(unit, new Set());
58
+ }
59
+ byUnit.get(unit).add(decl);
60
+ }
61
+ for (let declarations1 of byUnit.values()){
62
+ // Get all but the last one
63
+ let removableDeclarations = Array.from(declarations1).slice(0, -1);
64
+ for (let decl of removableDeclarations){
65
+ decl.remove();
66
+ }
67
+ }
68
+ }
27
69
  });
28
70
  };
29
71
  }
72
+ let UNITLESS_NUMBER = Symbol('unitless-number');
73
+ function resolveUnit(input) {
74
+ let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
75
+ if (result) {
76
+ var ref;
77
+ return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
78
+ }
79
+ return null;
80
+ }
@@ -15,10 +15,12 @@ const PATTERNS = [
15
15
  /([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
16
16
  /([^<>"'`\s]*\['[^"'`\s]*'\])/.source,
17
17
  /([^<>"'`\s]*\["[^"'`\s]*"\])/.source,
18
+ /([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source,
18
19
  /([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
19
20
  /([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
20
21
  /([^<>"'`\s]*\[[^"'`\s]+\][^<>"'`\s]*)/.source,
21
- /([^<>"'`\s]*[^"'`\s:\\])/.source
22
+ /([^"'`\s]*[^<>"'`\s:\\])/.source,
23
+ /([^<>"'`\s]*[^"'`\s:\\])/.source,
22
24
  ].join('|');
23
25
  const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
24
26
  const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
@@ -31,4 +33,10 @@ function defaultExtractor(content) {
31
33
  ].flat().filter((v)=>v !== undefined
32
34
  );
33
35
  return results;
34
- }
36
+ } // Regular utilities
37
+ // {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
38
+ // Arbitrary values
39
+ // {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
40
+ // arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
41
+ // Arbitrary properties
42
+ // {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
@@ -267,7 +267,7 @@ function processApply(root, context) {
267
267
  // would have replaced this with something that didn't exist and
268
268
  // therefore it removed the selector altogether. In this specific
269
269
  // case it would result in `{}` instead of `.something-unrelated {}`
270
- if (!extractClasses(rule).some((thing)=>thing === applyCandidate
270
+ if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate
271
271
  )) {
272
272
  rule.remove();
273
273
  return;
@@ -143,14 +143,23 @@ function expandTailwindAtRules(context) {
143
143
  utilities: null,
144
144
  variants: null
145
145
  };
146
- // Make sure this file contains Tailwind directives. If not, we can save
147
- // a lot of work and bail early. Also we don't have to register our touch
148
- // file as a dependency since the output of this CSS does not depend on
149
- // the source of any templates. Think Vue <style> blocks for example.
150
- root.walkAtRules('tailwind', (rule)=>{
151
- if (Object.keys(layerNodes).includes(rule.params)) {
152
- layerNodes[rule.params] = rule;
146
+ // let hasApply = false
147
+ root.walkAtRules((rule)=>{
148
+ // Make sure this file contains Tailwind directives. If not, we can save
149
+ // a lot of work and bail early. Also we don't have to register our touch
150
+ // file as a dependency since the output of this CSS does not depend on
151
+ // the source of any templates. Think Vue <style> blocks for example.
152
+ if (rule.name === 'tailwind') {
153
+ if (Object.keys(layerNodes).includes(rule.params)) {
154
+ layerNodes[rule.params] = rule;
155
+ }
153
156
  }
157
+ // We also want to check for @apply because the user can
158
+ // apply classes in an isolated environment like CSS
159
+ // modules and we still need to inject defaults
160
+ // if (rule.name === 'apply') {
161
+ // hasApply = true
162
+ // }
154
163
  });
155
164
  if (Object.values(layerNodes).every((n)=>n === null
156
165
  )) {
@@ -12,7 +12,11 @@ function _interopRequireDefault(obj) {
12
12
  function normalizeTailwindDirectives(root) {
13
13
  let tailwindDirectives = new Set();
14
14
  let layerDirectives = new Set();
15
+ let applyDirectives = new Set();
15
16
  root.walkAtRules((atRule)=>{
17
+ if (atRule.name === 'apply') {
18
+ applyDirectives.add(atRule);
19
+ }
16
20
  if (atRule.name === 'import') {
17
21
  if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
18
22
  atRule.name = 'tailwind';
@@ -72,5 +76,8 @@ function normalizeTailwindDirectives(root) {
72
76
  }
73
77
  }
74
78
  }
75
- return tailwindDirectives;
79
+ return {
80
+ tailwindDirectives,
81
+ applyDirectives
82
+ };
76
83
  }
@@ -463,11 +463,17 @@ function getFileModifiedMap(context) {
463
463
  function trackModified(files, fileModifiedMap) {
464
464
  let changed = false;
465
465
  for (let file of files){
466
+ var ref;
466
467
  if (!file) continue;
467
468
  let parsed = _url.default.parse(file);
468
469
  let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href;
469
470
  pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname;
470
- let newModified = _fs.default.statSync(decodeURIComponent(pathname)).mtimeMs;
471
+ let newModified = (ref = _fs.default.statSync(decodeURIComponent(pathname), {
472
+ throwIfNoEntry: false
473
+ })) === null || ref === void 0 ? void 0 : ref.mtimeMs;
474
+ if (!newModified) {
475
+ continue;
476
+ }
471
477
  if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
472
478
  changed = true;
473
479
  }
@@ -119,16 +119,17 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
119
119
  return changedFiles;
120
120
  }
121
121
  function setupTrackingContext(configOrPath) {
122
- return ({ tailwindDirectives , registerDependency })=>{
122
+ return ({ tailwindDirectives , registerDependency , applyDirectives })=>{
123
123
  return (root, result)=>{
124
124
  let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
125
125
  let contextDependencies = new Set(configDependencies);
126
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
127
- // to be dependencies of the context. Can reuse the context even if they change.
128
- // We may want to think about `@layer` being part of this trigger too, but it's tough
129
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
130
- // in another file since independent sources are effectively isolated.
131
- if (tailwindDirectives.size > 0) {
126
+ // If there are no @tailwind or @apply rules, we don't consider this CSS
127
+ // file or its dependencies to be dependencies of the context. Can reuse
128
+ // the context even if they change. We may want to think about `@layer`
129
+ // being part of this trigger too, but it's tough because it's impossible
130
+ // for a layer in one file to end up in the actual @tailwind rule in
131
+ // another file since independent sources are effectively isolated.
132
+ if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
132
133
  // Add current css file as a context dependencies.
133
134
  contextDependencies.add(result.opts.from);
134
135
  // Add all css @import dependencies as context dependencies.
@@ -140,12 +141,12 @@ function setupTrackingContext(configOrPath) {
140
141
  }
141
142
  let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
142
143
  let candidateFiles = getCandidateFiles(context, tailwindConfig);
143
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
144
- // to be dependencies of the context. Can reuse the context even if they change.
144
+ // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
145
+ // dependencies to be dependencies of the context. Can reuse the context even if they change.
145
146
  // We may want to think about `@layer` being part of this trigger too, but it's tough
146
147
  // because it's impossible for a layer in one file to end up in the actual @tailwind rule
147
148
  // in another file since independent sources are effectively isolated.
148
- if (tailwindDirectives.size > 0) {
149
+ if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
149
150
  let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
150
151
  // Add template paths as postcss dependencies.
151
152
  for (let fileOrGlob of candidateFiles){
@@ -2,13 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
+ exports.resolveDebug = resolveDebug;
5
6
  exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
6
7
  const env = {
7
- TAILWIND_MODE: process.env.TAILWIND_MODE,
8
8
  NODE_ENV: process.env.NODE_ENV,
9
- DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
10
- TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
11
- TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
9
+ DEBUG: resolveDebug(process.env.DEBUG)
12
10
  };
13
11
  exports.env = env;
14
12
  const contextMap = new Map();
@@ -17,3 +15,34 @@ const configContextMap = new Map();
17
15
  exports.configContextMap = configContextMap;
18
16
  const contextSourcesMap = new Map();
19
17
  exports.contextSourcesMap = contextSourcesMap;
18
+ function resolveDebug(debug) {
19
+ if (debug === undefined) {
20
+ return false;
21
+ }
22
+ // Environment variables are strings, so convert to boolean
23
+ if (debug === 'true' || debug === '1') {
24
+ return true;
25
+ }
26
+ if (debug === 'false' || debug === '0') {
27
+ return false;
28
+ }
29
+ // Keep the debug convention into account:
30
+ // DEBUG=* -> This enables all debug modes
31
+ // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
32
+ // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
33
+ // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
34
+ if (debug === '*') {
35
+ return true;
36
+ }
37
+ let debuggers = debug.split(',').map((d)=>d.split(':')[0]
38
+ );
39
+ // Ignoring tailwindcss
40
+ if (debuggers.includes('-tailwindcss')) {
41
+ return false;
42
+ }
43
+ // Including tailwindcss
44
+ if (debuggers.includes('tailwindcss')) {
45
+ return true;
46
+ }
47
+ return false;
48
+ }
@@ -21,9 +21,10 @@ function _interopRequireDefault(obj) {
21
21
  }
22
22
  function processTailwindFeatures(setupContext) {
23
23
  return function(root, result) {
24
- let tailwindDirectives = (0, _normalizeTailwindDirectives).default(root);
24
+ let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
25
25
  let context = setupContext({
26
26
  tailwindDirectives,
27
+ applyDirectives,
27
28
  registerDependency (dependency) {
28
29
  result.messages.push({
29
30
  plugin: 'tailwindcss',
package/lib/util/color.js CHANGED
@@ -15,7 +15,8 @@ let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
15
15
  let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`;
16
16
  let SEP = `(?:\\s*,\\s*|\\s+)`;
17
17
  let ALPHA_SEP = `\\s*[,/]\\s*`;
18
- let RGB_HSL = new RegExp(`^(rgb|hsl)a?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
18
+ let RGB = new RegExp(`^rgba?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
19
+ let HSL = new RegExp(`^hsla?\\(\\s*((?:${VALUE})(?:deg|rad|grad|turn)?)${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
19
20
  function parseColor(value) {
20
21
  if (typeof value !== 'string') {
21
22
  return null;
@@ -62,18 +63,32 @@ function parseColor(value) {
62
63
  alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
63
64
  };
64
65
  }
65
- let match = value.match(RGB_HSL);
66
- if (match !== null) {
66
+ let rgbMatch = value.match(RGB);
67
+ if (rgbMatch !== null) {
67
68
  var ref, ref1;
68
69
  return {
69
- mode: match[1],
70
+ mode: 'rgb',
71
+ color: [
72
+ rgbMatch[1],
73
+ rgbMatch[2],
74
+ rgbMatch[3]
75
+ ].map((v)=>v.toString()
76
+ ),
77
+ alpha: (ref = rgbMatch[4]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
78
+ };
79
+ }
80
+ let hslMatch = value.match(HSL);
81
+ if (hslMatch !== null) {
82
+ var ref2, ref3;
83
+ return {
84
+ mode: 'hsl',
70
85
  color: [
71
- match[2],
72
- match[3],
73
- match[4]
86
+ hslMatch[1],
87
+ hslMatch[2],
88
+ hslMatch[3]
74
89
  ].map((v)=>v.toString()
75
90
  ),
76
- alpha: (ref = match[5]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
91
+ alpha: (ref2 = hslMatch[4]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.toString) === null || ref3 === void 0 ? void 0 : ref3.call(ref2)
77
92
  };
78
93
  }
79
94
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.0.7",
3
+ "version": "3.0.11",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -25,7 +25,7 @@
25
25
  "prepublishOnly": "npm install --force && npm run swcify",
26
26
  "style": "eslint .",
27
27
  "pretest": "npm run generate:plugin-list",
28
- "test": "cross-env TAILWIND_MODE=build jest",
28
+ "test": "jest",
29
29
  "test:integrations": "npm run test --prefix ./integrations",
30
30
  "install:integrations": "node scripts/install-integrations.js",
31
31
  "posttest": "npm run style",
@@ -43,22 +43,22 @@
43
43
  "*.js"
44
44
  ],
45
45
  "devDependencies": {
46
- "@swc/cli": "^0.1.52",
46
+ "@swc/cli": "^0.1.55",
47
47
  "@swc/core": "^1.2.118",
48
- "@swc/jest": "^0.2.11",
48
+ "@swc/jest": "^0.2.15",
49
49
  "@swc/register": "^0.1.7",
50
50
  "autoprefixer": "^10.4.0",
51
51
  "cross-env": "^7.0.3",
52
- "cssnano": "^5.0.12",
52
+ "cssnano": "^5.0.14",
53
53
  "esbuild": "^0.14.2",
54
54
  "eslint": "^8.4.1",
55
55
  "eslint-config-prettier": "^8.3.0",
56
56
  "eslint-plugin-prettier": "^4.0.0",
57
- "jest": "^27.4.3",
57
+ "jest": "^27.4.5",
58
58
  "jest-diff": "^27.4.2",
59
- "postcss": "^8.4.4",
59
+ "postcss": "^8.4.5",
60
60
  "postcss-cli": "^8.3.1",
61
- "prettier": "^2.5.0",
61
+ "prettier": "^2.5.1",
62
62
  "rimraf": "^3.0.0"
63
63
  },
64
64
  "peerDependencies": {
@@ -79,14 +79,13 @@
79
79
  "is-glob": "^4.0.3",
80
80
  "normalize-path": "^3.0.0",
81
81
  "object-hash": "^2.2.0",
82
- "postcss-js": "^3.0.3",
82
+ "postcss-js": "^4.0.0",
83
83
  "postcss-load-config": "^3.1.0",
84
84
  "postcss-nested": "5.0.6",
85
85
  "postcss-selector-parser": "^6.0.7",
86
86
  "postcss-value-parser": "^4.2.0",
87
87
  "quick-lru": "^5.1.1",
88
- "resolve": "^1.20.0",
89
- "tmp": "^0.2.1"
88
+ "resolve": "^1.20.0"
90
89
  },
91
90
  "browserslist": [
92
91
  "> 1%",