tailwindcss 0.0.0-insiders.ea80db2 → 0.0.0-insiders.eae2b7a

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 (213) hide show
  1. package/README.md +13 -9
  2. package/defaultTheme.d.ts +2 -1
  3. package/index.css +5 -0
  4. package/lib/cli/build/index.js +57 -0
  5. package/lib/cli/build/plugin.js +427 -0
  6. package/lib/cli/build/utils.js +88 -0
  7. package/lib/cli/build/watching.js +182 -0
  8. package/lib/cli/help/index.js +73 -0
  9. package/lib/cli/index.js +231 -0
  10. package/lib/cli/init/index.js +63 -0
  11. package/lib/cli.js +1 -759
  12. package/lib/corePluginList.js +12 -3
  13. package/lib/corePlugins.js +2308 -1739
  14. package/lib/css/preflight.css +13 -5
  15. package/lib/featureFlags.js +50 -25
  16. package/lib/index.js +1 -40
  17. package/lib/lib/cacheInvalidation.js +48 -25
  18. package/lib/lib/collapseAdjacentRules.js +17 -10
  19. package/lib/lib/collapseDuplicateDeclarations.js +13 -8
  20. package/lib/lib/content.js +207 -0
  21. package/lib/lib/defaultExtractor.js +232 -33
  22. package/lib/lib/detectNesting.js +21 -10
  23. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  24. package/lib/lib/expandApplyAtRules.js +316 -215
  25. package/lib/lib/expandTailwindAtRules.js +167 -115
  26. package/lib/lib/findAtConfigPath.js +46 -0
  27. package/lib/lib/generateRules.js +444 -211
  28. package/lib/lib/getModuleDependencies.js +88 -37
  29. package/lib/lib/handleImportAtRules.js +50 -0
  30. package/lib/lib/load-config.js +42 -0
  31. package/lib/lib/normalizeTailwindDirectives.js +29 -39
  32. package/lib/lib/offsets.js +306 -0
  33. package/lib/lib/partitionApplyAtRules.js +13 -8
  34. package/lib/lib/regex.js +74 -0
  35. package/lib/lib/remap-bitfield.js +89 -0
  36. package/lib/lib/resolveDefaultsAtRules.js +96 -74
  37. package/lib/lib/setupContextUtils.js +672 -300
  38. package/lib/lib/setupTrackingContext.js +63 -68
  39. package/lib/lib/sharedState.js +44 -17
  40. package/lib/lib/substituteScreenAtRules.js +14 -10
  41. package/lib/plugin.js +160 -0
  42. package/lib/postcss-plugins/nesting/README.md +2 -2
  43. package/lib/postcss-plugins/nesting/index.js +10 -6
  44. package/lib/postcss-plugins/nesting/plugin.js +24 -20
  45. package/lib/processTailwindFeatures.js +34 -29
  46. package/lib/public/colors.js +272 -246
  47. package/lib/public/create-plugin.js +9 -5
  48. package/lib/public/default-config.js +10 -6
  49. package/lib/public/default-theme.js +10 -6
  50. package/lib/public/load-config.js +12 -0
  51. package/lib/public/resolve-config.js +11 -6
  52. package/lib/util/applyImportantSelector.js +36 -0
  53. package/lib/util/bigSign.js +6 -1
  54. package/lib/util/buildMediaQuery.js +13 -6
  55. package/lib/util/cloneDeep.js +9 -6
  56. package/lib/util/cloneNodes.js +12 -3
  57. package/lib/util/color.js +66 -50
  58. package/lib/util/colorNames.js +752 -0
  59. package/lib/util/configurePlugins.js +7 -2
  60. package/lib/util/createPlugin.js +8 -5
  61. package/lib/util/createUtilityPlugin.js +13 -9
  62. package/lib/util/dataTypes.js +182 -111
  63. package/lib/util/defaults.js +12 -7
  64. package/lib/util/escapeClassName.js +13 -8
  65. package/lib/util/escapeCommas.js +7 -2
  66. package/lib/util/flattenColorPalette.js +11 -10
  67. package/lib/util/formatVariantSelector.js +228 -151
  68. package/lib/util/getAllConfigs.js +33 -12
  69. package/lib/util/hashConfig.js +9 -4
  70. package/lib/util/isKeyframeRule.js +7 -2
  71. package/lib/util/isPlainObject.js +7 -2
  72. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  73. package/lib/util/log.js +40 -13
  74. package/lib/util/nameClass.js +27 -10
  75. package/lib/util/negateValue.js +25 -8
  76. package/lib/util/normalizeConfig.js +155 -87
  77. package/lib/util/normalizeScreens.js +127 -8
  78. package/lib/util/parseAnimationValue.js +44 -40
  79. package/lib/util/parseBoxShadowValue.js +33 -62
  80. package/lib/util/parseDependency.js +39 -55
  81. package/lib/util/parseGlob.js +36 -0
  82. package/lib/util/parseObjectStyles.js +15 -10
  83. package/lib/util/pluginUtils.js +154 -59
  84. package/lib/util/prefixSelector.js +29 -10
  85. package/lib/util/pseudoElements.js +209 -0
  86. package/lib/util/removeAlphaVariables.js +31 -0
  87. package/lib/util/resolveConfig.js +96 -95
  88. package/lib/util/resolveConfigPath.js +29 -10
  89. package/lib/util/responsive.js +11 -6
  90. package/lib/util/splitAtTopLevelOnly.js +51 -0
  91. package/lib/util/tap.js +6 -1
  92. package/lib/util/toColorValue.js +7 -2
  93. package/lib/util/toPath.js +22 -4
  94. package/lib/util/transformThemeValue.js +40 -26
  95. package/lib/util/validateConfig.js +48 -0
  96. package/lib/util/validateFormalSyntax.js +26 -0
  97. package/lib/util/withAlphaVariable.js +27 -15
  98. package/lib/value-parser/LICENSE +22 -0
  99. package/lib/value-parser/README.md +3 -0
  100. package/lib/value-parser/index.d.js +2 -0
  101. package/lib/value-parser/index.js +22 -0
  102. package/lib/value-parser/parse.js +259 -0
  103. package/lib/value-parser/stringify.js +38 -0
  104. package/lib/value-parser/unit.js +86 -0
  105. package/lib/value-parser/walk.js +16 -0
  106. package/loadConfig.d.ts +4 -0
  107. package/loadConfig.js +2 -0
  108. package/package.json +54 -52
  109. package/plugin.d.ts +10 -5
  110. package/resolveConfig.d.ts +12 -0
  111. package/scripts/generate-types.js +53 -0
  112. package/scripts/release-channel.js +18 -0
  113. package/scripts/release-notes.js +21 -0
  114. package/scripts/type-utils.js +27 -0
  115. package/src/cli/build/index.js +53 -0
  116. package/src/cli/build/plugin.js +465 -0
  117. package/src/cli/build/utils.js +76 -0
  118. package/src/cli/build/watching.js +229 -0
  119. package/src/cli/help/index.js +70 -0
  120. package/src/cli/index.js +217 -0
  121. package/src/cli/init/index.js +79 -0
  122. package/src/cli.js +1 -836
  123. package/src/corePluginList.js +1 -1
  124. package/src/corePlugins.js +576 -106
  125. package/src/css/preflight.css +13 -5
  126. package/src/featureFlags.js +17 -3
  127. package/src/index.js +1 -42
  128. package/src/lib/collapseAdjacentRules.js +5 -1
  129. package/src/lib/content.js +240 -0
  130. package/src/lib/defaultExtractor.js +202 -35
  131. package/src/lib/detectNesting.js +9 -1
  132. package/src/lib/evaluateTailwindFunctions.js +82 -8
  133. package/src/lib/expandApplyAtRules.js +322 -189
  134. package/src/lib/expandTailwindAtRules.js +82 -59
  135. package/src/lib/findAtConfigPath.js +48 -0
  136. package/src/lib/generateRules.js +413 -132
  137. package/src/lib/getModuleDependencies.js +70 -30
  138. package/src/lib/handleImportAtRules.js +34 -0
  139. package/src/lib/load-config.ts +31 -0
  140. package/src/lib/normalizeTailwindDirectives.js +0 -27
  141. package/src/lib/offsets.js +373 -0
  142. package/src/lib/regex.js +74 -0
  143. package/src/lib/remap-bitfield.js +82 -0
  144. package/src/lib/resolveDefaultsAtRules.js +53 -36
  145. package/src/lib/setupContextUtils.js +570 -151
  146. package/src/lib/setupTrackingContext.js +44 -58
  147. package/src/lib/sharedState.js +13 -4
  148. package/src/plugin.js +128 -0
  149. package/src/postcss-plugins/nesting/README.md +2 -2
  150. package/src/public/colors.js +22 -0
  151. package/src/public/default-config.js +1 -1
  152. package/src/public/default-theme.js +2 -2
  153. package/src/public/load-config.js +2 -0
  154. package/src/util/applyImportantSelector.js +27 -0
  155. package/src/util/buildMediaQuery.js +5 -3
  156. package/src/util/cloneNodes.js +5 -1
  157. package/src/util/color.js +34 -17
  158. package/src/util/colorNames.js +150 -0
  159. package/src/util/dataTypes.js +67 -23
  160. package/src/util/formatVariantSelector.js +264 -144
  161. package/src/util/getAllConfigs.js +21 -2
  162. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  163. package/src/util/log.js +25 -1
  164. package/src/util/nameClass.js +4 -0
  165. package/src/util/negateValue.js +11 -3
  166. package/src/util/normalizeConfig.js +78 -20
  167. package/src/util/normalizeScreens.js +99 -4
  168. package/src/util/parseBoxShadowValue.js +3 -50
  169. package/src/util/parseDependency.js +37 -42
  170. package/src/util/parseGlob.js +24 -0
  171. package/src/util/pluginUtils.js +118 -23
  172. package/src/util/prefixSelector.js +28 -10
  173. package/src/util/pseudoElements.js +167 -0
  174. package/src/util/removeAlphaVariables.js +24 -0
  175. package/src/util/resolveConfig.js +70 -62
  176. package/src/util/resolveConfigPath.js +12 -1
  177. package/src/util/splitAtTopLevelOnly.js +52 -0
  178. package/src/util/toPath.js +1 -1
  179. package/src/util/transformThemeValue.js +13 -3
  180. package/src/util/validateConfig.js +36 -0
  181. package/src/util/validateFormalSyntax.js +34 -0
  182. package/src/util/withAlphaVariable.js +1 -1
  183. package/src/value-parser/LICENSE +22 -0
  184. package/src/value-parser/README.md +3 -0
  185. package/src/value-parser/index.d.ts +177 -0
  186. package/src/value-parser/index.js +28 -0
  187. package/src/value-parser/parse.js +303 -0
  188. package/src/value-parser/stringify.js +41 -0
  189. package/src/value-parser/unit.js +118 -0
  190. package/src/value-parser/walk.js +18 -0
  191. package/stubs/.gitignore +1 -0
  192. package/stubs/.prettierrc.json +6 -0
  193. package/stubs/{defaultConfig.stub.js → config.full.js} +215 -165
  194. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
  195. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  196. package/stubs/postcss.config.js +5 -0
  197. package/stubs/tailwind.config.cjs +2 -0
  198. package/stubs/tailwind.config.js +2 -0
  199. package/stubs/tailwind.config.ts +3 -0
  200. package/types/config.d.ts +102 -56
  201. package/types/generated/colors.d.ts +22 -0
  202. package/types/generated/corePluginList.d.ts +1 -1
  203. package/types/generated/default-theme.d.ts +372 -0
  204. package/types/index.d.ts +7 -1
  205. package/CHANGELOG.md +0 -2099
  206. package/lib/cli-peer-dependencies.js +0 -15
  207. package/lib/constants.js +0 -37
  208. package/peers/index.js +0 -75156
  209. package/scripts/install-integrations.js +0 -27
  210. package/scripts/rebuildFixtures.js +0 -68
  211. package/src/cli-peer-dependencies.js +0 -9
  212. package/src/constants.js +0 -17
  213. package/types.d.ts +0 -1
