tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea4e1cd

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 (184) hide show
  1. package/README.md +1 -1
  2. package/lib/cli/build/deps.js +17 -9
  3. package/lib/cli/build/index.js +20 -10
  4. package/lib/cli/build/plugin.js +86 -70
  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 +222 -10
  9. package/lib/cli/init/index.js +29 -12
  10. package/lib/cli-peer-dependencies.js +12 -4
  11. package/lib/cli.js +4 -226
  12. package/lib/corePluginList.js +7 -1
  13. package/lib/corePlugins.js +348 -75
  14. package/lib/css/preflight.css +2 -0
  15. package/lib/featureFlags.js +27 -15
  16. package/lib/index.js +1 -47
  17. package/lib/lib/cacheInvalidation.js +7 -5
  18. package/lib/lib/collapseAdjacentRules.js +5 -3
  19. package/lib/lib/collapseDuplicateDeclarations.js +12 -10
  20. package/lib/lib/content.js +34 -30
  21. package/lib/lib/defaultExtractor.js +15 -8
  22. package/lib/lib/detectNesting.js +10 -2
  23. package/lib/lib/evaluateTailwindFunctions.js +22 -20
  24. package/lib/lib/expandApplyAtRules.js +43 -35
  25. package/lib/lib/expandTailwindAtRules.js +46 -19
  26. package/lib/lib/findAtConfigPath.js +9 -7
  27. package/lib/lib/generateRules.js +157 -92
  28. package/lib/lib/getModuleDependencies.js +85 -37
  29. package/lib/lib/load-config.js +42 -0
  30. package/lib/lib/normalizeTailwindDirectives.js +5 -3
  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 +190 -131
  37. package/lib/lib/setupTrackingContext.js +49 -26
  38. package/lib/lib/sharedState.js +37 -10
  39. package/lib/lib/substituteScreenAtRules.js +5 -3
  40. package/lib/oxide/cli/build/deps.js +89 -0
  41. package/lib/oxide/cli/build/index.js +53 -0
  42. package/lib/oxide/cli/build/plugin.js +375 -0
  43. package/lib/oxide/cli/build/utils.js +87 -0
  44. package/lib/oxide/cli/build/watching.js +179 -0
  45. package/lib/oxide/cli/help/index.js +72 -0
  46. package/lib/oxide/cli/index.js +214 -0
  47. package/lib/oxide/cli/init/index.js +52 -0
  48. package/lib/oxide/cli.js +5 -0
  49. package/lib/oxide/postcss-plugin.js +2 -0
  50. package/lib/plugin.js +98 -0
  51. package/lib/postcss-plugins/nesting/index.js +3 -1
  52. package/lib/postcss-plugins/nesting/plugin.js +10 -8
  53. package/lib/processTailwindFeatures.js +14 -12
  54. package/lib/public/colors.js +49 -25
  55. package/lib/public/create-plugin.js +5 -3
  56. package/lib/public/default-config.js +6 -4
  57. package/lib/public/default-theme.js +6 -4
  58. package/lib/public/load-config.js +12 -0
  59. package/lib/public/resolve-config.js +6 -4
  60. package/lib/util/applyImportantSelector.js +36 -0
  61. package/lib/util/bigSign.js +3 -1
  62. package/lib/util/buildMediaQuery.js +3 -1
  63. package/lib/util/cloneDeep.js +3 -1
  64. package/lib/util/cloneNodes.js +5 -3
  65. package/lib/util/color.js +30 -12
  66. package/lib/util/colorNames.js +752 -0
  67. package/lib/util/configurePlugins.js +3 -1
  68. package/lib/util/createPlugin.js +3 -1
  69. package/lib/util/createUtilityPlugin.js +7 -5
  70. package/lib/util/dataTypes.js +74 -17
  71. package/lib/util/defaults.js +9 -7
  72. package/lib/util/escapeClassName.js +10 -8
  73. package/lib/util/escapeCommas.js +3 -1
  74. package/lib/util/flattenColorPalette.js +3 -1
  75. package/lib/util/formatVariantSelector.js +138 -160
  76. package/lib/util/getAllConfigs.js +8 -6
  77. package/lib/util/hashConfig.js +6 -4
  78. package/lib/util/isKeyframeRule.js +3 -1
  79. package/lib/util/isPlainObject.js +3 -1
  80. package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
  81. package/lib/util/log.js +8 -4
  82. package/lib/util/nameClass.js +12 -6
  83. package/lib/util/negateValue.js +4 -2
  84. package/lib/util/normalizeConfig.js +28 -27
  85. package/lib/util/normalizeScreens.js +12 -4
  86. package/lib/util/parseAnimationValue.js +3 -1
  87. package/lib/util/parseBoxShadowValue.js +6 -2
  88. package/lib/util/parseDependency.js +3 -1
  89. package/lib/util/parseGlob.js +6 -4
  90. package/lib/util/parseObjectStyles.js +9 -7
  91. package/lib/util/pluginUtils.js +54 -54
  92. package/lib/util/prefixSelector.js +27 -11
  93. package/lib/util/pseudoElements.js +229 -0
  94. package/lib/util/removeAlphaVariables.js +3 -1
  95. package/lib/util/resolveConfig.js +17 -15
  96. package/lib/util/resolveConfigPath.js +26 -10
  97. package/lib/util/responsive.js +6 -4
  98. package/lib/util/splitAtTopLevelOnly.js +10 -2
  99. package/lib/util/tap.js +3 -1
  100. package/lib/util/toColorValue.js +3 -1
  101. package/lib/util/toPath.js +3 -1
  102. package/lib/util/transformThemeValue.js +6 -4
  103. package/lib/util/validateConfig.js +16 -3
  104. package/lib/util/validateFormalSyntax.js +3 -1
  105. package/lib/util/withAlphaVariable.js +6 -2
  106. package/loadConfig.d.ts +4 -0
  107. package/loadConfig.js +2 -0
  108. package/package.json +45 -37
  109. package/peers/index.js +63324 -46417
  110. package/resolveConfig.d.ts +11 -2
  111. package/scripts/swap-engines.js +40 -0
  112. package/src/cli/build/index.js +13 -9
  113. package/src/cli/build/plugin.js +42 -32
  114. package/src/cli/build/watching.js +4 -2
  115. package/src/cli/index.js +216 -3
  116. package/src/cli/init/index.js +37 -8
  117. package/src/cli.js +4 -220
  118. package/src/corePluginList.js +1 -1
  119. package/src/corePlugins.js +207 -32
  120. package/src/css/preflight.css +2 -0
  121. package/src/featureFlags.js +6 -0
  122. package/src/index.js +1 -47
  123. package/src/lib/content.js +12 -17
  124. package/src/lib/defaultExtractor.js +9 -3
  125. package/src/lib/detectNesting.js +9 -1
  126. package/src/lib/expandApplyAtRules.js +8 -1
  127. package/src/lib/expandTailwindAtRules.js +36 -7
  128. package/src/lib/generateRules.js +124 -42
  129. package/src/lib/getModuleDependencies.js +70 -30
  130. package/src/lib/load-config.ts +31 -0
  131. package/src/lib/offsets.js +104 -1
  132. package/src/lib/remap-bitfield.js +82 -0
  133. package/src/lib/setupContextUtils.js +103 -54
  134. package/src/lib/setupTrackingContext.js +36 -11
  135. package/src/lib/sharedState.js +15 -4
  136. package/src/oxide/cli/build/deps.ts +91 -0
  137. package/src/oxide/cli/build/index.ts +47 -0
  138. package/src/oxide/cli/build/plugin.ts +442 -0
  139. package/src/oxide/cli/build/utils.ts +74 -0
  140. package/src/oxide/cli/build/watching.ts +225 -0
  141. package/src/oxide/cli/help/index.ts +69 -0
  142. package/src/oxide/cli/index.ts +204 -0
  143. package/src/oxide/cli/init/index.ts +59 -0
  144. package/src/oxide/cli.ts +1 -0
  145. package/src/oxide/postcss-plugin.ts +1 -0
  146. package/src/plugin.js +107 -0
  147. package/src/public/colors.js +22 -0
  148. package/src/public/default-config.js +1 -1
  149. package/src/public/default-theme.js +2 -2
  150. package/src/public/load-config.js +2 -0
  151. package/src/util/applyImportantSelector.js +27 -0
  152. package/src/util/color.js +18 -3
  153. package/src/util/colorNames.js +150 -0
  154. package/src/util/dataTypes.js +33 -4
  155. package/src/util/formatVariantSelector.js +160 -163
  156. package/src/util/getAllConfigs.js +2 -2
  157. package/src/util/negateValue.js +1 -1
  158. package/src/util/normalizeConfig.js +2 -1
  159. package/src/util/pluginUtils.js +16 -31
  160. package/src/util/prefixSelector.js +28 -10
  161. package/src/util/pseudoElements.js +170 -0
  162. package/src/util/resolveConfigPath.js +12 -1
  163. package/src/util/splitAtTopLevelOnly.js +8 -1
  164. package/src/util/validateConfig.js +13 -0
  165. package/stubs/.gitignore +1 -0
  166. package/stubs/.prettierrc.json +6 -0
  167. package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
  168. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  169. package/stubs/postcss.config.js +6 -0
  170. package/stubs/tailwind.config.cjs +2 -0
  171. package/stubs/tailwind.config.js +2 -0
  172. package/stubs/tailwind.config.ts +3 -0
  173. package/types/config.d.ts +15 -9
  174. package/types/generated/colors.d.ts +22 -0
  175. package/types/generated/corePluginList.d.ts +1 -1
  176. package/types/generated/default-theme.d.ts +108 -79
  177. package/CHANGELOG.md +0 -2336
  178. package/lib/cli/shared.js +0 -12
  179. package/lib/constants.js +0 -44
  180. package/scripts/install-integrations.js +0 -27
  181. package/scripts/rebuildFixtures.js +0 -68
  182. package/src/cli/shared.js +0 -5
  183. package/src/constants.js +0 -17
  184. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -9,36 +9,46 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- isValidVariantFormatString: ()=>isValidVariantFormatString,
