tailwindcss 0.0.0-insiders.27e4b65 → 0.0.0-insiders.28bd90e

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 (49) hide show
  1. package/lib/cli/build/plugin.js +4 -11
  2. package/lib/cli.js +1 -5
  3. package/lib/corePlugins.js +49 -40
  4. package/lib/css/preflight.css +1 -0
  5. package/lib/featureFlags.js +2 -6
  6. package/lib/lib/content.js +3 -36
  7. package/lib/lib/defaultExtractor.js +23 -1
  8. package/lib/lib/expandApplyAtRules.js +13 -0
  9. package/lib/lib/expandTailwindAtRules.js +20 -32
  10. package/lib/lib/generateRules.js +4 -1
  11. package/lib/lib/load-config.js +8 -0
  12. package/lib/lib/sharedState.js +2 -10
  13. package/lib/plugin.js +0 -50
  14. package/lib/processTailwindFeatures.js +0 -2
  15. package/lib/util/applyImportantSelector.js +5 -3
  16. package/lib/util/dataTypes.js +30 -2
  17. package/lib/util/normalizeConfig.js +1 -2
  18. package/lib/util/parseAnimationValue.js +1 -1
  19. package/lib/util/parseGlob.js +1 -2
  20. package/lib/util/pluginUtils.js +1 -1
  21. package/lib/util/resolveConfigPath.js +3 -1
  22. package/lib/util/splitAtTopLevelOnly.js +1 -5
  23. package/package.json +5 -8
  24. package/peers/index.js +2140 -1972
  25. package/src/cli/build/plugin.js +4 -11
  26. package/src/cli.js +1 -5
  27. package/src/corePlugins.js +71 -50
  28. package/src/css/preflight.css +1 -0
  29. package/src/featureFlags.js +2 -6
  30. package/src/lib/content.js +1 -42
  31. package/src/lib/defaultExtractor.js +26 -1
  32. package/src/lib/expandApplyAtRules.js +17 -0
  33. package/src/lib/expandTailwindAtRules.js +23 -41
  34. package/src/lib/generateRules.js +1 -1
  35. package/src/lib/load-config.ts +16 -0
  36. package/src/lib/sharedState.js +0 -4
  37. package/src/plugin.js +0 -60
  38. package/src/processTailwindFeatures.js +0 -3
  39. package/src/util/applyImportantSelector.js +5 -6
  40. package/src/util/dataTypes.js +35 -1
  41. package/src/util/normalizeConfig.js +1 -3
  42. package/src/util/parseAnimationValue.js +1 -1
  43. package/src/util/parseGlob.js +1 -2
  44. package/src/util/pluginUtils.js +1 -1
  45. package/src/util/resolveConfigPath.js +2 -0
  46. package/src/util/splitAtTopLevelOnly.js +1 -5
  47. package/stubs/config.full.js +1 -1
  48. package/lib/lib/detectNesting.js +0 -45
  49. package/src/lib/detectNesting.js +0 -47