@@ -22,6 +22,8 @@
22
22
  2. Prevent adjustments of font size after orientation changes in iOS.
23
23
  3. Use a more readable tab size.
24
24
  4. Use the user's configured `sans` font-family by default.
25
+ 5. Use the user's configured `sans` font-feature-settings by default.
26
+ 6. Use the user's configured `sans` font-variation-settings by default.
25
27
  */
26
28
 
27
29
  html {
@@ -30,6 +32,8 @@ html {
30
32
  -moz-tab-size: 4; /* 3 */
31
33
  tab-size: 4; /* 3 */
32
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 */
35
+ font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
36
+ font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
33
37
  }
34
38
 
35
39
  /*
@@ -159,7 +163,10 @@ optgroup,
159
163
  select,
160
164
  textarea {
161
165
  font-family: inherit; /* 1 */
166
+ font-feature-settings: inherit; /* 1 */
167
+ font-variation-settings: inherit; /* 1 */
162
168
  font-size: 100%; /* 1 */
169
+ font-weight: inherit; /* 1 */
163
170
  line-height: inherit; /* 1 */
164
171
  color: inherit; /* 1 */
165
172
  margin: 0; /* 2 */
@@ -259,7 +266,7 @@ summary {
259
266
  }
260
267
 
261
268
  /*
262
- Removes the default spacing and border for appropriate elements.
269
+ Removes the default spacing for appropriate elements.
263
270
  */
264
271
 
265
272
  blockquote,
@@ -295,6 +302,10 @@ menu {
295
302
  padding: 0;
296
303
  }
297
304
 
305
+ dialog {
306
+ padding: 0;
307
+ }
308
+
298
309
  /*
299
310
  Prevent resizing textareas horizontally by default.
300
311
  */
@@ -358,10 +369,7 @@ video {
358
369
  height: auto;
359
370
  }
360
371
 
361
- /*
362
- Ensure the default browser behavior of the `hidden` attribute.
363
- */
364
-
372
+ /* Make elements with the HTML hidden attribute stay hidden by default */
365
373
  [hidden] {
366
374
  display: none;
367
375
  }
@@ -2,58 +2,83 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.flagEnabled = flagEnabled;
6
- exports.issueFlagNotices = issueFlagNotices;
7
- exports.default = void 0;
8
- var _picocolors = _interopRequireDefault(require("picocolors"));
9
- var _log = _interopRequireDefault(require("./util/log"));
10
- function _interopRequireDefault(obj) {
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
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
+ }
24
+ });
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) {
11
28
  return obj && obj.__esModule ? obj : {
12
29
  default: obj
13
30
  };
14
31
  }
