tailwindcss 0.0.0-insiders.bc00445 → 0.0.0-insiders.bc3d38b

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 (40) hide show
  1. package/CHANGELOG.md +81 -27
  2. package/README.md +6 -5
  3. package/lib/cli/build/plugin.js +52 -7
  4. package/lib/cli/build/watching.js +77 -12
  5. package/lib/corePlugins.js +9 -15
  6. package/lib/css/preflight.css +2 -0
  7. package/lib/lib/content.js +14 -4
  8. package/lib/lib/defaultExtractor.js +1 -1
  9. package/lib/lib/expandApplyAtRules.js +34 -15
  10. package/lib/lib/expandTailwindAtRules.js +1 -1
  11. package/lib/lib/findAtConfigPath.js +4 -4
  12. package/lib/lib/generateRules.js +18 -6
  13. package/lib/lib/setupContextUtils.js +30 -8
  14. package/lib/lib/sharedState.js +2 -0
  15. package/lib/util/formatVariantSelector.js +3 -3
  16. package/lib/util/normalizeConfig.js +14 -0
  17. package/lib/util/pluginUtils.js +19 -5
  18. package/lib/util/resolveConfig.js +4 -9
  19. package/package.json +10 -10
  20. package/peers/index.js +634 -579
  21. package/scripts/release-channel.js +18 -0
  22. package/scripts/release-notes.js +21 -0
  23. package/src/cli/build/plugin.js +68 -6
  24. package/src/cli/build/watching.js +105 -12
  25. package/src/corePlugins.js +13 -20
  26. package/src/css/preflight.css +2 -0
  27. package/src/lib/content.js +16 -8
  28. package/src/lib/defaultExtractor.js +1 -1
  29. package/src/lib/expandApplyAtRules.js +35 -15
  30. package/src/lib/findAtConfigPath.js +4 -6
  31. package/src/lib/generateRules.js +27 -11
  32. package/src/lib/setupContextUtils.js +33 -11
  33. package/src/lib/sharedState.js +2 -0
  34. package/src/util/formatVariantSelector.js +2 -2
  35. package/src/util/normalizeConfig.js +18 -0
  36. package/src/util/pluginUtils.js +28 -5
  37. package/src/util/resolveConfig.js +3 -9
  38. package/stubs/defaultConfig.stub.js +3 -20
  39. package/types/config.d.ts +1 -0
  40. package/scripts/calculate-tag-name.js +0 -8