@@ -167,17 +167,10 @@ let state = {
167
167
  // TODO: When we make the postcss plugin async-capable this can become async
168
168
  let files = _fastglob.default.sync(this.contentPatterns.all);
169
169
  for (let file of files){
170
- if (false) {
171
- content.push({
172
- file,
173
- extension: _path.default.extname(file).slice(1)
174
- });
175
- } else {
176
- content.push({
177
- content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
178
- extension: _path.default.extname(file).slice(1)
179
- });
180
- }
170
+ content.push({
171
+ content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
172
+ extension: _path.default.extname(file).slice(1)
173
+ });
181
174
  }
182
175
  // Resolve raw content in the tailwind config
183
176
  let rawContent = this.config.content.files.filter((file)=>{
package/lib/cli.js CHANGED
@@ -1,7 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- if (false) {
4
- module.exports = require("./oxide/cli");
5
- } else {
6
- module.exports = require("./cli/index");
7
- }
3
+ module.exports = require("./cli/index");
@@ -325,7 +325,7 @@ let variantPlugins = {
325
325
  addVariant("dark", selector);
326
326
  } else if (mode === "class") {
327
327
  // Old behavior
328
- addVariant("dark", `:is(${selector} &)`);
328
+ addVariant("dark", `&:is(${selector} *)`);
329
329
  }
330
330
  },
331
331
  printVariant: ({ addVariant })=>{
@@ -443,7 +443,7 @@ let variantPlugins = {
443
443
  matchVariant("supports", (value = "")=>{
444
444
  let check = (0, _dataTypes.normalize)(value);
445
445
  let isRaw = /^\w*\s*\(/.test(check);
446
- // Chrome has a bug where `(condtion1)or(condition2)` is not valid
446
+ // Chrome has a bug where `(condition1)or(condition2)` is not valid
447
447
  // But `(condition1) or (condition2)` is supported.
448
448
  check = isRaw ? check.replace(/\b(and|or|not)\b/g, " $1 ") : check;
449
449
  if (isRaw) {
@@ -460,42 +460,51 @@ let variantPlugins = {
460
460
  values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
461
461
  });
462
462
  },
463
- hasVariants: ({ matchVariant })=>{
463
+ hasVariants: ({ matchVariant , prefix })=>{
464
464
  matchVariant("has", (value)=>`&:has(${(0, _dataTypes.normalize)(value)})`, {
465
- values: {}
465
+ values: {},
466
+ [_setupContextUtils.INTERNAL_FEATURES]: {
467
+ respectPrefix: false
468
+ }
466
469
  });
467
- matchVariant("group-has", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) &` : `:merge(.group):has(${(0, _dataTypes.normalize)(value)}) &`, {
468
- values: {}
470
+ matchVariant("group-has", (value, { modifier })=>modifier ? `:merge(${prefix(".group")}\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) &` : `:merge(${prefix(".group")}):has(${(0, _dataTypes.normalize)(value)}) &`, {
471
+ values: {},
472
+ [_setupContextUtils.INTERNAL_FEATURES]: {
473
+ respectPrefix: false
474
+ }
469
475
  });
470
- matchVariant("peer-has", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) ~ &` : `:merge(.peer):has(${(0, _dataTypes.normalize)(value)}) ~ &`, {
471
- values: {}
476
+ matchVariant("peer-has", (value, { modifier })=>modifier ? `:merge(${prefix(".peer")}\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) ~ &` : `:merge(${prefix(".peer")}):has(${(0, _dataTypes.normalize)(value)}) ~ &`, {
477
+ values: {},
478
+ [_setupContextUtils.INTERNAL_FEATURES]: {
479
+ respectPrefix: false
480
+ }
472
481
  });
473
482
  },
474
483
  ariaVariants: ({ matchVariant , theme })=>{
475
484
  var _theme;
476
- matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
485
+ matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}]`, {
477
486
  values: (_theme = theme("aria")) !== null && _theme !== void 0 ? _theme : {}
478
487
  });
479
488
  var _theme1;
480
- matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
489
+ matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &`, {
481
490
  values: (_theme1 = theme("aria")) !== null && _theme1 !== void 0 ? _theme1 : {}
482
491
  });
483
492
  var _theme2;
484
- matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
493
+ matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &`, {
485
494
  values: (_theme2 = theme("aria")) !== null && _theme2 !== void 0 ? _theme2 : {}
486
495
  });
487
496
  },
488
497
  dataVariants: ({ matchVariant , theme })=>{
489
498
  var _theme;
490
- matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
499
+ matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}]`, {
491
500
  values: (_theme = theme("data")) !== null && _theme !== void 0 ? _theme : {}
492
501
  });
493
502
  var _theme1;
494
- matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
503
+ matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &` : `:merge(.group)[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] &`, {
495
504
  values: (_theme1 = theme("data")) !== null && _theme1 !== void 0 ? _theme1 : {}
496
505
  });
497
506
  var _theme2;
498
- matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
507
+ matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalizeAttributeSelectors)((0, _dataTypes.normalize)(value))}] ~ &`, {
499
508
  values: (_theme2 = theme("data")) !== null && _theme2 !== void 0 ? _theme2 : {}
500
509
  });
501
510
  },
@@ -794,7 +803,9 @@ let corePlugins = {
794
803
  "gridColumnStart"
795
804
  ]
796
805
  ]
797
- ]),
806
+ ], {
807
+ supportsNegativeValues: true
808
+ }),
798
809
  gridColumnEnd: (0, _createUtilityPlugin.default)("gridColumnEnd", [
799
810
  [
800
811
  "col-end",
@@ -802,7 +813,9 @@ let corePlugins = {
802
813
  "gridColumnEnd"
803
814
  ]
804
815
  ]
805
- ]),
816
+ ], {
817
+ supportsNegativeValues: true
818
+ }),
806
819
  gridRow: (0, _createUtilityPlugin.default)("gridRow", [
807
820
  [
808
821
  "row",
@@ -818,7 +831,9 @@ let corePlugins = {
818
831
  "gridRowStart"
819
832
  ]
820
833
  ]
821
- ]),
834
+ ], {
835
+ supportsNegativeValues: true
836
+ }),
822
837
  gridRowEnd: (0, _createUtilityPlugin.default)("gridRowEnd", [
823
838
  [
824
839
  "row-end",
@@ -826,7 +841,9 @@ let corePlugins = {
826
841
  "gridRowEnd"
827
842
  ]
828
843
  ]
829
- ]),
844
+ ], {
845
+ supportsNegativeValues: true
846
+ }),
830
847
  float: ({ addUtilities })=>{
831
848
  addUtilities({
832
849
  ".float-start": {
@@ -2022,15 +2039,6 @@ let corePlugins = {
2022
2039
  matchUtilities({
2023
2040
  "space-x": (value)=>{
2024
2041
  value = value === "0" ? "0px" : value;
2025
- if (false) {
2026
- return {
2027
- "& > :not([hidden]) ~ :not([hidden])": {
2028
- "--tw-space-x-reverse": "0",
2029
- "margin-inline-end": `calc(${value} * var(--tw-space-x-reverse))`,
2030
- "margin-inline-start": `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`
2031
- }
2032
- };
2033
- }
2034
2042
  return {
2035
2043
  "& > :not([hidden]) ~ :not([hidden])": {
2036
2044
  "--tw-space-x-reverse": "0",
@@ -2066,16 +2074,6 @@ let corePlugins = {
2066
2074
  matchUtilities({
2067
2075
  "divide-x": (value)=>{
2068
2076
  value = value === "0" ? "0px" : value;
2069
- if (false) {
2070
- return {
2071
- "& > :not([hidden]) ~ :not([hidden])": {
2072
- "@defaults border-width": {},
2073
- "--tw-divide-x-reverse": "0",
2074
- "border-inline-end-width": `calc(${value} * var(--tw-divide-x-reverse))`,
2075
- "border-inline-start-width": `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
2076
- }
2077
- };
2078
- }
2079
2077
  return {
2080
2078
  "& > :not([hidden]) ~ :not([hidden])": {
2081
2079
  "@defaults border-width": {},
@@ -3708,7 +3706,7 @@ let corePlugins = {
3708
3706
  `var(--tw-shadow)`
3709
3707
  ].join(", ");
3710
3708
  return function({ matchUtilities , addDefaults , theme }) {
3711
- addDefaults(" box-shadow", {
3709
+ addDefaults("box-shadow", {
3712
3710
  "--tw-ring-offset-shadow": "0 0 #0000",
3713
3711
  "--tw-ring-shadow": "0 0 #0000",
3714
3712
  "--tw-shadow": "0 0 #0000",
@@ -3931,7 +3929,7 @@ let corePlugins = {
3931
3929
  matchUtilities({
3932
3930
  blur: (value)=>{
3933
3931
  return {
3934
- "--tw-blur": `blur(${value})`,
3932
+ "--tw-blur": value.trim() === "" ? " " : `blur(${value})`,
3935
3933
  "@defaults filter": {},
3936
3934
  filter: cssFilterValue
3937
3935
  };
@@ -4071,8 +4069,9 @@ let corePlugins = {
4071
4069
  matchUtilities({
4072
4070
  "backdrop-blur": (value)=>{
4073
4071
  return {
4074
- "--tw-backdrop-blur": `blur(${value})`,
4072
+ "--tw-backdrop-blur": value.trim() === "" ? " " : `blur(${value})`,
4075
4073
  "@defaults backdrop-filter": {},
4074
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4076
4075
  "backdrop-filter": cssBackdropFilterValue
4077
4076
  };
4078
4077
  }
@@ -4086,6 +4085,7 @@ let corePlugins = {
4086
4085
  return {
4087
4086
  "--tw-backdrop-brightness": `brightness(${value})`,
4088
4087
  "@defaults backdrop-filter": {},
4088
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4089
4089
  "backdrop-filter": cssBackdropFilterValue
4090
4090
  };
4091
4091
  }
@@ -4099,6 +4099,7 @@ let corePlugins = {
4099
4099
  return {
4100
4100
  "--tw-backdrop-contrast": `contrast(${value})`,
4101
4101
  "@defaults backdrop-filter": {},
4102
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4102
4103
  "backdrop-filter": cssBackdropFilterValue
4103
4104
  };
4104
4105
  }
@@ -4112,6 +4113,7 @@ let corePlugins = {
4112
4113
  return {
4113
4114
  "--tw-backdrop-grayscale": `grayscale(${value})`,
4114
4115
  "@defaults backdrop-filter": {},
4116
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4115
4117
  "backdrop-filter": cssBackdropFilterValue
4116
4118
  };
4117
4119
  }
@@ -4125,6 +4127,7 @@ let corePlugins = {
4125
4127
  return {
4126
4128
  "--tw-backdrop-hue-rotate": `hue-rotate(${value})`,
4127
4129
  "@defaults backdrop-filter": {},
4130
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4128
4131
  "backdrop-filter": cssBackdropFilterValue
4129
4132
  };
4130
4133
  }
@@ -4139,6 +4142,7 @@ let corePlugins = {
4139
4142
  return {
4140
4143
  "--tw-backdrop-invert": `invert(${value})`,
4141
4144
  "@defaults backdrop-filter": {},
4145
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4142
4146
  "backdrop-filter": cssBackdropFilterValue
4143
4147
  };
4144
4148
  }
@@ -4152,6 +4156,7 @@ let corePlugins = {
4152
4156
  return {
4153
4157
  "--tw-backdrop-opacity": `opacity(${value})`,
4154
4158
  "@defaults backdrop-filter": {},
4159
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4155
4160
  "backdrop-filter": cssBackdropFilterValue
4156
4161
  };
4157
4162
  }
@@ -4165,6 +4170,7 @@ let corePlugins = {
4165
4170
  return {
4166
4171
  "--tw-backdrop-saturate": `saturate(${value})`,
4167
4172
  "@defaults backdrop-filter": {},
4173
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4168
4174
  "backdrop-filter": cssBackdropFilterValue
4169
4175
  };
4170
4176
  }
@@ -4178,6 +4184,7 @@ let corePlugins = {
4178
4184
  return {
4179
4185
  "--tw-backdrop-sepia": `sepia(${value})`,
4180
4186
  "@defaults backdrop-filter": {},
4187
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4181
4188
  "backdrop-filter": cssBackdropFilterValue
4182
4189
  };
4183
4190
  }
@@ -4200,9 +4207,11 @@ let corePlugins = {
4200
4207
  addUtilities({
4201
4208
  ".backdrop-filter": {
4202
4209
  "@defaults backdrop-filter": {},
4210
+ "-webkit-backdrop-filter": cssBackdropFilterValue,
4203
4211
  "backdrop-filter": cssBackdropFilterValue
4204
4212
  },
4205
4213
  ".backdrop-filter-none": {
4214
+ "-webkit-backdrop-filter": "none",
4206
4215
  "backdrop-filter": "none"
4207
4216
  }
4208
4217
  });
@@ -175,6 +175,7 @@ textarea {
175
175
  font-size: 100%; /* 1 */
176
176
  font-weight: inherit; /* 1 */
177
177
  line-height: inherit; /* 1 */
178
+ letter-spacing: inherit; /* 1 */
178
179
  color: inherit; /* 1 */
179
180
  margin: 0; /* 2 */
180
181
  padding: 0; /* 3 */
@@ -29,12 +29,8 @@ function _interop_require_default(obj) {
29
29
  let defaults = {
30
30
  optimizeUniversalDefaults: false,
31
31
  generalizedModifiers: true,
32
- get disableColorOpacityUtilitiesByDefault () {
33
- return false;
34
- },
35
- get relativeContentPathsByDefault () {
36
- return false;
37
- }
32
+ disableColorOpacityUtilitiesByDefault: false,
33
+ relativeContentPathsByDefault: false
38
34
  };
39
35
  let featureFlags = {
40
36
  future: [
@@ -21,6 +21,7 @@ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
21
21
  const _path = /*#__PURE__*/ _interop_require_default(require("path"));
22
22
  const _isglob = /*#__PURE__*/ _interop_require_default(require("is-glob"));
23
23
  const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
24
+ const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
24
25
  const _parseGlob = require("../util/parseGlob");
25
26
  const _sharedState = require("./sharedState");
26
27
  function _interop_require_default(obj) {
@@ -28,42 +29,11 @@ function _interop_require_default(obj) {
28
29
  default: obj
29
30
  };
30
31
  }
31
- /*!
32
- * Modified version of normalize-path, original license below
33
- *
34
- * normalize-path <https://github.com/jonschlinkert/normalize-path>
35
- *
36
- * Copyright (c) 2014-2018, Jon Schlinkert.
37
- * Released under the MIT License.
38
- */ function normalizePath(path) {
39
- if (typeof path !== "string") {
40
- throw new TypeError("expected path to be a string");
41
- }
42
- if (path === "\\" || path === "/") return "/";
43
- var len = path.length;
44
- if (len <= 1) return path;
45
- // ensure that win32 namespaces has two leading slashes, so that the path is
46
- // handled properly by the win32 version of path.parse() after being normalized
47
- // https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
48
- var prefix = "";
49
- if (len > 4 && path[3] === "\\") {
50
- var ch = path[2];
51
- if ((ch === "?" || ch === ".") && path.slice(0, 2) === "\\\\") {
52
- path = path.slice(2);
53
- prefix = "//";
54
- }
55
- }
56
- // Modified part: instead of purely splitting on `\\` and `/`, we split on
57
- // `/` and `\\` that is _not_ followed by any of the following characters: ()[]
58
- // This is to ensure that we keep the escaping of brackets and parentheses
59
- let segs = path.split(/[/\\]+(?![\(\)\[\]])/);
60
- return prefix + segs.join("/");
61
- }
62
32
  function parseCandidateFiles(context, tailwindConfig) {
63
33
  let files = tailwindConfig.content.files;
64
34
  // Normalize the file globs
65
35
  files = files.filter((filePath)=>typeof filePath === "string");
66
- files = files.map(normalizePath);
36
+ files = files.map(_normalizepath.default);
67
37
  // Split into included and excluded globs
68
38
  let tasks = _fastglob.default.generateTasks(files);
69
39
  /** @type {ContentPath[]} */ let included = [];
@@ -90,9 +60,6 @@ function parseCandidateFiles(context, tailwindConfig) {
90
60
  * @param {boolean} ignore
91
61
  * @returns {ContentPath}
92
62
  */ function parseFilePath(filePath, ignore) {
93
- // Escape special characters in the file path such as: ()[]
94
- // But only if the special character isn't already escaped
95
- filePath = filePath.replace(/(?<!\\)([\[\]\(\)])/g, "\\$1");
96
63
  let contentPath = {
97
64
  original: filePath,
98
65
  base: filePath,
@@ -114,7 +81,7 @@ function parseCandidateFiles(context, tailwindConfig) {
114
81
  // Afaik, this technically shouldn't be needed but there's probably
115
82
  // some internal, direct path matching with a normalized path in
116
83
  // a package which can't handle mixed directory separators
117
- let base = normalizePath(contentPath.base);
84
+ let base = (0, _normalizepath.default)(contentPath.base);
118
85
  // If the user's file path contains any special characters (like parens) for instance fast-glob
119
86
  // is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
120
87
  base = _fastglob.default.escapePath(base);
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "defaultExtractor", {
9
9
  }
10
10
  });
11
11
  const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
12
+ const _splitAtTopLevelOnly = require("../util/splitAtTopLevelOnly");
12
13
  function _getRequireWildcardCache(nodeInterop) {
13
14
  if (typeof WeakMap !== "function") return null;
14
15
  var cacheBabelInterop = new WeakMap();
@@ -60,6 +61,27 @@ function defaultExtractor(context) {
60
61
  results.push(clipAtBalancedParens(result));
61
62
  }
62
63
  }
64
+ // Extract any subclasses from languages like Slim and Pug, eg:
65
+ // div.flex.px-5.underline
66
+ for (let result of results.slice()){
67
+ let segments = (0, _splitAtTopLevelOnly.splitAtTopLevelOnly)(result, ".");
68
+ for(let idx = 0; idx < segments.length; idx++){
69
+ let segment = segments[idx];
70
+ if (idx >= segments.length - 1) {
71
+ results.push(segment);
72
+ continue;
73
+ }
74
+ // If the next segment is a number, discard both, for example seeing
75
+ // `px-1` and `5` means the real candidate was `px-1.5` which is already
76
+ // captured.
77
+ let next = Number(segments[idx + 1]);
78
+ if (isNaN(next)) {
79
+ results.push(segment);
80
+ } else {
81
+ idx++;
82
+ }
83
+ }
84
+ }
63
85
  return results;
64
86
  };
65
87
  }
@@ -170,7 +192,7 @@ function* buildRegExps(context) {
170
192
  ]);
171
193
  }
172
194
  // 5. Inner matches
173
- yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
195
+ yield /[^<>"'`\s.(){}[\]#=%$][^<>"'`\s(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
174
196
  }
175
197
  // We want to capture any "special" characters
176
198
  // AND the characters immediately following them (if there is one)
@@ -380,6 +380,19 @@ function processApply(root, context, localCache) {
380
380
  throw apply.error(`The \`${applyCandidate}\` class does not exist. If \`${applyCandidate}\` is a custom class, make sure it is defined within a \`@layer\` directive.`);
381
381
  }
382
382
  let rules = applyClassCache.get(applyCandidate);
383
+ // Verify that we can apply the class
384
+ for (let [, rule] of rules){
385
+ if (rule.type === "atrule") {
386
+ continue;
387
+ }
388
+ rule.walkRules(()=>{
389
+ throw apply.error([
390
+ `The \`${applyCandidate}\` class cannot be used with \`@apply\` because \`@apply\` does not currently support nested CSS.`,
391
+ "Rewrite the selector without nesting or configure the `tailwindcss/nesting` plugin:",
392
+ "https://tailwindcss.com/docs/using-with-preprocessors#nesting"
393
+ ].join("\n"));
394
+ });
395
+ }
383
396
  candidates.push([
384
397
  applyCandidate,
385
398
  important,
@@ -154,37 +154,25 @@ function expandTailwindAtRules(context) {
154
154
  ]);
155
155
  let seen = new Set();
156
156
  env.DEBUG && console.time("Reading changed files");
157
- if (false) {
158
- // TODO: Pass through or implement `extractor`
159
- for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
160
- candidates.add(candidate);
161
- }
162
- // for (let { file, content, extension } of context.changedContent) {
163
- // let transformer = getTransformer(context.tailwindConfig, extension)
164
- // let extractor = getExtractor(context, extension)
165
- // getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
166
- // }
167
- } else {
168
- /** @type {[item: {file?: string, content?: string}, meta: {transformer: any, extractor: any}][]} */ let regexParserContent = [];
169
- for (let item of context.changedContent){
170
- let transformer = getTransformer(context.tailwindConfig, item.extension);
171
- let extractor = getExtractor(context, item.extension);
172
- regexParserContent.push([
173
- item,
174
- {
175
- transformer,
176
- extractor
177
- }
178
- ]);
179
- }
180
- const BATCH_SIZE = 500;
181
- for(let i = 0; i < regexParserContent.length; i += BATCH_SIZE){
182
- let batch = regexParserContent.slice(i, i + BATCH_SIZE);
183
- await Promise.all(batch.map(async ([{ file , content }, { transformer , extractor }])=>{
184
- content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
185
- getClassCandidates(transformer(content), extractor, candidates, seen);
186
- }));
187
- }
157
+ /** @type {[item: {file?: string, content?: string}, meta: {transformer: any, extractor: any}][]} */ let regexParserContent = [];
158
+ for (let item of context.changedContent){
159
+ let transformer = getTransformer(context.tailwindConfig, item.extension);
160
+ let extractor = getExtractor(context, item.extension);
161
+ regexParserContent.push([
162
+ item,
163
+ {
164
+ transformer,
165
+ extractor
166
+ }
167
+ ]);
168
+ }
169
+ const BATCH_SIZE = 500;
170
+ for(let i = 0; i < regexParserContent.length; i += BATCH_SIZE){
171
+ let batch = regexParserContent.slice(i, i + BATCH_SIZE);
172
+ await Promise.all(batch.map(async ([{ file , content }, { transformer , extractor }])=>{
173
+ content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
174
+ getClassCandidates(transformer(content), extractor, candidates, seen);
175
+ }));
188
176
  }
189
177
  env.DEBUG && console.timeEnd("Reading changed files");
190
178
  // ---
@@ -192,7 +180,7 @@ function expandTailwindAtRules(context) {
192
180
  let classCacheCount = context.classCache.size;
193
181
  env.DEBUG && console.time("Generate rules");
194
182
  env.DEBUG && console.time("Sorting candidates");
195
- let sortedCandidates = false ? candidates : new Set([
183
+ let sortedCandidates = new Set([
196
184
  ...candidates
197
185
  ].sort((a, z)=>{
198
186
  if (a === z) return 0;
@@ -519,7 +519,10 @@ function extractArbitraryProperty(classCandidate, context) {
519
519
  [
520
520
  {
521
521
  sort,
522
- layer: "utilities"
522
+ layer: "utilities",
523
+ options: {
524
+ respectImportant: true
525
+ }
523
526
  },
524
527
  ()=>({
525
528
  [(0, _nameClass.asClass)(classCandidate)]: {
@@ -31,6 +31,10 @@ function lazyJiti() {
31
31
  return jiti !== null && jiti !== void 0 ? jiti : jiti = (0, _jiti.default)(__filename, {
32
32
  interopDefault: true,
33
33
  transform: (opts)=>{
34
+ // Sucrase can't transform import.meta so we have to use Babel
35
+ if (opts.source.includes("import.meta")) {
36
+ return require("jiti/dist/babel.js")(opts);
37
+ }
34
38
  return (0, _sucrase.transform)(opts.source, {
35
39
  transforms: [
36
40
  "typescript",
@@ -42,6 +46,10 @@ function lazyJiti() {
42
46
  }
43
47
  function loadConfig(path) {
44
48
  let config = function() {
49
+ // Always use jiti for ESM or TS files
50
+ if (path && (path.endsWith(".mjs") || path.endsWith(".ts") || path.endsWith(".cts") || path.endsWith(".mts"))) {
51
+ return lazyJiti()(path);
52
+ }
45
53
  try {
46
54
  return path ? require(path) : {};
47
55
  } catch {
@@ -34,20 +34,12 @@ _export(exports, {
34
34
  return resolveDebug;
35
35
  }
36
36
  });
37
- const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
38
- function _interop_require_default(obj) {
39
- return obj && obj.__esModule ? obj : {
40
- default: obj
41
- };
42
- }
43
37
  const env = typeof process !== "undefined" ? {
44
38
  NODE_ENV: process.env.NODE_ENV,
45
- DEBUG: resolveDebug(process.env.DEBUG),
46
- ENGINE: _packagejson.default.tailwindcss.engine
39
+ DEBUG: resolveDebug(process.env.DEBUG)
47
40
  } : {
48
41
  NODE_ENV: "production",
49
- DEBUG: false,
50
- ENGINE: _packagejson.default.tailwindcss.engine
42
+ DEBUG: false
51
43
  };
52
44
  const contextMap = new Map();
53
45
  const configContextMap = new Map();
package/lib/plugin.js CHANGED
@@ -37,56 +37,6 @@ module.exports = function tailwindcss(configOrPath) {
37
37
  }
38
38
  await (0, _processTailwindFeatures.default)(context)(root, result);
39
39
  },
40
- false && function lightningCssPlugin(_root, result) {
41
- let postcss = require("postcss");
42
- let lightningcss = require("lightningcss");
43
- let browserslist = require("browserslist");
44
- try {
45
- let transformed = lightningcss.transform({
46
- filename: result.opts.from,
47
- code: Buffer.from(result.root.toString()),
48
- minify: false,
49
- sourceMap: !!result.map,
50
- inputSourceMap: result.map ? result.map.toString() : undefined,
51
- targets: typeof process !== "undefined" && process.env.JEST_WORKER_ID ? {
52
- chrome: 106 << 16
53
- } : lightningcss.browserslistToTargets(browserslist(require("../package.json").browserslist)),
54
- drafts: {
55
- nesting: true,
56
- customMedia: true
57
- }
58
- });
59
- var _result_map;
60
- result.map = Object.assign((_result_map = result.map) !== null && _result_map !== void 0 ? _result_map : {}, {
61
- toJSON () {
62
- return transformed.map.toJSON();
63
- },
64
- toString () {
65
- return transformed.map.toString();
66
- }
67
- });
68
- result.root = postcss.parse(transformed.code.toString("utf8"));
69
- } catch (err) {
70
- if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) {
71
- let lines = err.source.split("\n");
72
- err = new Error([
73
- "Error formatting using Lightning CSS:",
74
- "",
75
- ...[
76
- "```css",
77
- ...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
78
- " ".repeat(err.loc.column - 1) + "^-- " + err.toString(),
79
- ...lines.slice(err.loc.line, err.loc.line + 2),
80
- "```"
81
- ]
82
- ].join("\n"));
83
- }
84
- if (Error.captureStackTrace) {
85
- Error.captureStackTrace(err, lightningCssPlugin);
86
- }
87
- throw err;
88
- }
89
- },
90
40
  _sharedState.env.DEBUG && function(root) {
91
41
  console.timeEnd("JIT TOTAL");
92
42
  console.log("\n");
@@ -17,7 +17,6 @@ const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("
17
17
  const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules"));
18
18
  const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations"));
19
19
  const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules"));
20
- const _detectNesting = /*#__PURE__*/ _interop_require_default(require("./lib/detectNesting"));
21
20
  const _setupContextUtils = require("./lib/setupContextUtils");
22
21
  const _featureFlags = require("./featureFlags");
23
22
  function _interop_require_default(obj) {
@@ -28,7 +27,6 @@ function _interop_require_default(obj) {
28
27
  function processTailwindFeatures(setupContext) {
29
28
  return async function(root, result) {
30
29
  let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
31
- (0, _detectNesting.default)()(root, result);
32
30
  // Partition apply rules that are found in the css
33
31
  // itself.
34
32
  (0, _partitionApplyAtRules.default)()(root, result);