13
- parseVariant: ()=>parseVariant,
14
- getFileModifiedMap: ()=>getFileModifiedMap,
15
- createContext: ()=>createContext,
16
- getContext: ()=>getContext
12
+ isValidVariantFormatString: function() {
13
+ return isValidVariantFormatString;
14
+ },
15
+ parseVariant: function() {
16
+ return parseVariant;
17
+ },
18
+ getFileModifiedMap: function() {
19
+ return getFileModifiedMap;
20
+ },
21
+ createContext: function() {
22
+ return createContext;
23
+ },
24
+ getContext: function() {
25
+ return getContext;
26
+ }
17
27
  });
18
- const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
19
- const _url = /*#__PURE__*/ _interopRequireDefault(require("url"));
20
- const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
21
- const _dlv = /*#__PURE__*/ _interopRequireDefault(require("dlv"));
22
- const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
23
- const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("../util/transformThemeValue"));
24
- const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
25
- const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
26
- const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
27
- const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
28
- const _nameClass = /*#__PURE__*/ _interopRequireWildcard(require("../util/nameClass"));
28
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
29
+ const _url = /*#__PURE__*/ _interop_require_default(require("url"));
30
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
31
+ const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
32
+ const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
33
+ const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
34
+ const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
35
+ const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
36
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
37
+ const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
38
+ const _nameClass = /*#__PURE__*/ _interop_require_wildcard(require("../util/nameClass"));
29
39
  const _pluginUtils = require("../util/pluginUtils");
