tailwindcss 0.0.0-insiders.fe08e91 → 0.0.0-oxide.6bf5e56

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 (176) hide show
  1. package/CHANGELOG.md +379 -3
  2. package/LICENSE +1 -2
  3. package/README.md +12 -8
  4. package/colors.d.ts +3 -0
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultTheme.d.ts +4 -0
  7. package/lib/cli/build/deps.js +54 -0
  8. package/lib/cli/build/index.js +48 -0
  9. package/lib/cli/build/plugin.js +367 -0
  10. package/lib/cli/build/utils.js +78 -0
  11. package/lib/cli/build/watching.js +178 -0
  12. package/lib/cli/help/index.js +71 -0
  13. package/lib/cli/index.js +18 -0
  14. package/lib/cli/init/index.js +46 -0
  15. package/lib/cli/shared.js +13 -0
  16. package/lib/cli-peer-dependencies.js +20 -7
  17. package/lib/cli.js +107 -611
  18. package/lib/constants.js +27 -20
  19. package/lib/corePluginList.js +6 -3
  20. package/lib/corePlugins.js +2064 -1811
  21. package/lib/css/preflight.css +5 -5
  22. package/lib/featureFlags.js +31 -22
  23. package/lib/index.js +28 -10
  24. package/lib/lib/cacheInvalidation.js +90 -0
  25. package/lib/lib/collapseAdjacentRules.js +27 -9
  26. package/lib/lib/collapseDuplicateDeclarations.js +12 -9
  27. package/lib/lib/content.js +176 -0
  28. package/lib/lib/defaultExtractor.js +225 -31
  29. package/lib/lib/detectNesting.js +13 -10
  30. package/lib/lib/evaluateTailwindFunctions.js +118 -55
  31. package/lib/lib/expandApplyAtRules.js +439 -190
  32. package/lib/lib/expandTailwindAtRules.js +151 -134
  33. package/lib/lib/findAtConfigPath.js +44 -0
  34. package/lib/lib/generateRules.js +454 -187
  35. package/lib/lib/getModuleDependencies.js +11 -8
  36. package/lib/lib/normalizeTailwindDirectives.js +36 -32
  37. package/lib/lib/offsets.js +217 -0
  38. package/lib/lib/partitionApplyAtRules.js +56 -0
  39. package/lib/lib/regex.js +60 -0
  40. package/lib/lib/resolveDefaultsAtRules.js +89 -67
  41. package/lib/lib/setupContextUtils.js +667 -376
  42. package/lib/lib/setupTrackingContext.js +38 -67
  43. package/lib/lib/sharedState.js +27 -14
  44. package/lib/lib/substituteScreenAtRules.js +11 -9
  45. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  46. package/lib/postcss-plugins/nesting/index.js +19 -0
  47. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  48. package/lib/processTailwindFeatures.js +35 -25
  49. package/lib/public/colors.js +247 -245
  50. package/lib/public/create-plugin.js +6 -4
  51. package/lib/public/default-config.js +7 -5
  52. package/lib/public/default-theme.js +7 -5
  53. package/lib/public/resolve-config.js +8 -5
  54. package/lib/util/bigSign.js +4 -1
  55. package/lib/util/buildMediaQuery.js +11 -6
  56. package/lib/util/cloneDeep.js +7 -6
  57. package/lib/util/cloneNodes.js +21 -3
  58. package/lib/util/color.js +53 -54
  59. package/lib/util/configurePlugins.js +5 -2
  60. package/lib/util/createPlugin.js +6 -6
  61. package/lib/util/createUtilityPlugin.js +12 -14
  62. package/lib/util/dataTypes.js +119 -110
  63. package/lib/util/defaults.js +4 -1
  64. package/lib/util/escapeClassName.js +7 -4
  65. package/lib/util/escapeCommas.js +5 -2
  66. package/lib/util/flattenColorPalette.js +9 -12
  67. package/lib/util/formatVariantSelector.js +184 -85
  68. package/lib/util/getAllConfigs.js +27 -8
  69. package/lib/util/hashConfig.js +6 -3
  70. package/lib/util/isKeyframeRule.js +5 -2
  71. package/lib/util/isPlainObject.js +5 -2
  72. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +23 -15
  73. package/lib/util/log.js +20 -14
  74. package/lib/util/nameClass.js +20 -9
  75. package/lib/util/negateValue.js +23 -8
  76. package/lib/util/normalizeConfig.js +116 -72
  77. package/lib/util/normalizeScreens.js +120 -11
  78. package/lib/util/parseAnimationValue.js +42 -40
  79. package/lib/util/parseBoxShadowValue.js +30 -23
  80. package/lib/util/parseDependency.js +38 -56
  81. package/lib/util/parseGlob.js +34 -0
  82. package/lib/util/parseObjectStyles.js +11 -8
  83. package/lib/util/pluginUtils.js +147 -50
  84. package/lib/util/prefixSelector.js +10 -8
  85. package/lib/util/removeAlphaVariables.js +29 -0
  86. package/lib/util/resolveConfig.js +97 -85
  87. package/lib/util/resolveConfigPath.js +11 -9
  88. package/lib/util/responsive.js +8 -5
  89. package/lib/util/splitAtTopLevelOnly.js +43 -0
  90. package/lib/util/tap.js +4 -1
  91. package/lib/util/toColorValue.js +5 -3
  92. package/lib/util/toPath.js +20 -4
  93. package/lib/util/transformThemeValue.js +37 -29
  94. package/lib/util/validateConfig.js +24 -0
  95. package/lib/util/validateFormalSyntax.js +24 -0
  96. package/lib/util/withAlphaVariable.js +23 -15
  97. package/nesting/index.js +2 -12
  98. package/package.json +47 -42
  99. package/peers/index.js +11381 -7950
  100. package/plugin.d.ts +11 -0
  101. package/resolveConfig.d.ts +12 -0
  102. package/scripts/generate-types.js +105 -0
  103. package/scripts/release-channel.js +18 -0
  104. package/scripts/release-notes.js +21 -0
  105. package/scripts/type-utils.js +27 -0
  106. package/src/cli/build/deps.js +56 -0
  107. package/src/cli/build/index.js +49 -0
  108. package/src/cli/build/plugin.js +439 -0
  109. package/src/cli/build/utils.js +76 -0
  110. package/src/cli/build/watching.js +227 -0
  111. package/src/cli/help/index.js +70 -0
  112. package/src/cli/index.js +3 -0
  113. package/src/cli/init/index.js +50 -0
  114. package/src/cli/shared.js +6 -0
  115. package/src/cli-peer-dependencies.js +7 -1
  116. package/src/cli.js +50 -629
  117. package/src/corePluginList.js +1 -1
  118. package/src/corePlugins.js +532 -217
  119. package/src/css/preflight.css +5 -5
  120. package/src/featureFlags.js +15 -9
  121. package/src/index.js +20 -1
  122. package/src/lib/cacheInvalidation.js +52 -0
  123. package/src/lib/collapseAdjacentRules.js +21 -2
  124. package/src/lib/content.js +212 -0
  125. package/src/lib/defaultExtractor.js +196 -33
  126. package/src/lib/evaluateTailwindFunctions.js +78 -7
  127. package/src/lib/expandApplyAtRules.js +482 -183
  128. package/src/lib/expandTailwindAtRules.js +106 -85
  129. package/src/lib/findAtConfigPath.js +48 -0
  130. package/src/lib/generateRules.js +418 -129
  131. package/src/lib/normalizeTailwindDirectives.js +1 -0
  132. package/src/lib/offsets.js +270 -0
  133. package/src/lib/partitionApplyAtRules.js +52 -0
  134. package/src/lib/regex.js +74 -0
  135. package/src/lib/resolveDefaultsAtRules.js +51 -30
  136. package/src/lib/setupContextUtils.js +556 -208
  137. package/src/lib/setupTrackingContext.js +11 -48
  138. package/src/lib/sharedState.js +5 -0
  139. package/src/postcss-plugins/nesting/README.md +42 -0
  140. package/src/postcss-plugins/nesting/index.js +13 -0
  141. package/src/postcss-plugins/nesting/plugin.js +80 -0
  142. package/src/processTailwindFeatures.js +8 -0
  143. package/src/util/buildMediaQuery.js +5 -3
  144. package/src/util/cloneNodes.js +19 -2
  145. package/src/util/color.js +25 -21
  146. package/src/util/dataTypes.js +29 -21
  147. package/src/util/formatVariantSelector.js +184 -61
  148. package/src/util/getAllConfigs.js +19 -0
  149. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  150. package/src/util/log.js +8 -8
  151. package/src/util/nameClass.js +4 -0
  152. package/src/util/negateValue.js +11 -3
  153. package/src/util/normalizeConfig.js +44 -6
  154. package/src/util/normalizeScreens.js +99 -4
  155. package/src/util/parseBoxShadowValue.js +4 -3
  156. package/src/util/parseDependency.js +37 -42
  157. package/src/util/parseGlob.js +24 -0
  158. package/src/util/pluginUtils.js +132 -10
  159. package/src/util/prefixSelector.js +7 -5
  160. package/src/util/removeAlphaVariables.js +24 -0
  161. package/src/util/resolveConfig.js +70 -32
  162. package/src/util/splitAtTopLevelOnly.js +45 -0
  163. package/src/util/toPath.js +1 -1
  164. package/src/util/transformThemeValue.js +13 -3
  165. package/src/util/validateConfig.js +13 -0
  166. package/src/util/validateFormalSyntax.js +34 -0
  167. package/src/util/withAlphaVariable.js +1 -1
  168. package/stubs/defaultConfig.stub.js +23 -20
  169. package/stubs/simpleConfig.stub.js +1 -0
  170. package/types/config.d.ts +362 -0
  171. package/types/generated/.gitkeep +0 -0
  172. package/types/generated/colors.d.ts +276 -0
  173. package/types/generated/corePluginList.d.ts +1 -0
  174. package/types/generated/default-theme.d.ts +342 -0
  175. package/types/index.d.ts +7 -0
  176. package/nesting/plugin.js +0 -41
