tailwindcss 0.0.0-insiders.cbbfa82 → 0.0.0-insiders.cc1eec6

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 (140) hide show
  1. package/README.md +1 -1
  2. package/lib/cli/build/index.js +7 -3
  3. package/lib/cli/build/plugin.js +65 -51
  4. package/lib/cli/build/watching.js +4 -2
  5. package/lib/cli/index.js +222 -10
  6. package/lib/cli/init/index.js +22 -7
  7. package/lib/cli.js +4 -236
  8. package/lib/corePluginList.js +4 -0
  9. package/lib/corePlugins.js +319 -52
  10. package/lib/css/preflight.css +2 -0
  11. package/lib/featureFlags.js +16 -9
  12. package/lib/index.js +4 -46
  13. package/lib/lib/collapseAdjacentRules.js +2 -2
  14. package/lib/lib/collapseDuplicateDeclarations.js +2 -2
  15. package/lib/lib/content.js +16 -16
  16. package/lib/lib/defaultExtractor.js +10 -5
  17. package/lib/lib/detectNesting.js +7 -1
  18. package/lib/lib/evaluateTailwindFunctions.js +4 -4
  19. package/lib/lib/expandApplyAtRules.js +14 -3
  20. package/lib/lib/expandTailwindAtRules.js +34 -9
  21. package/lib/lib/findAtConfigPath.js +3 -3
  22. package/lib/lib/generateRules.js +123 -64
  23. package/lib/lib/getModuleDependencies.js +79 -33
  24. package/lib/lib/load-config.js +40 -0
  25. package/lib/lib/offsets.js +88 -1
  26. package/lib/lib/remap-bitfield.js +87 -0
  27. package/lib/lib/resolveDefaultsAtRules.js +4 -4
  28. package/lib/lib/setupContextUtils.js +123 -68
  29. package/lib/lib/setupTrackingContext.js +29 -8
  30. package/lib/lib/sharedState.js +25 -2
  31. package/lib/oxide/cli/build/deps.js +81 -0
  32. package/lib/oxide/cli/build/index.js +51 -0
  33. package/lib/oxide/cli/build/plugin.js +373 -0
  34. package/lib/oxide/cli/build/utils.js +77 -0
  35. package/lib/oxide/cli/build/watching.js +177 -0
  36. package/lib/oxide/cli/help/index.js +70 -0
  37. package/lib/oxide/cli/index.js +214 -0
  38. package/lib/oxide/cli/init/index.js +50 -0
  39. package/lib/oxide/cli.js +5 -0
  40. package/lib/oxide/postcss-plugin.js +2 -0
  41. package/lib/plugin.js +98 -0
  42. package/lib/postcss-plugins/nesting/plugin.js +2 -2
  43. package/lib/public/colors.js +44 -22
  44. package/lib/public/default-config.js +2 -2
  45. package/lib/public/default-theme.js +2 -2
  46. package/lib/public/load-config.js +10 -0
  47. package/lib/util/applyImportantSelector.js +37 -0
  48. package/lib/util/cloneNodes.js +2 -2
  49. package/lib/util/color.js +20 -6
  50. package/lib/util/createUtilityPlugin.js +2 -2
  51. package/lib/util/dataTypes.js +26 -2
  52. package/lib/util/defaults.js +4 -4
  53. package/lib/util/escapeClassName.js +3 -3
  54. package/lib/util/formatVariantSelector.js +173 -115
  55. package/lib/util/getAllConfigs.js +4 -4
  56. package/lib/util/negateValue.js +2 -2
  57. package/lib/util/normalizeConfig.js +21 -22
  58. package/lib/util/pluginUtils.js +20 -39
  59. package/lib/util/prefixSelector.js +22 -8
  60. package/lib/util/resolveConfig.js +7 -7
  61. package/lib/util/resolveConfigPath.js +19 -7
  62. package/lib/util/splitAtTopLevelOnly.js +7 -1
  63. package/lib/util/validateConfig.js +11 -0
  64. package/loadConfig.d.ts +4 -0
  65. package/loadConfig.js +2 -0
  66. package/package.json +33 -21
  67. package/peers/index.js +108 -173
  68. package/resolveConfig.d.ts +11 -2
  69. package/scripts/swap-engines.js +40 -0
  70. package/src/cli/build/index.js +7 -7
  71. package/src/cli/build/plugin.js +40 -30
  72. package/src/cli/build/watching.js +4 -2
  73. package/src/cli/index.js +216 -3
  74. package/src/cli/init/index.js +37 -8
  75. package/src/cli.js +4 -231
  76. package/src/corePluginList.js +1 -1
  77. package/src/corePlugins.js +205 -29
  78. package/src/css/preflight.css +2 -0
  79. package/src/featureFlags.js +7 -0
  80. package/src/index.js +4 -46
  81. package/src/lib/content.js +12 -17
  82. package/src/lib/defaultExtractor.js +9 -3
  83. package/src/lib/detectNesting.js +9 -1
  84. package/src/lib/expandApplyAtRules.js +14 -1
  85. package/src/lib/expandTailwindAtRules.js +35 -6
  86. package/src/lib/generateRules.js +124 -42
  87. package/src/lib/getModuleDependencies.js +70 -30
  88. package/src/lib/load-config.ts +31 -0
  89. package/src/lib/offsets.js +104 -1
  90. package/src/lib/remap-bitfield.js +82 -0
  91. package/src/lib/setupContextUtils.js +99 -43
  92. package/src/lib/setupTrackingContext.js +35 -10
  93. package/src/lib/sharedState.js +30 -4
  94. package/src/oxide/cli/build/deps.ts +91 -0
  95. package/src/oxide/cli/build/index.ts +47 -0
  96. package/src/oxide/cli/build/plugin.ts +442 -0
  97. package/src/oxide/cli/build/utils.ts +74 -0
  98. package/src/oxide/cli/build/watching.ts +225 -0
  99. package/src/oxide/cli/help/index.ts +69 -0
  100. package/src/oxide/cli/index.ts +204 -0
  101. package/src/oxide/cli/init/index.ts +59 -0
  102. package/src/oxide/cli.ts +1 -0
  103. package/src/oxide/postcss-plugin.ts +1 -0
  104. package/src/plugin.js +107 -0
  105. package/src/public/colors.js +22 -0
  106. package/src/public/default-config.js +1 -1
  107. package/src/public/default-theme.js +2 -2
  108. package/src/public/load-config.js +2 -0
  109. package/src/util/applyImportantSelector.js +30 -0
  110. package/src/util/color.js +17 -2
  111. package/src/util/dataTypes.js +29 -4
  112. package/src/util/formatVariantSelector.js +240 -121
  113. package/src/util/getAllConfigs.js +2 -2
  114. package/src/util/negateValue.js +1 -1
  115. package/src/util/normalizeConfig.js +2 -1
  116. package/src/util/pluginUtils.js +10 -29
  117. package/src/util/prefixSelector.js +28 -10
  118. package/src/util/resolveConfigPath.js +12 -1
  119. package/src/util/splitAtTopLevelOnly.js +8 -1
  120. package/src/util/validateConfig.js +13 -0
  121. package/stubs/.gitignore +1 -0
  122. package/stubs/.prettierrc.json +6 -0
  123. package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
  124. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  125. package/stubs/postcss.config.js +6 -0
  126. package/stubs/tailwind.config.cjs +2 -0
  127. package/stubs/tailwind.config.js +2 -0
  128. package/stubs/tailwind.config.ts +3 -0
  129. package/types/config.d.ts +15 -9
  130. package/types/generated/colors.d.ts +22 -0
  131. package/types/generated/corePluginList.d.ts +1 -1
  132. package/types/generated/default-theme.d.ts +108 -79
  133. package/CHANGELOG.md +0 -2339
  134. package/lib/cli/shared.js +0 -12
  135. package/lib/constants.js +0 -44
  136. package/scripts/install-integrations.js +0 -27
  137. package/scripts/rebuildFixtures.js +0 -68
  138. package/src/cli/shared.js +0 -5
  139. package/src/constants.js +0 -17
  140. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -15,6 +15,7 @@ _export(exports, {
15
15
  });
