tailwindcss 0.0.0-insiders.eeec89a → 0.0.0-insiders.eef91c9

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 (97) hide show
  1. package/README.md +1 -2
  2. package/lib/cli/build/deps.js +62 -0
  3. package/lib/cli/build/index.js +0 -3
  4. package/lib/cli/build/plugin.js +66 -126
  5. package/lib/cli/build/watching.js +2 -2
  6. package/lib/cli/help/index.js +2 -2
  7. package/lib/cli/index.js +3 -4
  8. package/lib/cli-peer-dependencies.js +36 -0
  9. package/lib/corePluginList.js +4 -1
  10. package/lib/corePlugins.js +318 -185
  11. package/lib/css/preflight.css +20 -9
  12. package/lib/featureFlags.js +9 -15
  13. package/lib/lib/content.js +2 -28
  14. package/lib/lib/defaultExtractor.js +33 -25
  15. package/lib/lib/evaluateTailwindFunctions.js +4 -4
  16. package/lib/lib/expandApplyAtRules.js +19 -0
  17. package/lib/lib/expandTailwindAtRules.js +22 -58
  18. package/lib/lib/generateRules.js +47 -27
  19. package/lib/lib/load-config.js +18 -3
  20. package/lib/lib/normalizeTailwindDirectives.js +15 -0
  21. package/lib/lib/offsets.js +53 -4
  22. package/lib/lib/resolveDefaultsAtRules.js +4 -2
  23. package/lib/lib/setupContextUtils.js +108 -80
  24. package/lib/lib/setupTrackingContext.js +2 -3
  25. package/lib/lib/substituteScreenAtRules.js +2 -2
  26. package/lib/plugin.js +0 -116
  27. package/lib/postcss-plugins/nesting/index.js +1 -1
  28. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  29. package/lib/processTailwindFeatures.js +1 -3
  30. package/lib/public/colors.js +1 -1
  31. package/lib/util/cloneNodes.js +33 -13
  32. package/lib/util/color.js +4 -4
  33. package/lib/util/createUtilityPlugin.js +2 -2
  34. package/lib/util/dataTypes.js +69 -6
  35. package/lib/util/defaults.js +4 -4
  36. package/lib/util/escapeClassName.js +2 -2
  37. package/lib/util/formatVariantSelector.js +12 -7
  38. package/lib/util/getAllConfigs.js +2 -3
  39. package/lib/util/isPlainObject.js +1 -1
  40. package/lib/util/log.js +0 -17
  41. package/lib/util/normalizeConfig.js +28 -59
  42. package/lib/util/normalizeScreens.js +3 -3
  43. package/lib/util/pluginUtils.js +22 -7
  44. package/lib/util/pseudoElements.js +3 -0
  45. package/lib/util/resolveConfig.js +6 -10
  46. package/lib/util/validateConfig.js +0 -11
  47. package/lib/util/withAlphaVariable.js +1 -1
  48. package/nesting/index.d.ts +4 -0
  49. package/package.json +39 -34
  50. package/peers/index.js +96671 -0
  51. package/resolveConfig.d.ts +22 -3
  52. package/scripts/generate-types.js +1 -2
  53. package/src/cli/build/deps.js +56 -0
  54. package/src/cli/build/index.js +0 -4
  55. package/src/cli/build/plugin.js +53 -85
  56. package/src/cli/build/watching.js +1 -1
  57. package/src/cli/index.js +0 -1
  58. package/src/cli-peer-dependencies.js +15 -0
  59. package/src/corePluginList.js +1 -1
  60. package/src/corePlugins.js +157 -44
  61. package/src/css/preflight.css +20 -9
  62. package/src/featureFlags.js +3 -9
  63. package/src/lib/content.js +1 -33
  64. package/src/lib/defaultExtractor.js +30 -17
  65. package/src/lib/expandApplyAtRules.js +24 -0
  66. package/src/lib/expandTailwindAtRules.js +19 -56
  67. package/src/lib/generateRules.js +43 -22
  68. package/src/lib/load-config.ts +13 -0
  69. package/src/lib/normalizeTailwindDirectives.js +27 -0
  70. package/src/lib/offsets.js +62 -3
  71. package/src/lib/resolveDefaultsAtRules.js +5 -1
  72. package/src/lib/setupContextUtils.js +79 -39
  73. package/src/plugin.js +0 -86
  74. package/src/processTailwindFeatures.js +0 -3
  75. package/src/util/cloneNodes.js +35 -14
  76. package/src/util/color.js +1 -1
  77. package/src/util/dataTypes.js +78 -6
  78. package/src/util/formatVariantSelector.js +7 -0
  79. package/src/util/isPlainObject.js +1 -1
  80. package/src/util/log.js +0 -24
  81. package/src/util/normalizeConfig.js +11 -38
  82. package/src/util/pluginUtils.js +21 -1
  83. package/src/util/pseudoElements.js +4 -0
  84. package/src/util/validateConfig.js +0 -10
  85. package/stubs/config.full.js +75 -16
  86. package/stubs/config.simple.js +1 -1
  87. package/stubs/postcss.config.cjs +1 -0
  88. package/stubs/postcss.config.js +1 -0
  89. package/types/config.d.ts +12 -5
  90. package/types/generated/corePluginList.d.ts +1 -1
  91. package/types/generated/default-theme.d.ts +34 -9
  92. package/types/index.d.ts +7 -3
  93. package/index.css +0 -5
  94. package/lib/lib/detectNesting.js +0 -45
  95. package/lib/lib/handleImportAtRules.js +0 -50
  96. package/src/lib/detectNesting.js +0 -47
  97. package/src/lib/handleImportAtRules.js +0 -34
