tailwindcss 0.0.0-insiders.d33b650 → 0.0.0-insiders.d3f2221

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 (191) hide show
  1. package/README.md +1 -1
  2. package/index.css +5 -0
  3. package/lib/cli/build/index.js +32 -19
  4. package/lib/cli/build/plugin.js +228 -148
  5. package/lib/cli/build/utils.js +31 -21
  6. package/lib/cli/build/watching.js +99 -30
  7. package/lib/cli/help/index.js +17 -15
  8. package/lib/cli/index.js +223 -10
  9. package/lib/cli/init/index.js +31 -14
  10. package/lib/cli.js +1 -227
  11. package/lib/corePluginList.js +8 -1
  12. package/lib/corePlugins.js +2128 -1823
  13. package/lib/css/preflight.css +17 -4
  14. package/lib/featureFlags.js +39 -25
  15. package/lib/index.js +1 -47
  16. package/lib/lib/cacheInvalidation.js +10 -8
  17. package/lib/lib/collapseAdjacentRules.js +10 -8
  18. package/lib/lib/collapseDuplicateDeclarations.js +13 -11
  19. package/lib/lib/content.js +65 -28
  20. package/lib/lib/defaultExtractor.js +24 -32
  21. package/lib/lib/detectNesting.js +18 -10
  22. package/lib/lib/evaluateTailwindFunctions.js +45 -41
  23. package/lib/lib/expandApplyAtRules.js +60 -52
  24. package/lib/lib/expandTailwindAtRules.js +115 -47
  25. package/lib/lib/findAtConfigPath.js +14 -12
  26. package/lib/lib/generateRules.js +206 -146
  27. package/lib/lib/getModuleDependencies.js +85 -37
  28. package/lib/lib/handleImportAtRules.js +50 -0
  29. package/lib/lib/load-config.js +42 -0
  30. package/lib/lib/normalizeTailwindDirectives.js +26 -39
  31. package/lib/lib/offsets.js +136 -47
  32. package/lib/lib/partitionApplyAtRules.js +5 -3
  33. package/lib/lib/regex.js +26 -12
  34. package/lib/lib/remap-bitfield.js +89 -0
  35. package/lib/lib/resolveDefaultsAtRules.js +53 -49
  36. package/lib/lib/setupContextUtils.js +337 -250
  37. package/lib/lib/setupTrackingContext.js +54 -29
  38. package/lib/lib/sharedState.js +36 -17
  39. package/lib/lib/substituteScreenAtRules.js +9 -7
  40. package/lib/plugin.js +164 -0
  41. package/lib/postcss-plugins/nesting/index.js +5 -3
  42. package/lib/postcss-plugins/nesting/plugin.js +19 -17
  43. package/lib/processTailwindFeatures.js +19 -17
  44. package/lib/public/colors.js +269 -245
  45. package/lib/public/create-plugin.js +5 -3
  46. package/lib/public/default-config.js +6 -4
  47. package/lib/public/default-theme.js +6 -4
  48. package/lib/public/load-config.js +12 -0
  49. package/lib/public/resolve-config.js +6 -4
  50. package/lib/util/applyImportantSelector.js +36 -0
  51. package/lib/util/bigSign.js +3 -1
  52. package/lib/util/buildMediaQuery.js +5 -3
  53. package/lib/util/cloneDeep.js +4 -2
  54. package/lib/util/cloneNodes.js +6 -4
  55. package/lib/util/color.js +46 -28
  56. package/lib/util/colorNames.js +752 -0
  57. package/lib/util/configurePlugins.js +3 -1
  58. package/lib/util/createPlugin.js +3 -1
  59. package/lib/util/createUtilityPlugin.js +9 -7
  60. package/lib/util/dataTypes.js +215 -96
  61. package/lib/util/defaults.js +9 -7
  62. package/lib/util/escapeClassName.js +10 -8
  63. package/lib/util/escapeCommas.js +4 -2
  64. package/lib/util/flattenColorPalette.js +5 -3
  65. package/lib/util/formatVariantSelector.js +149 -169
  66. package/lib/util/getAllConfigs.js +12 -9
  67. package/lib/util/hashConfig.js +6 -4
  68. package/lib/util/isKeyframeRule.js +4 -2
  69. package/lib/util/isPlainObject.js +4 -2
  70. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +14 -12
  71. package/lib/util/log.js +31 -10
  72. package/lib/util/nameClass.js +16 -10
  73. package/lib/util/negateValue.js +12 -10
  74. package/lib/util/normalizeConfig.js +123 -77
  75. package/lib/util/normalizeScreens.js +30 -22
  76. package/lib/util/parseAnimationValue.js +41 -39
  77. package/lib/util/parseBoxShadowValue.js +24 -20
  78. package/lib/util/parseDependency.js +7 -5
  79. package/lib/util/parseGlob.js +10 -8
  80. package/lib/util/parseObjectStyles.js +10 -8
  81. package/lib/util/pluginUtils.js +92 -96
  82. package/lib/util/prefixSelector.js +27 -11
  83. package/lib/util/pseudoElements.js +209 -0
  84. package/lib/util/removeAlphaVariables.js +4 -2
  85. package/lib/util/resolveConfig.js +28 -24
  86. package/lib/util/resolveConfigPath.js +28 -12
  87. package/lib/util/responsive.js +7 -5
  88. package/lib/util/splitAtTopLevelOnly.js +12 -4
  89. package/lib/util/tap.js +3 -1
  90. package/lib/util/toColorValue.js +4 -2
  91. package/lib/util/toPath.js +5 -3
  92. package/lib/util/transformThemeValue.js +30 -28
  93. package/lib/util/validateConfig.js +31 -7
  94. package/lib/util/validateFormalSyntax.js +8 -6
  95. package/lib/util/withAlphaVariable.js +11 -7
  96. package/lib/value-parser/LICENSE +22 -0
  97. package/lib/value-parser/README.md +3 -0
  98. package/lib/value-parser/index.d.js +2 -0
  99. package/lib/value-parser/index.js +22 -0
  100. package/lib/value-parser/parse.js +259 -0
  101. package/lib/value-parser/stringify.js +38 -0
  102. package/lib/value-parser/unit.js +86 -0
  103. package/lib/value-parser/walk.js +16 -0
  104. package/loadConfig.d.ts +4 -0
  105. package/loadConfig.js +2 -0
  106. package/package.json +49 -50
  107. package/resolveConfig.d.ts +11 -2
  108. package/scripts/release-notes.js +1 -1
  109. package/src/cli/build/index.js +17 -9
  110. package/src/cli/build/plugin.js +129 -77
  111. package/src/cli/build/watching.js +108 -13
  112. package/src/cli/index.js +217 -3
  113. package/src/cli/init/index.js +37 -8
  114. package/src/cli.js +1 -221
  115. package/src/corePluginList.js +1 -1
  116. package/src/corePlugins.js +259 -46
  117. package/src/css/preflight.css +17 -4
  118. package/src/featureFlags.js +7 -7
  119. package/src/index.js +1 -47
  120. package/src/lib/content.js +44 -10
  121. package/src/lib/defaultExtractor.js +10 -14
  122. package/src/lib/detectNesting.js +9 -1
  123. package/src/lib/evaluateTailwindFunctions.js +4 -1
  124. package/src/lib/expandApplyAtRules.js +10 -3
  125. package/src/lib/expandTailwindAtRules.js +78 -13
  126. package/src/lib/generateRules.js +140 -65
  127. package/src/lib/getModuleDependencies.js +70 -30
  128. package/src/lib/handleImportAtRules.js +34 -0
  129. package/src/lib/load-config.ts +31 -0
  130. package/src/lib/normalizeTailwindDirectives.js +0 -27
  131. package/src/lib/offsets.js +105 -2
  132. package/src/lib/remap-bitfield.js +82 -0
  133. package/src/lib/setupContextUtils.js +145 -80
  134. package/src/lib/setupTrackingContext.js +37 -14
  135. package/src/lib/sharedState.js +11 -4
  136. package/src/plugin.js +133 -0
  137. package/src/processTailwindFeatures.js +3 -2
  138. package/src/public/colors.js +22 -0
  139. package/src/public/default-config.js +1 -1
  140. package/src/public/default-theme.js +2 -2
  141. package/src/public/load-config.js +2 -0
  142. package/src/util/applyImportantSelector.js +27 -0
  143. package/src/util/color.js +19 -4
  144. package/src/util/colorNames.js +150 -0
  145. package/src/util/dataTypes.js +97 -9
  146. package/src/util/formatVariantSelector.js +163 -165
  147. package/src/util/getAllConfigs.js +2 -2
  148. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  149. package/src/util/log.js +24 -0
  150. package/src/util/negateValue.js +1 -1
  151. package/src/util/normalizeConfig.js +57 -11
  152. package/src/util/pluginUtils.js +38 -54
  153. package/src/util/prefixSelector.js +29 -10
  154. package/src/util/pseudoElements.js +167 -0
  155. package/src/util/resolveConfig.js +0 -2
  156. package/src/util/resolveConfigPath.js +12 -1
  157. package/src/util/splitAtTopLevelOnly.js +8 -1
  158. package/src/util/validateConfig.js +23 -0
  159. package/src/value-parser/LICENSE +22 -0
  160. package/src/value-parser/README.md +3 -0
  161. package/src/value-parser/index.d.ts +177 -0
  162. package/src/value-parser/index.js +28 -0
  163. package/src/value-parser/parse.js +303 -0
  164. package/src/value-parser/stringify.js +41 -0
  165. package/src/value-parser/unit.js +118 -0
  166. package/src/value-parser/walk.js +18 -0
  167. package/stubs/.gitignore +1 -0
  168. package/stubs/.prettierrc.json +6 -0
  169. package/stubs/{defaultConfig.stub.js → config.full.js} +203 -172
  170. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
  171. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  172. package/stubs/postcss.config.js +5 -0
  173. package/stubs/tailwind.config.cjs +2 -0
  174. package/stubs/tailwind.config.js +2 -0
  175. package/stubs/tailwind.config.ts +3 -0
  176. package/types/config.d.ts +20 -13
  177. package/types/generated/colors.d.ts +22 -0
  178. package/types/generated/corePluginList.d.ts +1 -1
  179. package/types/generated/default-theme.d.ts +116 -80
  180. package/CHANGELOG.md +0 -2300
  181. package/lib/cli/build/deps.js +0 -54
  182. package/lib/cli/shared.js +0 -12
  183. package/lib/cli-peer-dependencies.js +0 -28
  184. package/lib/constants.js +0 -44
  185. package/peers/index.js +0 -79459
  186. package/scripts/install-integrations.js +0 -27
  187. package/scripts/rebuildFixtures.js +0 -68
  188. package/src/cli/build/deps.js +0 -56
  189. package/src/cli/shared.js +0 -5
  190. package/src/cli-peer-dependencies.js +0 -15
  191. package/src/constants.js +0 -17