15
32
  let defaults = {
16
- optimizeUniversalDefaults: false
33
+ optimizeUniversalDefaults: false,
34
+ disableColorOpacityUtilitiesByDefault: false,
35
+ relativeContentPathsByDefault: false,
36
+ oxideParser: true,
37
+ logicalSiblingUtilities: false
17
38
  };
18
39
  let featureFlags = {
19
- future: [],
40
+ future: [
41
+ "hoverOnlyWhenSupported",
42
+ "respectDefaultRingColorOpacity",
43
+ "disableColorOpacityUtilitiesByDefault",
44
+ "relativeContentPathsByDefault",
45
+ "logicalSiblingUtilities"
46
+ ],
20
47
  experimental: [
21
- 'optimizeUniversalDefaults'
48
+ "optimizeUniversalDefaults",
49
+ "oxideParser"
22
50
  ]
23
51
  };
24
52
  function flagEnabled(config, flag) {
25
53
  if (featureFlags.future.includes(flag)) {
26
- var ref;
27
- var ref1, ref2;
28
- 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);
29
57
  }
30
58
  if (featureFlags.experimental.includes(flag)) {
31
- var ref3;
32
- var ref4, ref5;
33
- 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);
34
62
  }
35
63
  return false;
36
64
  }
37
65
  function experimentalFlagsEnabled(config) {
38
- if (config.experimental === 'all') {
66
+ if (config.experimental === "all") {
39
67
  return featureFlags.experimental;
40
68
  }
41
- var ref;
42
- 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]
43
- );
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]);
44
71
  }