package/CHANGELOG.md CHANGED
@@ -7,56 +7,105 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Fixed
11
+
12
+ - Cleanup unused `variantOrder` ([#9829](https://github.com/tailwindlabs/tailwindcss/pull/9829))
13
+
14
+ ### Added
15
+
16
+ - Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865))
17
+
18
+ ## [3.2.4] - 2022-11-11
19
+
20
+ ### Added
21
+
22
+ - Add `blocklist` option to prevent generating unwanted CSS ([#9812](https://github.com/tailwindlabs/tailwindcss/pull/9812))
23
+
24
+ ### Fixed
25
+
26
+ - Fix watching of files on Linux when renames are involved ([#9796](https://github.com/tailwindlabs/tailwindcss/pull/9796))
27
+ - Make sure errors are always displayed when watching for changes ([#9810](https://github.com/tailwindlabs/tailwindcss/pull/9810))
28
+
29
+ ## [3.2.3] - 2022-11-09
30
+
31
+ ### Fixed
32
+
33
+ - Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))
34
+ - Pick up changes from files that are both context and content deps ([#9787](https://github.com/tailwindlabs/tailwindcss/pull/9787))
35
+ - Sort pseudo-elements ONLY after classes when using variants and `@apply` ([#9765](https://github.com/tailwindlabs/tailwindcss/pull/9765))
36
+ - Support important utilities in the safelist (pattern must include a `!`) ([#9791](https://github.com/tailwindlabs/tailwindcss/pull/9791))
37
+
38
+ ## [3.2.2] - 2022-11-04
39
+
40
+ ### Fixed
41
+
42
+ - Escape special characters in resolved content base paths ([#9650](https://github.com/tailwindlabs/tailwindcss/pull/9650))
43
+ - Don't reuse container for array returning variant functions ([#9644](https://github.com/tailwindlabs/tailwindcss/pull/9644))
44
+ - Exclude non-relevant selectors when generating rules with the important modifier ([#9677](https://github.com/tailwindlabs/tailwindcss/issues/9677))
45
+ - Fix merging of arrays during config resolution ([#9706](https://github.com/tailwindlabs/tailwindcss/issues/9706))
46
+ - Ensure configured `font-feature-settings` are included in Preflight ([#9707](https://github.com/tailwindlabs/tailwindcss/pull/9707))
47
+ - Fix fractional values not being parsed properly inside arbitrary properties ([#9705](https://github.com/tailwindlabs/tailwindcss/pull/9705))
48
+ - Fix incorrect selectors when using `@apply` in selectors with combinators and pseudos ([#9722](https://github.com/tailwindlabs/tailwindcss/pull/9722))
49
+ - Fix cannot read properties of undefined (reading 'modifier') ([#9656](https://github.com/tailwindlabs/tailwindcss/pull/9656), [aa979d6](https://github.com/tailwindlabs/tailwindcss/commit/aa979d645f8bf4108c5fc938d7c0ba085b654c31))
50
+
51
+ ## [3.2.1] - 2022-10-21
52
+
53
+ ### Fixed
54
+
55
+ - Fix missing `supports` in types ([#9616](https://github.com/tailwindlabs/tailwindcss/pull/9616))
56
+ - Fix missing PostCSS dependencies in the CLI ([#9617](https://github.com/tailwindlabs/tailwindcss/pull/9617))
57
+ - Ensure `micromatch` is a proper CLI dependency ([#9620](https://github.com/tailwindlabs/tailwindcss/pull/9620))
58
+ - Ensure modifier values exist when using a `modifiers` object for `matchVariant` ([ba6551db0f2726461371b4f3c6cd4c7090888504](https://github.com/tailwindlabs/tailwindcss/commit/ba6551db0f2726461371b4f3c6cd4c7090888504))
59
+
60
+ ## [3.2.0] - 2022-10-19
61
+
10
62
  ### Added
11
63
 
64
+ - Add new `@config` directive ([#9405](https://github.com/tailwindlabs/tailwindcss/pull/9405))
65
+ - Add new `relative: true` option to resolve content paths relative to the config file ([#9396](https://github.com/tailwindlabs/tailwindcss/pull/9396))
66
+ - Add new `supports-*` variant ([#9453](https://github.com/tailwindlabs/tailwindcss/pull/9453))
67
+ - Add new `min-*` and `max-*` variants ([#9558](https://github.com/tailwindlabs/tailwindcss/pull/9558))
68
+ - Add new `aria-*` variants ([#9557](https://github.com/tailwindlabs/tailwindcss/pull/9557), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
69
+ - Add new `data-*` variants ([#9559](https://github.com/tailwindlabs/tailwindcss/pull/9559), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
12
70
  - Add new `break-keep` utility for `word-break: keep-all` ([#9393](https://github.com/tailwindlabs/tailwindcss/pull/9393))
71
+ - Add new `collapse` utility for `visibility: collapse` ([#9181](https://github.com/tailwindlabs/tailwindcss/pull/9181))
72
+ - Add new `fill-none` utility for `fill: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
73
+ - Add new `stroke-none` utility for `stroke: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
74
+ - Add new `place-content-baseline` utility for `place-content: baseline` ([#9498](https://github.com/tailwindlabs/tailwindcss/pull/9498))
75
+ - Add new `place-items-baseline` utility for `place-items: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
76
+ - Add new `content-baseline` utility for `align-content: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
13
77
  - Add support for configuring default `font-feature-settings` for a font family ([#9039](https://github.com/tailwindlabs/tailwindcss/pull/9039))
14
- - Add a standalone CLI build for 32-bit Linux on ARM (`node16-linux-armv7`) ([#9084](https://github.com/tailwindlabs/tailwindcss/pull/9084))
78
+ - Add standalone CLI build for 32-bit Linux on ARM (`node16-linux-armv7`) ([#9084](https://github.com/tailwindlabs/tailwindcss/pull/9084))
15
79
  - Add future flag to disable color opacity utility plugins ([#9088](https://github.com/tailwindlabs/tailwindcss/pull/9088))
16
80
  - Add negative value support for `outline-offset` ([#9136](https://github.com/tailwindlabs/tailwindcss/pull/9136))
17
- - Allow negating utilities using min/max/clamp ([#9237](https://github.com/tailwindlabs/tailwindcss/pull/9237))
18
- - Add new `collapse` utility for `visibility: collapse` ([#9181](https://github.com/tailwindlabs/tailwindcss/pull/9181))
19
- - Allow resolving content paths relative to the config file ([#9396](https://github.com/tailwindlabs/tailwindcss/pull/9396))
20
- - Add `@config` support ([#9405](https://github.com/tailwindlabs/tailwindcss/pull/9405))
21
- - Add `fill-none` and `stroke-none` utilities by default ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
22
- - Support `sort` function in `matchVariant` ([#9423](https://github.com/tailwindlabs/tailwindcss/pull/9423))
23
- - Implement the `supports` variant ([#9453](https://github.com/tailwindlabs/tailwindcss/pull/9453))
24
- - Add experimental `label`s for variants ([#9456](https://github.com/tailwindlabs/tailwindcss/pull/9456), [#9520](https://github.com/tailwindlabs/tailwindcss/pull/9520))
25
- - Added 'place-content-baseline' utility ([#9498](https://github.com/tailwindlabs/tailwindcss/pull/9498))
26
- - Added 'place-items-baseline' utility ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
27
- - Added 'content-baseline' utility ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
28
- - Prepare for container queries setup ([#9526](https://github.com/tailwindlabs/tailwindcss/pull/9526))
29
81
  - Add support for modifiers to `matchUtilities` ([#9541](https://github.com/tailwindlabs/tailwindcss/pull/9541))
30
- - Switch to positional argument + object for modifiers ([#9541](https://github.com/tailwindlabs/tailwindcss/pull/9541))
31
- - Add new `min` and `max` variants ([#9558](https://github.com/tailwindlabs/tailwindcss/pull/9558))
32
- - Add aria variants ([#9557](https://github.com/tailwindlabs/tailwindcss/pull/9557))
33
- - Add `data-*` variants ([#9559](https://github.com/tailwindlabs/tailwindcss/pull/9559))
82
+ - Allow negating utilities using `min`/`max`/`clamp` ([#9237](https://github.com/tailwindlabs/tailwindcss/pull/9237))
83
+ - Implement fallback plugins when there is ambiguity between plugins when using arbitrary values ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
84
+ - Support `sort` function in `matchVariant` ([#9423](https://github.com/tailwindlabs/tailwindcss/pull/9423))
34
85
  - Upgrade to `postcss-nested` v6.0 ([#9546](https://github.com/tailwindlabs/tailwindcss/pull/9546))
35
- - Expose `context.getVariants` for intellisense ([#9505](https://github.com/tailwindlabs/tailwindcss/pull/9505))
36
86
 
37
87
  ### Fixed
38
88
 
39
89
  - Use absolute paths when resolving changed files for resilience against working directory changes ([#9032](https://github.com/tailwindlabs/tailwindcss/pull/9032))
40
90
  - Fix ring color utility generation when using `respectDefaultRingColorOpacity` ([#9070](https://github.com/tailwindlabs/tailwindcss/pull/9070))
41
- - Sort tags before classes when `@applying` a selector with joined classes ([#9107](https://github.com/tailwindlabs/tailwindcss/pull/9107))
91
+ - Sort tags before classes when `@apply`-ing a selector with joined classes ([#9107](https://github.com/tailwindlabs/tailwindcss/pull/9107))
42
92
  - Remove invalid `outline-hidden` utility ([#9147](https://github.com/tailwindlabs/tailwindcss/pull/9147))
43
93
  - Honor the `hidden` attribute on elements in preflight ([#9174](https://github.com/tailwindlabs/tailwindcss/pull/9174))
44
94
  - Don't stop watching atomically renamed files ([#9173](https://github.com/tailwindlabs/tailwindcss/pull/9173), [#9215](https://github.com/tailwindlabs/tailwindcss/pull/9215))
45
- - Re-use existing entries in the rule cache ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
46
- - Don't output duplicate utilities ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
95
+ - Fix duplicate utilities issue causing memory leaks ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
47
96
  - Fix `fontFamily` config TypeScript types ([#9214](https://github.com/tailwindlabs/tailwindcss/pull/9214))
48
97
  - Handle variants on complex selector utilities ([#9262](https://github.com/tailwindlabs/tailwindcss/pull/9262))
49
- - Don't mutate shared config objects ([#9294](https://github.com/tailwindlabs/tailwindcss/pull/9294))
98
+ - Fix shared config mutation issue ([#9294](https://github.com/tailwindlabs/tailwindcss/pull/9294))
50
99
  - Fix ordering of parallel variants ([#9282](https://github.com/tailwindlabs/tailwindcss/pull/9282))
51
100
  - Handle variants in utility selectors using `:where()` and `:has()` ([#9309](https://github.com/tailwindlabs/tailwindcss/pull/9309))
52
- - Improve data type analyses for arbitrary values ([#9320](https://github.com/tailwindlabs/tailwindcss/pull/9320))
101
+ - Improve data type analysis for arbitrary values ([#9320](https://github.com/tailwindlabs/tailwindcss/pull/9320))
53
102
  - Don't emit generated utilities with invalid uses of theme functions ([#9319](https://github.com/tailwindlabs/tailwindcss/pull/9319))
54
103
  - Revert change that only listened for stdin close on TTYs ([#9331](https://github.com/tailwindlabs/tailwindcss/pull/9331))
55
104
  - Ignore unset values (like `null` or `undefined`) when resolving the classList for intellisense ([#9385](https://github.com/tailwindlabs/tailwindcss/pull/9385))
56
- - Implement fallback plugins when arbitrary values result in css from multiple plugins ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
57
105
  - Improve type checking for formal syntax ([#9349](https://github.com/tailwindlabs/tailwindcss/pull/9349), [#9448](https://github.com/tailwindlabs/tailwindcss/pull/9448))
58
- - Don't require `content` key in custom plugin configs ([#9502](https://github.com/tailwindlabs/tailwindcss/pull/9502), [#9545](https://github.com/tailwindlabs/tailwindcss/pull/9545))
106
+ - Fix incorrect required `content` key in custom plugin configs ([#9502](https://github.com/tailwindlabs/tailwindcss/pull/9502), [#9545](https://github.com/tailwindlabs/tailwindcss/pull/9545))
59
107
  - Fix content path detection on Windows ([#9569](https://github.com/tailwindlabs/tailwindcss/pull/9569))
108
+ - Ensure `--content` is used in the CLI when passed ([#9587](https://github.com/tailwindlabs/tailwindcss/pull/9587))
60
109
 
61
110
  ## [3.1.8] - 2022-08-05
62
111
 
@@ -153,7 +202,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
153
202
  - Move `important` selector to the front when `@apply`-ing selector-modifying variants in custom utilities ([#8313](https://github.com/tailwindlabs/tailwindcss/pull/8313))
154
203
  - Error when registering an invalid custom variant ([#8345](https://github.com/tailwindlabs/tailwindcss/pull/8345))
155
204
  - Create tailwind.config.cjs file in ESM package when running init ([#8363](https://github.com/tailwindlabs/tailwindcss/pull/8363))
156
- - Fix `matchVariants` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
205
+ - Fix `matchVariant` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
157
206
  - Improve types of the `tailwindcss/plugin` ([#8400](https://github.com/tailwindlabs/tailwindcss/pull/8400))
158
207
  - Allow returning parallel variants from `addVariant` or `matchVariant` callback functions ([#8455](https://github.com/tailwindlabs/tailwindcss/pull/8455))
159
208
  - Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
@@ -2078,7 +2127,12 @@ No release notes
2078
2127
 
2079
2128
  - Everything!
2080
2129
 
2081
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...HEAD
2130
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.4...HEAD
2131
+ [3.2.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.3...v3.2.4
2132
+ [3.2.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.2...v3.2.3
2133
+ [3.2.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.1...v3.2.2
2134
+ [3.2.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.0...v3.2.1
2135
+ [3.2.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...v3.2.0
2082
2136
  [3.1.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.7...v3.1.8
2083
2137
  [3.1.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.6...v3.1.7
2084
2138
  [3.1.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.5...v3.1.6
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  <p align="center">
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">
2
+ <a href="https://tailwindcss.com" target="_blank">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-dark.svg">
5
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg">
6
+ <img alt="Tailwind CSS" src="https://raw.githubusercontent.com/tailwindlabs/tailwindcss/HEAD/.github/logo-light.svg" width="350" height="70" style="max-width: 100%;">
7
+ </picture>
7
8
  </a>
8
9
  </p>
9
10
 
@@ -25,6 +25,7 @@ const _contentJs = require("../../lib/content.js");
25
25
  const _watchingJs = require("./watching.js");
26
26
  const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
27
27
  const _findAtConfigPathJs = require("../../lib/findAtConfigPath.js");
28
+ const _log = /*#__PURE__*/ _interopRequireDefault(require("../../util/log"));
28
29
  function _interopRequireDefault(obj) {
29
30
  return obj && obj.__esModule ? obj : {
30
31
  default: obj
@@ -124,7 +125,7 @@ let state = {
124
125
  dynamic: this.contentPaths.filter((contentPath)=>contentPath.glob !== undefined).map((contentPath)=>contentPath.pattern)
125
126
  };
126
127
  },
127
- loadConfig (configPath) {
128
+ loadConfig (configPath, content) {
128
129
  if (this.watcher && configPath) {
129
130
  this.refreshConfigDependencies(configPath);
130
131
  }
@@ -135,6 +136,10 @@ let state = {
135
136
  files: []
136
137
  }
137
138
  });
139
+ // Override content files if `--content` has been passed explicitly
140
+ if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
141
+ config.content.files = content;
142
+ }
138
143
  return config;
139
144
  },
140
145
  refreshConfigDependencies (configPath) {
@@ -165,15 +170,15 @@ let state = {
165
170
  let rawContent = this.config.content.files.filter((file)=>{
166
171
  return file !== null && typeof file === "object";
167
172
  });
168
- for (let { raw: content1 , extension ="html" } of rawContent){
169
- content1.push({
170
- content: content1,
173
+ for (let { raw: htmlContent , extension ="html" } of rawContent){
174
+ content.push({
175
+ content: htmlContent,
171
176
  extension
172
177
  });
173
178
  }
174
179
  return content;
175
180
  },
176
- getContext ({ createContext , cliConfigPath , root , result }) {
181
+ getContext ({ createContext , cliConfigPath , root , result , content }) {
177
182
  if (this.context) {
178
183
  this.context.changedContent = this.changedContent.splice(0);
179
184
  return this.context;
@@ -183,7 +188,7 @@ let state = {
183
188
  let configPath = (ref = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : cliConfigPath;
184
189
  _shared.env.DEBUG && console.timeEnd("Searching for config");
185
190
  _shared.env.DEBUG && console.time("Loading config");
186
- let config = this.loadConfig(configPath);
191
+ let config = this.loadConfig(configPath, content);
187
192
  _shared.env.DEBUG && console.timeEnd("Loading config");
188
193
  _shared.env.DEBUG && console.time("Creating context");
189
194
  this.context = createContext(config, []);
@@ -208,12 +213,24 @@ let state = {
208
213
  }
209
214
  };
210
215
  async function createProcessor(args, cliConfigPath) {
216
+ var ref;
211
217
  let postcss = (0, _deps.loadPostcss)();
212
218
  let input = args["--input"];
213
219
  let output = args["--output"];
214
220
  let includePostCss = args["--postcss"];
215
221
  let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
216
222
  let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
223
+ if (args["--purge"]) {
224
+ _log.default.warn("purge-flag-deprecated", [
225
+ "The `--purge` flag has been deprecated.",
226
+ "Please use `--content` instead."
227
+ ]);
228
+ if (!args["--content"]) {
229
+ args["--content"] = args["--purge"];
230
+ }
231
+ }
232
+ var ref1;
233
+ let content = (ref1 = (ref = args["--content"]) === null || ref === void 0 ? void 0 : ref.split(/(?<!{[^}]+),/)) !== null && ref1 !== void 0 ? ref1 : [];
217
234
  let tailwindPlugin = ()=>{
218
235
  return {
219
236
  postcssPlugin: "tailwindcss",
@@ -227,7 +244,8 @@ async function createProcessor(args, cliConfigPath) {
227
244
  createContext,
228
245
  cliConfigPath,
229
246
  root,
230
- result
247
+ result,
248
+ content
231
249
  });
232
250
  };
233
251
  })(root, result);
@@ -265,6 +283,22 @@ async function createProcessor(args, cliConfigPath) {
265
283
  from: input,
266
284
  to: output
267
285
  })).then((result)=>{
286
+ if (!state.watcher) {
287
+ return result;
288
+ }
289
+ _shared.env.DEBUG && console.time("Recording PostCSS dependencies");
290
+ for (let message of result.messages){
291
+ if (message.type === "dependency") {
292
+ state.contextDependencies.add(message.file);
293
+ }
294
+ }
295
+ _shared.env.DEBUG && console.timeEnd("Recording PostCSS dependencies");
296
+ // TODO: This needs to be in a different spot
297
+ _shared.env.DEBUG && console.time("Watch new files");
298
+ state.watcher.refreshWatchedFiles();
299
+ _shared.env.DEBUG && console.timeEnd("Watch new files");
300
+ return result;
301
+ }).then((result)=>{
268
302
  if (!output) {
269
303
  process.stdout.write(result.css);
270
304
  return;
@@ -277,6 +311,17 @@ async function createProcessor(args, cliConfigPath) {
277
311
  let end = process.hrtime.bigint();
278
312
  console.error();
279
313
  console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
314
+ }).then(()=>{}, (err)=>{
315
+ // TODO: If an initial build fails we can't easily pick up any PostCSS dependencies
316
+ // that were collected before the error occurred
317
+ // The result is not stored on the error so we have to store it externally
318
+ // and pull the messages off of it here somehow
319
+ // This results in a less than ideal DX because the watcher will not pick up
320
+ // changes to imported CSS if one of them caused an error during the initial build
321
+ // If you fix it and then save the main CSS file so there's no error
322
+ // The watcher will start watching the imported CSS files and will be
323
+ // resilient to future errors.
324
+ console.error(err);
280
325
  });
281
326
  }
282
327
  /**
@@ -37,22 +37,70 @@ function createWatcher(args, { state , rebuild }) {
37
37
  pollInterval: pollInterval
38
38
  } : false
39
39
  });
40
+ // A queue of rebuilds, file reads, etc… to run
40
41
  let chain = Promise.resolve();
41
- let pendingRebuilds = new Set();
42
- let changedContent = [];
42
+ /**
43
+ * A list of files that have been changed since the last rebuild
44
+ *
45
+ * @type {{file: string, content: () => Promise<string>, extension: string}[]}
46
+ */ let changedContent = [];
47
+ /**
48
+ * A list of files for which a rebuild has already been queued.
49
+ * This is used to prevent duplicate rebuilds when multiple events are fired for the same file.
50
+ * The rebuilt file is cleared from this list when it's associated rebuild has _started_
51
+ * This is because if the file is changed during a rebuild it won't trigger a new rebuild which it should
52
+ **/ let pendingRebuilds = new Set();
53
+ let _timer;
54
+ let _reject;
55
+ /**
56
+ * Rebuilds the changed files and resolves when the rebuild is
57
+ * complete regardless of whether it was successful or not
58
+ */ async function rebuildAndContinue() {
59
+ let changes = changedContent.splice(0);
60
+ // There are no changes to rebuild so we can just do nothing
61
+ if (changes.length === 0) {
62
+ return Promise.resolve();
63
+ }
64
+ // Clear all pending rebuilds for the about-to-be-built files
65
+ changes.forEach((change)=>pendingRebuilds.delete(change.file));
66
+ // Resolve the promise even when the rebuild fails
67
+ return rebuild(changes).then(()=>{}, ()=>{});
68
+ }
43
69
  /**
44
70
  *
45
71
  * @param {*} file
46
72
  * @param {(() => Promise<string>) | null} content
47
- */ function recordChangedFile(file, content = null) {
73
+ * @param {boolean} skipPendingCheck
74
+ * @returns {Promise<void>}
75
+ */ function recordChangedFile(file, content = null, skipPendingCheck = false) {
48
76
  file = _path.default.resolve(file);
49
- content = content !== null && content !== void 0 ? content : async ()=>await _fs.default.promises.readFile(file, "utf8");
77
+ // Applications like Vim/Neovim fire both rename and change events in succession for atomic writes
78
+ // In that case rebuild has already been queued by rename, so can be skipped in change
79
+ if (pendingRebuilds.has(file) && !skipPendingCheck) {
80
+ return Promise.resolve();
81
+ }
82
+ // Mark that a rebuild of this file is going to happen
83
+ // It MUST happen synchronously before the rebuild is queued for this to be effective
84
+ pendingRebuilds.add(file);
50
85
  changedContent.push({
51
86
  file,
52
- content,
87
+ content: content !== null && content !== void 0 ? content : ()=>_fs.default.promises.readFile(file, "utf8"),
53
88
  extension: _path.default.extname(file).slice(1)
54
89
  });
55
- chain = chain.then(()=>rebuild(changedContent));
90
+ if (_timer) {
91
+ clearTimeout(_timer);
92
+ _reject();
93
+ }
94
+ // If a rebuild is already in progress we don't want to start another one until the 10ms timer has expired
95
+ chain = chain.then(()=>new Promise((resolve, reject)=>{
96
+ _timer = setTimeout(resolve, 10);
97
+ _reject = reject;
98
+ }));
99
+ // Resolves once this file has been rebuilt (or the rebuild for this file has failed)
100
+ // This queues as many rebuilds as there are changed files
101
+ // But those rebuilds happen after some delay
102
+ // And will immediately resolve if there are no changes
103
+ chain = chain.then(rebuildAndContinue, rebuildAndContinue);
56
104
  return chain;
57
105
  }
58
106
  watcher.on("change", (file)=>recordChangedFile(file));
@@ -91,15 +139,32 @@ function createWatcher(args, { state , rebuild }) {
91
139
  if (pendingRebuilds.has(filePath)) {
92
140
  return;
93
141
  }
142
+ // We'll go ahead and add the file to the pending rebuilds list here
143
+ // It'll be removed when the rebuild starts unless the read fails
144
+ // which will be taken care of as well
94
145
  pendingRebuilds.add(filePath);
95
- chain = chain.then(async ()=>{
96
- let content;
146
+ async function enqueue() {
97
147
  try {
98
- content = await (0, _utilsJs.readFileWithRetries)(_path.default.resolve(filePath));
99
- } finally{
100
- pendingRebuilds.delete(filePath);
148
+ // We need to read the file as early as possible outside of the chain
149
+ // because it may be gone by the time we get to it. doing the read
150
+ // immediately increases the chance that the file is still there
151
+ let content = await (0, _utilsJs.readFileWithRetries)(_path.default.resolve(filePath));
152
+ if (content === undefined) {
153
+ return;
154
+ }
155
+ // This will push the rebuild onto the chain
156
+ // We MUST skip the rebuild check here otherwise the rebuild will never happen on Linux
157
+ // This is because the order of events and timing is different on Linux
158
+ // @ts-ignore: TypeScript isn't picking up that content is a string here
159
+ await recordChangedFile(filePath, ()=>content, true);
160
+ } catch {
161
+ // If reading the file fails, it's was probably a deleted temporary file
162
+ // So we can ignore it and no rebuild is needed
101
163
  }
102
- return recordChangedFile(filePath, ()=>content);
164
+ }
165
+ enqueue().then(()=>{
166
+ // If the file read fails we still need to make sure the file isn't stuck in the pending rebuilds list
167
+ pendingRebuilds.delete(filePath);
103
168
  });
104
169
  });
105
170
  return {
@@ -228,12 +228,6 @@ let variantPlugins = {
228
228
  };
229
229
  for (let [name, fn] of Object.entries(variants)){
230
230
  matchVariant(name, (value = "", extra)=>{
231
- if (extra.modifier) {
232
- _log.default.warn(`modifier-${name}-experimental`, [
233
- `The ${name} variant modifier feature in Tailwind CSS is currently in preview.`,
234
- "Preview features are not covered by semver, and may be improved in breaking ways at any time."
235
- ]);
236
- }
237
231
  let result = (0, _dataTypes.normalize)(typeof value === "function" ? value(extra) : value);
238
232
  if (!result.includes("&")) result = "&" + result;
239
233
  let [a, b] = fn("", extra);
@@ -352,17 +346,17 @@ let variantPlugins = {
352
346
  return (value)=>{
353
347
  if (!areSimpleScreens) {
354
348
  _log.default.warn("complex-screen-config", [
355
- "The min and max variants are not supported with a screen configuration containing objects."
349
+ "The `min-*` and `max-*` variants are not supported with a `screens` configuration containing objects."
356
350
  ]);
357
351
  return [];
358
352
  } else if (!screensUseConsistentUnits) {
359
353
  _log.default.warn("mixed-screen-units", [
360
- "The min and max variants are not supported with a screen configuration containing mixed units."
354
+ "The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units."
361
355
  ]);
362
356
  return [];
363
357
  } else if (typeof value === "string" && !canUseUnits(value)) {
364
358
  _log.default.warn("minmax-have-mixed-units", [
365
- "The min and max variants are not supported with a screen configuration containing mixed units."
359
+ "The `min-*` and `max-*` variants are not supported with a `screens` configuration containing mixed units."
366
360
  ]);
367
361
  return [];
368
362
  }
@@ -413,29 +407,29 @@ let variantPlugins = {
413
407
  },
414
408
  ariaVariants: ({ matchVariant , theme })=>{
415
409
  var ref;
416
- matchVariant("aria", (value)=>`&[aria-${value}]`, {
410
+ matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
417
411
  values: (ref = theme("aria")) !== null && ref !== void 0 ? ref : {}
418
412
  });
419
413
  var ref1;
420
- matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${value}] &` : `:merge(.group)[aria-${value}] &`, {
414
+ matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
421
415
  values: (ref1 = theme("aria")) !== null && ref1 !== void 0 ? ref1 : {}
422
416
  });
423
417
  var ref2;
424
- matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${value}] ~ &` : `:merge(.peer)[aria-${value}] ~ &`, {
418
+ matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
425
419
  values: (ref2 = theme("aria")) !== null && ref2 !== void 0 ? ref2 : {}
426
420
  });
427
421
  },
428
422
  dataVariants: ({ matchVariant , theme })=>{
429
423
  var ref;
430
- matchVariant("data", (value)=>`&[data-${value}]`, {
424
+ matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
431
425
  values: (ref = theme("data")) !== null && ref !== void 0 ? ref : {}
432
426
  });
433
427
  var ref1;
434
- matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${value}] &` : `:merge(.group)[data-${value}] &`, {
428
+ matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
435
429
  values: (ref1 = theme("data")) !== null && ref1 !== void 0 ? ref1 : {}
436
430
  });
437
431
  var ref2;
438
- matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${value}] ~ &` : `:merge(.peer)[data-${value}] ~ &`, {
432
+ matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
439
433
  values: (ref2 = theme("data")) !== null && ref2 !== void 0 ? ref2 : {}
440
434
  });
441
435
  },
@@ -22,6 +22,7 @@
22
22
  2. Prevent adjustments of font size after orientation changes in iOS.
23
23
  3. Use a more readable tab size.
24
24
  4. Use the user's configured `sans` font-family by default.
25
+ 5. Use the user's configured `sans` font-feature-settings by default.
25
26
  */
26
27
 
27
28
  html {
@@ -30,6 +31,7 @@ html {
30
31
  -moz-tab-size: 4; /* 3 */
31
32
  tab-size: 4; /* 3 */
32
33
  font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
34
+ font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
33
35
  }
34
36
 
35
37
  /*
@@ -73,13 +73,16 @@ function parseCandidateFiles(context, tailwindConfig) {
73
73
  * @param {ContentPath} contentPath
74
74
  * @returns {ContentPath}
75
75
  */ function resolveGlobPattern(contentPath) {
76
- contentPath.pattern = contentPath.glob ? `${contentPath.base}/${contentPath.glob}` : contentPath.base;
77
- contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
78
76
  // This is required for Windows support to properly pick up Glob paths.
79
77
  // Afaik, this technically shouldn't be needed but there's probably
80
78
  // some internal, direct path matching with a normalized path in
81
79
  // a package which can't handle mixed directory separators
82
- contentPath.pattern = (0, _normalizePath.default)(contentPath.pattern);
80
+ let base = (0, _normalizePath.default)(contentPath.base);
81
+ // If the user's file path contains any special characters (like parens) for instance fast-glob
82
+ // is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
83
+ base = _fastGlob.default.escapePath(base);
84
+ contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
85
+ contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
83
86
  return contentPath;
84
87
  }
85
88
  /**
@@ -157,7 +160,14 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
157
160
  for (let file of files){
158
161
  let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
159
162
  let modified = _fs.default.statSync(file).mtimeMs;
160
- if (modified > prevModified) {
163
+ // This check is intentionally >= because we track the last modified time of context dependencies
164
+ // earier in the process and we want to make sure we don't miss any changes that happen
165
+ // when a context dependency is also a content dependency
166
+ // Ideally, we'd do all this tracking at one time but that is a larger refactor
167
+ // than we want to commit to right now, so this is a decent compromise.
168
+ // This should be sufficient because file modification times will be off by at least
169
+ // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
170
+ if (modified >= prevModified) {
161
171
  changedFiles.add(file);
162
172
  fileModifiedMap.set(file, modified);
163
173
  }
@@ -72,7 +72,7 @@ function* buildRegExps(context) {
72
72
  ])) : "";
73
73
  let utility = _regex.any([
74
74
  // Arbitrary properties
75
- /\[[^\s:'"`]+:[^\s\]]+\]/,
75
+ /\[[^\s:'"`]+:[^\s]+\]/,
76
76
  // Utilities
77
77
  _regex.pattern([
78
78
  // Utility Name / Group Name
@@ -306,21 +306,40 @@ function processApply(root, context, localCache) {
306
306
  hasReplaced = true;
307
307
  });
308
308
  });
309
- // Sort tag names before class names
309
+ // Sort tag names before class names (but only sort each group (separated by a combinator)
310
+ // separately and not in total)
310
311
  // This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
311
- for (const sel1 of replaced){
312
- sel1.sort((a, b)=>{
313
- if (a.type === "tag" && b.type === "class") {
314
- return -1;
315
- } else if (a.type === "class" && b.type === "tag") {
316
- return 1;
317
- } else if (a.type === "class" && b.type === "pseudo") {
318
- return -1;
319
- } else if (a.type === "pseudo" && b.type === "class") {
320
- return 1;
312
+ for (let sel1 of replaced){
313
+ let groups = [
314
+ []
315
+ ];
316
+ for (let node of sel1.nodes){
317
+ if (node.type === "combinator") {
318
+ groups.push(node);
319
+ groups.push([]);
320
+ } else {
321
+ let last = groups[groups.length - 1];
322
+ last.push(node);
321
323
  }
322
- return sel1.index(a) - sel1.index(b);
323
- });
324
+ }
325
+ sel1.nodes = [];
326
+ for (let group of groups){
327
+ if (Array.isArray(group)) {
328
+ group.sort((a, b)=>{
329
+ if (a.type === "tag" && b.type === "class") {
330
+ return -1;
331
+ } else if (a.type === "class" && b.type === "tag") {
332
+ return 1;
333
+ } else if (a.type === "class" && b.type === "pseudo" && b.value.startsWith("::")) {
334
+ return -1;
335
+ } else if (a.type === "pseudo" && a.value.startsWith("::") && b.type === "class") {
336
+ return 1;
337
+ }
338
+ return 0;
339
+ });
340
+ }
341
+ sel1.nodes = sel1.nodes.concat(group);
342
+ }
324
343
  }
325
344
  sel.replaceWith(...replaced);
326
345
  });
@@ -340,7 +359,7 @@ function processApply(root, context, localCache) {
340
359
  let [applyCandidates1, important] = extractApplyCandidates(apply.params);
341
360
  if (apply.parent.type === "atrule") {
342
361
  if (apply.parent.name === "screen") {
343
- const screenType = apply.parent.params;
362
+ let screenType = apply.parent.params;
344
363
  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.`);
345
364
  }
346
365
  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}.`);
@@ -364,7 +383,7 @@ function processApply(root, context, localCache) {
364
383
  ]);
365
384
  }
366
385
  }
367
- for (const [parent, [candidates1, atApplySource]] of perParentApplies){
386
+ for (let [parent, [candidates1, atApplySource]] of perParentApplies){
368
387
  let siblings = [];
369
388
  for (let [applyCandidate1, important1, rules1] of candidates1){
370
389
  let potentialApplyCandidates = [