30
40
  const _corePlugins = require("../corePlugins");
31
- const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
41
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
32
42
  const _toPath = require("../util/toPath");
33
- const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
34
- const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("../util/negateValue"));
35
- const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
43
+ const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
44
+ const _negateValue = /*#__PURE__*/ _interop_require_default(require("../util/negateValue"));
45
+ const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
36
46
  const _generateRules = require("./generateRules");
37
- const _cacheInvalidationJs = require("./cacheInvalidation.js");
38
- const _offsetsJs = require("./offsets.js");
39
- const _featureFlagsJs = require("../featureFlags.js");
47
+ const _cacheInvalidation = require("./cacheInvalidation.js");
48
+ const _offsets = require("./offsets.js");
49
+ const _featureFlags = require("../featureFlags.js");
40
50
  const _formatVariantSelector = require("../util/formatVariantSelector");
41
- function _interopRequireDefault(obj) {
51
+ function _interop_require_default(obj) {
42
52
  return obj && obj.__esModule ? obj : {
43
53
  default: obj
44
54
  };
@@ -51,7 +61,7 @@ function _getRequireWildcardCache(nodeInterop) {
51
61
  return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
52
62
  })(nodeInterop);
53
63
  }
54
- function _interopRequireWildcard(obj, nodeInterop) {
64
+ function _interop_require_wildcard(obj, nodeInterop) {
55
65
  if (!nodeInterop && obj && obj.__esModule) {
56
66
  return obj;
57
67
  }
@@ -113,27 +123,41 @@ function normalizeOptionTypes({ type ="any" , ...options }) {
113
123
  };
114
124
  }
115
125
  function parseVariantFormatString(input) {
116
- if (input.includes("{")) {
117
- if (!isBalanced(input)) throw new Error(`Your { and } are unbalanced.`);
118
- return input.split(/{(.*)}/gim).flatMap((line)=>parseVariantFormatString(line)).filter(Boolean);
119
- }
120
- return [
121
- input.trim()
122
- ];
123
- }
124
- function isBalanced(input) {
125
- let count = 0;
126
- for (let char of input){
127
- if (char === "{") {
128
- count++;
126
+ /** @type {string[]} */ let parts = [];
127
+ // When parsing whitespace around special characters are insignificant
128
+ // However, _inside_ of a variant they could be
129
+ // Because the selector could look like this
130
+ // @media { &[data-name="foo bar"] }
131
+ // This is why we do not skip whitespace
132
+ let current = "";
133
+ let depth = 0;
134
+ for(let idx = 0; idx < input.length; idx++){
135
+ let char = input[idx];
136
+ if (char === "\\") {
137
+ // Escaped characters are not special
138
+ current += "\\" + input[++idx];
139
+ } else if (char === "{") {
140
+ // Nested rule: start
141
+ ++depth;
142
+ parts.push(current.trim());
143
+ current = "";
129
144
  } else if (char === "}") {
130
- if (--count < 0) {
131
- return false // unbalanced
132
- ;
145
+ // Nested rule: end
146
+ if (--depth < 0) {
147
+ throw new Error(`Your { and } are unbalanced.`);
133
148
  }
149
+ parts.push(current.trim());
150
+ current = "";
151
+ } else {
152
+ // Normal character
153
+ current += char;
134
154
  }
135
155
  }
136
- return count === 0;
156
+ if (current.length > 0) {
157
+ parts.push(current.trim());
158
+ }
159
+ parts = parts.filter((part)=>part !== "");
160
+ return parts;
137
161
  }
138
162
  function insertInto(list, value, { before =[] } = {}) {
139
163
  before = [].concat(before);
@@ -161,7 +185,7 @@ function parseStyles(styles) {
161
185
  });
162
186
  }
163
187
  function getClasses(selector, mutate) {
164
- let parser = (0, _postcssSelectorParser.default)((selectors)=>{
188
+ let parser = (0, _postcssselectorparser.default)((selectors)=>{
165
189
  let allClasses = [];
166
190
  if (mutate) {
167
191
  mutate(selectors);
@@ -281,26 +305,20 @@ function parseVariant(variant) {
281
305
  return context.tailwindConfig.prefix + identifier;
282
306
  }
283
307
  function resolveThemeValue(path, defaultValue, opts = {}) {
284
- const [pathRoot, ...subPaths] = (0, _toPath.toPath)(path);
285
- const value = getConfigValue([
308
+ let parts = (0, _toPath.toPath)(path);
309
+ let value = getConfigValue([
286
310
  "theme",
287
- pathRoot,
288
- ...subPaths
311
+ ...parts
289
312
  ], defaultValue);
290
- return (0, _transformThemeValue.default)(pathRoot)(value, opts);
313
+ return (0, _transformThemeValue.default)(parts[0])(value, opts);
291
314
  }
292
- const theme = Object.assign((path, defaultValue = undefined)=>resolveThemeValue(path, defaultValue), {
293
- withAlpha: (path, opacityValue)=>resolveThemeValue(path, undefined, {
294
- opacityValue
295
- })
296
- });
297
315
  let variantIdentifier = 0;
298
316
  let api = {
299
317
  postcss: _postcss.default,
300
318
  prefix: applyConfiguredPrefix,
301
319
  e: _escapeClassName.default,
302
320
  config: getConfigValue,
303
- theme,
321
+ theme: resolveThemeValue,
304
322
  corePlugins: (path)=>{
305
323
  if (Array.isArray(tailwindConfig.corePlugins)) {
306
324
  return tailwindConfig.corePlugins.includes(path);
@@ -443,7 +461,7 @@ function parseVariant(variant) {
443
461
  return utilityModifier;
444
462
  }
445
463
  };
446
- let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
464
+ let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
447
465
  let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
448
466
  [(0, _nameClass.default)(identifier, modifier)]: declaration
449
467
  }));
@@ -509,7 +527,7 @@ function parseVariant(variant) {
509
527
  return utilityModifier;
510
528
  }
511
529
  };
512
- let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
530
+ let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
513
531
  let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
514
532
  [(0, _nameClass.default)(identifier, modifier)]: declaration
515
533
  }));
@@ -565,14 +583,14 @@ function parseVariant(variant) {
565
583
  context.variantOptions.set(variantName, options);
566
584
  },
567
585
  matchVariant (variant, variantFn, options) {
568
- var ref;
586
+ var _options_id;
569
587
  // A unique identifier that "groups" these variants together.
570
588
  // This is for internal use only which is why it is not present in the types
571
- let id = (ref = options === null || options === void 0 ? void 0 : options.id) !== null && ref !== void 0 ? ref : ++variantIdentifier;
589
+ let id = (_options_id = options === null || options === void 0 ? void 0 : options.id) !== null && _options_id !== void 0 ? _options_id : ++variantIdentifier;
572
590
  let isSpecial = variant === "@";
573
- let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
574
- var ref1;
575
- for (let [key, value] of Object.entries((ref1 = options === null || options === void 0 ? void 0 : options.values) !== null && ref1 !== void 0 ? ref1 : {})){
591
+ let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
592
+ var _options_values;
593
+ for (let [key, value] of Object.entries((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {})){
576
594
  if (key === "DEFAULT") continue;
577
595
  api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>{
578
596
  return variantFn(value, modifiersEnabled ? {
@@ -589,15 +607,15 @@ function parseVariant(variant) {
589
607
  variantInfo: VARIANT_INFO.Base
590
608
  });
591
609
  }
592
- var ref2;
593
- let hasDefault = "DEFAULT" in ((ref2 = options === null || options === void 0 ? void 0 : options.values) !== null && ref2 !== void 0 ? ref2 : {});
610
+ var _options_values1;
611
+ let hasDefault = "DEFAULT" in ((_options_values1 = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {});
594
612
  api.addVariant(variant, ({ args , container })=>{
595
613
  if ((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE && !hasDefault) {
596
614
  return null;
597
615
  }
598
616
  var // (JetBrains) plugins.
599
- ref;
600
- return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (ref = args === null || args === void 0 ? void 0 : args.value) !== null && ref !== void 0 ? ref : typeof args === "string" ? args : "", modifiersEnabled ? {
617
+ _args_value;
618
+ return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (_args_value = args === null || args === void 0 ? void 0 : args.value) !== null && _args_value !== void 0 ? _args_value : typeof args === "string" ? args : "", modifiersEnabled ? {
601
619
  modifier: args === null || args === void 0 ? void 0 : args.modifier,
602
620
  container
603
621
  } : {
@@ -622,24 +640,28 @@ function getFileModifiedMap(context) {
622
640
  }
623
641
  function trackModified(files, fileModifiedMap) {
624
642
  let changed = false;
643
+ let mtimesToCommit = new Map();
625
644
  for (let file of files){
626
- var ref;
645
+ var _fs_statSync;
627
646
  if (!file) continue;
628
647
  let parsed = _url.default.parse(file);
629
648
  let pathname = parsed.hash ? parsed.href.replace(parsed.hash, "") : parsed.href;
630
649
  pathname = parsed.search ? pathname.replace(parsed.search, "") : pathname;
631
- let newModified = (ref = _fs.default.statSync(decodeURIComponent(pathname), {
650
+ let newModified = (_fs_statSync = _fs.default.statSync(decodeURIComponent(pathname), {
632
651
  throwIfNoEntry: false
633
- })) === null || ref === void 0 ? void 0 : ref.mtimeMs;
652
+ })) === null || _fs_statSync === void 0 ? void 0 : _fs_statSync.mtimeMs;
634
653
  if (!newModified) {
635
654
  continue;
636
655
  }
637
656
  if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
638
657
  changed = true;
639
658
  }
640
- fileModifiedMap.set(file, newModified);
659
+ mtimesToCommit.set(file, newModified);
641
660
  }
642
- return changed;
661
+ return [
662
+ changed,
663
+ mtimesToCommit
664
+ ];
643
665
  }
644
666
  function extractVariantAtRules(node) {
645
667
  node.walkAtRules((atRule)=>{
@@ -677,9 +699,9 @@ function collectLayerPlugins(root) {
677
699
  }
678
700
  layerRule.remove();
679
701
  } else if (layerRule.params === "components") {
680
- for (let node1 of layerRule.nodes){
702
+ for (let node of layerRule.nodes){
681
703
  layerPlugins.push(function({ addComponents }) {
682
- addComponents(node1, {
704
+ addComponents(node, {
683
705
  respectPrefix: false,
684
706
  preserveSource: true
685
707
  });
@@ -687,9 +709,9 @@ function collectLayerPlugins(root) {
687
709
  }
688
710
  layerRule.remove();
689
711
  } else if (layerRule.params === "utilities") {
690
- for (let node2 of layerRule.nodes){
712
+ for (let node of layerRule.nodes){
691
713
  layerPlugins.push(function({ addUtilities }) {
692
- addUtilities(node2, {
714
+ addUtilities(node, {
693
715
  respectPrefix: false,
694
716
  preserveSource: true
695
717
  });
@@ -747,7 +769,7 @@ function registerPlugins(plugins, context) {
747
769
  let variantList = [];
748
770
  let variantMap = new Map();
749
771
  context.variantMap = variantMap;
750
- let offsets = new _offsetsJs.Offsets();
772
+ let offsets = new _offsets.Offsets();
751
773
  context.offsets = offsets;
752
774
  let classList = new Set();
753
775
  let pluginApi = buildPluginApi(context.tailwindConfig, context, {
@@ -774,8 +796,8 @@ function registerPlugins(plugins, context) {
774
796
  variantFunction
775
797
  ]));
776
798
  }
777
- var _safelist;
778
- let safelist = ((_safelist = context.tailwindConfig.safelist) !== null && _safelist !== void 0 ? _safelist : []).filter(Boolean);
799
+ var _context_tailwindConfig_safelist;
800
+ let safelist = ((_context_tailwindConfig_safelist = context.tailwindConfig.safelist) !== null && _context_tailwindConfig_safelist !== void 0 ? _context_tailwindConfig_safelist : []).filter(Boolean);
779
801
  if (safelist.length > 0) {
780
802
  let checks = [];
781
803
  for (let value of safelist){
@@ -803,8 +825,8 @@ function registerPlugins(plugins, context) {
803
825
  for (let util of classList){
804
826
  let utils = Array.isArray(util) ? (()=>{
805
827
  let [utilName, options] = util;
806
- var ref;
807
- let values = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {});
828
+ var _options_values;
829
+ let values = Object.keys((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {});
808
830
  let classes = values.map((value)=>(0, _nameClass.formatClass)(utilName, value));
809
831
  if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
810
832
  // This is the normal negated version
@@ -838,7 +860,7 @@ function registerPlugins(plugins, context) {
838
860
  })() : [
839
861
  util
840
862
  ];
841
- for (let util1 of utils){
863
+ for (let util of utils){
842
864
  for (let { pattern , variants =[] } of checks){
843
865
  // RegExp with the /g flag are stateful, so let's reset the last
844
866
  // index pointer to reset the state.
@@ -846,15 +868,15 @@ function registerPlugins(plugins, context) {
846
868
  if (!patternMatchingCount.has(pattern)) {
847
869
  patternMatchingCount.set(pattern, 0);
848
870
  }
849
- if (!pattern.test(util1)) continue;
871
+ if (!pattern.test(util)) continue;
850
872
  patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
851
873
  context.changedContent.push({
852
- content: util1,
874
+ content: util,
853
875
  extension: "html"
854
876
  });
855
877
  for (let variant of variants){
856
878
  context.changedContent.push({
857
- content: variant + context.tailwindConfig.separator + util1,
879
+ content: variant + context.tailwindConfig.separator + util,
858
880
  extension: "html"
859
881
  });
860
882
  }
@@ -871,8 +893,8 @@ function registerPlugins(plugins, context) {
871
893
  }
872
894
  }
873
895
  }
874
- var _darkMode, ref;
875
- let darkClassName = (ref = [].concat((_darkMode = context.tailwindConfig.darkMode) !== null && _darkMode !== void 0 ? _darkMode : "media")[1]) !== null && ref !== void 0 ? ref : "dark";
896
+ var _context_tailwindConfig_darkMode, _concat_;
897
+ let darkClassName = (_concat_ = [].concat((_context_tailwindConfig_darkMode = context.tailwindConfig.darkMode) !== null && _context_tailwindConfig_darkMode !== void 0 ? _context_tailwindConfig_darkMode : "media")[1]) !== null && _concat_ !== void 0 ? _concat_ : "dark";
876
898
  // A list of utilities that are used by certain Tailwind CSS utilities but
877
899
  // that don't exist on their own. This will result in them "not existing" and
878
900
  // sorting could be weird since you still require them in order to make the
@@ -883,22 +905,30 @@ function registerPlugins(plugins, context) {
883
905
  prefix(context, "peer")
884
906
  ];
885
907
  context.getClassOrder = function getClassOrder(classes) {
908
+ // Sort classes so they're ordered in a deterministic manner
909
+ let sorted = [
910
+ ...classes
911
+ ].sort((a, z)=>{
912
+ if (a === z) return 0;
913
+ if (a < z) return -1;
914
+ return 1;
915
+ });
886
916
  // Non-util classes won't be generated, so we default them to null
887
- let sortedClassNames = new Map(classes.map((className)=>[
917
+ let sortedClassNames = new Map(sorted.map((className)=>[
888
918
  className,
889
919
  null
890
920
  ]));
891
921
  // Sort all classes in order
892
922
  // Non-tailwind classes won't be generated and will be left as `null`
893
- let rules = (0, _generateRules.generateRules)(new Set(classes), context);
923
+ let rules = (0, _generateRules.generateRules)(new Set(sorted), context);
894
924
  rules = context.offsets.sort(rules);
895
925
  let idx = BigInt(parasiteUtilities.length);
896
926
  for (const [, rule] of rules){
897
927
  sortedClassNames.set(rule.raws.tailwind.candidate, idx++);
898
928
  }
899
929
  return classes.map((className)=>{
900
- var ref;
901
- let order = (ref = sortedClassNames.get(className)) !== null && ref !== void 0 ? ref : null;
930
+ var _sortedClassNames_get;
931
+ let order = (_sortedClassNames_get = sortedClassNames.get(className)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : null;
902
932
  let parasiteIndex = parasiteUtilities.indexOf(className);
903
933
  if (order === null && parasiteIndex !== -1) {
904
934
  // This will make sure that it is at the very beginning of the
@@ -914,21 +944,40 @@ function registerPlugins(plugins, context) {
914
944
  };
915
945
  // Generate a list of strings for autocompletion purposes, e.g.
916
946
  // ['uppercase', 'lowercase', ...]
917
- context.getClassList = function getClassList() {
947
+ context.getClassList = function getClassList(options = {}) {
918
948
  let output = [];
919
949
  for (let util of classList){
920
950
  if (Array.isArray(util)) {
921
- let [utilName, options] = util;
951
+ var _utilOptions_types;
952
+ let [utilName, utilOptions] = util;
922
953
  let negativeClasses = [];
923
- var ref;
924
- for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {})){
954
+ var _utilOptions_modifiers;
955
+ let modifiers = Object.keys((_utilOptions_modifiers = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.modifiers) !== null && _utilOptions_modifiers !== void 0 ? _utilOptions_modifiers : {});
956
+ if (utilOptions === null || utilOptions === void 0 ? void 0 : (_utilOptions_types = utilOptions.types) === null || _utilOptions_types === void 0 ? void 0 : _utilOptions_types.some(({ type })=>type === "color")) {
957
+ var _context_tailwindConfig_theme_opacity;
958
+ modifiers.push(...Object.keys((_context_tailwindConfig_theme_opacity = context.tailwindConfig.theme.opacity) !== null && _context_tailwindConfig_theme_opacity !== void 0 ? _context_tailwindConfig_theme_opacity : {}));
959
+ }
960
+ let metadata = {
961
+ modifiers
962
+ };
963
+ let includeMetadata = options.includeMetadata && modifiers.length > 0;
964
+ var _utilOptions_values;
965
+ for (let [key, value] of Object.entries((_utilOptions_values = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.values) !== null && _utilOptions_values !== void 0 ? _utilOptions_values : {})){
925
966
  // Ignore undefined and null values
926
967
  if (value == null) {
927
968
  continue;
928
969
  }
929
- output.push((0, _nameClass.formatClass)(utilName, key));
930
- if ((options === null || options === void 0 ? void 0 : options.supportsNegativeValues) && (0, _negateValue.default)(value)) {
931
- negativeClasses.push((0, _nameClass.formatClass)(utilName, `-${key}`));
970
+ let cls = (0, _nameClass.formatClass)(utilName, key);
971
+ output.push(includeMetadata ? [
972
+ cls,
973
+ metadata
974
+ ] : cls);
975
+ if ((utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.supportsNegativeValues) && (0, _negateValue.default)(value)) {
976
+ let cls = (0, _nameClass.formatClass)(utilName, `-${key}`);
977
+ negativeClasses.push(includeMetadata ? [
978
+ cls,
979
+ metadata
980
+ ] : cls);
932
981
  }
933
982
  }
934
983
  output.push(...negativeClasses);
@@ -943,11 +992,11 @@ function registerPlugins(plugins, context) {
943
992
  let result = [];
944
993
  for (let [name, options] of context.variantOptions.entries()){
945
994
  if (options.variantInfo === VARIANT_INFO.Base) continue;
946
- var _values;
995
+ var _options_values;
947
996
  result.push({
948
997
  name,
949
998
  isArbitrary: options.type === Symbol.for("MATCH_VARIANT"),
950
- values: Object.keys((_values = options.values) !== null && _values !== void 0 ? _values : {}),
999
+ values: Object.keys((_options_values = options.values) !== null && _options_values !== void 0 ? _options_values : {}),
951
1000
  hasDash: name !== "@",
952
1001
  selectors ({ modifier , value } = {}) {
953
1002
  let candidate = "__TAILWIND_PLACEHOLDER__";
@@ -960,17 +1009,17 @@ function registerPlugins(plugins, context) {
960
1009
  ]
961
1010
  });
962
1011
  let before = container.toString();
963
- var ref;
964
- let fns = ((ref = context.variantMap.get(name)) !== null && ref !== void 0 ? ref : []).flatMap(([_, fn])=>fn);
1012
+ var _context_variantMap_get;
1013
+ let fns = ((_context_variantMap_get = context.variantMap.get(name)) !== null && _context_variantMap_get !== void 0 ? _context_variantMap_get : []).flatMap(([_, fn])=>fn);
965
1014
  let formatStrings = [];
966
1015
  for (let fn of fns){
967
- var ref1;
1016
+ var _options_values;
968
1017
  let localFormatStrings = [];
969
- var ref2;
1018
+ var _options_values_value;
970
1019
  let api = {
971
1020
  args: {
972
1021
  modifier,
973
- value: (ref2 = (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[value]) !== null && ref2 !== void 0 ? ref2 : value
1022
+ value: (_options_values_value = (_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[value]) !== null && _options_values_value !== void 0 ? _options_values_value : value
974
1023
  },
975
1024
  separator: context.tailwindConfig.separator,
976
1025
  modifySelectors (modifierFunction) {
@@ -1021,7 +1070,7 @@ function registerPlugins(plugins, context) {
1021
1070
  // as well. E.g.: `${variant}${separator}${className}`.
1022
1071
  // However, plugin authors probably also prepend or append certain
1023
1072
  // classes, pseudos, ids, ...
1024
- let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
1073
+ let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
1025
1074
  selectors.walkClasses((classNode)=>{
1026
1075
  classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
1027
1076
  });
@@ -1044,15 +1093,23 @@ function registerPlugins(plugins, context) {
1044
1093
  manualFormatStrings.push(`@${atrule.name} (${atrule.params}) { & }`);
1045
1094
  });
1046
1095
  }
1047
- var _values;
1048
- let result = formatStrings.map((formatString)=>(0, _formatVariantSelector.finalizeSelector)((0, _formatVariantSelector.formatVariantSelector)("&", ...formatString), {
1049
- selector: `.${candidate}`,
1050
- candidate,
1051
- context,
1052
- isArbitraryVariant: !(value in ((_values = options.values) !== null && _values !== void 0 ? _values : {}))
1053
- }).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
1096
+ var _options_values1;
1097
+ let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {}));
1098
+ formatStrings = formatStrings.map((format)=>format.map((str)=>({
1099
+ format: str,
1100
+ isArbitraryVariant
1101
+ })));
1102
+ manualFormatStrings = manualFormatStrings.map((format)=>({
1103
+ format,
1104
+ isArbitraryVariant
1105
+ }));
1106
+ let opts = {
1107
+ candidate,
1108
+ context
1109
+ };
1110
+ let result = formatStrings.map((formats)=>(0, _formatVariantSelector.finalizeSelector)(`.${candidate}`, (0, _formatVariantSelector.formatVariantSelector)(formats, opts), opts).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
1054
1111
  if (manualFormatStrings.length > 0) {
1055
- result.push((0, _formatVariantSelector.formatVariantSelector)("&", ...manualFormatStrings));
1112
+ result.push((0, _formatVariantSelector.formatVariantSelector)(manualFormatStrings, opts).toString().replace(`.${candidate}`, "&"));
1056
1113
  }
1057
1114
  return result;
1058
1115
  }
@@ -1098,7 +1155,7 @@ function registerPlugins(plugins, context) {
1098
1155
  markInvalidUtilityCandidate(context, candidate);
1099
1156
  }
1100
1157
  function createContext(tailwindConfig, changedContent = [], root = _postcss.default.root()) {
1101
- var _blocklist;
1158
+ var _tailwindConfig_blocklist;
1102
1159
  let context = {
1103
1160
  disposables: [],
1104
1161
  ruleCache: new Set(),
@@ -1106,7 +1163,7 @@ function createContext(tailwindConfig, changedContent = [], root = _postcss.defa
1106
1163
  classCache: new Map(),
1107
1164
  applyClassCache: new Map(),
1108
1165
  // Seed the not class cache with the blocklist (which is only strings)
1109
- notClassCache: new Set((_blocklist = tailwindConfig.blocklist) !== null && _blocklist !== void 0 ? _blocklist : []),
1166
+ notClassCache: new Set((_tailwindConfig_blocklist = tailwindConfig.blocklist) !== null && _tailwindConfig_blocklist !== void 0 ? _tailwindConfig_blocklist : []),
1110
1167
  postCssNodeCache: new Map(),
1111
1168
  candidateRuleMap: new Map(),
1112
1169
  tailwindConfig,
@@ -1137,17 +1194,18 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
1137
1194
  contextMap.set(sourcePath, context);
1138
1195
  existingContext = context;
1139
1196
  }
1140
- let cssDidChange = (0, _cacheInvalidationJs.hasContentChanged)(sourcePath, root);
1197
+ let cssDidChange = (0, _cacheInvalidation.hasContentChanged)(sourcePath, root);
1141
1198
  // If there's already a context in the cache and we don't need to
1142
1199
  // reset the context, return the cached context.
1143
1200
  if (existingContext) {
1144
- let contextDependenciesChanged = trackModified([
1201
+ let [contextDependenciesChanged, mtimesToCommit] = trackModified([
1145
1202
  ...contextDependencies
1146
1203
  ], getFileModifiedMap(existingContext));
1147
1204
  if (!contextDependenciesChanged && !cssDidChange) {
1148
1205
  return [
1149
1206
  existingContext,
1150
- false
1207
+ false,
1208
+ mtimesToCommit
1151
1209
  ];
1152
1210
  }
1153
1211
  }
@@ -1162,9 +1220,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
1162
1220
  contextSourcesMap.get(oldContext).delete(sourcePath);
1163
1221
  if (contextSourcesMap.get(oldContext).size === 0) {
1164
1222
  contextSourcesMap.delete(oldContext);
1165
- for (let [tailwindConfigHash1, context1] of configContextMap){
1166
- if (context1 === oldContext) {
1167
- configContextMap.delete(tailwindConfigHash1);
1223
+ for (let [tailwindConfigHash, context] of configContextMap){
1224
+ if (context === oldContext) {
1225
+ configContextMap.delete(tailwindConfigHash);
1168
1226
  }
1169
1227
  }
1170
1228
  for (let disposable of oldContext.disposables.splice(0)){
@@ -1174,23 +1232,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
1174
1232
  }
1175
1233
  }
1176
1234
  _sharedState.env.DEBUG && console.log("Setting up new context...");
1177
- let context2 = createContext(tailwindConfig, [], root);
1178
- Object.assign(context2, {
1235
+ let context = createContext(tailwindConfig, [], root);
1236
+ Object.assign(context, {
1179
1237
  userConfigPath
1180
1238
  });
1181
- trackModified([
1239
+ let [, mtimesToCommit] = trackModified([
1182
1240
  ...contextDependencies
1183
- ], getFileModifiedMap(context2));
1241
+ ], getFileModifiedMap(context));
1184
1242
  // ---
1185
1243
  // Update all context tracking state
1186
- configContextMap.set(tailwindConfigHash, context2);
1187
- contextMap.set(sourcePath, context2);
1188
- if (!contextSourcesMap.has(context2)) {
1189
- contextSourcesMap.set(context2, new Set());
1244
+ configContextMap.set(tailwindConfigHash, context);
1245
+ contextMap.set(sourcePath, context);
1246
+ if (!contextSourcesMap.has(context)) {
1247
+ contextSourcesMap.set(context, new Set());
1190
1248
  }
1191
- contextSourcesMap.get(context2).add(sourcePath);
1249
+ contextSourcesMap.get(context).add(sourcePath);
1192
1250
  return [
1193
- context2,
1194
- true
1251
+ context,
1252
+ true,
1253
+ mtimesToCommit
1195
1254
  ];
1196
1255
  }