45
72
  function issueFlagNotices(config) {
46
73
  if (process.env.JEST_WORKER_ID !== undefined) {
47
74
  return;
48
75
  }
49
76
  if (experimentalFlagsEnabled(config).length > 0) {
50
- let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)
51
- ).join(', ');
52
- _log.default.warn('experimental-flags-enabled', [
77
+ let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
78
+ _log.default.warn("experimental-flags-enabled", [
53
79
  `You have enabled experimental features: ${changes}`,
54
- 'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.',
80
+ "Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
55
81
  ]);
56
82
  }
57
83
  }
58
- var _default = featureFlags;
59
- exports.default = _default;
84
+ const _default = featureFlags;
package/lib/index.js CHANGED
@@ -1,41 +1,2 @@
1
1
  "use strict";
2
- var _setupTrackingContext = _interopRequireDefault(require("./lib/setupTrackingContext"));
3
- var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
4
- var _sharedState = require("./lib/sharedState");
5
- function _interopRequireDefault(obj) {
6
- return obj && obj.__esModule ? obj : {
7
- default: obj
8
- };
9
- }
10
- module.exports = function tailwindcss(configOrPath) {
11
- return {
12
- postcssPlugin: 'tailwindcss',
13
- plugins: [
14
- _sharedState.env.DEBUG && function(root) {
15
- console.log('\n');
16
- console.time('JIT TOTAL');
17
- return root;
18
- },
19
- function(root, result) {
20
- let context = (0, _setupTrackingContext).default(configOrPath);
21
- if (root.type === 'document') {
22
- let roots = root.nodes.filter((node)=>node.type === 'root'
23
- );
24
- for (const root1 of roots){
25
- if (root1.type === 'root') {
26
- (0, _processTailwindFeatures).default(context)(root1, result);
27
- }
28
- }
29
- return;
30
- }
31
- (0, _processTailwindFeatures).default(context)(root, result);
32
- },
33
- _sharedState.env.DEBUG && function(root) {
34
- console.timeEnd('JIT TOTAL');
35
- console.log('\n');
36
- return root;
37
- },
38
- ].filter(Boolean)
39
- };
40
- };
41
- module.exports.postcss = true;
2
+ module.exports = require("./plugin");
@@ -2,34 +2,57 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.hasContentChanged = hasContentChanged;
6
- var _crypto = _interopRequireDefault(require("crypto"));
7
- var sharedState = _interopRequireWildcard(require("./sharedState"));
8
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "hasContentChanged", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return hasContentChanged;
9
+ }
10
+ });
11
+ const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
12
+ const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
13
+ function _interop_require_default(obj) {
9
14
  return obj && obj.__esModule ? obj : {
10
15
  default: obj
11
16
  };
12
17
  }
