tailwindcss 0.0.0-insiders.bc00445 → 0.0.0-insiders.bc115f0

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 (108) hide show
  1. package/CHANGELOG.md +109 -27
  2. package/README.md +7 -6
  3. package/lib/cli/build/index.js +5 -1
  4. package/lib/cli/build/plugin.js +69 -19
  5. package/lib/cli/build/watching.js +77 -12
  6. package/lib/cli/index.js +231 -10
  7. package/lib/cli/init/index.js +2 -2
  8. package/lib/cli/shared.js +2 -1
  9. package/lib/cli.js +4 -226
  10. package/lib/corePlugins.js +43 -42
  11. package/lib/css/preflight.css +2 -0
  12. package/lib/featureFlags.js +8 -8
  13. package/lib/index.js +4 -46
  14. package/lib/lib/collapseAdjacentRules.js +2 -2
  15. package/lib/lib/collapseDuplicateDeclarations.js +2 -2
  16. package/lib/lib/content.js +21 -11
  17. package/lib/lib/defaultExtractor.js +10 -5
  18. package/lib/lib/detectNesting.js +7 -1
  19. package/lib/lib/evaluateTailwindFunctions.js +4 -4
  20. package/lib/lib/expandApplyAtRules.js +36 -17
  21. package/lib/lib/expandTailwindAtRules.js +38 -10
  22. package/lib/lib/findAtConfigPath.js +7 -7
  23. package/lib/lib/generateRules.js +110 -49
  24. package/lib/lib/offsets.js +83 -1
  25. package/lib/lib/remap-bitfield.js +87 -0
  26. package/lib/lib/resolveDefaultsAtRules.js +4 -4
  27. package/lib/lib/setupContextUtils.js +121 -77
  28. package/lib/lib/setupTrackingContext.js +25 -4
  29. package/lib/lib/sharedState.js +4 -1
  30. package/lib/oxide/cli/build/deps.js +81 -0
  31. package/lib/oxide/cli/build/index.js +47 -0
  32. package/lib/oxide/cli/build/plugin.js +364 -0
  33. package/lib/oxide/cli/build/utils.js +77 -0
  34. package/lib/oxide/cli/build/watching.js +177 -0
  35. package/lib/oxide/cli/help/index.js +70 -0
  36. package/lib/oxide/cli/index.js +220 -0
  37. package/lib/oxide/cli/init/index.js +35 -0
  38. package/lib/oxide/cli/shared.js +12 -0
  39. package/lib/oxide/cli.js +5 -0
  40. package/lib/oxide/postcss-plugin.js +2 -0
  41. package/lib/plugin.js +48 -0
  42. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  43. package/lib/util/cloneNodes.js +2 -2
  44. package/lib/util/color.js +4 -4
  45. package/lib/util/createUtilityPlugin.js +2 -2
  46. package/lib/util/dataTypes.js +29 -2
  47. package/lib/util/defaults.js +4 -4
  48. package/lib/util/escapeClassName.js +3 -3
  49. package/lib/util/formatVariantSelector.js +172 -106
  50. package/lib/util/getAllConfigs.js +2 -2
  51. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +2 -2
  52. package/lib/util/negateValue.js +2 -2
  53. package/lib/util/normalizeConfig.js +36 -22
  54. package/lib/util/pluginUtils.js +66 -47
  55. package/lib/util/prefixSelector.js +22 -8
  56. package/lib/util/resolveConfig.js +11 -16
  57. package/oxide-node-api-shim/index.js +21 -0
  58. package/oxide-node-api-shim/package.json +5 -0
  59. package/package.json +37 -23
  60. package/peers/index.js +693 -619
  61. package/resolveConfig.d.ts +11 -2
  62. package/scripts/release-channel.js +18 -0
  63. package/scripts/release-notes.js +21 -0
  64. package/src/cli/build/index.js +6 -2
  65. package/src/cli/build/plugin.js +81 -14
  66. package/src/cli/build/watching.js +105 -12
  67. package/src/cli/index.js +234 -3
  68. package/src/cli/shared.js +1 -0
  69. package/src/cli.js +4 -220
  70. package/src/corePlugins.js +29 -23
  71. package/src/css/preflight.css +2 -0
  72. package/src/index.js +4 -46
  73. package/src/lib/content.js +19 -16
  74. package/src/lib/defaultExtractor.js +9 -3
  75. package/src/lib/detectNesting.js +9 -1
  76. package/src/lib/expandApplyAtRules.js +35 -15
  77. package/src/lib/expandTailwindAtRules.js +40 -6
  78. package/src/lib/findAtConfigPath.js +4 -6
  79. package/src/lib/generateRules.js +105 -35
  80. package/src/lib/offsets.js +98 -1
  81. package/src/lib/remap-bitfield.js +82 -0
  82. package/src/lib/setupContextUtils.js +112 -60
  83. package/src/lib/setupTrackingContext.js +31 -6
  84. package/src/lib/sharedState.js +3 -0
  85. package/src/oxide/cli/build/deps.ts +91 -0
  86. package/src/oxide/cli/build/index.ts +47 -0
  87. package/src/oxide/cli/build/plugin.ts +436 -0
  88. package/src/oxide/cli/build/utils.ts +74 -0
  89. package/src/oxide/cli/build/watching.ts +225 -0
  90. package/src/oxide/cli/help/index.ts +69 -0
  91. package/src/oxide/cli/index.ts +212 -0
  92. package/src/oxide/cli/init/index.ts +32 -0
  93. package/src/oxide/cli/shared.ts +4 -0
  94. package/src/oxide/cli.ts +1 -0
  95. package/src/oxide/postcss-plugin.ts +1 -0
  96. package/src/plugin.js +47 -0
  97. package/src/util/dataTypes.js +33 -4
  98. package/src/util/formatVariantSelector.js +216 -123
  99. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  100. package/src/util/negateValue.js +1 -1
  101. package/src/util/normalizeConfig.js +18 -0
  102. package/src/util/pluginUtils.js +60 -26
  103. package/src/util/prefixSelector.js +28 -10
  104. package/src/util/resolveConfig.js +3 -9
  105. package/stubs/defaultConfig.stub.js +150 -164
  106. package/types/config.d.ts +8 -2
  107. package/types/generated/default-theme.d.ts +82 -79
  108. package/scripts/calculate-tag-name.js +0 -8
