tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea3d9cd

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 (187) hide show
  1. package/README.md +1 -1
  2. package/index.css +5 -0
  3. package/lib/cli/build/index.js +23 -10
  4. package/lib/cli/build/plugin.js +136 -117
  5. package/lib/cli/build/utils.js +18 -8
  6. package/lib/cli/build/watching.js +16 -12
  7. package/lib/cli/help/index.js +6 -4
  8. package/lib/cli/index.js +223 -10
  9. package/lib/cli/init/index.js +29 -12
  10. package/lib/cli.js +1 -227
  11. package/lib/corePluginList.js +8 -1
  12. package/lib/corePlugins.js +374 -77
  13. package/lib/css/preflight.css +9 -1
  14. package/lib/featureFlags.js +30 -17
  15. package/lib/index.js +1 -47
  16. package/lib/lib/cacheInvalidation.js +7 -5
  17. package/lib/lib/collapseAdjacentRules.js +5 -3
  18. package/lib/lib/collapseDuplicateDeclarations.js +12 -10
  19. package/lib/lib/content.js +61 -31
  20. package/lib/lib/defaultExtractor.js +15 -8
  21. package/lib/lib/detectNesting.js +10 -2
  22. package/lib/lib/evaluateTailwindFunctions.js +24 -20
  23. package/lib/lib/expandApplyAtRules.js +43 -35
  24. package/lib/lib/expandTailwindAtRules.js +89 -22
  25. package/lib/lib/findAtConfigPath.js +9 -7
  26. package/lib/lib/generateRules.js +160 -98
  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 +5 -18
  31. package/lib/lib/offsets.js +93 -4
  32. package/lib/lib/partitionApplyAtRules.js +3 -1
  33. package/lib/lib/regex.js +21 -7
  34. package/lib/lib/remap-bitfield.js +89 -0
  35. package/lib/lib/resolveDefaultsAtRules.js +28 -24
  36. package/lib/lib/setupContextUtils.js +191 -142
  37. package/lib/lib/setupTrackingContext.js +50 -26
  38. package/lib/lib/sharedState.js +28 -9
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/plugin.js +116 -0
  41. package/lib/postcss-plugins/nesting/index.js +3 -1
  42. package/lib/postcss-plugins/nesting/plugin.js +10 -8
  43. package/lib/processTailwindFeatures.js +14 -12
  44. package/lib/public/colors.js +49 -25
  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 +3 -1
  53. package/lib/util/cloneDeep.js +3 -1
  54. package/lib/util/cloneNodes.js +5 -3
  55. package/lib/util/color.js +30 -12
  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 +7 -5
  60. package/lib/util/dataTypes.js +88 -23
  61. package/lib/util/defaults.js +9 -7
  62. package/lib/util/escapeClassName.js +10 -8
  63. package/lib/util/escapeCommas.js +3 -1
  64. package/lib/util/flattenColorPalette.js +3 -1
  65. package/lib/util/formatVariantSelector.js +138 -160
  66. package/lib/util/getAllConfigs.js +8 -6
  67. package/lib/util/hashConfig.js +6 -4
  68. package/lib/util/isKeyframeRule.js +3 -1
  69. package/lib/util/isPlainObject.js +3 -1
  70. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  71. package/lib/util/log.js +25 -4
  72. package/lib/util/nameClass.js +12 -6
  73. package/lib/util/negateValue.js +4 -2
  74. package/lib/util/normalizeConfig.js +63 -36
  75. package/lib/util/normalizeScreens.js +12 -4
  76. package/lib/util/parseAnimationValue.js +3 -1
  77. package/lib/util/parseBoxShadowValue.js +6 -2
  78. package/lib/util/parseDependency.js +3 -1
  79. package/lib/util/parseGlob.js +6 -4
  80. package/lib/util/parseObjectStyles.js +9 -7
  81. package/lib/util/pluginUtils.js +53 -55
  82. package/lib/util/prefixSelector.js +27 -11
  83. package/lib/util/pseudoElements.js +209 -0
  84. package/lib/util/removeAlphaVariables.js +3 -1
  85. package/lib/util/resolveConfig.js +17 -15
  86. package/lib/util/resolveConfigPath.js +26 -10
  87. package/lib/util/responsive.js +6 -4
  88. package/lib/util/splitAtTopLevelOnly.js +10 -2
  89. package/lib/util/tap.js +3 -1
  90. package/lib/util/toColorValue.js +3 -1
  91. package/lib/util/toPath.js +3 -1
  92. package/lib/util/transformThemeValue.js +6 -4
  93. package/lib/util/validateConfig.js +27 -3
  94. package/lib/util/validateFormalSyntax.js +3 -1
  95. package/lib/util/withAlphaVariable.js +6 -2
  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 +46 -45
  107. package/resolveConfig.d.ts +11 -2
  108. package/src/cli/build/index.js +17 -9
  109. package/src/cli/build/plugin.js +96 -73
  110. package/src/cli/build/watching.js +4 -2
  111. package/src/cli/index.js +217 -3
  112. package/src/cli/init/index.js +37 -8
  113. package/src/cli.js +1 -221
  114. package/src/corePluginList.js +1 -1
  115. package/src/corePlugins.js +237 -34
  116. package/src/css/preflight.css +9 -1
  117. package/src/featureFlags.js +7 -3
  118. package/src/index.js +1 -47
  119. package/src/lib/content.js +45 -18
  120. package/src/lib/defaultExtractor.js +9 -3
  121. package/src/lib/detectNesting.js +9 -1
  122. package/src/lib/evaluateTailwindFunctions.js +4 -1
  123. package/src/lib/expandApplyAtRules.js +8 -1
  124. package/src/lib/expandTailwindAtRules.js +73 -12
  125. package/src/lib/generateRules.js +127 -49
  126. package/src/lib/getModuleDependencies.js +70 -30
  127. package/src/lib/handleImportAtRules.js +34 -0
  128. package/src/lib/load-config.ts +31 -0
  129. package/src/lib/normalizeTailwindDirectives.js +0 -27
  130. package/src/lib/offsets.js +104 -1
  131. package/src/lib/remap-bitfield.js +82 -0
  132. package/src/lib/setupContextUtils.js +109 -69
  133. package/src/lib/setupTrackingContext.js +37 -14
  134. package/src/lib/sharedState.js +11 -4
  135. package/src/plugin.js +124 -0
  136. package/src/public/colors.js +22 -0
  137. package/src/public/default-config.js +1 -1
  138. package/src/public/default-theme.js +2 -2
  139. package/src/public/load-config.js +2 -0
  140. package/src/util/applyImportantSelector.js +27 -0
  141. package/src/util/color.js +18 -3
  142. package/src/util/colorNames.js +150 -0
  143. package/src/util/dataTypes.js +49 -9
  144. package/src/util/formatVariantSelector.js +160 -163
  145. package/src/util/getAllConfigs.js +2 -2
  146. package/src/util/log.js +24 -0
  147. package/src/util/negateValue.js +1 -1
  148. package/src/util/normalizeConfig.js +39 -11
  149. package/src/util/pluginUtils.js +16 -35
  150. package/src/util/prefixSelector.js +28 -10
  151. package/src/util/pseudoElements.js +167 -0
  152. package/src/util/resolveConfigPath.js +12 -1
  153. package/src/util/splitAtTopLevelOnly.js +8 -1
  154. package/src/util/validateConfig.js +23 -0
  155. package/src/value-parser/LICENSE +22 -0
  156. package/src/value-parser/README.md +3 -0
  157. package/src/value-parser/index.d.ts +177 -0
  158. package/src/value-parser/index.js +28 -0
  159. package/src/value-parser/parse.js +303 -0
  160. package/src/value-parser/stringify.js +41 -0
  161. package/src/value-parser/unit.js +118 -0
  162. package/src/value-parser/walk.js +18 -0
  163. package/stubs/.gitignore +1 -0
  164. package/stubs/.prettierrc.json +6 -0
  165. package/stubs/{defaultConfig.stub.js → config.full.js} +197 -147
  166. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
  167. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  168. package/stubs/postcss.config.js +5 -0
  169. package/stubs/tailwind.config.cjs +2 -0
  170. package/stubs/tailwind.config.js +2 -0
  171. package/stubs/tailwind.config.ts +3 -0
  172. package/types/config.d.ts +17 -10
  173. package/types/generated/colors.d.ts +22 -0
  174. package/types/generated/corePluginList.d.ts +1 -1
  175. package/types/generated/default-theme.d.ts +110 -80
  176. package/CHANGELOG.md +0 -2336
  177. package/lib/cli/build/deps.js +0 -54
  178. package/lib/cli/shared.js +0 -12
  179. package/lib/cli-peer-dependencies.js +0 -28
  180. package/lib/constants.js +0 -44
  181. package/peers/index.js +0 -79512
  182. package/scripts/install-integrations.js +0 -27
  183. package/scripts/rebuildFixtures.js +0 -68
  184. package/src/cli/build/deps.js +0 -56
  185. package/src/cli/shared.js +0 -5
  186. package/src/cli-peer-dependencies.js +0 -15
  187. package/src/constants.js +0 -17