@@ -24,16 +24,19 @@
24
24
  4. Use the user's configured `sans` font-family by default.
25
25
  5. Use the user's configured `sans` font-feature-settings by default.
26
26
  6. Use the user's configured `sans` font-variation-settings by default.
27
+ 7. Disable tap highlights on iOS
27
28
  */
28
29
 
29
- html {
30
+ html,
31
+ :host {
30
32
  line-height: 1.5; /* 1 */
31
33
  -webkit-text-size-adjust: 100%; /* 2 */
32
34
  -moz-tab-size: 4; /* 3 */
33
35
  tab-size: 4; /* 3 */
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 */
36
+ font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
35
37
  font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
36
38
  font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
39
+ -webkit-tap-highlight-color: transparent; /* 7 */
37
40
  }
38
41
 
39
42
  /*
@@ -99,8 +102,10 @@ strong {
99
102
  }
100
103
 
101
104
  /*
102
- 1. Use the user's configured `mono` font family by default.
103
- 2. Correct the odd `em` font sizing in all browsers.
105
+ 1. Use the user's configured `mono` font-family by default.
106
+ 2. Use the user's configured `mono` font-feature-settings by default.
107
+ 3. Use the user's configured `mono` font-variation-settings by default.
108
+ 4. Correct the odd `em` font sizing in all browsers.
104
109
  */
105
110
 
106
111
  code,
@@ -108,7 +113,9 @@ kbd,
108
113
  samp,
109
114
  pre {
110
115
  font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
111
- font-size: 1em; /* 2 */
116
+ font-feature-settings: theme('fontFamily.mono[1].fontFeatureSettings', normal); /* 2 */
117
+ font-variation-settings: theme('fontFamily.mono[1].fontVariationSettings', normal); /* 3 */
118
+ font-size: 1em; /* 4 */
112
119
  }
113
120
 
114
121
  /*
@@ -168,6 +175,7 @@ textarea {
168
175
  font-size: 100%; /* 1 */
169
176
  font-weight: inherit; /* 1 */
170
177
  line-height: inherit; /* 1 */
178
+ letter-spacing: inherit; /* 1 */
171
179
  color: inherit; /* 1 */
172
180
  margin: 0; /* 2 */
173
181
  padding: 0; /* 3 */
@@ -188,9 +196,9 @@ select {
188
196
  */
189
197
 
190
198
  button,
191
- [type='button'],
192
- [type='reset'],
193
- [type='submit'] {
199
+ input:where([type='button']),
200
+ input:where([type='reset']),
201
+ input:where([type='submit']) {
194
202
  -webkit-appearance: button; /* 1 */
195
203
  background-color: transparent; /* 2 */
196
204
  background-image: none; /* 2 */
@@ -266,7 +274,7 @@ summary {
266
274
  }
267
275
 
268
276
  /*
269
- Removes the default spacing for appropriate elements.
277
+ Removes the default spacing and border for appropriate elements.
270
278
  */
271
279
 
272
280
  blockquote,
@@ -302,6 +310,9 @@ menu {
302
310
  padding: 0;
303
311
  }
304
312
 
313
+ /*
314
+ Reset default styling for dialogs.
315
+ */
305
316
  dialog {
306
317
  padding: 0;
307
318
  }
@@ -9,9 +9,6 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- featureFlags: function() {
13
- return featureFlags;
14
- },
15
12
  flagEnabled: function() {
16
13
  return flagEnabled;
17
14
  },
@@ -31,44 +28,41 @@ function _interop_require_default(obj) {
31
28
  }
32
29
  let defaults = {
33
30
  optimizeUniversalDefaults: false,
31
+ generalizedModifiers: true,
34
32
  disableColorOpacityUtilitiesByDefault: false,
35
- relativeContentPathsByDefault: false,
36
- oxideParser: true,
37
- logicalSiblingUtilities: false
33
+ relativeContentPathsByDefault: false
38
34
  };
39
35
  let featureFlags = {
40
36
  future: [
41
37
  "hoverOnlyWhenSupported",
42
38
  "respectDefaultRingColorOpacity",
43
39
  "disableColorOpacityUtilitiesByDefault",
44
- "relativeContentPathsByDefault",
45
- "logicalSiblingUtilities"
40
+ "relativeContentPathsByDefault"
46
41
  ],
47
42
  experimental: [
48
43
  "optimizeUniversalDefaults",
49
- "oxideParser"
44
+ "generalizedModifiers"
50
45
  ]
51
46
  };
52
47
  function flagEnabled(config, flag) {
53
48
  if (featureFlags.future.includes(flag)) {
54
- var _config_future, _config;
49
+ var _config_future;
55
50
  var _config_future_flag, _ref;
56
- return config.future === "all" || ((_ref = (_config_future_flag = (_config = 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);
51
+ 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);
57
52
  }
58
53
  if (featureFlags.experimental.includes(flag)) {
59
- var _config_experimental, _config1;
54
+ var _config_experimental;
60
55
  var _config_experimental_flag, _ref1;
61
- return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = (_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_experimental = _config1.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);
56
+ 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);
62
57
  }
63
58
  return false;
64
59
  }
65
60
  function experimentalFlagsEnabled(config) {
66
- var _config;
67
61
  if (config.experimental === "all") {
68
62
  return featureFlags.experimental;
69
63
  }
70
64
  var _config_experimental;
71
- return Object.keys((_config_experimental = (_config = 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]);
65
+ 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]);
72
66
  }
73
67
  function issueFlagNotices(config) {
74
68
  if (process.env.JEST_WORKER_ID !== undefined) {
@@ -24,39 +24,13 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
24
24
  const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
25
25
  const _parseGlob = require("../util/parseGlob");
26
26
  const _sharedState = require("./sharedState");
27
- const _oxide = require("@tailwindcss/oxide");
28
27
  function _interop_require_default(obj) {
29
28
  return obj && obj.__esModule ? obj : {
30
29
  default: obj
31
30
  };
32
31
  }
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
32
  function parseCandidateFiles(context, tailwindConfig) {
55
- let files = resolveContentFiles(tailwindConfig, {
56
- skip: [
57
- context.userConfigPath
58
- ]
59
- });
33
+ let files = tailwindConfig.content.files;
60
34
  // Normalize the file globs
61
35
  files = files.filter((filePath)=>typeof filePath === "string");
62
36
  files = files.map(_normalizepath.default);
@@ -161,7 +135,7 @@ function parseCandidateFiles(context, tailwindConfig) {
161
135
  return paths;
162
136
  }
163
137
  function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
164
- let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw, extension = "html" })=>({
138
+ let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
165
139
  content: raw,
166
140
  extension
167
141
  }));
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "defaultExtractor", {
8
8
  return defaultExtractor;
9
9
  }
10
10
  });
11
- const _featureFlags = require("../featureFlags");
12
11
  const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
13
12
  function _getRequireWildcardCache(nodeInterop) {
14
13
  if (typeof WeakMap !== "function") return null;
@@ -57,17 +56,15 @@ function defaultExtractor(context) {
57
56
  /** @type {(string|string)[]} */ let results = [];
58
57
  for (let pattern of patterns){
59
58
  var _content_match;
60
- results = [
61
- ...results,
62
- ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
63
- ];
59
+ for (let result of (_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []){
60
+ results.push(clipAtBalancedParens(result));
61
+ }
64
62
  }
65
- return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
63
+ return results;
66
64
  };
67
65
  }
68
66
  function* buildRegExps(context) {
69
67
  let separator = context.tailwindConfig.separator;
70
- let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping");
71
68
  let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
72
69
  /-?/,
73
70
  _regex.escape(context.tailwindConfig.prefix)
@@ -79,16 +76,25 @@ function* buildRegExps(context) {
79
76
  // This is a targeted fix to continue to allow theme()
80
77
  // with square brackets to work in arbitrary properties
81
78
  // while fixing a problem with the regex matching too much
82
- /\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
79
+ /\[[^\s:'"`\]]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
83
80
  // Utilities
84
81
  _regex.pattern([
85
82
  // Utility Name / Group Name
86
- /-?(?:\w+)/,
83
+ _regex.any([
84
+ /-?(?:\w+)/,
85
+ // This is here to make sure @container supports everything that other utilities do
86
+ /@(?:\w+)/
87
+ ]),
87
88
  // Normal/Arbitrary values
88
89
  _regex.optional(_regex.any([
89
90
  _regex.pattern([
90
91
  // Arbitrary values
91
- /-(?:\w+-)*\[[^\s:]+\]/,
92
+ _regex.any([
93
+ /-(?:\w+-)*\['[^\s]+'\]/,
94
+ /-(?:\w+-)*\["[^\s]+"\]/,
95
+ /-(?:\w+-)*\[`[^\s]+`\]/,
96
+ /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/
97
+ ]),
92
98
  // Not immediately followed by an `{[(`
93
99
  /(?![{([]])/,
94
100
  // optionally followed by an opacity modifier
@@ -96,7 +102,12 @@ function* buildRegExps(context) {
96
102
  ]),
97
103
  _regex.pattern([
98
104
  // Arbitrary values
99
- /-(?:\w+-)*\[[^\s]+\]/,
105
+ _regex.any([
106
+ /-(?:\w+-)*\['[^\s]+'\]/,
107
+ /-(?:\w+-)*\["[^\s]+"\]/,
108
+ /-(?:\w+-)*\[`[^\s]+`\]/,
109
+ /-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s\[\]]+\]/
110
+ ]),
100
111
  // Not immediately followed by an `{[(`
101
112
  /(?![{([]])/,
102
113
  // optionally followed by an opacity modifier
@@ -115,6 +126,11 @@ function* buildRegExps(context) {
115
126
  /@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
116
127
  separator
117
128
  ]),
129
+ // With variant modifier (e.g.: group-[..]/modifier)
130
+ _regex.pattern([
131
+ /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/[\w_-]+/,
132
+ separator
133
+ ]),
118
134
  _regex.pattern([
119
135
  /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
120
136
  separator
@@ -126,6 +142,11 @@ function* buildRegExps(context) {
126
142
  ]),
127
143
  // With quotes allowed
128
144
  _regex.any([
145
+ // With variant modifier (e.g.: group-[..]/modifier)
146
+ _regex.pattern([
147
+ /([^\s"'`\[\\]+-)?\[[^\s`]+\]\/[\w_-]+/,
148
+ separator
149
+ ]),
129
150
  _regex.pattern([
130
151
  /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
131
152
  separator
@@ -145,20 +166,7 @@ function* buildRegExps(context) {
145
166
  // Important (optional)
146
167
  /!?/,
147
168
  prefix,
148
- variantGroupingEnabled ? _regex.any([
149
- // Or any of those things but grouped separated by commas
150
- _regex.pattern([
151
- /\(/,
152
- utility,
153
- _regex.zeroOrMore([
154
- /,/,
155
- utility
156
- ]),
157
- /\)/
158
- ]),
159
- // Arbitrary properties, constrained utilities, arbitrary values, etc…
160
- utility
161
- ]) : utility
169
+ utility
162
170
  ]);
163
171
  }
164
172
  // 5. Inner matches
@@ -188,11 +188,11 @@ function _default(context) {
188
188
  let config = context.tailwindConfig;
189
189
  let functions = {
190
190
  theme: (node, path, ...defaultValue)=>{
191
- let { isValid, value, error, alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
191
+ let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
192
192
  if (!isValid) {
193
- var _parentNode_raws_tailwind, _parentNode;
193
+ var _parentNode_raws_tailwind;
194
194
  let parentNode = node.parent;
195
- let candidate = (_parentNode = parentNode) === null || _parentNode === void 0 ? void 0 : (_parentNode_raws_tailwind = _parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
195
+ let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
196
196
  if (parentNode && candidate !== undefined) {
197
197
  // Remove this utility from any caches
198
198
  context.markInvalidUtilityNode(parentNode);
@@ -219,7 +219,7 @@ function _default(context) {
219
219
  screen: (node, screen)=>{
220
220
  screen = screen.replace(/^['"]+/g, "").replace(/['"]+$/g, "");
221
221
  let screens = (0, _normalizeScreens.normalizeScreens)(config.theme.screens);
222
- let screenDefinition = screens.find(({ name })=>name === screen);
222
+ let screenDefinition = screens.find(({ name })=>name === screen);
223
223
  if (!screenDefinition) {
224
224
  throw node.error(`The '${screen}' screen does not exist in your theme.`);
225
225
  }
@@ -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,
@@ -482,6 +495,12 @@ function processApply(root, context, localCache) {
482
495
  // We do *not* want to do this for user CSS that happens to be structured the same
483
496
  let isGenerated = parent.raws.tailwind !== undefined;
484
497
  let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
498
+ // If the selector becomes empty after replacing the important selector
499
+ // This means that it's the same as the parent selector and we don't want to replace it
500
+ // Otherwise we'll crash
501
+ if (parentSelector === "") {
502
+ parentSelector = parent.selector;
503
+ }
485
504
  rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
486
505
  // And then re-add it if it was removed
487
506
  if (importantSelector && parentSelector !== parent.selector) {
@@ -10,13 +10,11 @@ Object.defineProperty(exports, "default", {
10
10
  });
11
11
  const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
12
  const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
13
- const _oxide = require("@tailwindcss/oxide");
14
13
  const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
15
14
  const _generateRules = require("./generateRules");
16
15
  const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
17
16
  const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
18
17
  const _defaultExtractor = require("./defaultExtractor");
19
- const _featureFlags = require("../featureFlags");
20
18
  function _interop_require_default(obj) {
21
19
  return obj && obj.__esModule ? obj : {
22
20
  default: obj
@@ -71,12 +69,7 @@ const builtInTransformers = {
71
69
  };
72
70
  function getExtractor(context, fileExtension) {
73
71
  let extractors = context.tailwindConfig.content.extract;
74
- return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || // Because we call `DEFAULT(context)`, the returning function is always a new function without a
75
- // stable identity. Marking it with `DEFAULT_EXTRACTOR` allows us to check if it is the default
76
- // extractor without relying on the function identity.
77
- Object.assign(builtInExtractors.DEFAULT(context), {
78
- DEFAULT_EXTRACTOR: true
79
- });
72
+ return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || builtInExtractors.DEFAULT(context);
80
73
  }
81
74
  function getTransformer(tailwindConfig, fileExtension) {
82
75
  let transformers = tailwindConfig.content.transform;
@@ -161,40 +154,22 @@ function expandTailwindAtRules(context) {
161
154
  ]);
162
155
  let seen = new Set();
163
156
  env.DEBUG && console.time("Reading changed files");
164
- if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "oxideParser")) {
165
- let rustParserContent = [];
166
- let regexParserContent = [];
167
- for (let item of context.changedContent){
168
- var _extractor;
169
- let transformer = getTransformer(context.tailwindConfig, item.extension);
170
- let extractor = getExtractor(context, item.extension);
171
- if (transformer === builtInTransformers.DEFAULT && ((_extractor = extractor) === null || _extractor === void 0 ? void 0 : _extractor.DEFAULT_EXTRACTOR) === true) {
172
- rustParserContent.push(item);
173
- } else {
174
- regexParserContent.push([
175
- item,
176
- {
177
- transformer,
178
- extractor
179
- }
180
- ]);
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
181
166
  }
182
- }
183
- if (rustParserContent.length > 0) {
184
- for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
185
- candidates.add(candidate);
186
- }
187
- }
188
- if (regexParserContent.length > 0) {
189
- await Promise.all(regexParserContent.map(async ([{ file, content }, { transformer, extractor }])=>{
190
- content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
191
- getClassCandidates(transformer(content), extractor, candidates, seen);
192
- }));
193
- }
194
- } else {
195
- await Promise.all(context.changedContent.map(async ({ file, content, extension })=>{
196
- let transformer = getTransformer(context.tailwindConfig, extension);
197
- let extractor = getExtractor(context, extension);
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 }])=>{
198
173
  content = file ? await _fs.default.promises.readFile(file, "utf8") : content;
199
174
  getClassCandidates(transformer(content), extractor, candidates, seen);
200
175
  }));
@@ -205,9 +180,6 @@ function expandTailwindAtRules(context) {
205
180
  let classCacheCount = context.classCache.size;
206
181
  env.DEBUG && console.time("Generate rules");
207
182
  env.DEBUG && console.time("Sorting candidates");
208
- // TODO: only sort if we are not using the oxide parser (flagEnabled(context.tailwindConfig,
209
- // 'oxideParser')) AND if we got all the candidates form the oxideParser alone. This will not
210
- // be the case currently if you have custom transformers / extractors.
211
183
  let sortedCandidates = new Set([
212
184
  ...candidates
213
185
  ].sort((a, z)=>{
@@ -226,7 +198,7 @@ function expandTailwindAtRules(context) {
226
198
  ], context);
227
199
  }
228
200
  env.DEBUG && console.timeEnd("Build stylesheet");
229
- let { defaults: defaultNodes, base: baseNodes, components: componentNodes, utilities: utilityNodes, variants: screenNodes } = context.stylesheetCache;
201
+ let { defaults: defaultNodes , base: baseNodes , components: componentNodes , utilities: utilityNodes , variants: screenNodes } = context.stylesheetCache;
230
202
  // ---
231
203
  // Replace any Tailwind directives with generated CSS
232
204
  if (layerNodes.base) {
@@ -272,21 +244,13 @@ function expandTailwindAtRules(context) {
272
244
  }));
273
245
  layerNodes.variants.remove();
274
246
  } else if (variantNodes.length > 0) {
275
- let cloned = (0, _cloneNodes.default)(variantNodes, undefined, {
247
+ root.append((0, _cloneNodes.default)(variantNodes, root.source, {
276
248
  layer: "variants"
277
- });
278
- cloned.forEach((node)=>{
279
- var _node_raws_tailwind;
280
- var _node_raws_tailwind_parentLayer;
281
- let parentLayer = (_node_raws_tailwind_parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) !== null && _node_raws_tailwind_parentLayer !== void 0 ? _node_raws_tailwind_parentLayer : null;
282
- node.walk((n)=>{
283
- if (!n.source) {
284
- n.source = layerNodes[parentLayer].source;
285
- }
286
- });
287
- });
288
- root.append(cloned);
249
+ }));
289
250
  }
251
+ var _root_source_end;
252
+ // TODO: Why is the root node having no source location for `end` possible?
253
+ root.source.end = (_root_source_end = root.source.end) !== null && _root_source_end !== void 0 ? _root_source_end : root.source.start;
290
254
  // If we've got a utility layer and no utilities are generated there's likely something wrong
291
255
  const hasUtilityVariants = variantNodes.some((node)=>{
292
256
  var _node_raws_tailwind;