@@ -2,110 +2,120 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.getFileModifiedMap = getFileModifiedMap;
6
- exports.createContext = createContext;
7
- exports.getContext = getContext;
8
- var _fs = _interopRequireDefault(require("fs"));
9
- var _url = _interopRequireDefault(require("url"));
10
- var _postcss = _interopRequireDefault(require("postcss"));
11
- var _dlv = _interopRequireDefault(require("dlv"));
12
- var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser"));
13
- var _transformThemeValue = _interopRequireDefault(require("../util/transformThemeValue"));
14
- var _parseObjectStyles = _interopRequireDefault(require("../util/parseObjectStyles"));
15
- var _prefixSelector = _interopRequireDefault(require("../util/prefixSelector"));
16
- var _isPlainObject = _interopRequireDefault(require("../util/isPlainObject"));
17
- var _escapeClassName = _interopRequireDefault(require("../util/escapeClassName"));
18
- var _nameClass = _interopRequireWildcard(require("../util/nameClass"));
19
- var _pluginUtils = require("../util/pluginUtils");
20
- var _bigSign = _interopRequireDefault(require("../util/bigSign"));
21
- var _corePlugins = require("../corePlugins");
22
- var sharedState = _interopRequireWildcard(require("./sharedState"));
23
- var _toPath = require("../util/toPath");
24
- var _log = _interopRequireDefault(require("../util/log"));
25
- var _negateValue = _interopRequireDefault(require("../util/negateValue"));
26
- var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
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
+ isValidVariantFormatString: ()=>isValidVariantFormatString,
13
+ parseVariant: ()=>parseVariant,
14
+ getFileModifiedMap: ()=>getFileModifiedMap,
15
+ createContext: ()=>createContext,
16
+ getContext: ()=>getContext
17
+ });
18
+ const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
19
+ const _url = /*#__PURE__*/ _interopRequireDefault(require("url"));
20
+ const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
21
+ const _dlv = /*#__PURE__*/ _interopRequireDefault(require("dlv"));
22
+ const _postcssSelectorParser = /*#__PURE__*/ _interopRequireDefault(require("postcss-selector-parser"));
23
+ const _transformThemeValue = /*#__PURE__*/ _interopRequireDefault(require("../util/transformThemeValue"));
24
+ const _parseObjectStyles = /*#__PURE__*/ _interopRequireDefault(require("../util/parseObjectStyles"));
25
+ const _prefixSelector = /*#__PURE__*/ _interopRequireDefault(require("../util/prefixSelector"));
26
+ const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("../util/isPlainObject"));
27
+ const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("../util/escapeClassName"));
28
+ const _nameClass = /*#__PURE__*/ _interopRequireWildcard(require("../util/nameClass"));
29
+ const _pluginUtils = require("../util/pluginUtils");
30
+ const _corePlugins = require("../corePlugins");
31
+ const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
32
+ const _toPath = require("../util/toPath");
33
+ const _log = /*#__PURE__*/ _interopRequireDefault(require("../util/log"));
34
+ const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("../util/negateValue"));
35
+ const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interopRequireDefault(require("../util/isSyntacticallyValidPropertyValue"));
36
+ const _generateRules = require("./generateRules");
37
+ const _cacheInvalidationJs = require("./cacheInvalidation.js");
38
+ const _offsetsJs = require("./offsets.js");
39
+ const _featureFlagsJs = require("../featureFlags.js");
40
+ const _formatVariantSelector = require("../util/formatVariantSelector");
27
41
  function _interopRequireDefault(obj) {
28
42
  return obj && obj.__esModule ? obj : {
29
43
  default: obj
30
44
  };
31
45
  }
