tailwindcss 3.1.6 → 3.1.7

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 (81) hide show
  1. package/CHANGELOG.md +18 -2
  2. package/lib/cli-peer-dependencies.js +12 -4
  3. package/lib/cli.js +78 -75
  4. package/lib/constants.js +19 -12
  5. package/lib/corePluginList.js +5 -3
  6. package/lib/corePlugins.js +194 -187
  7. package/lib/featureFlags.js +14 -7
  8. package/lib/index.js +9 -6
  9. package/lib/lib/cacheInvalidation.js +18 -15
  10. package/lib/lib/collapseAdjacentRules.js +14 -11
  11. package/lib/lib/collapseDuplicateDeclarations.js +11 -8
  12. package/lib/lib/defaultExtractor.js +38 -35
  13. package/lib/lib/detectNesting.js +4 -1
  14. package/lib/lib/evaluateTailwindFunctions.js +37 -34
  15. package/lib/lib/expandApplyAtRules.js +45 -42
  16. package/lib/lib/expandTailwindAtRules.js +153 -150
  17. package/lib/lib/generateRules.js +80 -70
  18. package/lib/lib/getModuleDependencies.js +21 -18
  19. package/lib/lib/normalizeTailwindDirectives.js +10 -7
  20. package/lib/lib/partitionApplyAtRules.js +14 -11
  21. package/lib/lib/regex.js +15 -7
  22. package/lib/lib/resolveDefaultsAtRules.js +92 -85
  23. package/lib/lib/setupContextUtils.js +109 -97
  24. package/lib/lib/setupTrackingContext.js +82 -75
  25. package/lib/lib/sharedState.js +15 -8
  26. package/lib/lib/substituteScreenAtRules.js +8 -5
  27. package/lib/postcss-plugins/nesting/index.js +7 -5
  28. package/lib/postcss-plugins/nesting/plugin.js +7 -4
  29. package/lib/processTailwindFeatures.js +34 -31
  30. package/lib/public/colors.js +6 -4
  31. package/lib/public/create-plugin.js +6 -4
  32. package/lib/public/default-config.js +7 -5
  33. package/lib/public/default-theme.js +7 -5
  34. package/lib/public/resolve-config.js +13 -10
  35. package/lib/util/bigSign.js +4 -1
  36. package/lib/util/buildMediaQuery.js +5 -2
  37. package/lib/util/cloneDeep.js +4 -1
  38. package/lib/util/cloneNodes.js +9 -2
  39. package/lib/util/color.js +11 -3
  40. package/lib/util/configurePlugins.js +4 -1
  41. package/lib/util/createPlugin.js +5 -3
  42. package/lib/util/createUtilityPlugin.js +13 -10
  43. package/lib/util/dataTypes.js +27 -19
  44. package/lib/util/defaults.js +4 -1
  45. package/lib/util/escapeClassName.js +12 -9
  46. package/lib/util/escapeCommas.js +4 -1
  47. package/lib/util/flattenColorPalette.js +5 -3
  48. package/lib/util/formatVariantSelector.js +21 -14
  49. package/lib/util/getAllConfigs.js +12 -9
  50. package/lib/util/hashConfig.js +10 -7
  51. package/lib/util/isKeyframeRule.js +4 -1
  52. package/lib/util/isPlainObject.js +4 -1
  53. package/lib/util/isValidArbitraryValue.js +33 -24
  54. package/lib/util/log.js +12 -5
  55. package/lib/util/nameClass.js +16 -8
  56. package/lib/util/negateValue.js +4 -1
  57. package/lib/util/normalizeConfig.js +26 -23
  58. package/lib/util/normalizeScreens.js +17 -2
  59. package/lib/util/parseAnimationValue.js +42 -39
  60. package/lib/util/parseBoxShadowValue.js +12 -4
  61. package/lib/util/parseDependency.js +35 -32
  62. package/lib/util/parseObjectStyles.js +14 -11
  63. package/lib/util/pluginUtils.js +28 -20
  64. package/lib/util/prefixSelector.js +6 -3
  65. package/lib/util/removeAlphaVariables.js +13 -2
  66. package/lib/util/resolveConfig.js +55 -52
  67. package/lib/util/resolveConfigPath.js +20 -17
  68. package/lib/util/responsive.js +12 -9
  69. package/lib/util/splitAtTopLevelOnly.js +16 -13
  70. package/lib/util/tap.js +4 -1
  71. package/lib/util/toColorValue.js +4 -1
  72. package/lib/util/toPath.js +18 -2
  73. package/lib/util/transformThemeValue.js +10 -7
  74. package/lib/util/validateConfig.js +5 -2
  75. package/lib/util/withAlphaVariable.js +30 -22
  76. package/package.json +8 -8
  77. package/peers/index.js +13 -4
  78. package/resolveConfig.d.ts +3 -0
  79. package/src/lib/generateRules.js +5 -1
  80. package/src/lib/setupContextUtils.js +4 -2
  81. package/src/util/cloneNodes.js +5 -1