@@ -23,6 +23,7 @@
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
29
  html {
@@ -32,6 +33,7 @@ html {
32
33
  tab-size: 4; /* 3 */
33
34
  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
35
  font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
36
+ font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
35
37
  }
36
38
 
37
39
  /*
@@ -161,6 +163,8 @@ optgroup,
161
163
  select,
162
164
  textarea {
163
165
  font-family: inherit; /* 1 */
166
+ font-feature-settings: inherit; /* 1 */
167
+ font-variation-settings: inherit; /* 1 */
164
168
  font-size: 100%; /* 1 */
165
169
  font-weight: inherit; /* 1 */
166
170
  line-height: inherit; /* 1 */
@@ -262,7 +266,7 @@ summary {
262
266
  }
263
267
 
264
268
  /*
265
- Removes the default spacing and border for appropriate elements.
269
+ Removes the default spacing for appropriate elements.
266
270
  */
267
271
 
268
272
  blockquote,
@@ -298,6 +302,10 @@ menu {
298
302
  padding: 0;
299
303
  }
300
304
 
305
+ dialog {
306
+ padding: 0;
307
+ }
308
+
301
309
  /*
302
310
  Prevent resizing textareas horizontally by default.
303
311
  */
@@ -9,43 +9,56 @@ 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
41
  "hoverOnlyWhenSupported",
30
42
  "respectDefaultRingColorOpacity",
31
43
  "disableColorOpacityUtilitiesByDefault",
32
- "relativeContentPathsByDefault"
44
+ "relativeContentPathsByDefault",
45
+ "logicalSiblingUtilities"
33
46
  ],
