tailwindcss 0.0.0-insiders.eebf529 → 0.0.0-insiders.ef2ebb2

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 (227) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/defaultConfig.d.ts +3 -0
  5. package/defaultTheme.d.ts +4 -0
  6. package/index.css +5 -0
  7. package/lib/cli/build/index.js +57 -0
  8. package/lib/cli/build/plugin.js +433 -0
  9. package/lib/cli/build/utils.js +88 -0
  10. package/lib/cli/build/watching.js +182 -0
  11. package/lib/cli/help/index.js +73 -0
  12. package/lib/cli/index.js +231 -0
  13. package/lib/cli/init/index.js +63 -0
  14. package/lib/cli.js +1 -704
  15. package/lib/corePluginList.js +13 -3
  16. package/lib/corePlugins.js +2399 -1867
  17. package/lib/css/preflight.css +17 -9
  18. package/lib/featureFlags.js +50 -26
  19. package/lib/index.js +1 -31
  20. package/lib/lib/cacheInvalidation.js +92 -0
  21. package/lib/lib/collapseAdjacentRules.js +30 -10
  22. package/lib/lib/collapseDuplicateDeclarations.js +60 -4
  23. package/lib/lib/content.js +207 -0
  24. package/lib/lib/defaultExtractor.js +243 -0
  25. package/lib/lib/detectNesting.js +21 -10
  26. package/lib/lib/evaluateTailwindFunctions.js +117 -50
  27. package/lib/lib/expandApplyAtRules.js +467 -161
  28. package/lib/lib/expandTailwindAtRules.js +200 -133
  29. package/lib/lib/findAtConfigPath.js +46 -0
  30. package/lib/lib/generateRules.js +550 -200
  31. package/lib/lib/getModuleDependencies.js +88 -37
  32. package/lib/lib/handleImportAtRules.js +50 -0
  33. package/lib/lib/load-config.js +42 -0
  34. package/lib/lib/normalizeTailwindDirectives.js +36 -38
  35. package/lib/lib/offsets.js +306 -0
  36. package/lib/lib/partitionApplyAtRules.js +58 -0
  37. package/lib/lib/regex.js +74 -0
  38. package/lib/lib/remap-bitfield.js +89 -0
  39. package/lib/lib/resolveDefaultsAtRules.js +98 -58
  40. package/lib/lib/setupContextUtils.js +767 -325
  41. package/lib/lib/setupTrackingContext.js +71 -75
  42. package/lib/lib/sharedState.js +70 -10
  43. package/lib/lib/substituteScreenAtRules.js +14 -10
  44. package/lib/plugin.js +166 -0
  45. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  46. package/lib/postcss-plugins/nesting/index.js +21 -0
  47. package/lib/postcss-plugins/nesting/plugin.js +89 -0
  48. package/lib/processTailwindFeatures.js +39 -26
  49. package/lib/public/colors.js +272 -246
  50. package/lib/public/create-plugin.js +9 -5
  51. package/lib/public/default-config.js +10 -6
  52. package/lib/public/default-theme.js +10 -6
  53. package/lib/public/load-config.js +12 -0
  54. package/lib/public/resolve-config.js +11 -6
  55. package/lib/util/applyImportantSelector.js +36 -0
  56. package/lib/util/bigSign.js +6 -1
  57. package/lib/util/buildMediaQuery.js +13 -6
  58. package/lib/util/cloneDeep.js +9 -6
  59. package/lib/util/cloneNodes.js +23 -3
  60. package/lib/util/color.js +70 -38
  61. package/lib/util/colorNames.js +752 -0
  62. package/lib/util/configurePlugins.js +7 -2
  63. package/lib/util/createPlugin.js +8 -6
  64. package/lib/util/createUtilityPlugin.js +16 -16
  65. package/lib/util/dataTypes.js +182 -111
  66. package/lib/util/defaults.js +14 -3
  67. package/lib/util/escapeClassName.js +13 -8
  68. package/lib/util/escapeCommas.js +7 -2
  69. package/lib/util/flattenColorPalette.js +11 -12
  70. package/lib/util/formatVariantSelector.js +228 -151
  71. package/lib/util/getAllConfigs.js +33 -12
  72. package/lib/util/hashConfig.js +9 -4
  73. package/lib/util/isKeyframeRule.js +7 -2
  74. package/lib/util/isPlainObject.js +7 -2
  75. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  76. package/lib/util/log.js +44 -13
  77. package/lib/util/nameClass.js +27 -10
  78. package/lib/util/negateValue.js +25 -8
  79. package/lib/util/normalizeConfig.js +167 -67
  80. package/lib/util/normalizeScreens.js +128 -11
  81. package/lib/util/parseAnimationValue.js +44 -40
  82. package/lib/util/parseBoxShadowValue.js +34 -23
  83. package/lib/util/parseDependency.js +39 -55
  84. package/lib/util/parseGlob.js +36 -0
  85. package/lib/util/parseObjectStyles.js +15 -10
  86. package/lib/util/pluginUtils.js +157 -69
  87. package/lib/util/prefixSelector.js +30 -12
  88. package/lib/util/pseudoElements.js +209 -0
  89. package/lib/util/removeAlphaVariables.js +31 -0
  90. package/lib/util/resolveConfig.js +101 -79
  91. package/lib/util/resolveConfigPath.js +30 -12
  92. package/lib/util/responsive.js +11 -6
  93. package/lib/util/splitAtTopLevelOnly.js +51 -0
  94. package/lib/util/tap.js +6 -1
  95. package/lib/util/toColorValue.js +7 -3
  96. package/lib/util/toPath.js +26 -3
  97. package/lib/util/transformThemeValue.js +40 -30
  98. package/lib/util/validateConfig.js +48 -0
  99. package/lib/util/validateFormalSyntax.js +26 -0
  100. package/lib/util/withAlphaVariable.js +27 -15
  101. package/lib/value-parser/LICENSE +22 -0
  102. package/lib/value-parser/README.md +3 -0
  103. package/lib/value-parser/index.d.js +2 -0
  104. package/lib/value-parser/index.js +22 -0
  105. package/lib/value-parser/parse.js +259 -0
  106. package/lib/value-parser/stringify.js +38 -0
  107. package/lib/value-parser/unit.js +86 -0
  108. package/lib/value-parser/walk.js +16 -0
  109. package/loadConfig.d.ts +4 -0
  110. package/loadConfig.js +2 -0
  111. package/nesting/index.js +2 -12
  112. package/package.json +63 -62
  113. package/plugin.d.ts +11 -0
  114. package/resolveConfig.d.ts +12 -0
  115. package/scripts/generate-types.js +105 -0
  116. package/scripts/release-channel.js +18 -0
  117. package/scripts/release-notes.js +21 -0
  118. package/scripts/type-utils.js +27 -0
  119. package/src/cli/build/index.js +53 -0
  120. package/src/cli/build/plugin.js +476 -0
  121. package/src/cli/build/utils.js +76 -0
  122. package/src/cli/build/watching.js +229 -0
  123. package/src/cli/help/index.js +70 -0
  124. package/src/cli/index.js +217 -0
  125. package/src/cli/init/index.js +79 -0
  126. package/src/cli.js +1 -766
  127. package/src/corePluginList.js +1 -1
  128. package/src/corePlugins.js +800 -296
  129. package/src/css/preflight.css +17 -9
  130. package/src/featureFlags.js +20 -6
  131. package/src/index.js +1 -34
  132. package/src/lib/cacheInvalidation.js +52 -0
  133. package/src/lib/collapseAdjacentRules.js +21 -2
  134. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  135. package/src/lib/content.js +240 -0
  136. package/src/lib/defaultExtractor.js +217 -0
  137. package/src/lib/detectNesting.js +9 -1
  138. package/src/lib/evaluateTailwindFunctions.js +83 -9
  139. package/src/lib/expandApplyAtRules.js +515 -153
  140. package/src/lib/expandTailwindAtRules.js +147 -86
  141. package/src/lib/findAtConfigPath.js +48 -0
  142. package/src/lib/generateRules.js +541 -147
  143. package/src/lib/getModuleDependencies.js +70 -30
  144. package/src/lib/handleImportAtRules.js +34 -0
  145. package/src/lib/load-config.ts +31 -0
  146. package/src/lib/normalizeTailwindDirectives.js +5 -26
  147. package/src/lib/offsets.js +373 -0
  148. package/src/lib/partitionApplyAtRules.js +52 -0
  149. package/src/lib/regex.js +74 -0
  150. package/src/lib/remap-bitfield.js +82 -0
  151. package/src/lib/resolveDefaultsAtRules.js +59 -17
  152. package/src/lib/setupContextUtils.js +693 -176
  153. package/src/lib/setupTrackingContext.js +52 -65
  154. package/src/lib/sharedState.js +54 -7
  155. package/src/plugin.js +141 -0
  156. package/src/postcss-plugins/nesting/README.md +42 -0
  157. package/src/postcss-plugins/nesting/index.js +13 -0
  158. package/src/postcss-plugins/nesting/plugin.js +80 -0
  159. package/src/processTailwindFeatures.js +12 -2
  160. package/src/public/colors.js +22 -0
  161. package/src/public/default-config.js +1 -1
  162. package/src/public/default-theme.js +2 -2
  163. package/src/public/load-config.js +2 -0
  164. package/src/util/applyImportantSelector.js +27 -0
  165. package/src/util/buildMediaQuery.js +5 -3
  166. package/src/util/cloneNodes.js +19 -2
  167. package/src/util/color.js +44 -12
  168. package/src/util/colorNames.js +150 -0
  169. package/src/util/dataTypes.js +67 -23
  170. package/src/util/defaults.js +6 -0
  171. package/src/util/formatVariantSelector.js +264 -144
  172. package/src/util/getAllConfigs.js +21 -2
  173. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  174. package/src/util/log.js +35 -7
  175. package/src/util/nameClass.js +4 -0
  176. package/src/util/negateValue.js +11 -3
  177. package/src/util/normalizeConfig.js +86 -7
  178. package/src/util/normalizeScreens.js +99 -4
  179. package/src/util/parseBoxShadowValue.js +4 -3
  180. package/src/util/parseDependency.js +37 -42
  181. package/src/util/parseGlob.js +24 -0
  182. package/src/util/pluginUtils.js +118 -23
  183. package/src/util/prefixSelector.js +30 -10
  184. package/src/util/pseudoElements.js +167 -0
  185. package/src/util/removeAlphaVariables.js +24 -0
  186. package/src/util/resolveConfig.js +74 -26
  187. package/src/util/resolveConfigPath.js +12 -1
  188. package/src/util/splitAtTopLevelOnly.js +52 -0
  189. package/src/util/toPath.js +23 -1
  190. package/src/util/transformThemeValue.js +13 -3
  191. package/src/util/validateConfig.js +36 -0
  192. package/src/util/validateFormalSyntax.js +34 -0
  193. package/src/util/withAlphaVariable.js +1 -1
  194. package/src/value-parser/LICENSE +22 -0
  195. package/src/value-parser/README.md +3 -0
  196. package/src/value-parser/index.d.ts +177 -0
  197. package/src/value-parser/index.js +28 -0
  198. package/src/value-parser/parse.js +303 -0
  199. package/src/value-parser/stringify.js +41 -0
  200. package/src/value-parser/unit.js +118 -0
  201. package/src/value-parser/walk.js +18 -0
  202. package/stubs/.gitignore +1 -0
  203. package/stubs/.prettierrc.json +6 -0
  204. package/stubs/{defaultConfig.stub.js → config.full.js} +220 -167
  205. package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
  206. package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
  207. package/stubs/postcss.config.js +5 -0
  208. package/stubs/tailwind.config.cjs +2 -0
  209. package/stubs/tailwind.config.js +2 -0
  210. package/stubs/tailwind.config.ts +3 -0
  211. package/types/config.d.ts +369 -0
  212. package/types/generated/.gitkeep +0 -0
  213. package/types/generated/colors.d.ts +298 -0
  214. package/types/generated/corePluginList.d.ts +1 -0
  215. package/types/generated/default-theme.d.ts +372 -0
  216. package/types/index.d.ts +7 -0
  217. package/CHANGELOG.md +0 -1853
  218. package/lib/cli-peer-dependencies.js +0 -15
  219. package/lib/constants.js +0 -37
  220. package/lib/lib/setupWatchingContext.js +0 -288
  221. package/nesting/plugin.js +0 -41
  222. package/peers/index.js +0 -76107
  223. package/scripts/install-integrations.js +0 -27
  224. package/scripts/rebuildFixtures.js +0 -68
  225. package/src/cli-peer-dependencies.js +0 -9
  226. package/src/constants.js +0 -17
  227. package/src/lib/setupWatchingContext.js +0 -311