13
- function _interopRequireWildcard(obj) {
14
- if (obj && obj.__esModule) {
18
+ function _getRequireWildcardCache(nodeInterop) {
19
+ if (typeof WeakMap !== "function") return null;
20
+ var cacheBabelInterop = new WeakMap();
21
+ var cacheNodeInterop = new WeakMap();
22
+ return (_getRequireWildcardCache = function(nodeInterop) {
23
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
24
+ })(nodeInterop);
25
+ }
26
+ function _interop_require_wildcard(obj, nodeInterop) {
27
+ if (!nodeInterop && obj && obj.__esModule) {
15
28
  return obj;
16
- } else {
17
- var newObj = {};
18
- if (obj != null) {
19
- for(var key in obj){
20
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
21
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
22
- if (desc.get || desc.set) {
23
- Object.defineProperty(newObj, key, desc);
24
- } else {
25
- newObj[key] = obj[key];
26
- }
27
- }
29
+ }
30
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
31
+ return {
32
+ default: obj
33
+ };
34
+ }
35
+ var cache = _getRequireWildcardCache(nodeInterop);
36
+ if (cache && cache.has(obj)) {
37
+ return cache.get(obj);
38
+ }
39
+ var newObj = {};
40
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
41
+ for(var key in obj){
42
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
43
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
44
+ if (desc && (desc.get || desc.set)) {
45
+ Object.defineProperty(newObj, key, desc);
46
+ } else {
47
+ newObj[key] = obj[key];
28
48
  }
29
49
  }
30
- newObj.default = obj;
31
- return newObj;
32
50
  }
51
+ newObj.default = obj;
52
+ if (cache) {
53
+ cache.set(obj, newObj);
54
+ }
55
+ return newObj;
33
56
  }
34
57
  /**
35
58
  * Calculate the hash of a string.
@@ -49,21 +72,21 @@ function _interopRequireWildcard(obj) {
49
72
  * @param {string} str
50
73
  */ function getHash(str) {
51
74
  try {
52
- return _crypto.default.createHash('md5').update(str, 'utf-8').digest('binary');
75
+ return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
53
76
  } catch (err) {
54
- return '';
77
+ return "";
55
78
  }
56
79
  }
57
80
  function hasContentChanged(sourcePath, root) {
58
81
  let css = root.toString();
59
82
  // We only care about files with @tailwind directives
60
83
  // Other files use an existing context
61
- if (!css.includes('@tailwind')) {
84
+ if (!css.includes("@tailwind")) {
62
85
  return false;
63
86
  }
64
- let existingHash = sharedState.sourceHashMap.get(sourcePath);
87
+ let existingHash = _sharedState.sourceHashMap.get(sourcePath);
65
88
  let rootHash = getHash(css);
66
89
  let didChange = existingHash !== rootHash;
67
- sharedState.sourceHashMap.set(sourcePath, rootHash);
90
+ _sharedState.sourceHashMap.set(sourcePath, rootHash);
68
91
  return didChange;
69
92
  }
@@ -2,14 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = collapseAdjacentRules;
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return collapseAdjacentRules;
9
+ }
10
+ });
6
11
  let comparisonMap = {
7
12
  atrule: [
8
- 'name',
9
- 'params'
13
+ "name",
14
+ "params"
10
15
  ],
11
16
  rule: [
12
- 'selector'
17
+ "selector"
13
18
  ]
14
19
  };