34
47
  experimental: [
35
48
  "optimizeUniversalDefaults",
36
- "generalizedModifiers"
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;
55
+ var _config_future_flag, _ref;
56
+ return config.future === "all" || ((_ref = (_config_future_flag = 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;
60
+ var _config_experimental_flag, _ref1;
61
+ return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.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
  }
@@ -53,8 +66,8 @@ function experimentalFlagsEnabled(config) {
53
66
  if (config.experimental === "all") {
54
67
  return featureFlags.experimental;
55
68
  }
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]);
69
+ var _config_experimental;
70
+ return Object.keys((_config_experimental = 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
71
  }
59
72
  function issueFlagNotices(config) {
60
73
  if (process.env.JEST_WORKER_ID !== undefined) {
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
  }
@@ -4,7 +4,9 @@ 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: [
@@ -29,10 +31,10 @@ function collapseAdjacentRules() {
29
31
  return;
30
32
  }
31
33
  let properties = comparisonMap[node.type];
32
- var _property, _property1;
34
+ var _node_property, _currentRule_property;
33
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);
@@ -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,21 +53,21 @@ 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
  }
@@ -76,8 +78,8 @@ 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
61
  files = files.filter((filePath)=>typeof filePath === "string");
32
- files = files.map(_normalizePath.default);
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;
@@ -135,43 +165,43 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
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
190
  _sharedState.env.DEBUG && console.time("Finding changed files");
157
- let files = _fastGlob.default.sync(paths, {
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
- // 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) {
197
+ if (modified > prevModified) {
171
198
  changedFiles.add(file);
172
- fileModifiedMap.set(file, modified);
199
+ mTimesToCommit.set(file, modified);
173
200
  }
174
201
  }
175
202
  _sharedState.env.DEBUG && console.timeEnd("Finding changed files");
176
- return changedFiles;
203
+ return [
204
+ changedFiles,
205
+ mTimesToCommit
206
+ ];
177
207
  }
@@ -4,10 +4,12 @@ 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
11
  const _featureFlags = require("../featureFlags");
10
- const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
12
+ const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
11
13
  function _getRequireWildcardCache(nodeInterop) {
12
14
  if (typeof WeakMap !== "function") return null;
13
15
  var cacheBabelInterop = new WeakMap();
@@ -16,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) {
16
18
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
19
  })(nodeInterop);
18
20
  }
19
- function _interopRequireWildcard(obj, nodeInterop) {
21
+ function _interop_require_wildcard(obj, nodeInterop) {
20
22
  if (!nodeInterop && obj && obj.__esModule) {
21
23
  return obj;
22
24
  }
@@ -54,10 +56,10 @@ function defaultExtractor(context) {
54
56
  */ return (content)=>{
55
57
  /** @type {(string|string)[]} */ let results = [];
56
58
  for (let pattern of patterns){
57
- var ref;
59
+ var _content_match;
58
60
  results = [
59
61
  ...results,
60
- ...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
62
+ ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
61
63
  ];
62
64
  }
63
65
  return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
@@ -71,8 +73,13 @@ function* buildRegExps(context) {
71
73
  _regex.escape(context.tailwindConfig.prefix)
72
74
  ])) : "";
73
75
  let utility = _regex.any([
74
- // Arbitrary properties
75
- /\[[^\s:'"`]+:[^\s]+\]/,
76
+ // Arbitrary properties (without square brackets)
77
+ /\[[^\s:'"`]+:[^\s\[\]]+\]/,
78
+ // Arbitrary properties with balanced square brackets
79
+ // This is a targeted fix to continue to allow theme()
80
+ // with square brackets to work in arbitrary properties
81
+ // while fixing a problem with the regex matching too much
82
+ /\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
76
83
  // Utilities
77
84
  _regex.pattern([
78
85
  // Utility Name / Group Name
@@ -216,7 +223,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
216
223
  // This means that there was an extra closing `]`
217
224
  // We'll clip to just before it
218
225
  if (depth < 0) {
219
- return input.substring(0, match.index);
226
+ return input.substring(0, match.index - 1);
220
227
  }
221
228
  // We've finished balancing the brackets but there still may be characters that can be included
222
229
  // For example in the class `text-[#336699]/[.35]`
@@ -4,14 +4,22 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>_default
7
+ get: function() {
8
+ return _default;
9
+ }
8
10
  });
11
+ function isRoot(node) {
12
+ return node.type === "root";
13
+ }
14
+ function isAtLayer(node) {
15
+ return node.type === "atrule" && node.name === "layer";
16
+ }
9
17
  function _default(_context) {
10
18
  return (root, result)=>{
11
19
  let found = false;
12
20
  root.walkAtRules("tailwind", (node)=>{
13
21
  if (found) return false;
14
- if (node.parent && node.parent.type !== "root") {
22
+ if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
15
23
  found = true;
16
24
  node.warn(result, [
17
25
  "Nested @tailwind rules were detected, but are not supported.",
@@ -4,19 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  });
5
5
  Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
- get: ()=>_default
7
+ get: function() {
8
+ return _default;
9
+ }
8
10
  });
9
- const _dlv = /*#__PURE__*/ _interopRequireDefault(require("dlv"));
10
- const _didyoumean = /*#__PURE__*/ _interopRequireDefault(require("didyoumean"));
11
- const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("../util/transformThemeValue"));
12
- const _postcssValueParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-value-parser"));
11
+ const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
12
+ const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
13
+ const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
14
+ const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
13
15
  const _normalizeScreens = require("../util/normalizeScreens");
14
- const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("../util/buildMediaQuery"));
16
+ const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
15
17
  const _toPath = require("../util/toPath");
16
18
  const _withAlphaVariable = require("../util/withAlphaVariable");
17
19
  const _pluginUtils = require("../util/pluginUtils");
18
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
19
- function _interopRequireDefault(obj) {
20
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
21
+ function _interop_require_default(obj) {
20
22
  return obj && obj.__esModule ? obj : {
21
23
  default: obj
22
24
  };
@@ -86,22 +88,22 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
86
88
  };
87
89
  }
88
90
  if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
89
- let error1 = `'${pathString}' was found but does not resolve to a string.`;
91
+ let error = `'${pathString}' was found but does not resolve to a string.`;
90
92
  if (isObject(value)) {
91
- let validKeys1 = Object.keys(value).filter((key)=>validatePath(config, [
93
+ let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
92
94
  ...pathSegments,
93
95
  key
94
96
  ]).isValid);
95
- if (validKeys1.length) {
96
- error1 += ` Did you mean something like '${pathToString([
97
+ if (validKeys.length) {
98
+ error += ` Did you mean something like '${pathToString([
97
99
  ...pathSegments,
98
- validKeys1[0]
100
+ validKeys[0]
99
101
  ])}'?`;
100
102
  }
101
103
  }
102
104
  return {
103
105
  isValid: false,
104
- error: error1
106
+ error
105
107
  };
106
108
  }
107
109
  const [themeSection] = pathSegments;
@@ -119,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
119
121
  if (vNode.type === "div" && vNode.value === ",") {
120
122
  args.push("");
121
123
  } else {
122
- args[args.length - 1] += _postcssValueParser.default.stringify(vNode);
124
+ args[args.length - 1] += _index.default.stringify(vNode);
123
125
  }
124
126
  }
125
127
  return args;
@@ -133,7 +135,9 @@ function resolveVNode(node, vNode, functions) {
133
135
  return vNode;
134
136
  }
135
137
  function resolveFunctions(node, input, functions) {
136
- return (0, _postcssValueParser.default)(input).walk((vNode)=>{
138
+ let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
139
+ if (!hasAnyFn) return input;
140
+ return (0, _index.default)(input).walk((vNode)=>{
137
141
  resolveVNode(node, vNode, functions);
138
142
  }).toString();
139
143
  }
@@ -177,8 +181,8 @@ let nodeTypePropertyMap = {
177
181
  alpha
178
182
  });
179
183
  });
180
- var ref;
181
- return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
184
+ var _results_find;
185
+ return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
182
186
  }
183
187
  function _default(context) {
184
188
  let config = context.tailwindConfig;
@@ -186,9 +190,9 @@ function _default(context) {
186
190
  theme: (node, path, ...defaultValue)=>{
187
191
  let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
188
192
  if (!isValid) {
189
- var ref;
193
+ var _parentNode_raws_tailwind;
190
194
  let parentNode = node.parent;
191
- let candidate = (ref = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || ref === void 0 ? void 0 : ref.candidate;
195
+ let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
192
196
  if (parentNode && candidate !== undefined) {
193
197
  // Remove this utility from any caches
194
198
  context.markInvalidUtilityNode(parentNode);