16
16
  const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
17
17
  const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
18
+ const _sharedState = require("./lib/sharedState");
18
19
  function _interopRequireDefault(obj) {
19
20
  return obj && obj.__esModule ? obj : {
20
21
  default: obj
@@ -22,7 +23,13 @@ function _interopRequireDefault(obj) {
22
23
  }
23
24
  let defaults = {
24
25
  optimizeUniversalDefaults: false,
25
- generalizedModifiers: true
26
+ generalizedModifiers: true,
27
+ get disableColorOpacityUtilitiesByDefault () {
28
+ return _sharedState.env.OXIDE;
29
+ },
30
+ get relativeContentPathsByDefault () {
31
+ return _sharedState.env.OXIDE;
32
+ }
26
33
  };
27
34
  let featureFlags = {
28
35
  future: [
@@ -38,14 +45,14 @@ let featureFlags = {
38
45
  };
39
46
  function flagEnabled(config, flag) {
40
47
  if (featureFlags.future.includes(flag)) {
41
- var ref;
42
- var ref1, ref2;
43
- return config.future === "all" || ((ref2 = (ref1 = config === null || config === void 0 ? void 0 : (ref = config.future) === null || ref === void 0 ? void 0 : ref[flag]) !== null && ref1 !== void 0 ? ref1 : defaults[flag]) !== null && ref2 !== void 0 ? ref2 : false);
48
+ var _config_future;
49
+ var _config_future_flag, _ref;
50
+ 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);
44
51
  }
45
52
  if (featureFlags.experimental.includes(flag)) {
46
- var ref3;
47
- var ref4, ref5;
48
- return config.experimental === "all" || ((ref5 = (ref4 = config === null || config === void 0 ? void 0 : (ref3 = config.experimental) === null || ref3 === void 0 ? void 0 : ref3[flag]) !== null && ref4 !== void 0 ? ref4 : defaults[flag]) !== null && ref5 !== void 0 ? ref5 : false);
53
+ var _config_experimental;
54
+ var _config_experimental_flag, _ref1;
55
+ 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);
49
56
  }
50
57
  return false;
51
58
  }
@@ -53,8 +60,8 @@ function experimentalFlagsEnabled(config) {
53
60
  if (config.experimental === "all") {
54
61
  return featureFlags.experimental;
55
62
  }
56
- var ref;
57
- return Object.keys((ref = config === null || config === void 0 ? void 0 : config.experimental) !== null && ref !== void 0 ? ref : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
63
+ var _config_experimental;
64
+ 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]);
58
65
  }
59
66
  function issueFlagNotices(config) {
60
67
  if (process.env.JEST_WORKER_ID !== undefined) {
package/lib/index.js CHANGED
@@ -1,48 +1,6 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
6
- const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
7
- const _sharedState = require("./lib/sharedState");
8
- const _findAtConfigPath = require("./lib/findAtConfigPath");
9
- function _interopRequireDefault(obj) {
10
- return obj && obj.__esModule ? obj : {
11
- default: obj
12
- };
2
+ if (process.env.OXIDE) {
3
+ module.exports = require("./oxide/postcss-plugin");
4
+ } else {
5
+ module.exports = require("./plugin");
13
6
  }
14
- module.exports = function tailwindcss(configOrPath) {
15
- return {
16
- postcssPlugin: "tailwindcss",
17
- plugins: [
18
- _sharedState.env.DEBUG && function(root) {
19
- console.log("\n");
20
- console.time("JIT TOTAL");
21
- return root;
22
- },
23
- function(root, result) {
24
- var ref;
25
- // Use the path for the `@config` directive if it exists, otherwise use the
26
- // path for the file being processed
27
- configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
28
- let context = (0, _setupTrackingContext.default)(configOrPath);
29
- if (root.type === "document") {
30
- let roots = root.nodes.filter((node)=>node.type === "root");
31
- for (const root1 of roots){
32
- if (root1.type === "root") {
33
- (0, _processTailwindFeatures.default)(context)(root1, result);
34
- }
35
- }
36
- return;
37
- }
38
- (0, _processTailwindFeatures.default)(context)(root, result);
39
- },
40
- _sharedState.env.DEBUG && function(root) {
41
- console.timeEnd("JIT TOTAL");
42
- console.log("\n");
43
- return root;
44
- }
45
- ].filter(Boolean)
46
- };
47
- };
48
- module.exports.postcss = true;
@@ -29,10 +29,10 @@ function collapseAdjacentRules() {
29
29
  return;
30
30
  }
31
31
  let properties = comparisonMap[node.type];
32
- var _property, _property1;
32
+ var _node_property, _currentRule_property;
33
33
  if (node.type === "atrule" && node.name === "font-face") {
34
34
  currentRule = node;
35
- } else if (properties.every((property)=>((_property = node[property]) !== null && _property !== void 0 ? _property : "").replace(/\s+/g, " ") === ((_property1 = currentRule[property]) !== null && _property1 !== void 0 ? _property1 : "").replace(/\s+/g, " "))) {
35
+ } else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property : "").replace(/\s+/g, " ") === ((_currentRule_property = currentRule[property]) !== null && _currentRule_property !== void 0 ? _currentRule_property : "").replace(/\s+/g, " "))) {
36
36
  // An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
37
37
  if (node.nodes) {
38
38
  currentRule.append(node.nodes);
@@ -76,8 +76,8 @@ let UNITLESS_NUMBER = Symbol("unitless-number");
76
76
  function resolveUnit(input) {
77
77
  let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
78
78
  if (result) {
79
- var ref;
80
- return (ref = result[1]) !== null && ref !== void 0 ? ref : UNITLESS_NUMBER;
79
+ var _result_;
80
+ return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
81
81
  }
82
82
  return null;
83
83
  }
@@ -135,43 +135,43 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
135
135
  content: raw,
136
136
  extension
137
137
  }));
