tailwindcss 0.0.0-insiders.ee55770 → 0.0.0-insiders.ee945bb

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 (81) hide show
  1. package/CHANGELOG.md +205 -4
  2. package/LICENSE +1 -2
  3. package/README.md +8 -4
  4. package/lib/cli.js +83 -36
  5. package/lib/corePlugins.js +238 -291
  6. package/lib/css/preflight.css +2 -3
  7. package/lib/featureFlags.js +4 -7
  8. package/lib/index.js +12 -3
  9. package/lib/lib/cacheInvalidation.js +69 -0
  10. package/lib/lib/collapseAdjacentRules.js +14 -1
  11. package/lib/lib/collapseDuplicateDeclarations.js +52 -1
  12. package/lib/lib/defaultExtractor.js +44 -0
  13. package/lib/lib/evaluateTailwindFunctions.js +1 -1
  14. package/lib/lib/expandApplyAtRules.js +257 -69
  15. package/lib/lib/expandTailwindAtRules.js +57 -66
  16. package/lib/lib/generateRules.js +117 -33
  17. package/lib/lib/normalizeTailwindDirectives.js +10 -2
  18. package/lib/lib/partitionApplyAtRules.js +53 -0
  19. package/lib/lib/resolveDefaultsAtRules.js +10 -6
  20. package/lib/lib/setupContextUtils.js +105 -83
  21. package/lib/lib/setupTrackingContext.js +8 -7
  22. package/lib/lib/sharedState.js +38 -5
  23. package/{nesting → lib/postcss-plugins/nesting}/README.md +0 -0
  24. package/lib/postcss-plugins/nesting/index.js +17 -0
  25. package/lib/postcss-plugins/nesting/plugin.js +85 -0
  26. package/lib/processTailwindFeatures.js +10 -2
  27. package/lib/util/cloneNodes.js +12 -1
  28. package/lib/util/color.js +23 -8
  29. package/lib/util/createPlugin.js +1 -2
  30. package/lib/util/createUtilityPlugin.js +4 -8
  31. package/lib/util/flattenColorPalette.js +1 -3
  32. package/lib/util/log.js +7 -7
  33. package/lib/util/normalizeConfig.js +19 -16
  34. package/lib/util/normalizeScreens.js +2 -4
  35. package/lib/util/parseBoxShadowValue.js +44 -4
  36. package/lib/util/pluginUtils.js +6 -13
  37. package/lib/util/prefixSelector.js +4 -5
  38. package/lib/util/resolveConfig.js +40 -19
  39. package/lib/util/resolveConfigPath.js +1 -2
  40. package/lib/util/toColorValue.js +1 -2
  41. package/lib/util/toPath.js +6 -1
  42. package/lib/util/transformThemeValue.js +4 -8
  43. package/nesting/index.js +2 -12
  44. package/package.json +27 -33
  45. package/peers/index.js +3167 -4197
  46. package/src/cli.js +84 -25
  47. package/src/corePlugins.js +175 -165
  48. package/src/css/preflight.css +2 -3
  49. package/src/featureFlags.js +3 -7
  50. package/src/index.js +14 -6
  51. package/src/lib/cacheInvalidation.js +52 -0
  52. package/src/lib/collapseAdjacentRules.js +16 -1
  53. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  54. package/src/lib/defaultExtractor.js +50 -0
  55. package/src/lib/evaluateTailwindFunctions.js +1 -1
  56. package/src/lib/expandApplyAtRules.js +274 -72
  57. package/src/lib/expandTailwindAtRules.js +68 -53
  58. package/src/lib/generateRules.js +97 -26
  59. package/src/lib/normalizeTailwindDirectives.js +7 -1
  60. package/src/lib/partitionApplyAtRules.js +52 -0
  61. package/src/lib/resolveDefaultsAtRules.js +11 -7
  62. package/src/lib/setupContextUtils.js +94 -45
  63. package/src/lib/setupTrackingContext.js +8 -7
  64. package/src/lib/sharedState.js +42 -4
  65. package/src/postcss-plugins/nesting/README.md +42 -0
  66. package/src/postcss-plugins/nesting/index.js +13 -0
  67. package/src/postcss-plugins/nesting/plugin.js +80 -0
  68. package/src/processTailwindFeatures.js +12 -2
  69. package/src/util/cloneNodes.js +14 -1
  70. package/src/util/color.js +20 -7
  71. package/src/util/log.js +7 -7
  72. package/src/util/normalizeConfig.js +12 -4
  73. package/src/util/parseBoxShadowValue.js +51 -3
  74. package/src/util/pluginUtils.js +1 -1
  75. package/src/util/prefixSelector.js +7 -5
  76. package/src/util/resolveConfig.js +41 -1
  77. package/src/util/toPath.js +23 -1
  78. package/stubs/defaultConfig.stub.js +2 -2
  79. package/lib/lib/setupWatchingContext.js +0 -288
  80. package/nesting/plugin.js +0 -41
  81. package/src/lib/setupWatchingContext.js +0 -311