15
20
  let types = new Set(Object.keys(comparisonMap));
@@ -26,12 +31,14 @@ function collapseAdjacentRules() {
26
31
  return;
27
32
  }
28
33
  let properties = comparisonMap[node.type];
29
- var _property, _property1;
30
- if (node.type === 'atrule' && node.name === 'font-face') {
34
+ var _node_property, _currentRule_property;
35
+ if (node.type === "atrule" && node.name === "font-face") {
31
36
  currentRule = node;
32
- } 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, ' ')
33
- )) {
34
- currentRule.append(node.nodes);
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, " "))) {
38
+ // An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
39
+ if (node.nodes) {
40
+ currentRule.append(node.nodes);
41
+ }
35
42
  node.remove();
36
43
  } else {
37
44
  currentRule = node;
@@ -43,7 +50,7 @@ function collapseAdjacentRules() {
43
50
  // explicitly does not handle rule nesting on its own as
44
51
  // the user is expected to use a nesting plugin
45
52
  root.each((node)=>{
46
- if (node.type === 'atrule') {
53
+ if (node.type === "atrule") {
47
54
  collapseRulesIn(node);
48
55
  }
49
56
  });
@@ -2,7 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = collapseDuplicateDeclarations;
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return collapseDuplicateDeclarations;
9
+ }
10
+ });
6
11
  function collapseDuplicateDeclarations() {
7
12
  return (root)=>{
8
13
  root.walkRules((node)=>{
@@ -41,8 +46,8 @@ function collapseDuplicateDeclarations() {
41
46
  });
42
47
  // Drop all the duplicate declarations with the exact same value we've
43
48
  // already seen so far.
44
- for (let decl1 of droppable){
45
- decl1.remove();
49
+ for (let decl of droppable){
50
+ decl.remove();
46
51
  }
47
52
  // Analyze the declarations based on its unit, drop all the declarations
48
53
  // with the same unit but the last one in the list.
@@ -58,9 +63,9 @@ function collapseDuplicateDeclarations() {
58
63
  }
59
64
  byUnit.get(unit).add(decl);
60
65
  }
61
- for (let declarations1 of byUnit.values()){
66
+ for (let declarations of byUnit.values()){
62
67
  // Get all but the last one
63
- let removableDeclarations = Array.from(declarations1).slice(0, -1);
68
+ let removableDeclarations = Array.from(declarations).slice(0, -1);
64
69
  for (let decl of removableDeclarations){
65
70
  decl.remove();
66
71
  }
@@ -69,12 +74,12 @@ function collapseDuplicateDeclarations() {
69
74
  });
70
75
  };
71
76
  }
72
- let UNITLESS_NUMBER = Symbol('unitless-number');
77
+ let UNITLESS_NUMBER = Symbol("unitless-number");
73
78
  function resolveUnit(input) {
74
79
  let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
75
80
  if (result) {
76
- var ref;
77
- 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;
78
83
  }
79
84
  return null;
80
85
  }
@@ -0,0 +1,207 @@
1
+ // @ts-check
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ parseCandidateFiles: function() {
14
+ return parseCandidateFiles;
15
+ },
16
+ resolvedChangedContent: function() {
17
+ return resolvedChangedContent;
18
+ }
19
+ });
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"));
25
+ const _parseGlob = require("../util/parseGlob");
26
+ const _sharedState = require("./sharedState");
27
+ const _oxide = require("@tailwindcss/oxide");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
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
+ }
54
+ function parseCandidateFiles(context, tailwindConfig) {
55
+ let files = resolveContentFiles(tailwindConfig, {
56
+ skip: [
57
+ context.userConfigPath
58
+ ]
59
+ });
60
+ // Normalize the file globs
61
+ files = files.filter((filePath)=>typeof filePath === "string");
62
+ files = files.map(_normalizepath.default);
63
+ // Split into included and excluded globs
64
+ let tasks = _fastglob.default.generateTasks(files);
65
+ /** @type {ContentPath[]} */ let included = [];
66
+ /** @type {ContentPath[]} */ let excluded = [];
67
+ for (const task of tasks){
68
+ included.push(...task.positive.map((filePath)=>parseFilePath(filePath, false)));
69
+ excluded.push(...task.negative.map((filePath)=>parseFilePath(filePath, true)));
70
+ }
71
+ let paths = [
72
+ ...included,
73
+ ...excluded
74
+ ];
75
+ // Resolve paths relative to the config file or cwd
76
+ paths = resolveRelativePaths(context, paths);
77
+ // Resolve symlinks if possible
78
+ paths = paths.flatMap(resolvePathSymlinks);
79
+ // Update cached patterns
80
+ paths = paths.map(resolveGlobPattern);
81
+ return paths;
82
+ }
83
+ /**
84
+ *
85
+ * @param {string} filePath
86
+ * @param {boolean} ignore
87
+ * @returns {ContentPath}
88
+ */ function parseFilePath(filePath, ignore) {
89
+ let contentPath = {
90
+ original: filePath,
91
+ base: filePath,
92
+ ignore,
93
+ pattern: filePath,
94
+ glob: null
95
+ };
96
+ if ((0, _isglob.default)(filePath)) {
97
+ Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
98
+ }
99
+ return contentPath;
100
+ }
101
+ /**
102
+ *
103
+ * @param {ContentPath} contentPath
104
+ * @returns {ContentPath}
105
+ */ function resolveGlobPattern(contentPath) {
106
+ // This is required for Windows support to properly pick up Glob paths.
107
+ // Afaik, this technically shouldn't be needed but there's probably
108
+ // some internal, direct path matching with a normalized path in
109
+ // a package which can't handle mixed directory separators
110
+ let base = (0, _normalizepath.default)(contentPath.base);
111
+ // If the user's file path contains any special characters (like parens) for instance fast-glob
112
+ // is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
113
+ base = _fastglob.default.escapePath(base);
114
+ contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
115
+ contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
116
+ return contentPath;
117
+ }
118
+ /**
119
+ * Resolve each path relative to the config file (when possible) if the experimental flag is enabled
120
+ * Otherwise, resolve relative to the current working directory
121
+ *
122
+ * @param {any} context
123
+ * @param {ContentPath[]} contentPaths
124
+ * @returns {ContentPath[]}
125
+ */ function resolveRelativePaths(context, contentPaths) {
126
+ let resolveFrom = [];
127
+ // Resolve base paths relative to the config file (when possible) if the experimental flag is enabled
128
+ if (context.userConfigPath && context.tailwindConfig.content.relative) {
129
+ resolveFrom = [
130
+ _path.default.dirname(context.userConfigPath)
131
+ ];
132
+ }
133
+ return contentPaths.map((contentPath)=>{
134
+ contentPath.base = _path.default.resolve(...resolveFrom, contentPath.base);
135
+ return contentPath;
136
+ });
137
+ }
138
+ /**
139
+ * Resolve the symlink for the base directory / file in each path
140
+ * These are added as additional dependencies to watch for changes because
141
+ * some tools (like webpack) will only watch the actual file or directory
142
+ * but not the symlink itself even in projects that use monorepos.
143
+ *
144
+ * @param {ContentPath} contentPath
145
+ * @returns {ContentPath[]}
146
+ */ function resolvePathSymlinks(contentPath) {
147
+ let paths = [
148
+ contentPath
149
+ ];
150
+ try {
151
+ let resolvedPath = _fs.default.realpathSync(contentPath.base);
152
+ if (resolvedPath !== contentPath.base) {
153
+ paths.push({
154
+ ...contentPath,
155
+ base: resolvedPath
156
+ });
157
+ }
158
+ } catch {
159
+ // TODO: log this?
160
+ }
161
+ return paths;
162
+ }
163
+ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
164
+ let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
165
+ content: raw,
166
+ extension
167
+ }));
168
+ let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
169
+ for (let changedFile of changedFiles){
170
+ let extension = _path.default.extname(changedFile).slice(1);
171
+ changedContent.push({
172
+ file: changedFile,
173
+ extension
174
+ });
175
+ }
176
+ return [
177
+ changedContent,
178
+ mTimesToCommit
179
+ ];
180
+ }
181
+ /**
182
+ *
183
+ * @param {ContentPath[]} candidateFiles
184
+ * @param {Map<string, number>} fileModifiedMap
185
+ * @returns {[Set<string>, Map<string, number>]}
186
+ */ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
187
+ let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
188
+ let mTimesToCommit = new Map();
189
+ let changedFiles = new Set();
190
+ _sharedState.env.DEBUG && console.time("Finding changed files");
191
+ let files = _fastglob.default.sync(paths, {
192
+ absolute: true
193
+ });
194
+ for (let file of files){
195
+ let prevModified = fileModifiedMap.get(file) || -Infinity;
196
+ let modified = _fs.default.statSync(file).mtimeMs;
197
+ if (modified > prevModified) {
198
+ changedFiles.add(file);
199
+ mTimesToCommit.set(file, modified);
200
+ }
201
+ }
202
+ _sharedState.env.DEBUG && console.timeEnd("Finding changed files");
203
+ return [
204
+ changedFiles,
205
+ mTimesToCommit
206
+ ];
207
+ }