138
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
139
- let content = _fs.default.readFileSync(changedFile, "utf8");
138
+ let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
139
+ for (let changedFile of changedFiles){
140
140
  let extension = _path.default.extname(changedFile).slice(1);
141
141
  changedContent.push({
142
- content,
142
+ file: changedFile,
143
143
  extension
144
144
  });
145
145
  }
146
- return changedContent;
146
+ return [
147
+ changedContent,
148
+ mTimesToCommit
149
+ ];
147
150
  }
148
151
  /**
149
152
  *
150
153
  * @param {ContentPath[]} candidateFiles
151
154
  * @param {Map<string, number>} fileModifiedMap
152
- * @returns {Set<string>}
155
+ * @returns {[Set<string>, Map<string, number>]}
153
156
  */ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
154
157
  let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
158
+ let mTimesToCommit = new Map();
155
159
  let changedFiles = new Set();
156
160
  _sharedState.env.DEBUG && console.time("Finding changed files");
157
161
  let files = _fastGlob.default.sync(paths, {
158
162
  absolute: true
159
163
  });
160
164
  for (let file of files){
161
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
165
+ let prevModified = fileModifiedMap.get(file) || -Infinity;
162
166
  let modified = _fs.default.statSync(file).mtimeMs;
163
- // This check is intentionally >= because we track the last modified time of context dependencies
164
- // earier in the process and we want to make sure we don't miss any changes that happen
165
- // when a context dependency is also a content dependency
166
- // Ideally, we'd do all this tracking at one time but that is a larger refactor
167
- // than we want to commit to right now, so this is a decent compromise.
168
- // This should be sufficient because file modification times will be off by at least
169
- // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
170
- if (modified >= prevModified) {
167
+ if (modified > prevModified) {
171
168
  changedFiles.add(file);
172
- fileModifiedMap.set(file, modified);
169
+ mTimesToCommit.set(file, modified);
173
170
  }
174
171
  }
175
172
  _sharedState.env.DEBUG && console.timeEnd("Finding changed files");
176
- return changedFiles;
173
+ return [
174
+ changedFiles,
175
+ mTimesToCommit
176
+ ];
177
177
  }