package/lib/util/log.js CHANGED
@@ -2,25 +2,57 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = void 0;
6
- var _chalk = _interopRequireDefault(require("chalk"));
7
- 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
+ dim: function() {
13
+ return dim;
14
+ },
15
+ default: function() {
16
+ return _default;
17
+ }
18
+ });
19
+ const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
20
+ function _interop_require_default(obj) {
8
21
  return obj && obj.__esModule ? obj : {
9
22
  default: obj
10
23
  };
11
24
  }
12
25
  let alreadyShown = new Set();
13
- function log(chalk, messages, key) {
14
- if (process.env.JEST_WORKER_ID !== undefined) return;
26
+ function log(type, messages, key) {
27
+ if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
15
28
  if (key && alreadyShown.has(key)) return;
16
29
  if (key) alreadyShown.add(key);
17
- console.warn('');
18
- messages.forEach((message)=>console.warn(chalk, '-', message)
19
- );
30
+ console.warn("");
31
+ messages.forEach((message)=>console.warn(type, "-", message));
32
+ }
33
+ function dim(input) {
34
+ return _picocolors.default.dim(input);
20
35
  }
21
- var _default = {
36
+ const _default = {
37
+ group (key, cb) {
38
+ if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
39
+ if (key && alreadyShown.has(key)) return;
40
+ if (key) alreadyShown.add(key);
41
+ console.warn("");
42
+ cb({
43
+ info (messages) {
44
+ messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.cyan("info")), "-", message));
45
+ },
46
+ warn (messages) {
47
+ messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.yellow("warn")), "-", message));
48
+ },
49
+ risk (messages) {
50
+ messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.magenta("risk")), "-", message));
51
+ }
52
+ });
53
+ },
22
54
  info (key, messages) {
23
- log(_chalk.default.bold.cyan('info'), ...Array.isArray(key) ? [
55
+ log(_picocolors.default.bold(_picocolors.default.cyan("info")), ...Array.isArray(key) ? [
24
56
  key
25
57
  ] : [
26
58
  messages,
@@ -28,7 +60,7 @@ var _default = {
28
60
  ]);
29
61
  },
30
62
  warn (key, messages) {
31
- log(_chalk.default.bold.yellow('warn'), ...Array.isArray(key) ? [
63
+ log(_picocolors.default.bold(_picocolors.default.yellow("warn")), ...Array.isArray(key) ? [
32
64
  key
33
65
  ] : [
34
66
  messages,
@@ -36,7 +68,7 @@ var _default = {
36
68
  ]);
37
69
  },
38
70
  risk (key, messages) {
39
- log(_chalk.default.bold.magenta('risk'), ...Array.isArray(key) ? [
71
+ log(_picocolors.default.bold(_picocolors.default.magenta("risk")), ...Array.isArray(key) ? [
40
72
  key
41
73
  ] : [
42
74
  messages,
@@ -44,4 +76,3 @@ var _default = {
44
76
  ]);
45
77
  }
46
78
  };
47
- exports.default = _default;
@@ -2,31 +2,48 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.asClass = asClass;
6
- exports.default = nameClass;
7
- exports.formatClass = formatClass;
8
- var _escapeClassName = _interopRequireDefault(require("./escapeClassName"));
9
- var _escapeCommas = _interopRequireDefault(require("./escapeCommas"));
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
+ asClass: function() {
13
+ return asClass;
14
+ },
15
+ default: function() {
16
+ return nameClass;
17
+ },
18
+ formatClass: function() {
19
+ return formatClass;
20
+ }
21
+ });
22
+ const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("./escapeClassName"));
23
+ const _escapeCommas = /*#__PURE__*/ _interop_require_default(require("./escapeCommas"));
24
+ function _interop_require_default(obj) {
11
25
  return obj && obj.__esModule ? obj : {
12
26
  default: obj
13
27
  };
14
28
  }
15
29
  function asClass(name) {
16
- return (0, _escapeCommas).default(`.${(0, _escapeClassName).default(name)}`);
30
+ return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
17
31
  }
18
32
  function nameClass(classPrefix, key) {
19
33
  return asClass(formatClass(classPrefix, key));
20
34
  }
21
35
  function formatClass(classPrefix, key) {
22
- if (key === 'DEFAULT') {
36
+ if (key === "DEFAULT") {
23
37
  return classPrefix;
24
38
  }
25
- if (key === '-' || key === '-DEFAULT') {
39
+ if (key === "-" || key === "-DEFAULT") {
26
40
  return `-${classPrefix}`;
27
41
  }
28
- if (key.startsWith('-')) {
42
+ if (key.startsWith("-")) {
29
43
  return `-${classPrefix}${key}`;
30
44
  }
45
+ if (key.startsWith("/")) {
46
+ return `${classPrefix}${key}`;
47
+ }
31
48
  return `${classPrefix}-${key}`;
32
49
  }
@@ -2,18 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = _default;
6
- function _default(value) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return negateValue;
9
+ }
10
+ });
11
+ function negateValue(value) {
7
12
  value = `${value}`;
8
- if (value === '0') {
9
- return '0';
13
+ if (value === "0") {
14
+ return "0";
10
15
  }
11
16
  // Flip sign of numbers
12
17
  if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
13
- return value.replace(/^[+-]?/, (sign)=>sign === '-' ? '' : '-'
14
- );
18
+ return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
15
19
  }
16
- if (value.includes('var(') || value.includes('calc(')) {
17
- return `calc(${value} * -1)`;
20
+ // What functions we support negating numeric values for
21
+ // var() isn't inherently a numeric function but we support it anyway
22
+ // The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
23
+ // to produce generally useful results and that will be covered already
24
+ let numericFunctions = [
25
+ "var",
26
+ "calc",
27
+ "min",
28
+ "max",
29
+ "clamp"
30
+ ];
31
+ for (const fn of numericFunctions){
32
+ if (value.includes(`${fn}(`)) {
33
+ return `calc(${value} * -1)`;
34
+ }
18
35
  }
19
36
  }
@@ -2,12 +2,52 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.normalizeConfig = normalizeConfig;
6
- var _log = _interopRequireDefault(require("./log"));
7
- function _interopRequireDefault(obj) {
8
- return obj && obj.__esModule ? obj : {
9
- default: obj
10
- };
5
+ Object.defineProperty(exports, "normalizeConfig", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return normalizeConfig;
9
+ }
10
+ });
11
+ const _featureFlags = require("../featureFlags");
12
+ const _log = /*#__PURE__*/ _interop_require_wildcard(require("./log"));
13
+ function _getRequireWildcardCache(nodeInterop) {
14
+ if (typeof WeakMap !== "function") return null;
15
+ var cacheBabelInterop = new WeakMap();
16
+ var cacheNodeInterop = new WeakMap();
17
+ return (_getRequireWildcardCache = function(nodeInterop) {
18
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
19
+ })(nodeInterop);
20
+ }
21
+ function _interop_require_wildcard(obj, nodeInterop) {
22
+ if (!nodeInterop && obj && obj.__esModule) {
23
+ return obj;
24
+ }
25
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
26
+ return {
27
+ default: obj
28
+ };
29
+ }
30
+ var cache = _getRequireWildcardCache(nodeInterop);
31
+ if (cache && cache.has(obj)) {
32
+ return cache.get(obj);
33
+ }
34
+ var newObj = {};
35
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
36
+ for(var key in obj){
37
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
38
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
39
+ if (desc && (desc.get || desc.set)) {
40
+ Object.defineProperty(newObj, key, desc);
41
+ } else {
42
+ newObj[key] = obj[key];
43
+ }
44
+ }
45
+ }
46
+ newObj.default = obj;
47
+ if (cache) {
48
+ cache.set(obj, newObj);
49
+ }
50
+ return newObj;
11
51
  }
12
52
  function normalizeConfig(config) {
13
53
  // Quick structure validation
@@ -25,6 +65,9 @@ function normalizeConfig(config) {
25
65
  * transform?: TransformerFn | { [extension: string]: TransformerFn }
26
66
  * }
27
67
  */ let valid = (()=>{
68
+ if (config.content === "auto") {
69
+ return true;
70
+ }
28
71
  // `config.purge` should not exist anymore
29
72
  if (config.purge) {
30
73
  return false;
@@ -34,45 +77,45 @@ function normalizeConfig(config) {
34
77
  return false;
35
78
  }
36
79
  // `config.content` should be an object or an array
37
- if (!Array.isArray(config.content) && !(typeof config.content === 'object' && config.content !== null)) {
80
+ if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
38
81
  return false;
39
82
  }
40
83
  // When `config.content` is an array, it should consist of FilePaths or RawFiles
41
84
  if (Array.isArray(config.content)) {
42
85
  return config.content.every((path)=>{
43
86
  // `path` can be a string
44
- if (typeof path === 'string') return true;
87
+ if (typeof path === "string") return true;
45
88
  // `path` can be an object { raw: string, extension?: string }
46
89
  // `raw` must be a string
47
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== 'string') return false;
90
+ if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
48
91
  // `extension` (if provided) should also be a string
49
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== 'string') {
92
+ if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
50
93
  return false;
51
94
  }
52
95
  return true;
53
96
  });
54
97
  }
55
98
  // When `config.content` is an object
56
- if (typeof config.content === 'object' && config.content !== null) {
57
- // Only `files`, `extract` and `transform` can exist in `config.content`
99
+ if (typeof config.content === "object" && config.content !== null) {
100
+ // Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
58
101
  if (Object.keys(config.content).some((key)=>![
59
- 'files',
60
- 'extract',
61
- 'transform'
62
- ].includes(key)
63
- )) {
102
+ "files",
103
+ "relative",
104
+ "extract",
105
+ "transform"
106
+ ].includes(key))) {
64
107
  return false;
65
108
  }
66
109
  // `config.content.files` should exist of FilePaths or RawFiles
67
110
  if (Array.isArray(config.content.files)) {
68
111
  if (!config.content.files.every((path)=>{
69
112
  // `path` can be a string
70
- if (typeof path === 'string') return true;
113
+ if (typeof path === "string") return true;
71
114
  // `path` can be an object { raw: string, extension?: string }
72
115
  // `raw` must be a string
73
- if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== 'string') return false;
116
+ if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
74
117
  // `extension` (if provided) should also be a string
75
- if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== 'string') {
118
+ if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
76
119
  return false;
77
120
  }
78
121
  return true;
@@ -80,23 +123,27 @@ function normalizeConfig(config) {
80
123
  return false;
81
124
  }
82
125
  // `config.content.extract` is optional, and can be a Function or a Record<String, Function>
83
- if (typeof config.content.extract === 'object') {
126
+ if (typeof config.content.extract === "object") {
84
127
  for (let value of Object.values(config.content.extract)){
85
- if (typeof value !== 'function') {
128
+ if (typeof value !== "function") {
86
129
  return false;
87
130
  }
88
131
  }
89
- } else if (!(config.content.extract === undefined || typeof config.content.extract === 'function')) {
132
+ } else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
90
133
  return false;
91
134
  }
92
135
  // `config.content.transform` is optional, and can be a Function or a Record<String, Function>
93
- if (typeof config.content.transform === 'object') {
136
+ if (typeof config.content.transform === "object") {
94
137
  for (let value of Object.values(config.content.transform)){
95
- if (typeof value !== 'function') {
138
+ if (typeof value !== "function") {
96
139
  return false;
97
140
  }
98
141
  }
99
- } else if (!(config.content.transform === undefined || typeof config.content.transform === 'function')) {
142
+ } else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
143
+ return false;
144
+ }
145
+ // `config.content.relative` is optional and can be a boolean
146
+ if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
100
147
  return false;
101
148
  }
102
149
  }
@@ -105,63 +152,91 @@ function normalizeConfig(config) {
105
152
  return false;
106
153
  })();
107
154
  if (!valid) {
108
- _log.default.warn('purge-deprecation', [
109
- 'The `purge`/`content` options have changed in Tailwind CSS v3.0.',
110
- 'Update your configuration file to eliminate this warning.'
155
+ _log.default.warn("purge-deprecation", [
156
+ "The `purge`/`content` options have changed in Tailwind CSS v3.0.",
157
+ "Update your configuration file to eliminate this warning.",
158
+ "https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
111
159
  ]);
112
160
  }
113
161
  // Normalize the `safelist`
114
162
  config.safelist = (()=>{
115
- var ref;
163
+ var _purge_options;
116
164
  let { content , purge , safelist } = config;
117
165
  if (Array.isArray(safelist)) return safelist;
118
166
  if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
119
167
  if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
120
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : (ref = purge.options) === null || ref === void 0 ? void 0 : ref.safelist)) return purge.options.safelist;
168
+ if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge_options = purge.options) === null || _purge_options === void 0 ? void 0 : _purge_options.safelist)) return purge.options.safelist;
169
+ return [];
170
+ })();
171
+ // Normalize the `blocklist`
172
+ config.blocklist = (()=>{
173
+ let { blocklist } = config;
174
+ if (Array.isArray(blocklist)) {
175
+ if (blocklist.every((item)=>typeof item === "string")) {
176
+ return blocklist;
177
+ }
178
+ _log.default.warn("blocklist-invalid", [
179
+ "The `blocklist` option must be an array of strings.",
180
+ "https://tailwindcss.com/docs/content-configuration#discarding-classes"
181
+ ]);
182
+ }
121
183
  return [];
122
184
  })();
123
185
  // Normalize prefix option
124
- if (typeof config.prefix === 'function') {
125
- _log.default.warn('prefix-function', [
126
- 'As of Tailwind CSS v3.0, `prefix` cannot be a function.',
127
- 'Update `prefix` in your configuration to be a string to eliminate this warning.'
186
+ if (typeof config.prefix === "function") {
187
+ _log.default.warn("prefix-function", [
188
+ "As of Tailwind CSS v3.0, `prefix` cannot be a function.",
189
+ "Update `prefix` in your configuration to be a string to eliminate this warning.",
190
+ "https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
128
191
  ]);
129
- config.prefix = '';
192
+ config.prefix = "";
130
193
  } else {
131
- var _prefix;
132
- config.prefix = (_prefix = config.prefix) !== null && _prefix !== void 0 ? _prefix : '';
194
+ var _config_prefix;
195
+ config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
133
196
  }
134
197
  // Normalize the `content`
135
198
  config.content = {
199
+ relative: (()=>{
200
+ let { content } = config;
201
+ if (content === null || content === void 0 ? void 0 : content.relative) {
202
+ return content.relative;
203
+ }
204
+ return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
205
+ })(),
136
206
  files: (()=>{
137
207
  let { content , purge } = config;
138
- if (Array.isArray(purge)) return purge;
139
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
208
+ if (content === undefined && purge === undefined) return [];
209
+ if (purge) {
210
+ if (Array.isArray(purge)) return purge;
211
+ if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
212
+ return [];
213
+ }
140
214
  if (Array.isArray(content)) return content;
141
215
  if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
142
216
  if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
217
+ if (content === "auto") return [
218
+ "auto"
219
+ ];
143
220
  return [];
144
221
  })(),
145
222
  extract: (()=>{
146
223
  let extract = (()=>{
147
- var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9;
148
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.extract) return config.purge.extract;
149
- if ((ref1 = config.content) === null || ref1 === void 0 ? void 0 : ref1.extract) return config.content.extract;
150
- if ((ref2 = config.purge) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.extract) === null || ref3 === void 0 ? void 0 : ref3.DEFAULT) return config.purge.extract.DEFAULT;
151
- if ((ref4 = config.content) === null || ref4 === void 0 ? void 0 : (ref5 = ref4.extract) === null || ref5 === void 0 ? void 0 : ref5.DEFAULT) return config.content.extract.DEFAULT;
152
- if ((ref6 = config.purge) === null || ref6 === void 0 ? void 0 : (ref7 = ref6.options) === null || ref7 === void 0 ? void 0 : ref7.extractors) return config.purge.options.extractors;
153
- if ((ref8 = config.content) === null || ref8 === void 0 ? void 0 : (ref9 = ref8.options) === null || ref9 === void 0 ? void 0 : ref9.extractors) return config.content.options.extractors;
154
- return {
155
- };
224
+ var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
225
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
226
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
227
+ if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
228
+ if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_extract = _config_content1.extract) === null || _config_content_extract === void 0 ? void 0 : _config_content_extract.DEFAULT) return config.content.extract.DEFAULT;
229
+ if ((_config_purge2 = config.purge) === null || _config_purge2 === void 0 ? void 0 : (_config_purge_options = _config_purge2.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.extractors) return config.purge.options.extractors;
230
+ if ((_config_content2 = config.content) === null || _config_content2 === void 0 ? void 0 : (_config_content_options = _config_content2.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.extractors) return config.content.options.extractors;
231
+ return {};
156
232
  })();
157
- let extractors = {
158
- };
233
+ let extractors = {};
159
234
  let defaultExtractor = (()=>{
160
- var ref, ref10, ref11, ref12;
161
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : (ref10 = ref.options) === null || ref10 === void 0 ? void 0 : ref10.defaultExtractor) {
235
+ var _config_purge, _config_purge_options, _config_content, _config_content_options;
236
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
162
237
  return config.purge.options.defaultExtractor;
163
238
  }
164
- if ((ref11 = config.content) === null || ref11 === void 0 ? void 0 : (ref12 = ref11.options) === null || ref12 === void 0 ? void 0 : ref12.defaultExtractor) {
239
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : (_config_content_options = _config_content.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.defaultExtractor) {
165
240
  return config.content.options.defaultExtractor;
166
241
  }
167
242
  return undefined;
@@ -170,7 +245,7 @@ function normalizeConfig(config) {
170
245
  extractors.DEFAULT = defaultExtractor;
171
246
  }
172
247
  // Functions
173
- if (typeof extract === 'function') {
248
+ if (typeof extract === "function") {
174
249
  extractors.DEFAULT = extract;
175
250
  } else if (Array.isArray(extract)) {
176
251
  for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
@@ -178,31 +253,56 @@ function normalizeConfig(config) {
178
253
  extractors[extension] = extractor;
179
254
  }
180
255
  }
181
- } else if (typeof extract === 'object' && extract !== null) {
256
+ } else if (typeof extract === "object" && extract !== null) {
182
257
  Object.assign(extractors, extract);
183
258
  }
184
259
  return extractors;
185
260
  })(),
186
261
  transform: (()=>{
187
262
  let transform = (()=>{
188
- var ref, ref13, ref14, ref15, ref16, ref17;
189
- if ((ref = config.purge) === null || ref === void 0 ? void 0 : ref.transform) return config.purge.transform;
190
- if ((ref13 = config.content) === null || ref13 === void 0 ? void 0 : ref13.transform) return config.content.transform;
191
- if ((ref14 = config.purge) === null || ref14 === void 0 ? void 0 : (ref15 = ref14.transform) === null || ref15 === void 0 ? void 0 : ref15.DEFAULT) return config.purge.transform.DEFAULT;
192
- if ((ref16 = config.content) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.transform) === null || ref17 === void 0 ? void 0 : ref17.DEFAULT) return config.content.transform.DEFAULT;
193
- return {
194
- };
263
+ var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
264
+ if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
265
+ if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
266
+ if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
267
+ if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_transform = _config_content1.transform) === null || _config_content_transform === void 0 ? void 0 : _config_content_transform.DEFAULT) return config.content.transform.DEFAULT;
268
+ return {};
195
269
  })();
196
- let transformers = {
197
- };
198
- if (typeof transform === 'function') {
270
+ let transformers = {};
271
+ if (typeof transform === "function") {
199
272
  transformers.DEFAULT = transform;
200
273
  }
201
- if (typeof transform === 'object' && transform !== null) {
274
+ if (typeof transform === "object" && transform !== null) {
202
275
  Object.assign(transformers, transform);
203
276
  }
204
277
  return transformers;
205
278
  })()
206
279
  };
280
+ // Force disable the `oxideParser` feature flag when using unsupported features.
281
+ // TODO: Remove once we have prefix or separator support in the oxide parser.
282
+ if (config.prefix !== "" || config.separator !== ":") {
283
+ if (config.experimental === "all") {
284
+ config.experimental = {};
285
+ for(let key in _featureFlags.featureFlags.experimental){
286
+ config.experimental[key] = true;
287
+ }
288
+ } else {
289
+ var _config_experimental;
290
+ config.experimental = (_config_experimental = config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {};
291
+ }
292
+ config.experimental.oxideParser = false;
293
+ }
294
+ // Validate globs to prevent bogus globs.
295
+ // E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
296
+ if (config.content.files !== "auto") {
297
+ for (let file of config.content.files){
298
+ if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
299
+ _log.default.warn("invalid-glob-braces", [
300
+ `The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
301
+ `Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
302
+ ]);
303
+ break;
304
+ }
305
+ }
306
+ }
207
307
  return config;
208
308
  }