package/CHANGELOG.md CHANGED
@@ -9,54 +9,131 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Added
11
11
 
12
+ - Add `line-height` modifier support to `font-size` utilities ([#9875](https://github.com/tailwindlabs/tailwindcss/pull/9875))
13
+ - Support using variables as arbitrary values without `var(...)` ([#9880](https://github.com/tailwindlabs/tailwindcss/pull/9880), [#9962](https://github.com/tailwindlabs/tailwindcss/pull/9962))
14
+ - Add `--watch=always` option to prevent exit when stdin closes ([#9966](https://github.com/tailwindlabs/tailwindcss/pull/9966))
15
+ - Add standalone CLI build for 64-bit Windows on ARM (`node16-win-arm64`) ([#10001](https://github.com/tailwindlabs/tailwindcss/pull/10001))
16
+ - Add `delay-0` and `duration-0` by default ([#10294](https://github.com/tailwindlabs/tailwindcss/pull/10294))
17
+
18
+ ### Fixed
19
+
20
+ - Cleanup unused `variantOrder` ([#9829](https://github.com/tailwindlabs/tailwindcss/pull/9829))
21
+ - Fix `foo-[abc]/[def]` not being handled correctly ([#9866](https://github.com/tailwindlabs/tailwindcss/pull/9866))
22
+ - Add container queries plugin to standalone CLI ([#9865](https://github.com/tailwindlabs/tailwindcss/pull/9865))
23
+ - Support renaming of output files by `PostCSS` plugin. ([#9944](https://github.com/tailwindlabs/tailwindcss/pull/9944))
24
+ - Improve return value of `resolveConfig`, unwrap `ResolvableTo` ([#9972](https://github.com/tailwindlabs/tailwindcss/pull/9972))
25
+ - Clip unbalanced brackets in arbitrary values ([#9973](https://github.com/tailwindlabs/tailwindcss/pull/9973))
26
+ - Don’t reorder webkit scrollbar pseudo elements ([#9991](https://github.com/tailwindlabs/tailwindcss/pull/9991))
27
+ - Deterministic sorting of arbitrary variants ([#10016](https://github.com/tailwindlabs/tailwindcss/pull/10016))
28
+ - Add `data` key to theme types ([#10023](https://github.com/tailwindlabs/tailwindcss/pull/10023))
29
+ - Prevent invalid arbitrary variant selectors from failing the build ([#10059](https://github.com/tailwindlabs/tailwindcss/pull/10059))
30
+ - Properly handle subtraction followed by a variable ([#10074](https://github.com/tailwindlabs/tailwindcss/pull/10074))
31
+ - Fix missing `string[]` in the `theme.dropShadow` types ([#10072](https://github.com/tailwindlabs/tailwindcss/pull/10072))
32
+ - Update list of length units ([#10100](https://github.com/tailwindlabs/tailwindcss/pull/10100))
33
+ - Fix not matching arbitrary properties when closely followed by square brackets ([#10212](https://github.com/tailwindlabs/tailwindcss/pull/10212))
34
+ - Allow direct nesting in `root` or `@layer` nodes ([#10229](https://github.com/tailwindlabs/tailwindcss/pull/10229))
35
+ - Don't prefix classes in arbitrary variants ([#10214](https://github.com/tailwindlabs/tailwindcss/pull/10214))
36
+ - Fix perf regression when checking for changed content ([#10234](https://github.com/tailwindlabs/tailwindcss/pull/10234))
37
+ - Fix missing `blocklist` member in the `Config` type ([#10239](https://github.com/tailwindlabs/tailwindcss/pull/10239))
38
+ - Escape group names in selectors ([#10276](https://github.com/tailwindlabs/tailwindcss/pull/10276))
39
+ - Consider earlier variants before sorting functions ([#10288](https://github.com/tailwindlabs/tailwindcss/pull/10288))
40
+
41
+ ### Changed
42
+
43
+ - Alphabetize `theme` keys in default config ([#9953](https://github.com/tailwindlabs/tailwindcss/pull/9953))
44
+ - Update esbuild to v16 ([#10178](https://github.com/tailwindlabs/tailwindcss/pull/10178))
45
+
46
+ ## [3.2.4] - 2022-11-11
47
+
48
+ ### Added
49
+
50
+ - Add `blocklist` option to prevent generating unwanted CSS ([#9812](https://github.com/tailwindlabs/tailwindcss/pull/9812))
51
+
52
+ ### Fixed
53
+
54
+ - Fix watching of files on Linux when renames are involved ([#9796](https://github.com/tailwindlabs/tailwindcss/pull/9796))
55
+ - Make sure errors are always displayed when watching for changes ([#9810](https://github.com/tailwindlabs/tailwindcss/pull/9810))
56
+
57
+ ## [3.2.3] - 2022-11-09
58
+
59
+ ### Fixed
60
+
61
+ - Fixed use of `raw` content in the CLI ([#9773](https://github.com/tailwindlabs/tailwindcss/pull/9773))
62
+ - Pick up changes from files that are both context and content deps ([#9787](https://github.com/tailwindlabs/tailwindcss/pull/9787))
63
+ - Sort pseudo-elements ONLY after classes when using variants and `@apply` ([#9765](https://github.com/tailwindlabs/tailwindcss/pull/9765))
64
+ - Support important utilities in the safelist (pattern must include a `!`) ([#9791](https://github.com/tailwindlabs/tailwindcss/pull/9791))
65
+
66
+ ## [3.2.2] - 2022-11-04
67
+
68
+ ### Fixed
69
+
70
+ - Escape special characters in resolved content base paths ([#9650](https://github.com/tailwindlabs/tailwindcss/pull/9650))
71
+ - Don't reuse container for array returning variant functions ([#9644](https://github.com/tailwindlabs/tailwindcss/pull/9644))
72
+ - Exclude non-relevant selectors when generating rules with the important modifier ([#9677](https://github.com/tailwindlabs/tailwindcss/issues/9677))
73
+ - Fix merging of arrays during config resolution ([#9706](https://github.com/tailwindlabs/tailwindcss/issues/9706))
74
+ - Ensure configured `font-feature-settings` are included in Preflight ([#9707](https://github.com/tailwindlabs/tailwindcss/pull/9707))
75
+ - Fix fractional values not being parsed properly inside arbitrary properties ([#9705](https://github.com/tailwindlabs/tailwindcss/pull/9705))
76
+ - Fix incorrect selectors when using `@apply` in selectors with combinators and pseudos ([#9722](https://github.com/tailwindlabs/tailwindcss/pull/9722))
77
+ - Fix cannot read properties of undefined (reading 'modifier') ([#9656](https://github.com/tailwindlabs/tailwindcss/pull/9656), [aa979d6](https://github.com/tailwindlabs/tailwindcss/commit/aa979d645f8bf4108c5fc938d7c0ba085b654c31))
78
+
79
+ ## [3.2.1] - 2022-10-21
80
+
81
+ ### Fixed
82
+
83
+ - Fix missing `supports` in types ([#9616](https://github.com/tailwindlabs/tailwindcss/pull/9616))
84
+ - Fix missing PostCSS dependencies in the CLI ([#9617](https://github.com/tailwindlabs/tailwindcss/pull/9617))
85
+ - Ensure `micromatch` is a proper CLI dependency ([#9620](https://github.com/tailwindlabs/tailwindcss/pull/9620))
86
+ - Ensure modifier values exist when using a `modifiers` object for `matchVariant` ([ba6551db0f2726461371b4f3c6cd4c7090888504](https://github.com/tailwindlabs/tailwindcss/commit/ba6551db0f2726461371b4f3c6cd4c7090888504))
87
+
88
+ ## [3.2.0] - 2022-10-19
89
+
90
+ ### Added
91
+
92
+ - Add new `@config` directive ([#9405](https://github.com/tailwindlabs/tailwindcss/pull/9405))
93
+ - Add new `relative: true` option to resolve content paths relative to the config file ([#9396](https://github.com/tailwindlabs/tailwindcss/pull/9396))
94
+ - Add new `supports-*` variant ([#9453](https://github.com/tailwindlabs/tailwindcss/pull/9453))
95
+ - Add new `min-*` and `max-*` variants ([#9558](https://github.com/tailwindlabs/tailwindcss/pull/9558))
96
+ - Add new `aria-*` variants ([#9557](https://github.com/tailwindlabs/tailwindcss/pull/9557), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
97
+ - Add new `data-*` variants ([#9559](https://github.com/tailwindlabs/tailwindcss/pull/9559), [#9588](https://github.com/tailwindlabs/tailwindcss/pull/9588))
12
98
  - Add new `break-keep` utility for `word-break: keep-all` ([#9393](https://github.com/tailwindlabs/tailwindcss/pull/9393))
99
+ - Add new `collapse` utility for `visibility: collapse` ([#9181](https://github.com/tailwindlabs/tailwindcss/pull/9181))
100
+ - Add new `fill-none` utility for `fill: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
101
+ - Add new `stroke-none` utility for `stroke: none` ([#9403](https://github.com/tailwindlabs/tailwindcss/pull/9403))
102
+ - Add new `place-content-baseline` utility for `place-content: baseline` ([#9498](https://github.com/tailwindlabs/tailwindcss/pull/9498))
103
+ - Add new `place-items-baseline` utility for `place-items: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
104
+ - Add new `content-baseline` utility for `align-content: baseline` ([#9507](https://github.com/tailwindlabs/tailwindcss/pull/9507))
13
105
  - 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))
106
+ - Add standalone CLI build for 32-bit Linux on ARM (`node16-linux-armv7`) ([#9084](https://github.com/tailwindlabs/tailwindcss/pull/9084))
15
107
  - Add future flag to disable color opacity utility plugins ([#9088](https://github.com/tailwindlabs/tailwindcss/pull/9088))
16
108
  - 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
109
  - 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))
110
+ - Allow negating utilities using `min`/`max`/`clamp` ([#9237](https://github.com/tailwindlabs/tailwindcss/pull/9237))
111
+ - Implement fallback plugins when there is ambiguity between plugins when using arbitrary values ([#9376](https://github.com/tailwindlabs/tailwindcss/pull/9376))
112
+ - Support `sort` function in `matchVariant` ([#9423](https://github.com/tailwindlabs/tailwindcss/pull/9423))
34
113
  - 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
114
 
37
115
  ### Fixed
38
116
 
39
117
  - Use absolute paths when resolving changed files for resilience against working directory changes ([#9032](https://github.com/tailwindlabs/tailwindcss/pull/9032))
40
118
  - 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))
119
+ - Sort tags before classes when `@apply`-ing a selector with joined classes ([#9107](https://github.com/tailwindlabs/tailwindcss/pull/9107))
42
120
  - Remove invalid `outline-hidden` utility ([#9147](https://github.com/tailwindlabs/tailwindcss/pull/9147))
43
121
  - Honor the `hidden` attribute on elements in preflight ([#9174](https://github.com/tailwindlabs/tailwindcss/pull/9174))
44
122
  - 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))
123
+ - Fix duplicate utilities issue causing memory leaks ([#9208](https://github.com/tailwindlabs/tailwindcss/pull/9208))
47
124
  - Fix `fontFamily` config TypeScript types ([#9214](https://github.com/tailwindlabs/tailwindcss/pull/9214))
48
125
  - 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))
126
+ - Fix shared config mutation issue ([#9294](https://github.com/tailwindlabs/tailwindcss/pull/9294))
50
127
  - Fix ordering of parallel variants ([#9282](https://github.com/tailwindlabs/tailwindcss/pull/9282))
51
128
  - 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))
129
+ - Improve data type analysis for arbitrary values ([#9320](https://github.com/tailwindlabs/tailwindcss/pull/9320))
53
130
  - Don't emit generated utilities with invalid uses of theme functions ([#9319](https://github.com/tailwindlabs/tailwindcss/pull/9319))
54
131
  - Revert change that only listened for stdin close on TTYs ([#9331](https://github.com/tailwindlabs/tailwindcss/pull/9331))
55
132
  - 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
133
  - 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))
134
+ - 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
135
  - Fix content path detection on Windows ([#9569](https://github.com/tailwindlabs/tailwindcss/pull/9569))
136
+ - Ensure `--content` is used in the CLI when passed ([#9587](https://github.com/tailwindlabs/tailwindcss/pull/9587))
60
137
 
61
138
  ## [3.1.8] - 2022-08-05
62
139
 
@@ -153,7 +230,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
153
230
  - Move `important` selector to the front when `@apply`-ing selector-modifying variants in custom utilities ([#8313](https://github.com/tailwindlabs/tailwindcss/pull/8313))
154
231
  - Error when registering an invalid custom variant ([#8345](https://github.com/tailwindlabs/tailwindcss/pull/8345))
155
232
  - 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))
233
+ - Fix `matchVariant` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
157
234
  - Improve types of the `tailwindcss/plugin` ([#8400](https://github.com/tailwindlabs/tailwindcss/pull/8400))
158
235
  - Allow returning parallel variants from `addVariant` or `matchVariant` callback functions ([#8455](https://github.com/tailwindlabs/tailwindcss/pull/8455))
159
236
  - Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
@@ -2078,7 +2155,12 @@ No release notes
2078
2155
 
2079
2156
  - Everything!
2080
2157
 
2081
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...HEAD
2158
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.4...HEAD
2159
+ [3.2.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.3...v3.2.4
2160
+ [3.2.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.2...v3.2.3
2161
+ [3.2.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.1...v3.2.2
2162
+ [3.2.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.2.0...v3.2.1
2163
+ [3.2.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...v3.2.0
2082
2164
  [3.1.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.7...v3.1.8
2083
2165
  [3.1.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.6...v3.1.7
2084
2166
  [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
 
@@ -13,7 +14,7 @@
13
14
 
14
15
 
15
16
  <p align="center">
16
- <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>
17
+ <a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/nodejs.yml?branch=master" alt="Build Status"></a>
17
18
  <a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
18
19
  <a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
19
20
  <a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
@@ -35,7 +35,11 @@ async function build(args, configs) {
35
35
  let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
36
36
  let processor = await (0, _pluginJs.createProcessor)(args, configPath);
37
37
  if (shouldWatch) {
38
- /* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0));
38
+ // Abort the watcher if stdin is closed to avoid zombie processes
39
+ // You can disable this behavior with --watch=always
40
+ if (args["--watch"] !== "always") {
41
+ process.stdin.on("end", ()=>process.exit(0));
42
+ }
39
43
  process.stdin.resume();
40
44
  await processor.watch();
41
45
  } else {
@@ -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
@@ -112,8 +113,8 @@ let state = {
112
113
  contextDependencies: new Set(),
113
114
  /** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
114
115
  refreshContentPaths () {
115
- var ref;
116
- this.contentPaths = (0, _contentJs.parseCandidateFiles)(this.context, (ref = this.context) === null || ref === void 0 ? void 0 : ref.tailwindConfig);
116
+ var _this_context;
117
+ this.contentPaths = (0, _contentJs.parseCandidateFiles)(this.context, (_this_context = this.context) === null || _this_context === void 0 ? void 0 : _this_context.tailwindConfig);
117
118
  },
118
119
  get config () {
119
120
  return this.context.tailwindConfig;
@@ -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) {
@@ -156,34 +161,41 @@ let state = {
156
161
  // TODO: When we make the postcss plugin async-capable this can become async
157
162
  let files = _fastGlob.default.sync(this.contentPatterns.all);
158
163
  for (let file of files){
159
- content.push({
160
- content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
161
- extension: _path.default.extname(file).slice(1)
162
- });
164
+ if (_shared.env.OXIDE) {
165
+ content.push({
166
+ file,
167
+ extension: _path.default.extname(file).slice(1)
168
+ });
169
+ } else {
170
+ content.push({
171
+ content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
172
+ extension: _path.default.extname(file).slice(1)
173
+ });
174
+ }
163
175
  }
164
176
  // Resolve raw content in the tailwind config
165
177
  let rawContent = this.config.content.files.filter((file)=>{
166
178
  return file !== null && typeof file === "object";
167
179
  });
168
- for (let { raw: content1 , extension ="html" } of rawContent){
169
- content1.push({
170
- content: content1,
180
+ for (let { raw: htmlContent , extension ="html" } of rawContent){
181
+ content.push({
182
+ content: htmlContent,
171
183
  extension
172
184
  });
173
185
  }
174
186
  return content;
175
187
  },
176
- getContext ({ createContext , cliConfigPath , root , result }) {
188
+ getContext ({ createContext , cliConfigPath , root , result , content }) {
177
189
  if (this.context) {
178
190
  this.context.changedContent = this.changedContent.splice(0);
179
191
  return this.context;
180
192
  }
181
193
  _shared.env.DEBUG && console.time("Searching for config");
182
- var ref;
183
- let configPath = (ref = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : cliConfigPath;
194
+ var _findAtConfigPath;
195
+ let configPath = (_findAtConfigPath = (0, _findAtConfigPathJs.findAtConfigPath)(root, result)) !== null && _findAtConfigPath !== void 0 ? _findAtConfigPath : cliConfigPath;
184
196
  _shared.env.DEBUG && console.timeEnd("Searching for config");
185
197
  _shared.env.DEBUG && console.time("Loading config");
186
- let config = this.loadConfig(configPath);
198
+ let config = this.loadConfig(configPath, content);
187
199
  _shared.env.DEBUG && console.timeEnd("Loading config");
188
200
  _shared.env.DEBUG && console.time("Creating context");
189
201
  this.context = createContext(config, []);
@@ -199,21 +211,31 @@ let state = {
199
211
  this.watcher.refreshWatchedFiles();
200
212
  _shared.env.DEBUG && console.timeEnd("Watch new files");
201
213
  }
202
- _shared.env.DEBUG && console.time("Reading content files");
203
214
  for (let file of this.readContentPaths()){
204
215
  this.context.changedContent.push(file);
205
216
  }
206
- _shared.env.DEBUG && console.timeEnd("Reading content files");
207
217
  return this.context;
208
218
  }
209
219
  };
210
220
  async function createProcessor(args, cliConfigPath) {
221
+ var _args_content;
211
222
  let postcss = (0, _deps.loadPostcss)();
212
223
  let input = args["--input"];
213
224
  let output = args["--output"];
214
225
  let includePostCss = args["--postcss"];
215
226
  let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
216
227
  let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
228
+ if (args["--purge"]) {
229
+ _log.default.warn("purge-flag-deprecated", [
230
+ "The `--purge` flag has been deprecated.",
231
+ "Please use `--content` instead."
232
+ ]);
233
+ if (!args["--content"]) {
234
+ args["--content"] = args["--purge"];
235
+ }
236
+ }
237
+ var _args_content_split;
238
+ let content = (_args_content_split = (_args_content = args["--content"]) === null || _args_content === void 0 ? void 0 : _args_content.split(/(?<!{[^}]+),/)) !== null && _args_content_split !== void 0 ? _args_content_split : [];
217
239
  let tailwindPlugin = ()=>{
218
240
  return {
219
241
  postcssPlugin: "tailwindcss",
@@ -227,7 +249,8 @@ async function createProcessor(args, cliConfigPath) {
227
249
  createContext,
228
250
  cliConfigPath,
229
251
  root,
230
- result
252
+ result,
253
+ content
231
254
  });
232
255
  };
233
256
  })(root, result);
@@ -265,18 +288,45 @@ async function createProcessor(args, cliConfigPath) {
265
288
  from: input,
266
289
  to: output
267
290
  })).then((result)=>{
291
+ if (!state.watcher) {
292
+ return result;
293
+ }
294
+ _shared.env.DEBUG && console.time("Recording PostCSS dependencies");
295
+ for (let message of result.messages){
296
+ if (message.type === "dependency") {
297
+ state.contextDependencies.add(message.file);
298
+ }
299
+ }
300
+ _shared.env.DEBUG && console.timeEnd("Recording PostCSS dependencies");
301
+ // TODO: This needs to be in a different spot
302
+ _shared.env.DEBUG && console.time("Watch new files");
303
+ state.watcher.refreshWatchedFiles();
304
+ _shared.env.DEBUG && console.timeEnd("Watch new files");
305
+ return result;
306
+ }).then((result)=>{
268
307
  if (!output) {
269
308
  process.stdout.write(result.css);
270
309
  return;
271
310
  }
272
311
  return Promise.all([
273
- (0, _utils.outputFile)(output, result.css),
274
- result.map && (0, _utils.outputFile)(output + ".map", result.map.toString())
312
+ (0, _utils.outputFile)(result.opts.to, result.css),
313
+ result.map && (0, _utils.outputFile)(result.opts.to + ".map", result.map.toString())
275
314
  ]);
276
315
  }).then(()=>{
277
316
  let end = process.hrtime.bigint();
278
317
  console.error();
279
318
  console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
319
+ }).then(()=>{}, (err)=>{
320
+ // TODO: If an initial build fails we can't easily pick up any PostCSS dependencies
321
+ // that were collected before the error occurred
322
+ // The result is not stored on the error so we have to store it externally
323
+ // and pull the messages off of it here somehow
324
+ // This results in a less than ideal DX because the watcher will not pick up
325
+ // changes to imported CSS if one of them caused an error during the initial build
326
+ // If you fix it and then save the main CSS file so there's no error
327
+ // The watcher will start watching the imported CSS files and will be
328
+ // resilient to future errors.
329
+ console.error(err);
280
330
  });
281
331
  }
282
332
  /**
@@ -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 {