@@ -2,9 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = withAlphaVariable;
6
- exports.withAlphaValue = withAlphaValue;
7
- var _color = require("./color");
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
+ withAlphaValue: ()=>withAlphaValue,
13
+ default: ()=>withAlphaVariable
14
+ });
15
+ const _color = require("./color");
16
+ function withAlphaValue(color, alphaValue, defaultValue) {
17
+ if (typeof color === "function") {
18
+ return color({
19
+ opacityValue: alphaValue
20
+ });
21
+ }
22
+ let parsed = (0, _color.parseColor)(color, {
23
+ loose: true
24
+ });
25
+ if (parsed === null) {
26
+ return defaultValue;
27
+ }
28
+ return (0, _color.formatColor)({
29
+ ...parsed,
30
+ alpha: alphaValue
31
+ });
32
+ }
8
33
  function withAlphaVariable({ color , property , variable }) {
9
34
  let properties = [].concat(property);
10
35
  if (typeof color === "function") {
@@ -21,7 +46,7 @@ function withAlphaVariable({ color , property , variable }) {
21
46
  }))
22
47
  };
23
48
  }
24
- const parsed = (0, _color).parseColor(color);
49
+ const parsed = (0, _color.parseColor)(color);
25
50
  if (parsed === null) {
26
51
  return Object.fromEntries(properties.map((p)=>[
27
52
  p,
@@ -40,7 +65,7 @@ function withAlphaVariable({ color , property , variable }) {
40
65
  ...Object.fromEntries(properties.map((p)=>{
41
66
  return [
42
67
  p,
43
- (0, _color).formatColor({
68
+ (0, _color.formatColor)({
44
69
  ...parsed,
45
70
  alpha: `var(${variable})`
46
71
  })
@@ -48,20 +73,3 @@ function withAlphaVariable({ color , property , variable }) {
48
73
  }))
49
74
  };
50
75
  }
51
- function withAlphaValue(color, alphaValue, defaultValue) {
52
- if (typeof color === "function") {
53
- return color({
54
- opacityValue: alphaValue
55
- });
56
- }
57
- let parsed = (0, _color).parseColor(color, {
58
- loose: true
59
- });
60
- if (parsed === null) {
61
- return defaultValue;
62
- }
63
- return (0, _color).formatColor({
64
- ...parsed,
65
- alpha: alphaValue
66
- });
67
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -43,19 +43,19 @@
43
43
  ],
44
44
  "devDependencies": {
45
45
  "@swc/cli": "^0.1.57",
46
- "@swc/core": "^1.2.196",
47
- "@swc/jest": "^0.2.21",
46
+ "@swc/core": "^1.2.218",
47
+ "@swc/jest": "^0.2.22",
48
48
  "@swc/register": "^0.1.10",
49
49
  "autoprefixer": "^10.4.7",
50
50
  "cssnano": "^5.1.12",
51
51
  "esbuild": "^0.14.48",
52
- "eslint": "^8.18.0",
52
+ "eslint": "^8.19.0",
53
53
  "eslint-config-prettier": "^8.5.0",
54
54
  "eslint-plugin-prettier": "^4.2.1",
55
- "jest": "^28.1.2",
56
- "jest-diff": "^28.1.1",
55
+ "jest": "^28.1.3",
56
+ "jest-diff": "^28.1.3",
57
57
  "prettier": "^2.7.1",
58
- "prettier-plugin-tailwindcss": "^0.1.11",
58
+ "prettier-plugin-tailwindcss": "^0.1.12",
59
59
  "rimraf": "^3.0.0",
60
60
  "source-map-js": "^1.0.2"
61
61
  },
@@ -72,7 +72,7 @@
72
72
  "fast-glob": "^3.2.11",
73
73
  "glob-parent": "^6.0.2",
74
74
  "is-glob": "^4.0.3",
75
- "lilconfig": "^2.0.5",
75
+ "lilconfig": "^2.0.6",
76
76
  "normalize-path": "^3.0.0",
77
77
  "object-hash": "^3.0.0",
78
78
  "picocolors": "^1.0.0",
package/peers/index.js CHANGED
@@ -77915,10 +77915,19 @@ var require_src32 = __commonJS({
77915
77915
  Object.defineProperty(exports, "__esModule", {
77916
77916
  value: true
77917
77917
  });
77918
- exports.lazyPostcss = lazyPostcss;
77919
- exports.lazyPostcssImport = lazyPostcssImport;
77920
- exports.lazyAutoprefixer = lazyAutoprefixer;
77921
- exports.lazyCssnano = lazyCssnano;
77918
+ function _export(target, all) {
77919
+ for (var name in all)
77920
+ Object.defineProperty(target, name, {
77921
+ enumerable: true,
77922
+ get: all[name]
77923
+ });
77924
+ }
77925
+ _export(exports, {
77926
+ lazyPostcss: () => lazyPostcss,
77927
+ lazyPostcssImport: () => lazyPostcssImport,
77928
+ lazyAutoprefixer: () => lazyAutoprefixer,
77929
+ lazyCssnano: () => lazyCssnano
77930
+ });
77922
77931
  function lazyPostcss() {
77923
77932
  return require_postcss();
77924
77933
  }
@@ -0,0 +1,3 @@
1
+ import type { Config } from './types/config'
2
+ declare function resolveConfig(config: Config): Config
3
+ export = resolveConfig
@@ -471,7 +471,11 @@ function splitWithSeparator(input, separator) {
471
471
 
472
472
  function* recordCandidates(matches, classCandidate) {
473
473
  for (const match of matches) {
474
- match[1].raws.tailwind = { ...match[1].raws.tailwind, classCandidate }
474
+ match[1].raws.tailwind = {
475
+ ...match[1].raws.tailwind,
476
+ classCandidate,
477
+ preserveSource: match[0].options?.preserveSource ?? false,
478
+ }
475
479
 
476
480
  yield match
477
481
  }
@@ -289,6 +289,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
289
289
  },
290
290
  addComponents(components, options) {
291
291
  let defaultOptions = {
292
+ preserveSource: false,
292
293
  respectPrefix: true,
293
294
  respectImportant: false,
294
295
  }
@@ -311,6 +312,7 @@ function buildPluginApi(tailwindConfig, context, { variantList, variantMap, offs
311
312
  },
312
313
  addUtilities(utilities, options) {
313
314
  let defaultOptions = {
315
+ preserveSource: false,
314
316
  respectPrefix: true,
315
317
  respectImportant: true,
316
318
  }
@@ -579,14 +581,14 @@ function collectLayerPlugins(root) {
579
581
  } else if (layerRule.params === 'components') {
580
582
  for (let node of layerRule.nodes) {
581
583
  layerPlugins.push(function ({ addComponents }) {
582
- addComponents(node, { respectPrefix: false })
584
+ addComponents(node, { respectPrefix: false, preserveSource: true })
583
585
  })
584
586
  }
585
587
  layerRule.remove()
586
588
  } else if (layerRule.params === 'utilities') {
587
589
  for (let node of layerRule.nodes) {
588
590
  layerPlugins.push(function ({ addUtilities }) {
589
- addUtilities(node, { respectPrefix: false })
591
+ addUtilities(node, { respectPrefix: false, preserveSource: true })
590
592
  })
591
593
  }
592
594
  layerRule.remove()
@@ -2,7 +2,11 @@ export default function cloneNodes(nodes, source = undefined, raws = undefined)
2
2
  return nodes.map((node) => {
3
3
  let cloned = node.clone()
4
4
 
5
- if (source !== undefined) {
5
+ // We always want override the source map
6
+ // except when explicitly told not to
7
+ let shouldOverwriteSource = node.raws.tailwind?.preserveSource !== true || !cloned.source
8
+
9
+ if (source !== undefined && shouldOverwriteSource) {
6
10
  cloned.source = source
7
11
 
8
12
  if ('walk' in cloned) {