@@ -23,15 +23,18 @@
23
23
  3. Use a more readable tab size.
24
24
  4. Use the user's configured `sans` font-family by default.
25
25
  5. Use the user's configured `sans` font-feature-settings by default.
26
+ 6. Use the user's configured `sans` font-variation-settings by default.
26
27
  */
27
28
 
28
- html {
29
+ html,
30
+ :host {
29
31
  line-height: 1.5; /* 1 */
30
32
  -webkit-text-size-adjust: 100%; /* 2 */
31
33
  -moz-tab-size: 4; /* 3 */
32
34
  tab-size: 4; /* 3 */
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 */
35
+ font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
34
36
  font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
37
+ font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
35
38
  }
36
39
 
37
40
  /*
@@ -161,6 +164,8 @@ optgroup,
161
164
  select,
162
165
  textarea {
163
166
  font-family: inherit; /* 1 */
167
+ font-feature-settings: inherit; /* 1 */
168
+ font-variation-settings: inherit; /* 1 */
164
169
  font-size: 100%; /* 1 */
165
170
  font-weight: inherit; /* 1 */
166
171
  line-height: inherit; /* 1 */
@@ -262,7 +267,7 @@ summary {
262
267
  }
263
268
 
264
269
  /*
265
- Removes the default spacing and border for appropriate elements.
270
+ Removes the default spacing for appropriate elements.
266
271
  */
267
272
 
268
273
  blockquote,
@@ -298,6 +303,10 @@ menu {
298
303
  padding: 0;
299
304
  }
300
305
 
306
+ dialog {
307
+ padding: 0;
308
+ }
309
+
301
310
  /*
302
311
  Prevent resizing textareas horizontally by default.
303
312
  */
@@ -329,6 +338,7 @@ button,
329
338
  /*
330
339
  Make sure disabled buttons don't get the pointer cursor.
331
340
  */
341
+
332
342
  :disabled {
333
343
  cursor: default;
334
344
  }
@@ -361,7 +371,10 @@ video {
361
371
  height: auto;
362
372
  }
363
373
 
364
- /* Make elements with the HTML hidden attribute stay hidden by default */
374
+ /*
375
+ Make elements with the HTML hidden attribute stay hidden by default.
376
+ */
377
+
365
378
  [hidden] {
366
379
  display: none;
367
380
  }
@@ -9,62 +9,76 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- flagEnabled: ()=>flagEnabled,
13
- issueFlagNotices: ()=>issueFlagNotices,
14
- default: ()=>_default
12
+ featureFlags: function() {
13
+ return featureFlags;
14
+ },
15
+ flagEnabled: function() {
16
+ return flagEnabled;
17
+ },
18
+ issueFlagNotices: function() {
19
+ return issueFlagNotices;
20
+ },
21
+ default: function() {
22
+ return _default;
23
+ }
15
24
  });