package/CHANGELOG.md CHANGED
@@ -7,13 +7,194 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- - Nothing yet!
10
+ ### Fixed
11
+
12
+ - Prevent nesting plugin from breaking other plugins ([#7563](https://github.com/tailwindlabs/tailwindcss/pull/7563))
13
+ - Recursively collapse adjacent rules ([#7565](https://github.com/tailwindlabs/tailwindcss/pull/7565))
14
+ - Preserve source maps for generated CSS ([#7588](https://github.com/tailwindlabs/tailwindcss/pull/7588))
15
+ - Split box shadows on top-level commas only ([#7479](https://github.com/tailwindlabs/tailwindcss/pull/7479))
16
+ - Use local user CSS cache for `@apply` ([#7524](https://github.com/tailwindlabs/tailwindcss/pull/7524))
17
+ - Invalidate context when main CSS changes ([#7626](https://github.com/tailwindlabs/tailwindcss/pull/7626))
18
+ - Only add `!` to selector class matching template candidate when using important modifier with mutli-class selectors ([#7664](https://github.com/tailwindlabs/tailwindcss/pull/7664))
19
+ - Correctly parse and prefix animation names with dots ([#7163](https://github.com/tailwindlabs/tailwindcss/pull/7163))
20
+ - Fix extraction from template literal/function with array ([#7481](https://github.com/tailwindlabs/tailwindcss/pull/7481))
21
+
22
+ ### Changed
23
+
24
+ - Replace `chalk` with `picocolors` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6039))
25
+ - Replace `cosmiconfig` with `lilconfig` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6038))
26
+
27
+ ### Added
28
+
29
+ - Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
30
+ - Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
31
+ - Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
32
+ - Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
33
+ - Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
34
+ - Add `--poll` option to the CLI ([#7725](https://github.com/tailwindlabs/tailwindcss/pull/7725))
35
+
36
+ ## [3.0.23] - 2022-02-16
37
+
38
+ ### Fixed
39
+
40
+ - Remove opacity variables from `:visited` pseudo class ([#7458](https://github.com/tailwindlabs/tailwindcss/pull/7458))
41
+ - Support arbitrary values + calc + theme with quotes ([#7462](https://github.com/tailwindlabs/tailwindcss/pull/7462))
42
+ - Don't duplicate layer output when scanning content with variants + wildcards ([#7478](https://github.com/tailwindlabs/tailwindcss/pull/7478))
43
+ - Implement `getClassOrder` instead of `sortClassList` ([#7459](https://github.com/tailwindlabs/tailwindcss/pull/7459))
44
+
45
+ ## [3.0.22] - 2022-02-11
46
+
47
+ ### Fixed
48
+
49
+ - Temporarily move `postcss` to dependencies ([#7424](https://github.com/tailwindlabs/tailwindcss/pull/7424))
50
+
51
+ ## [3.0.21] - 2022-02-10
52
+
53
+ ### Fixed
54
+
55
+ - Move prettier plugin to dev dependencies ([#7418](https://github.com/tailwindlabs/tailwindcss/pull/7418))
56
+
57
+ ## [3.0.20] - 2022-02-10
58
+
59
+ ### Added
60
+
61
+ - Expose `context.sortClassList(classes)` ([#7412](https://github.com/tailwindlabs/tailwindcss/pull/7412))
62
+
63
+ ## [3.0.19] - 2022-02-07
64
+
65
+ ### Fixed
66
+
67
+ - Fix preflight border color fallback ([#7288](https://github.com/tailwindlabs/tailwindcss/pull/7288))
68
+ - Correctly parse shadow lengths without a leading zero ([#7289](https://github.com/tailwindlabs/tailwindcss/pull/7289))
69
+ - Don't crash when scanning extremely long class candidates ([#7331](https://github.com/tailwindlabs/tailwindcss/pull/7331))
70
+ - Use less hacky fix for URLs detected as custom properties ([#7275](https://github.com/tailwindlabs/tailwindcss/pull/7275))
71
+ - Correctly generate negative utilities when dash is before the prefix ([#7295](https://github.com/tailwindlabs/tailwindcss/pull/7295))
72
+ - Detect prefixed negative utilities in the safelist ([#7295](https://github.com/tailwindlabs/tailwindcss/pull/7295))
73
+
74
+ ## [3.0.18] - 2022-01-28
75
+
76
+ ### Fixed
77
+
78
+ - Fix `@apply` order regression (in `addComponents`, `addUtilities`, ...) ([#7232](https://github.com/tailwindlabs/tailwindcss/pull/7232))
79
+ - Quick fix for incorrect arbitrary properties when using URLs ([#7252](https://github.com/tailwindlabs/tailwindcss/pull/7252))
80
+
81
+ ## [3.0.17] - 2022-01-26
82
+
83
+ ### Fixed
84
+
85
+ - Remove false positive warning in CLI when using the `--content` option ([#7220](https://github.com/tailwindlabs/tailwindcss/pull/7220))
86
+
87
+ ## [3.0.16] - 2022-01-24
88
+
89
+ ### Fixed
90
+
91
+ - Ensure to transpile the PostCSS Nesting plugin (tailwindcss/nesting) ([#7080](https://github.com/tailwindlabs/tailwindcss/pull/7080))
92
+ - Improve various warnings ([#7118](https://github.com/tailwindlabs/tailwindcss/pull/7118))
93
+ - Fix grammatical mistake ([cca5a38](https://github.com/tailwindlabs/tailwindcss/commit/cca5a3804e1d3ee0214491921e1aec35bf62a813))
94
+
95
+ ## [3.0.15] - 2022-01-15
96
+
97
+ ### Fixed
98
+
99
+ - Temporarily remove optional chaining in nesting plugin ([#7077](https://github.com/tailwindlabs/tailwindcss/pull/7077))
100
+
101
+ ## [3.0.14] - 2022-01-14
102
+
103
+ ### Added
104
+
105
+ - Show warnings for invalid content config ([#7065](https://github.com/tailwindlabs/tailwindcss/pull/7065))
106
+
107
+ ### Fixed
108
+
109
+ - Only emit utility/component variants when those layers exist ([#7066](https://github.com/tailwindlabs/tailwindcss/pull/7066))
110
+ - Ensure nesting plugins can receive options ([#7016](https://github.com/tailwindlabs/tailwindcss/pull/7016))
111
+
112
+ ## [3.0.13] - 2022-01-11
113
+
114
+ ### Fixed
115
+
116
+ - Fix consecutive builds with at apply producing different CSS ([#6999](https://github.com/tailwindlabs/tailwindcss/pull/6999))
117
+
118
+ ## [3.0.12] - 2022-01-07
119
+
120
+ ### Fixed
121
+
122
+ - Allow use of falsy values in theme config ([#6917](https://github.com/tailwindlabs/tailwindcss/pull/6917))
123
+ - Ensure we can apply classes that are grouped with non-class selectors ([#6922](https://github.com/tailwindlabs/tailwindcss/pull/6922))
124
+ - Improve standalone CLI compatibility on Linux by switching to the `linuxstatic` build target ([#6914](https://github.com/tailwindlabs/tailwindcss/pull/6914))
125
+ - Ensure `@apply` works consistently with or without `@layer` ([#6938](https://github.com/tailwindlabs/tailwindcss/pull/6938))
126
+ - Only emit defaults when using base layer ([#6926](https://github.com/tailwindlabs/tailwindcss/pull/6926))
127
+ - Emit plugin defaults regardless of usage ([#6926](https://github.com/tailwindlabs/tailwindcss/pull/6926))
128
+ - Move default border color back to preflight ([#6926](https://github.com/tailwindlabs/tailwindcss/pull/6926))
129
+ - Change `experimental.optimizeUniversalDefaults` to only work with `@tailwind base` ([#6926](https://github.com/tailwindlabs/tailwindcss/pull/6926))
130
+
131
+ ## [3.0.11] - 2022-01-05
132
+
133
+ ### Fixed
134
+
135
+ - Preserve casing of CSS variables added by plugins ([#6888](https://github.com/tailwindlabs/tailwindcss/pull/6888))
136
+ - Ignore content paths that are passed in but don't actually exist ([#6901](https://github.com/tailwindlabs/tailwindcss/pull/6901))
137
+ - Revert change that applies Tailwind's defaults in isolated environments like CSS modules ([9fdc391](https://github.com/tailwindlabs/tailwindcss/commit/9fdc391d4ff93e7e350f5ce439060176b1f0162f))
138
+
139
+ ## [3.0.10] - 2022-01-04
140
+
141
+ ### Fixed
142
+
143
+ - Fix `@apply` in files without `@tailwind` directives ([#6580](https://github.com/tailwindlabs/tailwindcss/pull/6580), [#6875](https://github.com/tailwindlabs/tailwindcss/pull/6875))
144
+ - CLI: avoid unnecessary writes to output files ([#6550](https://github.com/tailwindlabs/tailwindcss/pull/6550))
145
+
146
+ ### Added
147
+
148
+ - Allow piping data into the CLI ([#6876](https://github.com/tailwindlabs/tailwindcss/pull/6876))
149
+
150
+ ## [3.0.9] - 2022-01-03
151
+
152
+ ### Fixed
153
+
154
+ - Improve `DEBUG` flag ([#6797](https://github.com/tailwindlabs/tailwindcss/pull/6797), [#6804](https://github.com/tailwindlabs/tailwindcss/pull/6804))
155
+ - Ensure we can use `<` and `>` characters in modifiers ([#6851](https://github.com/tailwindlabs/tailwindcss/pull/6851))
156
+ - Validate `theme()` works in arbitrary values ([#6852](https://github.com/tailwindlabs/tailwindcss/pull/6852))
157
+ - Properly detect `theme()` value usage in arbitrary properties ([#6854](https://github.com/tailwindlabs/tailwindcss/pull/6854))
158
+ - Improve collapsing of duplicate declarations ([#6856](https://github.com/tailwindlabs/tailwindcss/pull/6856))
159
+ - Remove support for `TAILWIND_MODE=watch` ([#6858](https://github.com/tailwindlabs/tailwindcss/pull/6858))
160
+
161
+ ## [3.0.8] - 2021-12-28
162
+
163
+ ### Fixed
164
+
165
+ - Reduce specificity of `abbr` rule in preflight ([#6671](https://github.com/tailwindlabs/tailwindcss/pull/6671))
166
+ - Support HSL with hue units in arbitrary values ([#6726](https://github.com/tailwindlabs/tailwindcss/pull/6726))
167
+ - Add `node16-linux-arm64` target for standalone CLI ([#6693](https://github.com/tailwindlabs/tailwindcss/pull/6693))
168
+
169
+ ## [3.0.7] - 2021-12-17
170
+
171
+ ### Fixed
172
+
173
+ - Don't mutate custom color palette when overriding per-plugin colors ([#6546](https://github.com/tailwindlabs/tailwindcss/pull/6546))
174
+ - Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588))
175
+ - Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589))
176
+ - Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590))
177
+ - Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593))
178
+ - Ensure `@apply` of a rule inside an AtRule works ([#6594](https://github.com/tailwindlabs/tailwindcss/pull/6594))
179
+
180
+ ## [3.0.6] - 2021-12-16
181
+
182
+ ### Fixed
183
+
184
+ - Support square bracket notation in paths ([#6519](https://github.com/tailwindlabs/tailwindcss/pull/6519))
185
+ - Ensure all plugins are executed for a given candidate ([#6540](https://github.com/tailwindlabs/tailwindcss/pull/6540))
186
+
187
+ ## [3.0.5] - 2021-12-15
188
+
189
+ ### Fixed
190
+
191
+ - Revert: add `li` to list-style reset ([9777562d](https://github.com/tailwindlabs/tailwindcss/commit/9777562da37ee631bbf77374c0d14825f09ef9af))
11
192
 
12
193
  ## [3.0.4] - 2021-12-15
13
194
 
14
195
  ### Fixed
15
196
 
16
- - Insert always on defaults layer in correct spot ([#6526](https://github.com/tailwindlabs/tailwindcss/pull/6526))
197
+ - Insert always-on defaults layer in correct spot ([#6526](https://github.com/tailwindlabs/tailwindcss/pull/6526))
17
198
 
18
199
  ## [3.0.3] - 2021-12-15
19
200
 
@@ -21,13 +202,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
202
 
22
203
  - Warn about invalid globs in `content` ([#6449](https://github.com/tailwindlabs/tailwindcss/pull/6449))
23
204
  - Add standalone tailwindcss CLI ([#6506](https://github.com/tailwindlabs/tailwindcss/pull/6506))
205
+ - Add `li` to list-style reset ([00f60e6](https://github.com/tailwindlabs/tailwindcss/commit/00f60e61013c6e4e3419e4b699371a13eb30b75d))
24
206
 
25
207
  ### Fixed
26
208
 
27
209
  - Don't output unparsable values ([#6469](https://github.com/tailwindlabs/tailwindcss/pull/6469))
28
210
  - Fix text decoration utilities from overriding the new text decoration color/style/thickness utilities when used with a modifier ([#6378](https://github.com/tailwindlabs/tailwindcss/pull/6378))
29
211
  - Move defaults to their own always-on layer ([#6500](https://github.com/tailwindlabs/tailwindcss/pull/6500))
30
- - Support negative values in safelist patterns ([6480](https://github.com/tailwindlabs/tailwindcss/pull/6480))
212
+ - Support negative values in safelist patterns ([#6480](https://github.com/tailwindlabs/tailwindcss/pull/6480))
31
213
 
32
214
  ## [3.0.2] - 2021-12-13
33
215
 
@@ -1716,7 +1898,26 @@ No release notes
1716
1898
 
1717
1899
  - Everything!
1718
1900
 
1719
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.4...HEAD
1901
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...HEAD
1902
+ [3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
1903
+ [3.0.22]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.21...v3.0.22
1904
+ [3.0.21]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.20...v3.0.21
1905
+ [3.0.20]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.19...v3.0.20
1906
+ [3.0.19]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.18...v3.0.19
1907
+ [3.0.18]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.17...v3.0.18
1908
+ [3.0.17]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.16...v3.0.17
1909
+ [3.0.16]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.15...v3.0.16
1910
+ [3.0.15]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.14...v3.0.15
1911
+ [3.0.14]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.13...v3.0.14
1912
+ [3.0.13]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.12...v3.0.13
1913
+ [3.0.12]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.11...v3.0.12
1914
+ [3.0.11]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.10...v3.0.11
1915
+ [3.0.10]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.9...v3.0.10
1916
+ [3.0.9]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.8...v3.0.9
1917
+ [3.0.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.7...v3.0.8
1918
+ [3.0.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.6...v3.0.7
1919
+ [3.0.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.5...v3.0.6
1920
+ [3.0.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.4...v3.0.5
1720
1921
  [3.0.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.3...v3.0.4
1721
1922
  [3.0.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.2...v3.0.3
1722
1923
  [3.0.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.1...v3.0.2
package/LICENSE CHANGED
@@ -1,7 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) Adam Wathan <adam.wathan@gmail.com>
4
- Copyright (c) Jonathan Reinink <jonathan@reinink.ca>
3
+ Copyright (c) Tailwind Labs, Inc.
5
4
 
6
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
7
6
  of this software and associated documentation files (the "Software"), to deal
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
@@ -6,7 +6,7 @@ var _path = _interopRequireDefault(require("path"));
6
6
  var _arg = _interopRequireDefault(require("arg"));
7
7
  var _fs = _interopRequireDefault(require("fs"));
8
8
  var _postcssLoadConfig = _interopRequireDefault(require("postcss-load-config"));
9
- var _cosmiconfig = require("cosmiconfig");
9
+ var _lilconfig = require("lilconfig");
10
10
  var _plugins // Little bit scary, looking at private/internal API
11
11
  = _interopRequireDefault(require("postcss-load-config/src/plugins"));
12
12
  var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
@@ -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
@@ -70,8 +89,7 @@ function help({ message , usage , commands: commands1 , options }) {
70
89
  }
71
90
  // Render options
72
91
  if (options) {
73
- let groupedOptions = {
74
- };
92
+ let groupedOptions = {};
75
93
  for (let [key, value] of Object.entries(options)){
76
94
  if (typeof value === 'object') {
77
95
  groupedOptions[key] = {
@@ -141,6 +159,10 @@ let commands = {
141
159
  type: Boolean,
142
160
  description: 'Watch for changes and rebuild as needed'
143
161
  },
162
+ '--poll': {
163
+ type: Boolean,
164
+ description: 'Use polling instead of filesystem events when watching'
165
+ },
144
166
  '--content': {
145
167
  type: String,
146
168
  description: 'Content paths to use for removing unused classes'
@@ -169,7 +191,8 @@ let commands = {
169
191
  '-i': '--input',
170
192
  '-o': '--output',
171
193
  '-m': '--minify',
172
- '-w': '--watch'
194
+ '-w': '--watch',
195
+ '-p': '--poll'
173
196
  }
174
197
  }
175
198
  };
@@ -330,13 +353,18 @@ async function build() {
330
353
  let input = args['--input'];
331
354
  let output = args['--output'];
332
355
  let shouldWatch = args['--watch'];
356
+ let shouldPoll = args['--poll'];
357
+ let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32';
333
358
  let includePostCss = args['--postcss'];
359
+ // Polling interval in milliseconds
360
+ // Used only when polling or coalescing add/change events on Windows
361
+ let pollInterval = 10;
334
362
  // TODO: Deprecate this in future versions
335
363
  if (!input && args['_'][1]) {
336
364
  console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
337
365
  input = args['--input'] = args['_'][1];
338
366
  }
339
- if (input && !_fs.default.existsSync(input = _path.default.resolve(input))) {
367
+ if (input && input !== '-' && !_fs.default.existsSync(input = _path.default.resolve(input))) {
340
368
  console.error(`Specified input file ${args['--input']} does not exist.`);
341
369
  process.exit(9);
342
370
  }
@@ -350,14 +378,12 @@ async function build() {
350
378
  let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
351
379
  let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
352
380
  let file = _path.default.resolve(customPostCssPath);
353
- // Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0.1/src/index.js
354
- let { config ={
355
- } } = await (0, _cosmiconfig).cosmiconfig('postcss').load(file);
381
+ // Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
382
+ let { config ={} } = await (0, _lilconfig).lilconfig('postcss').load(file);
356
383
  if (typeof config === 'function') {
357
384
  config = config();
358
385
  } else {
359
- config = Object.assign({
360
- }, config);
386
+ config = Object.assign({}, config);
361
387
  }
362
388
  if (!config.plugins) {
363
389
  config.plugins = [];
@@ -383,9 +409,7 @@ async function build() {
383
409
  ];
384
410
  }
385
411
  function resolveConfig() {
386
- let config = configPath ? require(configPath) : {
387
- };
388
- let resolvedConfig = (0, _resolveConfig).default(config);
412
+ let config = configPath ? require(configPath) : {};
389
413
  if (args['--purge']) {
390
414
  _log.default.warn('purge-flag-deprecated', [
391
415
  'The `--purge` flag has been deprecated.',
@@ -396,9 +420,16 @@ async function build() {
396
420
  }
397
421
  }
398
422
  if (args['--content']) {
399
- resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/);
423
+ let files = args['--content'].split(/(?<!{[^}]+),/);
424
+ let resolvedConfig = (0, _resolveConfig).default(config, {
425
+ content: {
426
+ files
427
+ }
428
+ });
429
+ resolvedConfig.content.files = files;
430
+ return resolvedConfig;
400
431
  }
401
- return resolvedConfig;
432
+ return (0, _resolveConfig).default(config);
402
433
  }
403
434
  function extractFileGlobs(config) {
404
435
  return config.content.files.filter((file)=>{
@@ -463,8 +494,7 @@ async function build() {
463
494
  // Try to load a local `autoprefixer` version first
464
495
  try {
465
496
  return require('autoprefixer');
466
- } catch {
467
- }
497
+ } catch {}
468
498
  return (0, _indexJs).lazyAutoprefixer();
469
499
  })(),
470
500
  args['--minify'] && (()=>{
@@ -479,8 +509,7 @@ async function build() {
479
509
  // Try to load a local `cssnano` version first
480
510
  try {
481
511
  return require('cssnano');
482
- } catch {
483
- }
512
+ } catch {}
484
513
  return (0, _indexJs).lazyCssnano()(options);
485
514
  })(),
486
515
  ].filter(Boolean);
@@ -499,10 +528,8 @@ async function build() {
499
528
  return process.stdout.write(result.css);
500
529
  }
501
530
  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
- ),
531
+ outputFile(output, result.css),
532
+ result.map && outputFile(output + '.map', result.map.toString()),
506
533
  ].filter(Boolean));
507
534
  }).then(()=>{
508
535
  let end = process.hrtime.bigint();
@@ -510,7 +537,18 @@ async function build() {
510
537
  console.error('Done in', (end - start) / BigInt(1000000) + 'ms.');
511
538
  });
512
539
  }
513
- let css1 = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
540
+ let css1 = await (()=>{
541
+ // Piping in data, let's drain the stdin
542
+ if (input === '-') {
543
+ return drainStdin();
544
+ }
545
+ // Input file has been provided
546
+ if (input) {
547
+ return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
548
+ }
549
+ // No input file provided, fallback to default atrules
550
+ return '@tailwind base; @tailwind components; @tailwind utilities';
551
+ })();
514
552
  return processCSS(css1);
515
553
  }
516
554
  let context = null;
@@ -547,8 +585,7 @@ async function build() {
547
585
  // Try to load a local `autoprefixer` version first
548
586
  try {
549
587
  return require('autoprefixer');
550
- } catch {
551
- }
588
+ } catch {}
552
589
  return (0, _indexJs).lazyAutoprefixer();
553
590
  })(),
554
591
  args['--minify'] && (()=>{
@@ -563,8 +600,7 @@ async function build() {
563
600
  // Try to load a local `cssnano` version first
564
601
  try {
565
602
  return require('cssnano');
566
- } catch {
567
- }
603
+ } catch {}
568
604
  return (0, _indexJs).lazyCssnano()(options);
569
605
  })(),
570
606
  ].filter(Boolean);
@@ -619,11 +655,9 @@ async function build() {
619
655
  if (!output) {
620
656
  return process.stdout.write(result.css);
621
657
  }
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
- ),
658
+ return Promise.all([
659
+ outputFile(output, result.css),
660
+ result.map && outputFile(output + '.map', result.map.toString()),
627
661
  ].filter(Boolean));
628
662
  }).then(()=>{
629
663
  let end = process.hrtime.bigint();
@@ -636,7 +670,18 @@ async function build() {
636
670
  }
637
671
  });
638
672
  }
639
- let css2 = input ? _fs.default.readFileSync(_path.default.resolve(input), 'utf8') : '@tailwind base; @tailwind components; @tailwind utilities';
673
+ let css2 = await (()=>{
674
+ // Piping in data, let's drain the stdin
675
+ if (input === '-') {
676
+ return drainStdin();
677
+ }
678
+ // Input file has been provided
679
+ if (input) {
680
+ return _fs.default.readFileSync(_path.default.resolve(input), 'utf8');
681
+ }
682
+ // No input file provided, fallback to default atrules
683
+ return '@tailwind base; @tailwind components; @tailwind utilities';
684
+ })();
640
685
  let result1 = await processCSS(css2);
641
686
  env.DEBUG && console.timeEnd('Finished in');
642
687
  return result1;
@@ -649,10 +694,12 @@ async function build() {
649
694
  ...contextDependencies,
650
695
  ...extractFileGlobs(config1)
651
696
  ], {
697
+ usePolling: shouldPoll,
698
+ interval: shouldPoll ? pollInterval : undefined,
652
699
  ignoreInitial: true,
653
- awaitWriteFinish: process.platform === 'win32' ? {
700
+ awaitWriteFinish: shouldCoalesceWriteEvents ? {
654
701
  stabilityThreshold: 50,
655
- pollInterval: 10
702
+ pollInterval: pollInterval
656
703
  } : false
657
704
  });
658
705
  let chain = Promise.resolve();