@@ -54,10 +54,10 @@ function defaultExtractor(context) {
54
54
  */ return (content)=>{
55
55
  /** @type {(string|string)[]} */ let results = [];
56
56
  for (let pattern of patterns){
57
- var ref;
57
+ var _content_match;
58
58
  results = [
59
59
  ...results,
60
- ...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
60
+ ...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
61
61
  ];
62
62
  }
63
63
  return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
@@ -71,8 +71,13 @@ function* buildRegExps(context) {
71
71
  _regex.escape(context.tailwindConfig.prefix)
72
72
  ])) : "";
73
73
  let utility = _regex.any([
74
- // Arbitrary properties
75
- /\[[^\s:'"`]+:[^\s]+\]/,
74
+ // Arbitrary properties (without square brackets)
75
+ /\[[^\s:'"`]+:[^\s\[\]]+\]/,
76
+ // Arbitrary properties with balanced square brackets
77
+ // This is a targeted fix to continue to allow theme()
78
+ // with square brackets to work in arbitrary properties
79
+ // while fixing a problem with the regex matching too much
80
+ /\[[^\s:'"`]+:[^\s]+?\[[^\s]+?\][^\s]+?\]/,
76
81
  // Utilities
77
82
  _regex.pattern([
78
83
  // Utility Name / Group Name
@@ -216,7 +221,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
216
221
  // This means that there was an extra closing `]`
217
222
  // We'll clip to just before it
218
223
  if (depth < 0) {
219
- return input.substring(0, match.index);
224
+ return input.substring(0, match.index - 1);
220
225
  }
221
226
  // We've finished balancing the brackets but there still may be characters that can be included
222
227
  // For example in the class `text-[#336699]/[.35]`
@@ -6,12 +6,18 @@ Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
7
  get: ()=>_default
8
8
  });
9
+ function isRoot(node) {
10
+ return node.type === "root";
11
+ }
12
+ function isAtLayer(node) {
13
+ return node.type === "atrule" && node.name === "layer";
14
+ }
9
15
  function _default(_context) {
10
16
  return (root, result)=>{
11
17
  let found = false;
12
18
  root.walkAtRules("tailwind", (node)=>{
13
19
  if (found) return false;
14
- if (node.parent && node.parent.type !== "root") {
20
+ if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
15
21
  found = true;
16
22
  node.warn(result, [
17
23
  "Nested @tailwind rules were detected, but are not supported.",
@@ -177,8 +177,8 @@ let nodeTypePropertyMap = {
177
177
  alpha
178
178
  });
179
179
  });
180
- var ref;
181
- return (ref = results.find((result)=>result.isValid)) !== null && ref !== void 0 ? ref : results[0];
180
+ var _results_find;
181
+ return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
182
182
  }
183
183
  function _default(context) {
184
184
  let config = context.tailwindConfig;
@@ -186,9 +186,9 @@ function _default(context) {
186
186
  theme: (node, path, ...defaultValue)=>{
187
187
  let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
188
188
  if (!isValid) {
189
- var ref;
189
+ var _parentNode_raws_tailwind;
190
190
  let parentNode = node.parent;
191
- let candidate = (ref = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || ref === void 0 ? void 0 : ref.candidate;
191
+ 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;
192
192
  if (parentNode && candidate !== undefined) {
193
193
  // Remove this utility from any caches
194
194
  context.markInvalidUtilityNode(parentNode);
@@ -10,6 +10,8 @@ const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
10
  const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
11
11
  const _generateRules = require("./generateRules");
12
12
  const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
13
+ const _applyImportantSelector = require("../util/applyImportantSelector");
14
+ const _formatVariantSelectorJs = require("../util/formatVariantSelector.js");
13
15
  function _interopRequireDefault(obj) {
14
16
  return obj && obj.__esModule ? obj : {
15
17
  default: obj
@@ -139,8 +141,8 @@ function* pathToRoot(node) {
139
141
  root.walkRules((rule)=>{
140
142
  // Ignore rules generated by Tailwind
141
143
  for (let node of pathToRoot(rule)){
142
- var ref;
143
- if (((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.layer) !== undefined) {
144
+ var _node_raws_tailwind;
145
+ if (((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.layer) !== undefined) {
144
146
  return;
145
147
  }
146
148
  }
@@ -481,11 +483,20 @@ function processApply(root, context, localCache) {
481
483
  rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate1);
482
484
  // And then re-add it if it was removed
483
485
  if (importantSelector && parentSelector !== parent.selector) {
484
- rule.selector = `${importantSelector} ${rule.selector}`;
486
+ rule.selector = (0, _applyImportantSelector.applyImportantSelector)(rule.selector, importantSelector);
485
487
  }
486
488
  rule.walkDecls((d)=>{
487
489
  d.important = meta.important || important1;
488
490
  });
491
+ // Move pseudo elements to the end of the selector (if necessary)
492
+ let selector = (0, _postcssSelectorParser.default)().astSync(rule.selector);
493
+ selector.each((sel)=>{
494
+ let [pseudoElements] = (0, _formatVariantSelectorJs.collectPseudoElements)(sel);
495
+ if (pseudoElements.length > 0) {
496
+ sel.nodes.push(...pseudoElements.sort(_formatVariantSelectorJs.sortSelector));
497
+ }
498
+ });
499
+ rule.selector = selector.toString();
489
500
  });
490
501
  }
491
502
  // It could be that the node we were inserted was removed because the class didn't match
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "default", {
6
6
  enumerable: true,
7
7
  get: ()=>expandTailwindAtRules
8
8
  });
9
+ const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
9
10
  const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
10
11
  const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
11
12
  const _generateRules = require("./generateRules");
@@ -142,24 +143,48 @@ function expandTailwindAtRules(context) {
142
143
  if (Object.values(layerNodes).every((n)=>n === null)) {
143
144
  return root;
144
145
  }
146
+ var _context_candidates;
145
147
  // ---
146
148
  // Find potential rules in changed files
147
149
  let candidates = new Set([
150
+ ...(_context_candidates = context.candidates) !== null && _context_candidates !== void 0 ? _context_candidates : [],
148
151
  _sharedState.NOT_ON_DEMAND
149
152
  ]);
150
153
  let seen = new Set();
151
154
  env.DEBUG && console.time("Reading changed files");
152
- for (let { content , extension } of context.changedContent){
153
- let transformer = getTransformer(context.tailwindConfig, extension);
154
- let extractor = getExtractor(context, extension);
155
- getClassCandidates(transformer(content), extractor, candidates, seen);
155
+ if (env.OXIDE) {
156
+ // TODO: Pass through or implement `extractor`
157
+ for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
158
+ candidates.add(candidate);
159
+ }
160
+ // for (let { file, content, extension } of context.changedContent) {
161
+ // let transformer = getTransformer(context.tailwindConfig, extension)
162
+ // let extractor = getExtractor(context, extension)
163
+ // getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
164
+ // }
165
+ } else {
166
+ for (let { file , content , extension } of context.changedContent){
167
+ let transformer = getTransformer(context.tailwindConfig, extension);
168
+ let extractor = getExtractor(context, extension);
169
+ content = file ? _fs.default.readFileSync(file, "utf8") : content;
170
+ getClassCandidates(transformer(content), extractor, candidates, seen);
171
+ }
156
172
  }
157
173
  env.DEBUG && console.timeEnd("Reading changed files");
158
174
  // ---
159
175
  // Generate the actual CSS
160
176
  let classCacheCount = context.classCache.size;
161
177
  env.DEBUG && console.time("Generate rules");
162
- (0, _generateRules.generateRules)(candidates, context);
178
+ env.DEBUG && console.time("Sorting candidates");
179
+ let sortedCandidates = env.OXIDE ? candidates : new Set([
180
+ ...candidates
181
+ ].sort((a, z)=>{
182
+ if (a === z) return 0;
183
+ if (a < z) return -1;
184
+ return 1;
185
+ }));
186
+ env.DEBUG && console.timeEnd("Sorting candidates");
187
+ (0, _generateRules.generateRules)(sortedCandidates, context);
163
188
  env.DEBUG && console.timeEnd("Generate rules");
164
189
  // We only ever add to the classCache, so if it didn't grow, there is nothing new.
165
190
  env.DEBUG && console.time("Build stylesheet");
@@ -199,8 +224,8 @@ function expandTailwindAtRules(context) {
199
224
  }
200
225
  // We do post-filtering to not alter the emitted order of the variants
201
226
  const variantNodes = Array.from(screenNodes).filter((node)=>{
202
- var ref;
203
- const parentLayer = (ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer;
227
+ var _node_raws_tailwind;
228
+ const parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer;
204
229
  if (parentLayer === "components") {
205
230
  return layerNodes.components !== null;
206
231
  }
@@ -221,8 +246,8 @@ function expandTailwindAtRules(context) {
221
246
  }
222
247
  // If we've got a utility layer and no utilities are generated there's likely something wrong
223
248
  const hasUtilityVariants = variantNodes.some((node)=>{
224
- var ref;
225
- return ((ref = node.raws.tailwind) === null || ref === void 0 ? void 0 : ref.parentLayer) === "utilities";
249
+ var _node_raws_tailwind;
250
+ return ((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) === "utilities";
226
251
  });
227
252
  if (layerNodes.utilities && utilityNodes.size === 0 && !hasUtilityVariants) {
228
253
  _log.default.warn("content-problems", [
@@ -17,9 +17,9 @@ function findAtConfigPath(root, result) {
17
17
  let configPath = null;
18
18
  let relativeTo = null;
19
19
  root.walkAtRules("config", (rule)=>{
20
- var ref;
21
- var _file, ref1;
22
- relativeTo = (ref1 = (_file = (ref = rule.source) === null || ref === void 0 ? void 0 : ref.input.file) !== null && _file !== void 0 ? _file : result.opts.from) !== null && ref1 !== void 0 ? ref1 : null;
20
+ var _rule_source;
21
+ var _rule_source_input_file, _ref;
22
+ relativeTo = (_ref = (_rule_source_input_file = (_rule_source = rule.source) === null || _rule_source === void 0 ? void 0 : _rule_source.input.file) !== null && _rule_source_input_file !== void 0 ? _rule_source_input_file : result.opts.from) !== null && _ref !== void 0 ? _ref : null;
23
23
  if (relativeTo === null) {
24
24
  throw rule.error("The `@config` directive cannot be used without setting `from` in your PostCSS config.");
25
25
  }