16
- const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
17
- const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
18
- function _interopRequireDefault(obj) {
25
+ const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
26
+ const _log = /*#__PURE__*/ _interop_require_default(require("./util/log"));
27
+ function _interop_require_default(obj) {
19
28
  return obj && obj.__esModule ? obj : {
20
29
  default: obj
21
30
  };
22
31
  }
23
32
  let defaults = {
24
33
  optimizeUniversalDefaults: false,
25
- generalizedModifiers: true
34
+ disableColorOpacityUtilitiesByDefault: false,
35
+ relativeContentPathsByDefault: false,
36
+ oxideParser: true,
37
+ logicalSiblingUtilities: false
26
38
  };
27
39
  let featureFlags = {
28
40
  future: [
29
- "hoverOnlyWhenSupported",
30
- "respectDefaultRingColorOpacity",
31
- "disableColorOpacityUtilitiesByDefault",
32
- "relativeContentPathsByDefault"
41
+ 'hoverOnlyWhenSupported',
42
+ 'respectDefaultRingColorOpacity',
43
+ 'disableColorOpacityUtilitiesByDefault',
44
+ 'relativeContentPathsByDefault',
45
+ 'logicalSiblingUtilities'
33
46
  ],
34
47
  experimental: [
35
- "optimizeUniversalDefaults",
36
- "generalizedModifiers"
48
+ 'optimizeUniversalDefaults',
49
+ 'oxideParser'
37
50
  ]
38
51
  };
39
52
  function flagEnabled(config, flag) {
40
53
  if (featureFlags.future.includes(flag)) {
41
- var ref;
42
- var ref1, ref2;
43
- return config.future === "all" || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
54
+ var _config_future, _config;
55
+ var _config_future_flag, _ref;
56
+ return config.future === 'all' || ((_ref = (_config_future_flag = (_config = config) === null || _config === void 0 ? void 0 : (_config_future = _config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
44
57
  }
45
58
  if (featureFlags.experimental.includes(flag)) {
46
- var ref3;
47
- var ref4, ref5;
48
- return config.experimental === "all" || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
59
+ var _config_experimental, _config1;
60
+ var _config_experimental_flag, _ref1;
61
+ return config.experimental === 'all' || ((_ref1 = (_config_experimental_flag = (_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_experimental = _config1.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
49
62
  }
50
63
  return false;
51
64
  }
52
65
  function experimentalFlagsEnabled(config) {
53
- if (config.experimental === "all") {
66
+ var _config;
67
+ if (config.experimental === 'all') {
54
68
  return featureFlags.experimental;
55
69
  }
56
- var ref;
57
- return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
70
+ var _config_experimental;
71
+ return Object.keys((_config_experimental = (_config = config) === null || _config === void 0 ? void 0 : _config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
58
72
  }
59
73
  function issueFlagNotices(config) {
60
74
  if (process.env.JEST_WORKER_ID !== undefined) {
61
75
  return;
62
76
  }
63
77
  if (experimentalFlagsEnabled(config).length > 0) {
64
- let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
65
- _log.default.warn("experimental-flags-enabled", [
78
+ let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(', ');
79
+ _log.default.warn('experimental-flags-enabled', [
66
80
  `You have enabled experimental features: ${changes}`,
67
- "Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
81
+ 'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.'
68
82
  ]);
69
83
  }
70
84
  }
package/lib/index.js CHANGED
@@ -1,48 +1,2 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
6
- const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
7
- const _sharedState = require("./lib/sharedState");
8
- const _findAtConfigPath = require("./lib/findAtConfigPath");
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
12
- };
13
- }
14
- module.exports = function tailwindcss(configOrPath) {
15
- return {
16
- postcssPlugin: "tailwindcss",
17
- plugins: [
18
- _sharedState.env.DEBUG && function(root) {
19
- console.log("\n");
20
- console.time("JIT TOTAL");
21
- return root;
22
- },
23
- function(root, result) {
24
- var ref;
25
- // Use the path for the `@config` directive if it exists, otherwise use the
26
- // path for the file being processed
27
- configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
28
- let context = (0, _setupTrackingContext.default)(configOrPath);
29
- if (root.type === "document") {
30
- let roots = root.nodes.filter((node)=>node.type === "root");
31
- for (const root1 of roots){
32
- if (root1.type === "root") {
33
- (0, _processTailwindFeatures.default)(context)(root1, result);
34
- }
35
- }
36
- return;
37
- }
38
- (0, _processTailwindFeatures.default)(context)(root, result);
39
- },
40
- _sharedState.env.DEBUG && function(root) {
41
- console.timeEnd("JIT TOTAL");
42
- console.log("\n");
43
- return root;
44
- }
45
- ].filter(Boolean)
46
- };
47
- };
48
- module.exports.postcss = true;
2
+ module.exports = require('./plugin');
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "hasContentChanged", {
6
6
  enumerable: true,
7
- get: ()=>hasContentChanged
7
+ get: function() {
8
+ return hasContentChanged;
9
+ }
8
10
  });
9
- const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
10
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
11
- function _interopRequireDefault(obj) {
11
+ const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
12
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
13
+ function _interop_require_default(obj) {
12
14
  return obj && obj.__esModule ? obj : {
13
15
  default: obj
14
16
  };
@@ -21,7 +23,7 @@ function _getRequireWildcardCache(nodeInterop) {
21
23
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
22
24
  })(nodeInterop);
23
25
  }
24
- function _interopRequireWildcard(obj, nodeInterop) {
26
+ function _interop_require_wildcard(obj, nodeInterop) {
25
27
  if (!nodeInterop && obj && obj.__esModule) {
26
28
  return obj;
27
29
  }
@@ -70,16 +72,16 @@ function _interopRequireWildcard(obj, nodeInterop) {
70
72
  * @param {string} str
71
73
  */ function getHash(str) {
72
74
  try {
73
- return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
75
+ return _crypto.default.createHash('md5').update(str, 'utf-8').digest('binary');
74
76
  } catch (err) {
75
- return "";
77
+ return '';
76
78
  }
77
79
  }
78
80
  function hasContentChanged(sourcePath, root) {
79
81
  let css = root.toString();
80
82
  // We only care about files with @tailwind directives
81
83
  // Other files use an existing context
82
- if (!css.includes("@tailwind")) {
84
+ if (!css.includes('@tailwind')) {
83
85
  return false;
84
86
  }
85
87
  let existingHash = _sharedState.sourceHashMap.get(sourcePath);
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>collapseAdjacentRules
7
+ get: function() {
8
+ return collapseAdjacentRules;
9
+ }
8
10
  });
9
11
  let comparisonMap = {
10
12
  atrule: [
11
- "name",
12
- "params"
13
+ 'name',
14
+ 'params'
13
15
  ],
14
16
  rule: [
15
- "selector"
17
+ 'selector'
16
18
  ]
17
19
  };
18
20
  let types = new Set(Object.keys(comparisonMap));
@@ -29,10 +31,10 @@ function collapseAdjacentRules() {
29
31
  return;
30
32
  }
31
33
  let properties = comparisonMap[node.type];
32
- var _property, _property1;
33
- if (node.type === "atrule" && node.name === "font-face") {
34
+ var _node_property, _currentRule_property;
35
+ if (node.type === 'atrule' && node.name === 'font-face') {
34
36
  currentRule = node;
35
- } else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " "))) {
37
+ } else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property : '').replace(/\s+/g, ' ') === ((_currentRule_property = currentRule[property]) !== null && _currentRule_property !== void 0 ? _currentRule_property : '').replace(/\s+/g, ' '))) {
36
38
  // An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
37
39
  if (node.nodes) {
38
40
  currentRule.append(node.nodes);
@@ -48,7 +50,7 @@ function collapseAdjacentRules() {
48
50
  // explicitly does not handle rule nesting on its own as
49
51
  // the user is expected to use a nesting plugin
50
52
  root.each((node)=>{
51
- if (node.type === "atrule") {
53
+ if (node.type === 'atrule') {
52
54
  collapseRulesIn(node);
53
55
  }
54
56
  });
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>collapseDuplicateDeclarations
7
+ get: function() {
8
+ return collapseDuplicateDeclarations;
9
+ }
8
10
  });
9
11
  function collapseDuplicateDeclarations() {
10
12
  return (root)=>{
@@ -51,33 +53,33 @@ function collapseDuplicateDeclarations() {
51
53
  // with the same unit but the last one in the list.
52
54
  for (let declarations of byProperty.values()){
53
55
  let byUnit = new Map();
54
- for (let decl1 of declarations){
55
- let unit = resolveUnit(decl1.value);
56
+ for (let decl of declarations){
57
+ let unit = resolveUnit(decl.value);
56
58
  if (unit === null) {
57
59
  continue;
58
60
  }
59
61
  if (!byUnit.has(unit)) {
60
62
  byUnit.set(unit, new Set());
61
63
  }
62
- byUnit.get(unit).add(decl1);
64
+ byUnit.get(unit).add(decl);
63
65
  }
64
- for (let declarations1 of byUnit.values()){
66
+ for (let declarations of byUnit.values()){
65
67
  // Get all but the last one
66
- let removableDeclarations = Array.from(declarations1).slice(0, -1);
67
- for (let decl2 of removableDeclarations){
68
- decl2.remove();
68
+ let removableDeclarations = Array.from(declarations).slice(0, -1);
69
+ for (let decl of removableDeclarations){
70
+ decl.remove();
69
71
  }
70
72
  }
71
73
  }
72
74
  });
73
75
  };
74
76
  }
75
- let UNITLESS_NUMBER = Symbol("unitless-number");
77
+ let UNITLESS_NUMBER = Symbol('unitless-number');
76
78
  function resolveUnit(input) {
77
79
  let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
78
80
  if (result) {
79
- var ref;
80
- return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
81
+ var _result_;
82
+ return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
81
83
  }
82
84
  return null;
83
85
  }
@@ -10,28 +10,58 @@ function _export(target, all) {
10
10
  });
11
11
  }
12
12
  _export(exports, {
13
- parseCandidateFiles: ()=>parseCandidateFiles,
14
- resolvedChangedContent: ()=>resolvedChangedContent
13
+ parseCandidateFiles: function() {
14
+ return parseCandidateFiles;
15
+ },
16
+ resolvedChangedContent: function() {
17
+ return resolvedChangedContent;
18
+ }
15
19
  });
16
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
17
- const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
18
- const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
19
- const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
20
- const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
20
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
21
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
22
+ const _isglob = /*#__PURE__*/ _interop_require_default(require("is-glob"));
23
+ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
24
+ const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
21
25
  const _parseGlob = require("../util/parseGlob");
22
26
  const _sharedState = require("./sharedState");
23
- function _interopRequireDefault(obj) {
27
+ const _oxide = require("@tailwindcss/oxide");
28
+ function _interop_require_default(obj) {
24
29
  return obj && obj.__esModule ? obj : {
25
30
  default: obj
26
31
  };
27
32
  }
33
+ /** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ /*
34
+ * @param {import('tailwindcss').Config} tailwindConfig
35
+ * @param {{skip:string[]}} options
36
+ * @returns {ContentPath[]}
37
+ */ function resolveContentFiles(tailwindConfig, { skip = [] } = {}) {
38
+ if (Array.isArray(tailwindConfig.content.files) && tailwindConfig.content.files.includes('auto')) {
39
+ let idx = tailwindConfig.content.files.indexOf('auto');
40
+ if (idx !== -1) {
41
+ _sharedState.env.DEBUG && console.time('Calculating resolve content paths');
42
+ let resolved = (0, _oxide.resolveContentPaths)({
43
+ base: process.cwd()
44
+ });
45
+ _sharedState.env.DEBUG && console.timeEnd('Calculating resolve content paths');
46
+ tailwindConfig.content.files.splice(idx, 1, ...resolved);
47
+ }
48
+ }
49
+ if (skip.length > 0) {
50
+ tailwindConfig.content.files = tailwindConfig.content.files.filter((filePath)=>!skip.includes(filePath));
51
+ }
52
+ return tailwindConfig.content.files;
53
+ }
28
54
  function parseCandidateFiles(context, tailwindConfig) {
29
- let files = tailwindConfig.content.files;
55
+ let files = resolveContentFiles(tailwindConfig, {
56
+ skip: [
57
+ context.userConfigPath
58
+ ]
59
+ });
30
60
  // Normalize the file globs
31
- files = files.filter((filePath)=>typeof filePath === "string");
32
- files = files.map(_normalizePath.default);
61
+ files = files.filter((filePath)=>typeof filePath === 'string');
62
+ files = files.map(_normalizepath.default);
33
63
  // Split into included and excluded globs
34
- let tasks = _fastGlob.default.generateTasks(files);
64
+ let tasks = _fastglob.default.generateTasks(files);
35
65
  /** @type {ContentPath[]} */ let included = [];
36
66
  /** @type {ContentPath[]} */ let excluded = [];
37
67
  for (const task of tasks){
@@ -63,7 +93,7 @@ function parseCandidateFiles(context, tailwindConfig) {
63
93
  pattern: filePath,
64
94
  glob: null
65
95
  };
66
- if ((0, _isGlob.default)(filePath)) {
96
+ if ((0, _isglob.default)(filePath)) {
67
97
  Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
68
98
  }
69
99
  return contentPath;
@@ -77,10 +107,10 @@ function parseCandidateFiles(context, tailwindConfig) {
77
107
  // Afaik, this technically shouldn't be needed but there's probably
78
108
  // some internal, direct path matching with a normalized path in
79
109
  // a package which can't handle mixed directory separators
80
- let base = (0, _normalizePath.default)(contentPath.base);
110
+ let base = (0, _normalizepath.default)(contentPath.base);
81
111
  // If the user's file path contains any special characters (like parens) for instance fast-glob
82
112
  // 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);
113
+ base = _fastglob.default.escapePath(base);
84
114
  contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
85
115
  contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
86
116
  return contentPath;
@@ -125,46 +155,53 @@ function parseCandidateFiles(context, tailwindConfig) {
125
155
  base: resolvedPath
126
156
  });
127
157
  }
128
- } catch {
158
+ } catch (e) {
129
159
  // TODO: log this?
130
160
  }
131
161
  return paths;
132
162
  }
133
163
  function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
134
- let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
164
+ let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string').map(({ raw, extension = 'html' })=>({
135
165
  content: raw,
136
166
  extension
137
167
  }));
138
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
139
- let content = _fs.default.readFileSync(changedFile, "utf8");
168
+ let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
169
+ for (let changedFile of changedFiles){
140
170
  let extension = _path.default.extname(changedFile).slice(1);
141
171
  changedContent.push({
142
- content,
172
+ file: changedFile,
143
173
  extension
144
174
  });
145
175
  }
146
- return changedContent;
176
+ return [
177
+ changedContent,
178
+ mTimesToCommit
179
+ ];
147
180
  }
148
181
  /**
149
182
  *
150
183
  * @param {ContentPath[]} candidateFiles
151
184
  * @param {Map<string, number>} fileModifiedMap
152
- * @returns {Set<string>}
185
+ * @returns {[Set<string>, Map<string, number>]}
153
186
  */ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
154
187
  let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
188
+ let mTimesToCommit = new Map();
155
189
  let changedFiles = new Set();
156
- _sharedState.env.DEBUG && console.time("Finding changed files");
157
- let files = _fastGlob.default.sync(paths, {
190
+ _sharedState.env.DEBUG && console.time('Finding changed files');
191
+ let files = _fastglob.default.sync(paths, {
158
192
  absolute: true
159
193
  });
160
194
  for (let file of files){
161
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
195
+ let prevModified = fileModifiedMap.get(file) || -Infinity;
162
196
  let modified = _fs.default.statSync(file).mtimeMs;
163
197
  if (modified > prevModified) {
164
198
  changedFiles.add(file);
165
- fileModifiedMap.set(file, modified);
199
+ mTimesToCommit.set(file, modified);
166
200
  }
167
201
  }
168
- _sharedState.env.DEBUG && console.timeEnd("Finding changed files");
169
- return changedFiles;
202
+ _sharedState.env.DEBUG && console.timeEnd('Finding changed files');
203
+ return [
204
+ changedFiles,
205
+ mTimesToCommit
206
+ ];
170
207
  }
@@ -4,10 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "defaultExtractor", {
6
6
  enumerable: true,
7
- get: ()=>defaultExtractor
7
+ get: function() {
8
+ return defaultExtractor;
9
+ }
8
10
  });
9
- const _featureFlags = require("../featureFlags");
10
- const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
11
+ const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
11
12
  function _getRequireWildcardCache(nodeInterop) {
12
13
  if (typeof WeakMap !== "function") return null;
13
14
  var cacheBabelInterop = new WeakMap();
@@ -16,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) {
16
17
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
18
  })(nodeInterop);
18
19
  }
19
- function _interopRequireWildcard(obj, nodeInterop) {
20
+ function _interop_require_wildcard(obj, nodeInterop) {
20
21
  if (!nodeInterop && obj && obj.__esModule) {
21
22
  return obj;
22
23
  }
@@ -54,10 +55,10 @@ function defaultExtractor(context) {
54
55
  */ return (content)=>{
55
56
  /** @type {(string|string)[]} */ let results = [];
56
57
  for (let pattern of patterns){
57
- var ref;
58
+ var _content_match;
58
59
  results = [
59
60
  ...results,
60
- ...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
61
+ ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
61
62
  ];
62
63
  }
63
64
  return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
@@ -65,14 +66,18 @@ function defaultExtractor(context) {
65
66
  }
66
67
  function* buildRegExps(context) {
67
68
  let separator = context.tailwindConfig.separator;
68
- let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping");
69
- let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
69
+ let prefix = context.tailwindConfig.prefix !== '' ? _regex.optional(_regex.pattern([
70
70
  /-?/,
71
71
  _regex.escape(context.tailwindConfig.prefix)
72
- ])) : "";
72
+ ])) : '';
73
73
  let utility = _regex.any([
74
- // Arbitrary properties
75
- /\[[^\s:'"`]+:[^\s]+\]/,
74
+ // Arbitrary properties (without square brackets)
75
+ /\[[^\s:'"`]+:[^\s\[\]]+\]/,
76
+ // Arbitrary properties with balanced square brackets
77
+ // This is a targeted fix to continue to allow theme()
78
+ // with square brackets to work in arbitrary properties
79
+ // while fixing a problem with the regex matching too much
80
+ /\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
76
81
  // Utilities
77
82
  _regex.pattern([
78
83
  // Utility Name / Group Name
@@ -132,26 +137,13 @@ function* buildRegExps(context) {
132
137
  for (const variantPattern of variantPatterns){
133
138
  yield _regex.pattern([
134
139
  // Variants
135
- "((?=((",
140
+ '((?=((',
136
141
  variantPattern,
137
- ")+))\\2)?",
142
+ ')+))\\2)?',
138
143
  // Important (optional)
139
144
  /!?/,
140
145
  prefix,
141
- variantGroupingEnabled ? _regex.any([
142
- // Or any of those things but grouped separated by commas
143
- _regex.pattern([
144
- /\(/,
145
- utility,
146
- _regex.zeroOrMore([
147
- /,/,
148
- utility
149
- ]),
150
- /\)/
151
- ]),
152
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
153
- utility
154
- ]) : utility
146
+ utility
155
147
  ]);
156
148
  }
157
149
  // 5. Inner matches
@@ -176,7 +168,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
176
168
  * @param {string} input
177
169
  */ function clipAtBalancedParens(input) {
178
170
  // We are care about this for arbitrary values
179
- if (!input.includes("-[")) {
171
+ if (!input.includes('-[')) {
180
172
  return input;
181
173
  }
182
174
  let depth = 0;
@@ -200,15 +192,15 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
200
192
  let inStringType = openStringTypes[openStringTypes.length - 1];
201
193
  if (char === inStringType) {
202
194
  openStringTypes.pop();
203
- } else if (char === "'" || char === '"' || char === "`") {
195
+ } else if (char === "'" || char === '"' || char === '`') {
204
196
  openStringTypes.push(char);
205
197
  }
206
198
  if (inStringType) {
207
199
  continue;
208
- } else if (char === "[") {
200
+ } else if (char === '[') {
209
201
  depth++;
210
202
  continue;
211
- } else if (char === "]") {
203
+ } else if (char === ']') {
212
204
  depth--;
213
205
  continue;
214
206
  }
@@ -216,7 +208,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
216
208
  // This means that there was an extra closing `]`
217
209
  // We'll clip to just before it
218
210
  if (depth < 0) {
219
- return input.substring(0, match.index);
211
+ return input.substring(0, match.index - 1);
220
212
  }
221
213
  // We've finished balancing the brackets but there still may be characters that can be included
222
214
  // For example in the class `text-[#336699]/[.35]`