32
- function _interopRequireWildcard(obj) {
33
- if (obj && obj.__esModule) {
46
+ function _getRequireWildcardCache(nodeInterop) {
47
+ if (typeof WeakMap !== "function") return null;
48
+ var cacheBabelInterop = new WeakMap();
49
+ var cacheNodeInterop = new WeakMap();
50
+ return (_getRequireWildcardCache = function(nodeInterop) {
51
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
52
+ })(nodeInterop);
53
+ }
54
+ function _interopRequireWildcard(obj, nodeInterop) {
55
+ if (!nodeInterop && obj && obj.__esModule) {
34
56
  return obj;
35
- } else {
36
- var newObj = {
57
+ }
58
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
59
+ return {
60
+ default: obj
37
61
  };
38
- if (obj != null) {
39
- for(var key in obj){
40
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
41
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {
42
- };
43
- if (desc.get || desc.set) {
44
- Object.defineProperty(newObj, key, desc);
45
- } else {
46
- newObj[key] = obj[key];
47
- }
48
- }
49
- }
50
- }
51
- newObj.default = obj;
52
- return newObj;
53
62
  }
54
- }
55
- function partitionRules(root) {
56
- if (!root.walkAtRules) return [
57
- root
58
- ];
59
- let applyParents = new Set();
60
- let rules = [];
61
- root.walkAtRules('apply', (rule)=>{
62
- applyParents.add(rule.parent);
63
- });
64
- if (applyParents.size === 0) {
65
- rules.push(root);
63
+ var cache = _getRequireWildcardCache(nodeInterop);
64
+ if (cache && cache.has(obj)) {
65
+ return cache.get(obj);
66
66
  }
67
- for (let rule1 of applyParents){
68
- let nodeGroups = [];
69
- let lastGroup = [];
70
- for (let node of rule1.nodes){
71
- if (node.type === 'atrule' && node.name === 'apply') {
72
- if (lastGroup.length > 0) {
73
- nodeGroups.push(lastGroup);
74
- lastGroup = [];
75
- }
76
- nodeGroups.push([
77
- node
78
- ]);
67
+ var newObj = {};
68
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
69
+ for(var key in obj){
70
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
71
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
72
+ if (desc && (desc.get || desc.set)) {
73
+ Object.defineProperty(newObj, key, desc);
79
74
  } else {
80
- lastGroup.push(node);
75
+ newObj[key] = obj[key];
81
76
  }
82
77
  }
83
- if (lastGroup.length > 0) {
84
- nodeGroups.push(lastGroup);
85
- }
86
- if (nodeGroups.length === 1) {
87
- rules.push(rule1);
88
- continue;
89
- }
90
- for (let group of [
91
- ...nodeGroups
92
- ].reverse()){
93
- let clone = rule1.clone({
94
- nodes: []
95
- });
96
- clone.append(group);
97
- rules.unshift(clone);
98
- rule1.after(clone);
99
- }
100
- rule1.remove();
101
78
  }
102
- return rules;
79
+ newObj.default = obj;
80
+ if (cache) {
81
+ cache.set(obj, newObj);
82
+ }
83
+ return newObj;
84
+ }
85
+ const VARIANT_TYPES = {
86
+ AddVariant: Symbol.for("ADD_VARIANT"),
87
+ MatchVariant: Symbol.for("MATCH_VARIANT")
88
+ };
89
+ const VARIANT_INFO = {
90
+ Base: 1 << 0,
91
+ Dynamic: 1 << 1
92
+ };
93
+ function prefix(context, selector) {
94
+ let prefix = context.tailwindConfig.prefix;
95
+ return typeof prefix === "function" ? prefix(selector) : prefix + selector;
96
+ }
97
+ function normalizeOptionTypes({ type ="any" , ...options }) {
98
+ let types = [].concat(type);
99
+ return {
100
+ ...options,
101
+ types: types.map((type)=>{
102
+ if (Array.isArray(type)) {
103
+ return {
104
+ type: type[0],
105
+ ...type[1]
106
+ };
107
+ }
108
+ return {
109
+ type,
110
+ preferOnConflict: false
111
+ };
112
+ })
113
+ };
103
114
  }
104
115
  function parseVariantFormatString(input) {
105
- if (input.includes('{')) {
116
+ if (input.includes("{")) {
106
117
  if (!isBalanced(input)) throw new Error(`Your { and } are unbalanced.`);
107
- return input.split(/{(.*)}/gim).flatMap((line)=>parseVariantFormatString(line)
108
- ).filter(Boolean);
118
+ return input.split(/{(.*)}/gim).flatMap((line)=>parseVariantFormatString(line)).filter(Boolean);
109
119
  }
110
120
  return [
111
121
  input.trim()
@@ -114,9 +124,9 @@ function parseVariantFormatString(input) {
114
124
  function isBalanced(input) {
115
125
  let count = 0;
116
126
  for (let char of input){
117
- if (char === '{') {
127
+ if (char === "{") {
118
128
  count++;
119
- } else if (char === '}') {
129
+ } else if (char === "}") {
120
130
  if (--count < 0) {
121
131
  return false // unbalanced
122
132
  ;
@@ -125,8 +135,7 @@ function isBalanced(input) {
125
135
  }
126
136
  return count === 0;
127
137
  }
128
- function insertInto(list, value, { before =[] } = {
129
- }) {
138
+ function insertInto(list, value, { before =[] } = {}) {
130
139
  before = [].concat(before);
131
140
  if (before.length <= 0) {
132
141
  list.push(value);
@@ -147,13 +156,16 @@ function parseStyles(styles) {
147
156
  ]);
148
157
  }
149
158
  return styles.flatMap((style)=>{
150
- let isNode = !Array.isArray(style) && !(0, _isPlainObject).default(style);
151
- return isNode ? style : (0, _parseObjectStyles).default(style);
159
+ let isNode = !Array.isArray(style) && !(0, _isPlainObject.default)(style);
160
+ return isNode ? style : (0, _parseObjectStyles.default)(style);
152
161
  });
153
162
  }
154
- function getClasses(selector) {
155
- let parser = (0, _postcssSelectorParser).default((selectors)=>{
163
+ function getClasses(selector, mutate) {
164
+ let parser = (0, _postcssSelectorParser.default)((selectors)=>{
156
165
  let allClasses = [];
166
+ if (mutate) {
167
+ mutate(selectors);
168
+ }
157
169
  selectors.walkClasses((classNode)=>{
158
170
  allClasses.push(classNode.value);
159
171
  });
@@ -166,9 +178,20 @@ function extractCandidates(node, state = {
166
178
  }, depth = 0) {
167
179
  let classes = [];
168
180
  // Handle normal rules
169
- if (node.type === 'rule') {
181
+ if (node.type === "rule") {
182
+ // Ignore everything inside a :not(...). This allows you to write code like
183
+ // `div:not(.foo)`. If `.foo` is never found in your code, then we used to
184
+ // not generated it. But now we will ignore everything inside a `:not`, so
185
+ // that it still gets generated.
186
+ function ignoreNot(selectors) {
187
+ selectors.walkPseudos((pseudo)=>{
188
+ if (pseudo.value === ":not") {
189
+ pseudo.remove();
190
+ }
191
+ });
192
+ }
170
193
  for (let selector of node.selectors){
171
- let classCandidates = getClasses(selector);
194
+ let classCandidates = getClasses(selector, ignoreNot);
172
195
  // At least one of the selectors contains non-"on-demandable" candidates.
173
196
  if (classCandidates.length === 0) {
174
197
  state.containsNonOnDemandable = true;
@@ -177,10 +200,9 @@ function extractCandidates(node, state = {
177
200
  classes.push(classCandidate);
178
201
  }
179
202
  }
180
- } else if (node.type === 'atrule') {
203
+ } else if (node.type === "atrule") {
181
204
  node.walkRules((rule)=>{
182
- for (let classCandidate of rule.selectors.flatMap((selector)=>getClasses(selector, state, depth + 1)
183
- )){
205
+ for (let classCandidate of rule.selectors.flatMap((selector)=>getClasses(selector))){
184
206
  classes.push(classCandidate);
185
207
  }
186
208
  });
@@ -199,7 +221,7 @@ function withIdentifiers(styles) {
199
221
  let [containsNonOnDemandableSelectors, candidates] = extractCandidates(node);
200
222
  // If this isn't "on-demandable", assign it a universal candidate to always include it.
201
223
  if (containsNonOnDemandableSelectors) {
202
- candidates.unshift('*');
224
+ candidates.unshift(_sharedState.NOT_ON_DEMAND);
203
225
  }
204
226
  // However, it could be that it also contains "on-demandable" candidates.
205
227
  // E.g.: `span, .foo {}`, in that case it should still be possible to use
@@ -215,77 +237,70 @@ function withIdentifiers(styles) {
215
237
  });
216
238
  });
217
239
  }
218
- function buildPluginApi(tailwindConfig, context, { variantList , variantMap , offsets , classList }) {
240
+ function isValidVariantFormatString(format) {
241
+ return format.startsWith("@") || format.includes("&");
242
+ }
243
+ function parseVariant(variant) {
244
+ variant = variant.replace(/\n+/g, "").replace(/\s{1,}/g, " ").trim();
245
+ let fns = parseVariantFormatString(variant).map((str)=>{
246
+ if (!str.startsWith("@")) {
247
+ return ({ format })=>format(str);
248
+ }
249
+ let [, name, params] = /@(.*?)( .+|[({].*)/g.exec(str);
250
+ return ({ wrap })=>wrap(_postcss.default.atRule({
251
+ name,
252
+ params: params.trim()
253
+ }));
254
+ }).reverse();
255
+ return (api)=>{
256
+ for (let fn of fns){
257
+ fn(api);
258
+ }
259
+ };
260
+ }
261
+ /**
262
+ *
263
+ * @param {any} tailwindConfig
264
+ * @param {any} context
265
+ * @param {object} param2
266
+ * @param {Offsets} param2.offsets
267
+ */ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , offsets , classList }) {
219
268
  function getConfigValue(path, defaultValue) {
220
- return path ? (0, _dlv).default(tailwindConfig, path, defaultValue) : tailwindConfig;
269
+ return path ? (0, _dlv.default)(tailwindConfig, path, defaultValue) : tailwindConfig;
221
270
  }
222
271
  function applyConfiguredPrefix(selector) {
223
- return (0, _prefixSelector).default(tailwindConfig.prefix, selector);
272
+ return (0, _prefixSelector.default)(tailwindConfig.prefix, selector);
224
273
  }
225
274
  function prefixIdentifier(identifier, options) {
226
- if (identifier === '*') {
227
- return '*';
275
+ if (identifier === _sharedState.NOT_ON_DEMAND) {
276
+ return _sharedState.NOT_ON_DEMAND;
228
277
  }
229
278
  if (!options.respectPrefix) {
230
279
  return identifier;
231
280
  }
232
281
  return context.tailwindConfig.prefix + identifier;
233
282
  }
234
- return {
235
- addVariant (variantName, variantFunctions, options = {
236
- }) {
237
- variantFunctions = [].concat(variantFunctions).map((variantFunction)=>{
238
- if (typeof variantFunction !== 'string') {
239
- // Safelist public API functions
240
- return ({ modifySelectors , container , separator })=>{
241
- return variantFunction({
242
- modifySelectors,
243
- container,
244
- separator
245
- });
246
- };
247
- }
248
- variantFunction = variantFunction.replace(/\n+/g, '').replace(/\s{1,}/g, ' ').trim();
249
- let fns = parseVariantFormatString(variantFunction).map((str)=>{
250
- if (!str.startsWith('@')) {
251
- return ({ format })=>format(str)
252
- ;
253
- }
254
- let [, name, params] = /@(.*?) (.*)/g.exec(str);
255
- return ({ wrap })=>wrap(_postcss.default.atRule({
256
- name,
257
- params
258
- }))
259
- ;
260
- }).reverse();
261
- return (api)=>{
262
- for (let fn of fns){
263
- fn(api);
264
- }
265
- };
266
- });
267
- insertInto(variantList, variantName, options);
268
- variantMap.set(variantName, variantFunctions);
269
- },
283
+ function resolveThemeValue(path, defaultValue, opts = {}) {
284
+ let parts = (0, _toPath.toPath)(path);
285
+ let value = getConfigValue([
286
+ "theme",
287
+ ...parts
288
+ ], defaultValue);
289
+ return (0, _transformThemeValue.default)(parts[0])(value, opts);
290
+ }
291
+ let variantIdentifier = 0;
292
+ let api = {
270
293
  postcss: _postcss.default,
271
294
  prefix: applyConfiguredPrefix,
272
295
  e: _escapeClassName.default,
273
296
  config: getConfigValue,
274
- theme (path, defaultValue) {
275
- const [pathRoot, ...subPaths] = (0, _toPath).toPath(path);
276
- const value = getConfigValue([
277
- 'theme',
278
- pathRoot,
279
- ...subPaths
280
- ], defaultValue);
281
- return (0, _transformThemeValue).default(pathRoot)(value);
282
- },
297
+ theme: resolveThemeValue,
283
298
  corePlugins: (path)=>{
284
299
  if (Array.isArray(tailwindConfig.corePlugins)) {
285
300
  return tailwindConfig.corePlugins.includes(path);
286
301
  }
287
302
  return getConfigValue([
288
- 'corePlugins',
303
+ "corePlugins",
289
304
  path
290
305
  ], true);
291
306
  },
@@ -293,38 +308,20 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
293
308
  // Preserved for backwards compatibility but not used in v3.0+
294
309
  return [];
295
310
  },
296
- addUserCss (userCss) {
297
- for (let [identifier, rule2] of withIdentifiers(userCss)){
298
- let offset = offsets.user++;
299
- if (!context.candidateRuleMap.has(identifier)) {
300
- context.candidateRuleMap.set(identifier, []);
301
- }
302
- context.candidateRuleMap.get(identifier).push(...partitionRules(rule2).map((rule)=>[
303
- {
304
- sort: offset,
305
- layer: 'user'
306
- },
307
- rule
308
- ]
309
- ));
310
- }
311
- },
312
311
  addBase (base) {
313
- for (let [identifier, rule3] of withIdentifiers(base)){
314
- let prefixedIdentifier = prefixIdentifier(identifier, {
315
- });
316
- let offset = offsets.base++;
312
+ for (let [identifier, rule] of withIdentifiers(base)){
313
+ let prefixedIdentifier = prefixIdentifier(identifier, {});
314
+ let offset = offsets.create("base");
317
315
  if (!context.candidateRuleMap.has(prefixedIdentifier)) {
318
316
  context.candidateRuleMap.set(prefixedIdentifier, []);
319
317
  }
320
- context.candidateRuleMap.get(prefixedIdentifier).push(...partitionRules(rule3).map((rule)=>[
321
- {
322
- sort: offset,
323
- layer: 'base'
324
- },
325
- rule
326
- ]
327
- ));
318
+ context.candidateRuleMap.get(prefixedIdentifier).push([
319
+ {
320
+ sort: offset,
321
+ layer: "base"
322
+ },
323
+ rule
324
+ ]);
328
325
  }
329
326
  },
330
327
  /**
@@ -334,82 +331,77 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
334
331
  const groups = {
335
332
  [`@defaults ${group}`]: declarations
336
333
  };
337
- for (let [identifier, rule4] of withIdentifiers(groups)){
338
- let prefixedIdentifier = prefixIdentifier(identifier, {
339
- });
334
+ for (let [identifier, rule] of withIdentifiers(groups)){
335
+ let prefixedIdentifier = prefixIdentifier(identifier, {});
340
336
  if (!context.candidateRuleMap.has(prefixedIdentifier)) {
341
337
  context.candidateRuleMap.set(prefixedIdentifier, []);
342
338
  }
343
- context.candidateRuleMap.get(prefixedIdentifier).push(...partitionRules(rule4).map((rule)=>[
344
- {
345
- sort: offsets.base++,
346
- layer: 'defaults'
347
- },
348
- rule,
349
- ]
350
- ));
339
+ context.candidateRuleMap.get(prefixedIdentifier).push([
340
+ {
341
+ sort: offsets.create("defaults"),
342
+ layer: "defaults"
343
+ },
344
+ rule
345
+ ]);
351
346
  }
352
347
  },
353
348
  addComponents (components, options) {
354
349
  let defaultOptions = {
350
+ preserveSource: false,
355
351
  respectPrefix: true,
356
352
  respectImportant: false
357
353
  };
358
- options = Object.assign({
359
- }, defaultOptions, Array.isArray(options) ? {
360
- } : options);
361
- for (let [identifier, rule5] of withIdentifiers(components)){
354
+ options = Object.assign({}, defaultOptions, Array.isArray(options) ? {} : options);
355
+ for (let [identifier, rule] of withIdentifiers(components)){
362
356
  let prefixedIdentifier = prefixIdentifier(identifier, options);
363
357
  classList.add(prefixedIdentifier);
364
358
  if (!context.candidateRuleMap.has(prefixedIdentifier)) {
365
359
  context.candidateRuleMap.set(prefixedIdentifier, []);
366
360
  }
367
- context.candidateRuleMap.get(prefixedIdentifier).push(...partitionRules(rule5).map((rule)=>[
368
- {
369
- sort: offsets.components++,
370
- layer: 'components',
371
- options
372
- },
373
- rule,
374
- ]
375
- ));
361
+ context.candidateRuleMap.get(prefixedIdentifier).push([
362
+ {
363
+ sort: offsets.create("components"),
364
+ layer: "components",
365
+ options
366
+ },
367
+ rule
368
+ ]);
376
369
  }
377
370
  },
378
371
  addUtilities (utilities, options) {
379
372
  let defaultOptions = {
373
+ preserveSource: false,
380
374
  respectPrefix: true,
381
375
  respectImportant: true
382
376
  };
383
- options = Object.assign({
384
- }, defaultOptions, Array.isArray(options) ? {
385
- } : options);
386
- for (let [identifier, rule6] of withIdentifiers(utilities)){
377
+ options = Object.assign({}, defaultOptions, Array.isArray(options) ? {} : options);
378
+ for (let [identifier, rule] of withIdentifiers(utilities)){
387
379
  let prefixedIdentifier = prefixIdentifier(identifier, options);
388
380
  classList.add(prefixedIdentifier);
389
381
  if (!context.candidateRuleMap.has(prefixedIdentifier)) {
390
382
  context.candidateRuleMap.set(prefixedIdentifier, []);
391
383
  }
392
- context.candidateRuleMap.get(prefixedIdentifier).push(...partitionRules(rule6).map((rule)=>[
393
- {
394
- sort: offsets.utilities++,
395
- layer: 'utilities',
396
- options
397
- },
398
- rule,
399
- ]
400
- ));
384
+ context.candidateRuleMap.get(prefixedIdentifier).push([
385
+ {
386
+ sort: offsets.create("utilities"),
387
+ layer: "utilities",
388
+ options
389
+ },
390
+ rule
391
+ ]);
401
392
  }
402
393
  },
403
394
  matchUtilities: function(utilities, options) {
404
395
  let defaultOptions = {
405
396
  respectPrefix: true,
406
- respectImportant: true
397
+ respectImportant: true,
398
+ modifiers: false
407
399
  };
408
- options = {
400
+ options = normalizeOptionTypes({
409
401
  ...defaultOptions,
410
402
  ...options
411
- };
412
- let offset = offsets.utilities++;
403
+ });
404
+ let offset = offsets.create("utilities");
413
405
  for(let identifier in utilities){
414
406
  let prefixedIdentifier = prefixIdentifier(identifier, options);
415
407
  let rule = utilities[identifier];
@@ -418,28 +410,43 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
418
410
  options
419
411
  ]);
420
412
  function wrapped(modifier, { isOnlyPlugin }) {
421
- let { type ='any' } = options;
422
- type = [].concat(type);
423
- let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options, tailwindConfig);
413
+ let [value, coercedType, utilityModifier] = (0, _pluginUtils.coerceValue)(options.types, modifier, options, tailwindConfig);
424
414
  if (value === undefined) {
425
415
  return [];
426
416
  }
427
- if (!type.includes(coercedType) && !isOnlyPlugin) {
428
- return [];
417
+ if (!options.types.some(({ type })=>type === coercedType)) {
418
+ if (isOnlyPlugin) {
419
+ _log.default.warn([
420
+ `Unnecessary typehint \`${coercedType}\` in \`${identifier}-${modifier}\`.`,
421
+ `You can safely update it to \`${identifier}-${modifier.replace(coercedType + ":", "")}\`.`
422
+ ]);
423
+ } else {
424
+ return [];
425
+ }
429
426
  }
430
- if (!(0, _isValidArbitraryValue).default(value)) {
427
+ if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
431
428
  return [];
432
429
  }
433
- let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
434
- [(0, _nameClass).default(identifier, modifier)]: declaration
435
- })
436
- );
430
+ let extras = {
431
+ get modifier () {
432
+ if (!options.modifiers) {
433
+ _log.default.warn(`modifier-used-without-options-for-${identifier}`, [
434
+ "Your plugin must set `modifiers: true` in its options to support modifiers."
435
+ ]);
436
+ }
437
+ return utilityModifier;
438
+ }
439
+ };
440
+ let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
441
+ let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
442
+ [(0, _nameClass.default)(identifier, modifier)]: declaration
443
+ }));
437
444
  return ruleSets;
438
445
  }
439
446
  let withOffsets = [
440
447
  {
441
448
  sort: offset,
442
- layer: 'utilities',
449
+ layer: "utilities",
443
450
  options
444
451
  },
445
452
  wrapped
@@ -453,13 +460,14 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
453
460
  matchComponents: function(components, options) {
454
461
  let defaultOptions = {
455
462
  respectPrefix: true,
456
- respectImportant: false
463
+ respectImportant: false,
464
+ modifiers: false
457
465
  };
458
- options = {
466
+ options = normalizeOptionTypes({
459
467
  ...defaultOptions,
460
468
  ...options
461
- };
462
- let offset = offsets.components++;
469
+ });
470
+ let offset = offsets.create("components");
463
471
  for(let identifier in components){
464
472
  let prefixedIdentifier = prefixIdentifier(identifier, options);
465
473
  let rule = components[identifier];
@@ -468,35 +476,43 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
468
476
  options
469
477
  ]);
470
478
  function wrapped(modifier, { isOnlyPlugin }) {
471
- let { type ='any' } = options;
472
- type = [].concat(type);
473
- let [value, coercedType] = (0, _pluginUtils).coerceValue(type, modifier, options, tailwindConfig);
479
+ let [value, coercedType, utilityModifier] = (0, _pluginUtils.coerceValue)(options.types, modifier, options, tailwindConfig);
474
480
  if (value === undefined) {
475
481
  return [];
476
482
  }
477
- if (!type.includes(coercedType)) {
483
+ if (!options.types.some(({ type })=>type === coercedType)) {
478
484
  if (isOnlyPlugin) {
479
485
  _log.default.warn([
480
486
  `Unnecessary typehint \`${coercedType}\` in \`${identifier}-${modifier}\`.`,
481
- `You can safely update it to \`${identifier}-${modifier.replace(coercedType + ':', '')}\`.`,
487
+ `You can safely update it to \`${identifier}-${modifier.replace(coercedType + ":", "")}\`.`
482
488
  ]);
483
489
  } else {
484
490
  return [];
485
491
  }
486
492
  }
487
- if (!(0, _isValidArbitraryValue).default(value)) {
493
+ if (!(0, _isSyntacticallyValidPropertyValue.default)(value)) {
488
494
  return [];
489
495
  }
490
- let ruleSets = [].concat(rule(value)).filter(Boolean).map((declaration)=>({
491
- [(0, _nameClass).default(identifier, modifier)]: declaration
492
- })
493
- );
496
+ let extras = {
497
+ get modifier () {
498
+ if (!options.modifiers) {
499
+ _log.default.warn(`modifier-used-without-options-for-${identifier}`, [
500
+ "Your plugin must set `modifiers: true` in its options to support modifiers."
501
+ ]);
502
+ }
503
+ return utilityModifier;
504
+ }
505
+ };
506
+ let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
507
+ let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
508
+ [(0, _nameClass.default)(identifier, modifier)]: declaration
509
+ }));
494
510
  return ruleSets;
495
511
  }
496
512
  let withOffsets = [
497
513
  {
498
514
  sort: offset,
499
- layer: 'components',
515
+ layer: "components",
500
516
  options
501
517
  },
502
518
  wrapped
@@ -506,8 +522,90 @@ function buildPluginApi(tailwindConfig, context, { variantList , variantMap , of
506
522
  }
507
523
  context.candidateRuleMap.get(prefixedIdentifier).push(withOffsets);
508
524
  }
525
+ },
526
+ addVariant (variantName, variantFunctions, options = {}) {
527
+ variantFunctions = [].concat(variantFunctions).map((variantFunction)=>{
528
+ if (typeof variantFunction !== "string") {
529
+ // Safelist public API functions
530
+ return (api = {})=>{
531
+ let { args , modifySelectors , container , separator , wrap , format } = api;
532
+ let result = variantFunction(Object.assign({
533
+ modifySelectors,
534
+ container,
535
+ separator
536
+ }, options.type === VARIANT_TYPES.MatchVariant && {
537
+ args,
538
+ wrap,
539
+ format
540
+ }));
541
+ if (typeof result === "string" && !isValidVariantFormatString(result)) {
542
+ throw new Error(`Your custom variant \`${variantName}\` has an invalid format string. Make sure it's an at-rule or contains a \`&\` placeholder.`);
543
+ }
544
+ if (Array.isArray(result)) {
545
+ return result.filter((variant)=>typeof variant === "string").map((variant)=>parseVariant(variant));
546
+ }
547
+ // result may be undefined with legacy variants that use APIs like `modifySelectors`
548
+ // result may also be a postcss node if someone was returning the result from `modifySelectors`
549
+ return result && typeof result === "string" && parseVariant(result)(api);
550
+ };
551
+ }
552
+ if (!isValidVariantFormatString(variantFunction)) {
553
+ throw new Error(`Your custom variant \`${variantName}\` has an invalid format string. Make sure it's an at-rule or contains a \`&\` placeholder.`);
554
+ }
555
+ return parseVariant(variantFunction);
556
+ });
557
+ insertInto(variantList, variantName, options);
558
+ variantMap.set(variantName, variantFunctions);
559
+ context.variantOptions.set(variantName, options);
560
+ },
561
+ matchVariant (variant, variantFn, options) {
562
+ var ref;
563
+ // A unique identifier that "groups" these variants together.
564
+ // This is for internal use only which is why it is not present in the types
565
+ let id = (ref = options === null || options === void 0 ? void 0 : options.id) !== null && ref !== void 0 ? ref : ++variantIdentifier;
566
+ let isSpecial = variant === "@";
567
+ let modifiersEnabled = (0, _featureFlagsJs.flagEnabled)(tailwindConfig, "generalizedModifiers");
568
+ var ref1;
569
+ for (let [key, value] of Object.entries((ref1 = options === null || options === void 0 ? void 0 : options.values) !== null && ref1 !== void 0 ? ref1 : {})){
570
+ if (key === "DEFAULT") continue;
571
+ api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>{
572
+ return variantFn(value, modifiersEnabled ? {
573
+ modifier: args === null || args === void 0 ? void 0 : args.modifier,
574
+ container
575
+ } : {
576
+ container
577
+ });
578
+ }, {
579
+ ...options,
580
+ value,
581
+ id,
582
+ type: VARIANT_TYPES.MatchVariant,
583
+ variantInfo: VARIANT_INFO.Base
584
+ });
585
+ }
586
+ var ref2;
587
+ let hasDefault = "DEFAULT" in ((ref2 = options === null || options === void 0 ? void 0 : options.values) !== null && ref2 !== void 0 ? ref2 : {});
588
+ api.addVariant(variant, ({ args , container })=>{
589
+ if ((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE && !hasDefault) {
590
+ return null;
591
+ }
592
+ var // (JetBrains) plugins.
593
+ ref;
594
+ return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (ref = args === null || args === void 0 ? void 0 : args.value) !== null && ref !== void 0 ? ref : typeof args === "string" ? args : "", modifiersEnabled ? {
595
+ modifier: args === null || args === void 0 ? void 0 : args.modifier,
596
+ container
597
+ } : {
598
+ container
599
+ });
600
+ }, {
601
+ ...options,
602
+ id,
603
+ type: VARIANT_TYPES.MatchVariant,
604
+ variantInfo: VARIANT_INFO.Dynamic
605
+ });
509
606
  }
510
607
  };
608
+ return api;
511
609
  }
512
610
  let fileModifiedMapCache = new WeakMap();
513
611
  function getFileModifiedMap(context) {
@@ -522,8 +620,8 @@ function trackModified(files, fileModifiedMap) {
522
620
  var ref;
523
621
  if (!file) continue;
524
622
  let parsed = _url.default.parse(file);
525
- let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href;
526
- pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname;
623
+ let pathname = parsed.hash ? parsed.href.replace(parsed.hash, "") : parsed.href;
624
+ pathname = parsed.search ? pathname.replace(parsed.search, "") : pathname;
527
625
  let newModified = (ref = _fs.default.statSync(decodeURIComponent(pathname), {
528
626
  throwIfNoEntry: false
529
627
  })) === null || ref === void 0 ? void 0 : ref.mtimeMs;
@@ -540,8 +638,8 @@ function trackModified(files, fileModifiedMap) {
540
638
  function extractVariantAtRules(node) {
541
639
  node.walkAtRules((atRule)=>{
542
640
  if ([
543
- 'responsive',
544
- 'variants'
641
+ "responsive",
642
+ "variants"
545
643
  ].includes(atRule.name)) {
546
644
  extractVariantAtRules(atRule);
547
645
  atRule.before(atRule.nodes);
@@ -552,18 +650,18 @@ function extractVariantAtRules(node) {
552
650
  function collectLayerPlugins(root) {
553
651
  let layerPlugins = [];
554
652
  root.each((node)=>{
555
- if (node.type === 'atrule' && [
556
- 'responsive',
557
- 'variants'
653
+ if (node.type === "atrule" && [
654
+ "responsive",
655
+ "variants"
558
656
  ].includes(node.name)) {
559
- node.name = 'layer';
560
- node.params = 'utilities';
657
+ node.name = "layer";
658
+ node.params = "utilities";
561
659
  }
562
660
  });
563
661
  // Walk @layer rules and treat them like plugins
564
- root.walkAtRules('layer', (layerRule)=>{
662
+ root.walkAtRules("layer", (layerRule)=>{
565
663
  extractVariantAtRules(layerRule);
566
- if (layerRule.params === 'base') {
664
+ if (layerRule.params === "base") {
567
665
  for (let node of layerRule.nodes){
568
666
  layerPlugins.push(function({ addBase }) {
569
667
  addBase(node, {
@@ -572,36 +670,28 @@ function collectLayerPlugins(root) {
572
670
  });
573
671
  }
574
672
  layerRule.remove();
575
- } else if (layerRule.params === 'components') {
576
- for (let node of layerRule.nodes){
673
+ } else if (layerRule.params === "components") {
674
+ for (let node1 of layerRule.nodes){
577
675
  layerPlugins.push(function({ addComponents }) {
578
- addComponents(node, {
579
- respectPrefix: false
676
+ addComponents(node1, {
677
+ respectPrefix: false,
678
+ preserveSource: true
580
679
  });
581
680
  });
582
681
  }
583
682
  layerRule.remove();
584
- } else if (layerRule.params === 'utilities') {
585
- for (let node of layerRule.nodes){
683
+ } else if (layerRule.params === "utilities") {
684
+ for (let node2 of layerRule.nodes){
586
685
  layerPlugins.push(function({ addUtilities }) {
587
- addUtilities(node, {
588
- respectPrefix: false
686
+ addUtilities(node2, {
687
+ respectPrefix: false,
688
+ preserveSource: true
589
689
  });
590
690
  });
591
691
  }
592
692
  layerRule.remove();
593
693
  }
594
694
  });
595
- root.walkRules((rule)=>{
596
- // At this point it is safe to include all the left-over css from the
597
- // user's css file. This is because the `@tailwind` and `@layer` directives
598
- // will already be handled and will be removed from the css tree.
599
- layerPlugins.push(function({ addUserCss }) {
600
- addUserCss(rule, {
601
- respectPrefix: false
602
- });
603
- });
604
- });
605
695
  return layerPlugins;
606
696
  }
607
697
  function resolvePlugins(context, root) {
@@ -618,22 +708,26 @@ function resolvePlugins(context, root) {
618
708
  if (plugin.__isOptionsFunction) {
619
709
  plugin = plugin();
620
710
  }
621
- return typeof plugin === 'function' ? plugin : plugin.handler;
711
+ return typeof plugin === "function" ? plugin : plugin.handler;
622
712
  });
623
713
  let layerPlugins = collectLayerPlugins(root);
624
714
  // TODO: This is a workaround for backwards compatibility, since custom variants
625
715
  // were historically sorted before screen/stackable variants.
626
716
  let beforeVariants = [
627
- _corePlugins.variantPlugins['pseudoElementVariants'],
628
- _corePlugins.variantPlugins['pseudoClassVariants'],
717
+ _corePlugins.variantPlugins["pseudoElementVariants"],
718
+ _corePlugins.variantPlugins["pseudoClassVariants"],
719
+ _corePlugins.variantPlugins["ariaVariants"],
720
+ _corePlugins.variantPlugins["dataVariants"]
629
721
  ];
630
722
  let afterVariants = [
631
- _corePlugins.variantPlugins['directionVariants'],
632
- _corePlugins.variantPlugins['reducedMotionVariants'],
633
- _corePlugins.variantPlugins['darkVariants'],
634
- _corePlugins.variantPlugins['printVariant'],
635
- _corePlugins.variantPlugins['screenVariants'],
636
- _corePlugins.variantPlugins['orientationVariants'],
723
+ _corePlugins.variantPlugins["supportsVariants"],
724
+ _corePlugins.variantPlugins["directionVariants"],
725
+ _corePlugins.variantPlugins["reducedMotionVariants"],
726
+ _corePlugins.variantPlugins["prefersContrastVariants"],
727
+ _corePlugins.variantPlugins["darkVariants"],
728
+ _corePlugins.variantPlugins["printVariant"],
729
+ _corePlugins.variantPlugins["screenVariants"],
730
+ _corePlugins.variantPlugins["orientationVariants"]
637
731
  ];
638
732
  return [
639
733
  ...corePluginList,
@@ -646,13 +740,9 @@ function resolvePlugins(context, root) {
646
740
  function registerPlugins(plugins, context) {
647
741
  let variantList = [];
648
742
  let variantMap = new Map();
649
- let offsets = {
650
- defaults: 0n,
651
- base: 0n,
652
- components: 0n,
653
- utilities: 0n,
654
- user: 0n
655
- };
743
+ context.variantMap = variantMap;
744
+ let offsets = new _offsetsJs.Offsets();
745
+ context.offsets = offsets;
656
746
  let classList = new Set();
657
747
  let pluginApi = buildPluginApi(context.tailwindConfig, context, {
658
748
  variantList,
@@ -669,85 +759,73 @@ function registerPlugins(plugins, context) {
669
759
  plugin === null || plugin === void 0 ? void 0 : plugin(pluginApi);
670
760
  }
671
761
  }
672
- let highestOffset = ((args)=>args.reduce((m, e)=>e > m ? e : m
673
- )
674
- )([
675
- offsets.base,
676
- offsets.defaults,
677
- offsets.components,
678
- offsets.utilities,
679
- offsets.user,
680
- ]);
681
- let reservedBits = BigInt(highestOffset.toString(2).length);
682
- // A number one less than the top range of the highest offset area
683
- // so arbitrary properties are always sorted at the end.
684
- context.arbitraryPropertiesSort = (1n << reservedBits << 0n) - 1n;
685
- context.layerOrder = {
686
- defaults: 1n << reservedBits << 0n,
687
- base: 1n << reservedBits << 1n,
688
- components: 1n << reservedBits << 2n,
689
- utilities: 1n << reservedBits << 3n,
690
- user: 1n << reservedBits << 4n
691
- };
692
- reservedBits += 5n;
693
- let offset = 0;
694
- context.variantOrder = new Map(variantList.map((variant, i)=>{
695
- let variantFunctions = variantMap.get(variant).length;
696
- let bits = 1n << BigInt(i + offset) << reservedBits;
697
- offset += variantFunctions - 1;
698
- return [
699
- variant,
700
- bits
701
- ];
702
- }).sort(([, a], [, z])=>(0, _bigSign).default(a - z)
703
- ));
704
- context.minimumScreen = [
705
- ...context.variantOrder.values()
706
- ].shift();
762
+ // Make sure to record bit masks for every variant
763
+ offsets.recordVariants(variantList, (variant)=>variantMap.get(variant).length);
707
764
  // Build variantMap
708
- for (let [variantName, variantFunctions1] of variantMap.entries()){
709
- let sort = context.variantOrder.get(variantName);
710
- context.variantMap.set(variantName, variantFunctions1.map((variantFunction, idx)=>[
711
- sort << BigInt(idx),
765
+ for (let [variantName, variantFunctions] of variantMap.entries()){
766
+ context.variantMap.set(variantName, variantFunctions.map((variantFunction, idx)=>[
767
+ offsets.forVariant(variantName, idx),
712
768
  variantFunction
713
- ]
714
- ));
769
+ ]));
715
770
  }
716
771
  var _safelist;
717
772
  let safelist = ((_safelist = context.tailwindConfig.safelist) !== null && _safelist !== void 0 ? _safelist : []).filter(Boolean);
718
773
  if (safelist.length > 0) {
719
774
  let checks = [];
720
- for (let value1 of safelist){
721
- if (typeof value1 === 'string') {
775
+ for (let value of safelist){
776
+ if (typeof value === "string") {
722
777
  context.changedContent.push({
723
- content: value1,
724
- extension: 'html'
778
+ content: value,
779
+ extension: "html"
725
780
  });
726
781
  continue;
727
782
  }
728
- if (value1 instanceof RegExp) {
729
- _log.default.warn('root-regex', [
730
- 'Regular expressions in `safelist` work differently in Tailwind CSS v3.0.',
731
- 'Update your `safelist` configuration to eliminate this warning.'
783
+ if (value instanceof RegExp) {
784
+ _log.default.warn("root-regex", [
785
+ "Regular expressions in `safelist` work differently in Tailwind CSS v3.0.",
786
+ "Update your `safelist` configuration to eliminate this warning.",
787
+ "https://tailwindcss.com/docs/content-configuration#safelisting-classes"
732
788
  ]);
733
789
  continue;
734
790
  }
735
- checks.push(value1);
791
+ checks.push(value);
736
792
  }
737
793
  if (checks.length > 0) {
738
794
  let patternMatchingCount = new Map();
795
+ let prefixLength = context.tailwindConfig.prefix.length;
796
+ let checkImportantUtils = checks.some((check)=>check.pattern.source.includes("!"));
739
797
  for (let util of classList){
740
798
  let utils = Array.isArray(util) ? (()=>{
741
799
  let [utilName, options] = util;
742
800
  var ref;
743
- let classes = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
744
- }).map((value)=>(0, _nameClass).formatClass(utilName, value)
745
- );
801
+ let values = Object.keys((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {});
802
+ let classes = values.map((value)=>(0, _nameClass.formatClass)(utilName, value));
746
803
  if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
804
+ // This is the normal negated version
805
+ // e.g. `-inset-1` or `-tw-inset-1`
806
+ classes = [
807
+ ...classes,
808
+ ...classes.map((cls)=>"-" + cls)
809
+ ];
810
+ // This is the negated version *after* the prefix
811
+ // e.g. `tw--inset-1`
812
+ // The prefix is already attached to util name
813
+ // So we add the negative after the prefix
814
+ classes = [
815
+ ...classes,
816
+ ...classes.map((cls)=>cls.slice(0, prefixLength) + "-" + cls.slice(prefixLength))
817
+ ];
818
+ }
819
+ if (options.types.some(({ type })=>type === "color")) {
747
820
  classes = [
748
821
  ...classes,
749
- ...classes.map((cls)=>'-' + cls
750
- )
822
+ ...classes.flatMap((cls)=>Object.keys(context.tailwindConfig.theme.opacity).map((opacity)=>`${cls}/${opacity}`))
823
+ ];
824
+ }
825
+ if (checkImportantUtils && (options === null || options === void 0 ? void 0 : options.respectImportant)) {
826
+ classes = [
827
+ ...classes,
828
+ ...classes.map((cls)=>"!" + cls)
751
829
  ];
752
830
  }
753
831
  return classes;
@@ -766,12 +844,12 @@ function registerPlugins(plugins, context) {
766
844
  patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
767
845
  context.changedContent.push({
768
846
  content: util1,
769
- extension: 'html'
847
+ extension: "html"
770
848
  });
771
849
  for (let variant of variants){
772
850
  context.changedContent.push({
773
851
  content: variant + context.tailwindConfig.separator + util1,
774
- extension: 'html'
852
+ extension: "html"
775
853
  });
776
854
  }
777
855
  }
@@ -781,25 +859,70 @@ function registerPlugins(plugins, context) {
781
859
  if (count !== 0) continue;
782
860
  _log.default.warn([
783
861
  `The safelist pattern \`${regex}\` doesn't match any Tailwind CSS classes.`,
784
- 'Fix this pattern or remove it from your `safelist` configuration.',
862
+ "Fix this pattern or remove it from your `safelist` configuration.",
863
+ "https://tailwindcss.com/docs/content-configuration#safelisting-classes"
785
864
  ]);
786
865
  }
787
866
  }
788
867
  }
868
+ var _darkMode, ref;
869
+ let darkClassName = (ref = [].concat((_darkMode = context.tailwindConfig.darkMode) !== null && _darkMode !== void 0 ? _darkMode : "media")[1]) !== null && ref !== void 0 ? ref : "dark";
870
+ // A list of utilities that are used by certain Tailwind CSS utilities but
871
+ // that don't exist on their own. This will result in them "not existing" and
872
+ // sorting could be weird since you still require them in order to make the
873
+ // host utilities work properly. (Thanks Biology)
874
+ let parasiteUtilities = [
875
+ prefix(context, darkClassName),
876
+ prefix(context, "group"),
877
+ prefix(context, "peer")
878
+ ];
879
+ context.getClassOrder = function getClassOrder(classes) {
880
+ // Non-util classes won't be generated, so we default them to null
881
+ let sortedClassNames = new Map(classes.map((className)=>[
882
+ className,
883
+ null
884
+ ]));
885
+ // Sort all classes in order
886
+ // Non-tailwind classes won't be generated and will be left as `null`
887
+ let rules = (0, _generateRules.generateRules)(new Set(classes), context);
888
+ rules = context.offsets.sort(rules);
889
+ let idx = BigInt(parasiteUtilities.length);
890
+ for (const [, rule] of rules){
891
+ sortedClassNames.set(rule.raws.tailwind.candidate, idx++);
892
+ }
893
+ return classes.map((className)=>{
894
+ var ref;
895
+ let order = (ref = sortedClassNames.get(className)) !== null && ref !== void 0 ? ref : null;
896
+ let parasiteIndex = parasiteUtilities.indexOf(className);
897
+ if (order === null && parasiteIndex !== -1) {
898
+ // This will make sure that it is at the very beginning of the
899
+ // `components` layer which technically means 'before any
900
+ // components'.
901
+ order = BigInt(parasiteIndex);
902
+ }
903
+ return [
904
+ className,
905
+ order
906
+ ];
907
+ });
908
+ };
789
909
  // Generate a list of strings for autocompletion purposes, e.g.
790
910
  // ['uppercase', 'lowercase', ...]
791
- context.getClassList = function() {
911
+ context.getClassList = function getClassList() {
792
912
  let output = [];
793
913
  for (let util of classList){
794
914
  if (Array.isArray(util)) {
795
915
  let [utilName, options] = util;
796
916
  let negativeClasses = [];
797
917
  var ref;
798
- for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {
799
- })){
800
- output.push((0, _nameClass).formatClass(utilName, key));
801
- if ((options === null || options === void 0 ? void 0 : options.supportsNegativeValues) && (0, _negateValue).default(value)) {
802
- negativeClasses.push((0, _nameClass).formatClass(utilName, `-${key}`));
918
+ for (let [key, value] of Object.entries((ref = options === null || options === void 0 ? void 0 : options.values) !== null && ref !== void 0 ? ref : {})){
919
+ // Ignore undefined and null values
920
+ if (value == null) {
921
+ continue;
922
+ }
923
+ output.push((0, _nameClass.formatClass)(utilName, key));
924
+ if ((options === null || options === void 0 ? void 0 : options.supportsNegativeValues) && (0, _negateValue.default)(value)) {
925
+ negativeClasses.push((0, _nameClass.formatClass)(utilName, `-${key}`));
803
926
  }
804
927
  }
805
928
  output.push(...negativeClasses);
@@ -809,32 +932,196 @@ function registerPlugins(plugins, context) {
809
932
  }
810
933
  return output;
811
934
  };
935
+ // Generate a list of available variants with meta information of the type of variant.
936
+ context.getVariants = function getVariants() {
937
+ let result = [];
938
+ for (let [name, options] of context.variantOptions.entries()){
939
+ if (options.variantInfo === VARIANT_INFO.Base) continue;
940
+ var _values;
941
+ result.push({
942
+ name,
943
+ isArbitrary: options.type === Symbol.for("MATCH_VARIANT"),
944
+ values: Object.keys((_values = options.values) !== null && _values !== void 0 ? _values : {}),
945
+ hasDash: name !== "@",
946
+ selectors ({ modifier , value } = {}) {
947
+ let candidate = "__TAILWIND_PLACEHOLDER__";
948
+ let rule = _postcss.default.rule({
949
+ selector: `.${candidate}`
950
+ });
951
+ let container = _postcss.default.root({
952
+ nodes: [
953
+ rule.clone()
954
+ ]
955
+ });
956
+ let before = container.toString();
957
+ var ref;
958
+ let fns = ((ref = context.variantMap.get(name)) !== null && ref !== void 0 ? ref : []).flatMap(([_, fn])=>fn);
959
+ let formatStrings = [];
960
+ for (let fn of fns){
961
+ var ref1;
962
+ let localFormatStrings = [];
963
+ var ref2;
964
+ let api = {
965
+ args: {
966
+ modifier,
967
+ value: (ref2 = (ref1 = options.values) === null || ref1 === void 0 ? void 0 : ref1[value]) !== null && ref2 !== void 0 ? ref2 : value
968
+ },
969
+ separator: context.tailwindConfig.separator,
970
+ modifySelectors (modifierFunction) {
971
+ // Run the modifierFunction over each rule
972
+ container.each((rule)=>{
973
+ if (rule.type !== "rule") {
974
+ return;
975
+ }
976
+ rule.selectors = rule.selectors.map((selector)=>{
977
+ return modifierFunction({
978
+ get className () {
979
+ return (0, _generateRules.getClassNameFromSelector)(selector);
980
+ },
981
+ selector
982
+ });
983
+ });
984
+ });
985
+ return container;
986
+ },
987
+ format (str) {
988
+ localFormatStrings.push(str);
989
+ },
990
+ wrap (wrapper) {
991
+ localFormatStrings.push(`@${wrapper.name} ${wrapper.params} { & }`);
992
+ },
993
+ container
994
+ };
995
+ let ruleWithVariant = fn(api);
996
+ if (localFormatStrings.length > 0) {
997
+ formatStrings.push(localFormatStrings);
998
+ }
999
+ if (Array.isArray(ruleWithVariant)) {
1000
+ for (let variantFunction of ruleWithVariant){
1001
+ localFormatStrings = [];
1002
+ variantFunction(api);
1003
+ formatStrings.push(localFormatStrings);
1004
+ }
1005
+ }
1006
+ }
1007
+ // Reverse engineer the result of the `container`
1008
+ let manualFormatStrings = [];
1009
+ let after = container.toString();
1010
+ if (before !== after) {
1011
+ // Figure out all selectors
1012
+ container.walkRules((rule)=>{
1013
+ let modified = rule.selector;
1014
+ // Rebuild the base selector, this is what plugin authors would do
1015
+ // as well. E.g.: `${variant}${separator}${className}`.
1016
+ // However, plugin authors probably also prepend or append certain
1017
+ // classes, pseudos, ids, ...
1018
+ let rebuiltBase = (0, _postcssSelectorParser.default)((selectors)=>{
1019
+ selectors.walkClasses((classNode)=>{
1020
+ classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
1021
+ });
1022
+ }).processSync(modified);
1023
+ // Now that we know the original selector, the new selector, and
1024
+ // the rebuild part in between, we can replace the part that plugin
1025
+ // authors need to rebuild with `&`, and eventually store it in the
1026
+ // collectedFormats. Similar to what `format('...')` would do.
1027
+ //
1028
+ // E.g.:
1029
+ // variant: foo
1030
+ // selector: .markdown > p
1031
+ // modified (by plugin): .foo .foo\\:markdown > p
1032
+ // rebuiltBase (internal): .foo\\:markdown > p
1033
+ // format: .foo &
1034
+ manualFormatStrings.push(modified.replace(rebuiltBase, "&").replace(candidate, "&"));
1035
+ });
1036
+ // Figure out all atrules
1037
+ container.walkAtRules((atrule)=>{
1038
+ manualFormatStrings.push(`@${atrule.name} (${atrule.params}) { & }`);
1039
+ });
1040
+ }
1041
+ var _values;
1042
+ let result = formatStrings.map((formatString)=>(0, _formatVariantSelector.finalizeSelector)((0, _formatVariantSelector.formatVariantSelector)("&", ...formatString), {
1043
+ selector: `.${candidate}`,
1044
+ candidate,
1045
+ context,
1046
+ isArbitraryVariant: !(value in ((_values = options.values) !== null && _values !== void 0 ? _values : {}))
1047
+ }).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
1048
+ if (manualFormatStrings.length > 0) {
1049
+ result.push((0, _formatVariantSelector.formatVariantSelector)("&", ...manualFormatStrings));
1050
+ }
1051
+ return result;
1052
+ }
1053
+ });
1054
+ }
1055
+ return result;
1056
+ };
1057
+ }
1058
+ /**
1059
+ * Mark as class as retroactively invalid
1060
+ *
1061
+ *
1062
+ * @param {string} candidate
1063
+ */ function markInvalidUtilityCandidate(context, candidate) {
1064
+ if (!context.classCache.has(candidate)) {
1065
+ return;
1066
+ }
1067
+ // Mark this as not being a real utility
1068
+ context.notClassCache.add(candidate);
1069
+ // Remove it from any candidate-specific caches
1070
+ context.classCache.delete(candidate);
1071
+ context.applyClassCache.delete(candidate);
1072
+ context.candidateRuleMap.delete(candidate);
1073
+ context.candidateRuleCache.delete(candidate);
1074
+ // Ensure the stylesheet gets rebuilt
1075
+ context.stylesheetCache = null;
1076
+ }
1077
+ /**
1078
+ * Mark as class as retroactively invalid
1079
+ *
1080
+ * @param {import('postcss').Node} node
1081
+ */ function markInvalidUtilityNode(context, node) {
1082
+ let candidate = node.raws.tailwind.candidate;
1083
+ if (!candidate) {
1084
+ return;
1085
+ }
1086
+ for (const entry of context.ruleCache){
1087
+ if (entry[1].raws.tailwind.candidate === candidate) {
1088
+ context.ruleCache.delete(entry);
1089
+ // context.postCssNodeCache.delete(node)
1090
+ }
1091
+ }
1092
+ markInvalidUtilityCandidate(context, candidate);
812
1093
  }
813
1094
  function createContext(tailwindConfig, changedContent = [], root = _postcss.default.root()) {
1095
+ var _blocklist;
814
1096
  let context = {
815
1097
  disposables: [],
816
1098
  ruleCache: new Set(),
1099
+ candidateRuleCache: new Map(),
817
1100
  classCache: new Map(),
818
1101
  applyClassCache: new Map(),
819
- notClassCache: new Set(),
1102
+ // Seed the not class cache with the blocklist (which is only strings)
1103
+ notClassCache: new Set((_blocklist = tailwindConfig.blocklist) !== null && _blocklist !== void 0 ? _blocklist : []),
820
1104
  postCssNodeCache: new Map(),
821
1105
  candidateRuleMap: new Map(),
822
1106
  tailwindConfig,
823
1107
  changedContent: changedContent,
824
1108
  variantMap: new Map(),
825
- stylesheetCache: null
1109
+ stylesheetCache: null,
1110
+ variantOptions: new Map(),
1111
+ markInvalidUtilityCandidate: (candidate)=>markInvalidUtilityCandidate(context, candidate),
1112
+ markInvalidUtilityNode: (node)=>markInvalidUtilityNode(context, node)
826
1113
  };
827
1114
  let resolvedPlugins = resolvePlugins(context, root);
828
1115
  registerPlugins(resolvedPlugins, context);
829
1116
  return context;
830
1117
  }
831
- let contextMap = sharedState.contextMap;
832
- let configContextMap = sharedState.configContextMap;
833
- let contextSourcesMap = sharedState.contextSourcesMap;
1118
+ let contextMap = _sharedState.contextMap;
1119
+ let configContextMap = _sharedState.configContextMap;
1120
+ let contextSourcesMap = _sharedState.contextSourcesMap;
834
1121
  function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies) {
835
1122
  let sourcePath = result.opts.from;
836
1123
  let isConfigFile = userConfigPath !== null;
837
- sharedState.env.DEBUG && console.log('Source path:', sourcePath);
1124
+ _sharedState.env.DEBUG && console.log("Source path:", sourcePath);
838
1125
  let existingContext;
839
1126
  if (isConfigFile && contextMap.has(sourcePath)) {
840
1127
  existingContext = contextMap.get(sourcePath);
@@ -844,13 +1131,14 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
844
1131
  contextMap.set(sourcePath, context);
845
1132
  existingContext = context;
846
1133
  }
1134
+ let cssDidChange = (0, _cacheInvalidationJs.hasContentChanged)(sourcePath, root);
847
1135
  // If there's already a context in the cache and we don't need to
848
1136
  // reset the context, return the cached context.
849
1137
  if (existingContext) {
850
1138
  let contextDependenciesChanged = trackModified([
851
1139
  ...contextDependencies
852
1140
  ], getFileModifiedMap(existingContext));
853
- if (!contextDependenciesChanged) {
1141
+ if (!contextDependenciesChanged && !cssDidChange) {
854
1142
  return [
855
1143
  existingContext,
856
1144
  false
@@ -868,9 +1156,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
868
1156
  contextSourcesMap.get(oldContext).delete(sourcePath);
869
1157
  if (contextSourcesMap.get(oldContext).size === 0) {
870
1158
  contextSourcesMap.delete(oldContext);
871
- for (let [tailwindConfigHash, context] of configContextMap){
872
- if (context === oldContext) {
873
- configContextMap.delete(tailwindConfigHash);
1159
+ for (let [tailwindConfigHash1, context1] of configContextMap){
1160
+ if (context1 === oldContext) {
1161
+ configContextMap.delete(tailwindConfigHash1);
874
1162
  }
875
1163
  }
876
1164
  for (let disposable of oldContext.disposables.splice(0)){
@@ -879,21 +1167,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
879
1167
  }
880
1168
  }
881
1169
  }
882
- sharedState.env.DEBUG && console.log('Setting up new context...');
883
- let context = createContext(tailwindConfig, [], root);
1170
+ _sharedState.env.DEBUG && console.log("Setting up new context...");
1171
+ let context2 = createContext(tailwindConfig, [], root);
1172
+ Object.assign(context2, {
1173
+ userConfigPath
1174
+ });
884
1175
  trackModified([
885
1176
  ...contextDependencies
886
- ], getFileModifiedMap(context));
1177
+ ], getFileModifiedMap(context2));
887
1178
  // ---
888
1179
  // Update all context tracking state
889
- configContextMap.set(tailwindConfigHash, context);
890
- contextMap.set(sourcePath, context);
891
- if (!contextSourcesMap.has(context)) {
892
- contextSourcesMap.set(context, new Set());
1180
+ configContextMap.set(tailwindConfigHash, context2);
1181
+ contextMap.set(sourcePath, context2);
1182
+ if (!contextSourcesMap.has(context2)) {
1183
+ contextSourcesMap.set(context2, new Set());
893
1184
  }
894
- contextSourcesMap.get(context).add(sourcePath);
1185
+ contextSourcesMap.get(context2).add(sourcePath);
895
1186
  return [
896
- context,
1187
+ context2,
897
1188
  true
898
1189
  ];
899
1190
  }