tailwindcss 0.0.0-insiders.fda68f7 → 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 (195) hide show
  1. package/CHANGELOG.md +603 -2
  2. package/LICENSE +1 -2
  3. package/README.md +14 -6
  4. package/colors.d.ts +3 -0
  5. package/colors.js +2 -304
  6. package/defaultConfig.d.ts +3 -0
  7. package/defaultConfig.js +2 -4
  8. package/defaultTheme.d.ts +4 -0
  9. package/defaultTheme.js +2 -4
  10. package/lib/cli/build/deps.js +54 -0
  11. package/lib/cli/build/index.js +48 -0
  12. package/lib/cli/build/plugin.js +367 -0
  13. package/lib/cli/build/utils.js +78 -0
  14. package/lib/cli/build/watching.js +178 -0
  15. package/lib/cli/help/index.js +71 -0
  16. package/lib/cli/index.js +18 -0
  17. package/lib/cli/init/index.js +46 -0
  18. package/lib/cli/shared.js +13 -0
  19. package/lib/cli-peer-dependencies.js +22 -14
  20. package/lib/cli.js +217 -743
  21. package/lib/constants.js +41 -34
  22. package/lib/corePluginList.js +178 -5
  23. package/lib/corePlugins.js +3879 -2941
  24. package/lib/css/preflight.css +22 -9
  25. package/lib/featureFlags.js +61 -50
  26. package/lib/index.js +45 -28
  27. package/lib/lib/cacheInvalidation.js +90 -0
  28. package/lib/lib/collapseAdjacentRules.js +52 -36
  29. package/lib/lib/collapseDuplicateDeclarations.js +83 -0
  30. package/lib/lib/content.js +176 -0
  31. package/lib/lib/defaultExtractor.js +236 -0
  32. package/lib/lib/detectNesting.js +37 -0
  33. package/lib/lib/evaluateTailwindFunctions.js +203 -161
  34. package/lib/lib/expandApplyAtRules.js +502 -221
  35. package/lib/lib/expandTailwindAtRules.js +258 -243
  36. package/lib/lib/findAtConfigPath.js +44 -0
  37. package/lib/lib/generateRules.js +775 -320
  38. package/lib/lib/getModuleDependencies.js +44 -46
  39. package/lib/lib/normalizeTailwindDirectives.js +79 -60
  40. package/lib/lib/offsets.js +217 -0
  41. package/lib/lib/partitionApplyAtRules.js +56 -0
  42. package/lib/lib/regex.js +60 -0
  43. package/lib/lib/resolveDefaultsAtRules.js +150 -94
  44. package/lib/lib/setupContextUtils.js +1146 -599
  45. package/lib/lib/setupTrackingContext.js +129 -177
  46. package/lib/lib/sharedState.js +53 -21
  47. package/lib/lib/substituteScreenAtRules.js +26 -28
  48. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  49. package/lib/postcss-plugins/nesting/index.js +19 -0
  50. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  51. package/lib/processTailwindFeatures.js +58 -53
  52. package/lib/public/colors.js +331 -0
  53. package/lib/public/create-plugin.js +15 -0
  54. package/lib/public/default-config.js +16 -0
  55. package/lib/public/default-theme.js +16 -0
  56. package/lib/public/resolve-config.js +22 -0
  57. package/lib/util/bigSign.js +7 -6
  58. package/lib/util/buildMediaQuery.js +21 -32
  59. package/lib/util/cloneDeep.js +16 -14
  60. package/lib/util/cloneNodes.js +29 -15
  61. package/lib/util/color.js +90 -66
  62. package/lib/util/configurePlugins.js +17 -15
  63. package/lib/util/createPlugin.js +23 -26
  64. package/lib/util/createUtilityPlugin.js +46 -46
  65. package/lib/util/dataTypes.js +242 -0
  66. package/lib/util/defaults.js +20 -15
  67. package/lib/util/escapeClassName.js +18 -17
  68. package/lib/util/escapeCommas.js +7 -6
  69. package/lib/util/flattenColorPalette.js +13 -12
  70. package/lib/util/formatVariantSelector.js +285 -0
  71. package/lib/util/getAllConfigs.js +44 -18
  72. package/lib/util/hashConfig.js +15 -12
  73. package/lib/util/isKeyframeRule.js +7 -6
  74. package/lib/util/isPlainObject.js +11 -11
  75. package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
  76. package/lib/util/log.js +52 -33
  77. package/lib/util/nameClass.js +37 -26
  78. package/lib/util/negateValue.js +31 -17
  79. package/lib/util/normalizeConfig.js +281 -0
  80. package/lib/util/normalizeScreens.js +170 -0
  81. package/lib/util/parseAnimationValue.js +85 -54
  82. package/lib/util/parseBoxShadowValue.js +84 -0
  83. package/lib/util/parseDependency.js +41 -70
  84. package/lib/util/parseGlob.js +34 -0
  85. package/lib/util/parseObjectStyles.js +30 -24
  86. package/lib/util/pluginUtils.js +252 -287
  87. package/lib/util/prefixSelector.js +20 -20
  88. package/lib/util/removeAlphaVariables.js +29 -0
  89. package/lib/util/resolveConfig.js +221 -256
  90. package/lib/util/resolveConfigPath.js +43 -48
  91. package/lib/util/responsive.js +18 -14
  92. package/lib/util/splitAtTopLevelOnly.js +43 -0
  93. package/lib/util/tap.js +8 -7
  94. package/lib/util/toColorValue.js +7 -6
  95. package/lib/util/toPath.js +27 -8
  96. package/lib/util/transformThemeValue.js +67 -28
  97. package/lib/util/validateConfig.js +24 -0
  98. package/lib/util/validateFormalSyntax.js +24 -0
  99. package/lib/util/withAlphaVariable.js +67 -57
  100. package/nesting/index.js +2 -12
  101. package/package.json +60 -65
  102. package/peers/index.js +76445 -84221
  103. package/plugin.d.ts +11 -0
  104. package/plugin.js +1 -2
  105. package/resolveConfig.d.ts +12 -0
  106. package/resolveConfig.js +2 -7
  107. package/scripts/create-plugin-list.js +2 -2
  108. package/scripts/generate-types.js +105 -0
  109. package/scripts/release-channel.js +18 -0
  110. package/scripts/release-notes.js +21 -0
  111. package/scripts/type-utils.js +27 -0
  112. package/src/cli/build/deps.js +56 -0
  113. package/src/cli/build/index.js +49 -0
  114. package/src/cli/build/plugin.js +439 -0
  115. package/src/cli/build/utils.js +76 -0
  116. package/src/cli/build/watching.js +227 -0
  117. package/src/cli/help/index.js +70 -0
  118. package/src/cli/index.js +3 -0
  119. package/src/cli/init/index.js +50 -0
  120. package/src/cli/shared.js +6 -0
  121. package/src/cli-peer-dependencies.js +7 -1
  122. package/src/cli.js +50 -575
  123. package/src/corePluginList.js +1 -1
  124. package/src/corePlugins.js +2405 -1948
  125. package/src/css/preflight.css +22 -9
  126. package/src/featureFlags.js +26 -10
  127. package/src/index.js +19 -6
  128. package/src/lib/cacheInvalidation.js +52 -0
  129. package/src/lib/collapseAdjacentRules.js +21 -2
  130. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  131. package/src/lib/content.js +212 -0
  132. package/src/lib/defaultExtractor.js +211 -0
  133. package/src/lib/detectNesting.js +39 -0
  134. package/src/lib/evaluateTailwindFunctions.js +84 -10
  135. package/src/lib/expandApplyAtRules.js +508 -153
  136. package/src/lib/expandTailwindAtRules.js +130 -104
  137. package/src/lib/findAtConfigPath.js +48 -0
  138. package/src/lib/generateRules.js +596 -70
  139. package/src/lib/normalizeTailwindDirectives.js +10 -3
  140. package/src/lib/offsets.js +270 -0
  141. package/src/lib/partitionApplyAtRules.js +52 -0
  142. package/src/lib/regex.js +74 -0
  143. package/src/lib/resolveDefaultsAtRules.js +105 -47
  144. package/src/lib/setupContextUtils.js +828 -196
  145. package/src/lib/setupTrackingContext.js +19 -54
  146. package/src/lib/sharedState.js +45 -7
  147. package/src/lib/substituteScreenAtRules.js +6 -3
  148. package/src/postcss-plugins/nesting/README.md +42 -0
  149. package/src/postcss-plugins/nesting/index.js +13 -0
  150. package/src/postcss-plugins/nesting/plugin.js +80 -0
  151. package/src/processTailwindFeatures.js +19 -2
  152. package/src/public/colors.js +300 -0
  153. package/src/public/create-plugin.js +2 -0
  154. package/src/public/default-config.js +4 -0
  155. package/src/public/default-theme.js +4 -0
  156. package/src/public/resolve-config.js +7 -0
  157. package/src/util/buildMediaQuery.js +14 -16
  158. package/src/util/cloneNodes.js +19 -2
  159. package/src/util/color.js +31 -14
  160. package/src/util/createUtilityPlugin.js +2 -11
  161. package/src/util/dataTypes.js +256 -0
  162. package/src/util/defaults.js +6 -0
  163. package/src/util/formatVariantSelector.js +319 -0
  164. package/src/util/getAllConfigs.js +19 -0
  165. package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
  166. package/src/util/log.js +23 -22
  167. package/src/util/nameClass.js +14 -6
  168. package/src/util/negateValue.js +15 -5
  169. package/src/util/normalizeConfig.js +300 -0
  170. package/src/util/normalizeScreens.js +140 -0
  171. package/src/util/parseAnimationValue.js +7 -1
  172. package/src/util/parseBoxShadowValue.js +72 -0
  173. package/src/util/parseDependency.js +37 -38
  174. package/src/util/parseGlob.js +24 -0
  175. package/src/util/pluginUtils.js +216 -197
  176. package/src/util/prefixSelector.js +7 -8
  177. package/src/util/removeAlphaVariables.js +24 -0
  178. package/src/util/resolveConfig.js +86 -91
  179. package/src/util/splitAtTopLevelOnly.js +45 -0
  180. package/src/util/toPath.js +23 -1
  181. package/src/util/transformThemeValue.js +33 -8
  182. package/src/util/validateConfig.js +13 -0
  183. package/src/util/validateFormalSyntax.js +34 -0
  184. package/src/util/withAlphaVariable.js +14 -9
  185. package/stubs/defaultConfig.stub.js +186 -117
  186. package/stubs/simpleConfig.stub.js +1 -1
  187. package/types/config.d.ts +362 -0
  188. package/types/generated/.gitkeep +0 -0
  189. package/types/generated/colors.d.ts +276 -0
  190. package/types/generated/corePluginList.d.ts +1 -0
  191. package/types/generated/default-theme.d.ts +342 -0
  192. package/types/index.d.ts +7 -0
  193. package/lib/lib/setupWatchingContext.js +0 -331
  194. package/nesting/plugin.js +0 -41
  195. package/src/lib/setupWatchingContext.js +0 -306
@@ -0,0 +1,176 @@
1
+ // @ts-check
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ parseCandidateFiles: ()=>parseCandidateFiles,
14
+ resolvedChangedContent: ()=>resolvedChangedContent
15
+ });
16
+ const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
17
+ const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
18
+ const _isGlob = /*#__PURE__*/ _interopRequireDefault(require("is-glob"));
19
+ const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
20
+ const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
21
+ const _parseGlob = require("../util/parseGlob");
22
+ const _sharedState = require("./sharedState");
23
+ function _interopRequireDefault(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
28
+ function parseCandidateFiles(context, tailwindConfig) {
29
+ let files = tailwindConfig.content.files;
30
+ // Normalize the file globs
31
+ files = files.filter((filePath)=>typeof filePath === "string");
32
+ files = files.map(_normalizePath.default);
33
+ // Split into included and excluded globs
34
+ let tasks = _fastGlob.default.generateTasks(files);
35
+ /** @type {ContentPath[]} */ let included = [];
36
+ /** @type {ContentPath[]} */ let excluded = [];
37
+ for (const task of tasks){
38
+ included.push(...task.positive.map((filePath)=>parseFilePath(filePath, false)));
39
+ excluded.push(...task.negative.map((filePath)=>parseFilePath(filePath, true)));
40
+ }
41
+ let paths = [
42
+ ...included,
43
+ ...excluded
44
+ ];
45
+ // Resolve paths relative to the config file or cwd
46
+ paths = resolveRelativePaths(context, paths);
47
+ // Resolve symlinks if possible
48
+ paths = paths.flatMap(resolvePathSymlinks);
49
+ // Update cached patterns
50
+ paths = paths.map(resolveGlobPattern);
51
+ return paths;
52
+ }
53
+ /**
54
+ *
55
+ * @param {string} filePath
56
+ * @param {boolean} ignore
57
+ * @returns {ContentPath}
58
+ */ function parseFilePath(filePath, ignore) {
59
+ let contentPath = {
60
+ original: filePath,
61
+ base: filePath,
62
+ ignore,
63
+ pattern: filePath,
64
+ glob: null
65
+ };
66
+ if ((0, _isGlob.default)(filePath)) {
67
+ Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
68
+ }
69
+ return contentPath;
70
+ }
71
+ /**
72
+ *
73
+ * @param {ContentPath} contentPath
74
+ * @returns {ContentPath}
75
+ */ function resolveGlobPattern(contentPath) {
76
+ // This is required for Windows support to properly pick up Glob paths.
77
+ // Afaik, this technically shouldn't be needed but there's probably
78
+ // some internal, direct path matching with a normalized path in
79
+ // a package which can't handle mixed directory separators
80
+ let base = (0, _normalizePath.default)(contentPath.base);
81
+ // If the user's file path contains any special characters (like parens) for instance fast-glob
82
+ // is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
83
+ base = _fastGlob.default.escapePath(base);
84
+ contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
85
+ contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
86
+ return contentPath;
87
+ }
88
+ /**
89
+ * Resolve each path relative to the config file (when possible) if the experimental flag is enabled
90
+ * Otherwise, resolve relative to the current working directory
91
+ *
92
+ * @param {any} context
93
+ * @param {ContentPath[]} contentPaths
94
+ * @returns {ContentPath[]}
95
+ */ function resolveRelativePaths(context, contentPaths) {
96
+ let resolveFrom = [];
97
+ // Resolve base paths relative to the config file (when possible) if the experimental flag is enabled
98
+ if (context.userConfigPath && context.tailwindConfig.content.relative) {
99
+ resolveFrom = [
100
+ _path.default.dirname(context.userConfigPath)
101
+ ];
102
+ }
103
+ return contentPaths.map((contentPath)=>{
104
+ contentPath.base = _path.default.resolve(...resolveFrom, contentPath.base);
105
+ return contentPath;
106
+ });
107
+ }
108
+ /**
109
+ * Resolve the symlink for the base directory / file in each path
110
+ * These are added as additional dependencies to watch for changes because
111
+ * some tools (like webpack) will only watch the actual file or directory
112
+ * but not the symlink itself even in projects that use monorepos.
113
+ *
114
+ * @param {ContentPath} contentPath
115
+ * @returns {ContentPath[]}
116
+ */ function resolvePathSymlinks(contentPath) {
117
+ let paths = [
118
+ contentPath
119
+ ];
120
+ try {
121
+ let resolvedPath = _fs.default.realpathSync(contentPath.base);
122
+ if (resolvedPath !== contentPath.base) {
123
+ paths.push({
124
+ ...contentPath,
125
+ base: resolvedPath
126
+ });
127
+ }
128
+ } catch {
129
+ // TODO: log this?
130
+ }
131
+ return paths;
132
+ }
133
+ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
134
+ let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
135
+ content: raw,
136
+ extension
137
+ }));
138
+ for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
139
+ let extension = _path.default.extname(changedFile).slice(1);
140
+ changedContent.push({
141
+ file: changedFile,
142
+ extension
143
+ });
144
+ }
145
+ return changedContent;
146
+ }
147
+ /**
148
+ *
149
+ * @param {ContentPath[]} candidateFiles
150
+ * @param {Map<string, number>} fileModifiedMap
151
+ * @returns {Set<string>}
152
+ */ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
153
+ let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
154
+ let changedFiles = new Set();
155
+ _sharedState.env.DEBUG && console.time("Finding changed files");
156
+ let files = _fastGlob.default.sync(paths, {
157
+ absolute: true
158
+ });
159
+ for (let file of files){
160
+ let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
161
+ let modified = _fs.default.statSync(file).mtimeMs;
162
+ // This check is intentionally >= because we track the last modified time of context dependencies
163
+ // earier in the process and we want to make sure we don't miss any changes that happen
164
+ // when a context dependency is also a content dependency
165
+ // Ideally, we'd do all this tracking at one time but that is a larger refactor
166
+ // than we want to commit to right now, so this is a decent compromise.
167
+ // This should be sufficient because file modification times will be off by at least
168
+ // 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
169
+ if (modified >= prevModified) {
170
+ changedFiles.add(file);
171
+ fileModifiedMap.set(file, modified);
172
+ }
173
+ }
174
+ _sharedState.env.DEBUG && console.timeEnd("Finding changed files");
175
+ return changedFiles;
176
+ }
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "defaultExtractor", {
6
+ enumerable: true,
7
+ get: ()=>defaultExtractor
8
+ });
9
+ const _featureFlags = require("../featureFlags");
10
+ const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
11
+ function _getRequireWildcardCache(nodeInterop) {
12
+ if (typeof WeakMap !== "function") return null;
13
+ var cacheBabelInterop = new WeakMap();
14
+ var cacheNodeInterop = new WeakMap();
15
+ return (_getRequireWildcardCache = function(nodeInterop) {
16
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
17
+ })(nodeInterop);
18
+ }
19
+ function _interopRequireWildcard(obj, nodeInterop) {
20
+ if (!nodeInterop && obj && obj.__esModule) {
21
+ return obj;
22
+ }
23
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
+ return {
25
+ default: obj
26
+ };
27
+ }
28
+ var cache = _getRequireWildcardCache(nodeInterop);
29
+ if (cache && cache.has(obj)) {
30
+ return cache.get(obj);
31
+ }
32
+ var newObj = {};
33
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
+ for(var key in obj){
35
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
+ if (desc && (desc.get || desc.set)) {
38
+ Object.defineProperty(newObj, key, desc);
39
+ } else {
40
+ newObj[key] = obj[key];
41
+ }
42
+ }
43
+ }
44
+ newObj.default = obj;
45
+ if (cache) {
46
+ cache.set(obj, newObj);
47
+ }
48
+ return newObj;
49
+ }
50
+ function defaultExtractor(context) {
51
+ let patterns = Array.from(buildRegExps(context));
52
+ /**
53
+ * @param {string} content
54
+ */ return (content)=>{
55
+ /** @type {(string|string)[]} */ let results = [];
56
+ for (let pattern of patterns){
57
+ var ref;
58
+ results = [
59
+ ...results,
60
+ ...(ref = content.match(pattern)) !== null && ref !== void 0 ? ref : []
61
+ ];
62
+ }
63
+ return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
64
+ };
65
+ }
66
+ function* buildRegExps(context) {
67
+ let separator = context.tailwindConfig.separator;
68
+ let variantGroupingEnabled = (0, _featureFlags.flagEnabled)(context.tailwindConfig, "variantGrouping");
69
+ let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
70
+ /-?/,
71
+ _regex.escape(context.tailwindConfig.prefix)
72
+ ])) : "";
73
+ let utility = _regex.any([
74
+ // Arbitrary properties
75
+ /\[[^\s:'"`]+:[^\s]+\]/,
76
+ // Utilities
77
+ _regex.pattern([
78
+ // Utility Name / Group Name
79
+ /-?(?:\w+)/,
80
+ // Normal/Arbitrary values
81
+ _regex.optional(_regex.any([
82
+ _regex.pattern([
83
+ // Arbitrary values
84
+ /-(?:\w+-)*\[[^\s:]+\]/,
85
+ // Not immediately followed by an `{[(`
86
+ /(?![{([]])/,
87
+ // optionally followed by an opacity modifier
88
+ /(?:\/[^\s'"`\\><$]*)?/
89
+ ]),
90
+ _regex.pattern([
91
+ // Arbitrary values
92
+ /-(?:\w+-)*\[[^\s]+\]/,
93
+ // Not immediately followed by an `{[(`
94
+ /(?![{([]])/,
95
+ // optionally followed by an opacity modifier
96
+ /(?:\/[^\s'"`\\$]*)?/
97
+ ]),
98
+ // Normal values w/o quotes — may include an opacity modifier
99
+ /[-\/][^\s'"`\\$={><]*/
100
+ ]))
101
+ ])
102
+ ]);
103
+ let variantPatterns = [
104
+ // Without quotes
105
+ _regex.any([
106
+ // This is here to provide special support for the `@` variant
107
+ _regex.pattern([
108
+ /@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
109
+ separator
110
+ ]),
111
+ _regex.pattern([
112
+ /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
113
+ separator
114
+ ]),
115
+ _regex.pattern([
116
+ /[^\s"'`\[\\]+/,
117
+ separator
118
+ ])
119
+ ]),
120
+ // With quotes allowed
121
+ _regex.any([
122
+ _regex.pattern([
123
+ /([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
124
+ separator
125
+ ]),
126
+ _regex.pattern([
127
+ /[^\s`\[\\]+/,
128
+ separator
129
+ ])
130
+ ])
131
+ ];
132
+ for (const variantPattern of variantPatterns){
133
+ yield _regex.pattern([
134
+ // Variants
135
+ "((?=((",
136
+ variantPattern,
137
+ ")+))\\2)?",
138
+ // Important (optional)
139
+ /!?/,
140
+ prefix,
141
+ variantGroupingEnabled ? _regex.any([
142
+ // Or any of those things but grouped separated by commas
143
+ _regex.pattern([
144
+ /\(/,
145
+ utility,
146
+ _regex.zeroOrMore([
147
+ /,/,
148
+ utility
149
+ ]),
150
+ /\)/
151
+ ]),
152
+ // Arbitrary properties, constrained utilities, arbitrary values, etc…
153
+ utility
154
+ ]) : utility
155
+ ]);
156
+ }
157
+ // 5. Inner matches
158
+ yield /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g;
159
+ }
160
+ // We want to capture any "special" characters
161
+ // AND the characters immediately following them (if there is one)
162
+ let SPECIALS = /([\[\]'"`])([^\[\]'"`])?/g;
163
+ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
164
+ /**
165
+ * Clips a string ensuring that parentheses, quotes, etc… are balanced
166
+ * Used for arbitrary values only
167
+ *
168
+ * We will go past the end of the balanced parens until we find a non-class character
169
+ *
170
+ * Depth matching behavior:
171
+ * w-[calc(100%-theme('spacing[some_key][1.5]'))]']
172
+ * ┬ ┬ ┬┬ ┬ ┬┬ ┬┬┬┬┬┬┬
173
+ * 1 2 3 4 34 3 210 END
174
+ * ╰────┴──────────┴────────┴────────┴┴───┴─┴┴┴
175
+ *
176
+ * @param {string} input
177
+ */ function clipAtBalancedParens(input) {
178
+ // We are care about this for arbitrary values
179
+ if (!input.includes("-[")) {
180
+ return input;
181
+ }
182
+ let depth = 0;
183
+ let openStringTypes = [];
184
+ // Find all parens, brackets, quotes, etc
185
+ // Stop when we end at a balanced pair
186
+ // This is naive and will treat mismatched parens as balanced
187
+ // This shouldn't be a problem in practice though
188
+ let matches = input.matchAll(SPECIALS);
189
+ // We can't use lookbehind assertions because we have to support Safari
190
+ // So, instead, we've emulated it using capture groups and we'll re-work the matches to accommodate
191
+ matches = Array.from(matches).flatMap((match)=>{
192
+ const [, ...groups] = match;
193
+ return groups.map((group, idx)=>Object.assign([], match, {
194
+ index: match.index + idx,
195
+ 0: group
196
+ }));
197
+ });
198
+ for (let match of matches){
199
+ let char = match[0];
200
+ let inStringType = openStringTypes[openStringTypes.length - 1];
201
+ if (char === inStringType) {
202
+ openStringTypes.pop();
203
+ } else if (char === "'" || char === '"' || char === "`") {
204
+ openStringTypes.push(char);
205
+ }
206
+ if (inStringType) {
207
+ continue;
208
+ } else if (char === "[") {
209
+ depth++;
210
+ continue;
211
+ } else if (char === "]") {
212
+ depth--;
213
+ continue;
214
+ }
215
+ // We've gone one character past the point where we should stop
216
+ // This means that there was an extra closing `]`
217
+ // We'll clip to just before it
218
+ if (depth < 0) {
219
+ return input.substring(0, match.index);
220
+ }
221
+ // We've finished balancing the brackets but there still may be characters that can be included
222
+ // For example in the class `text-[#336699]/[.35]`
223
+ // The depth goes to `0` at the closing `]` but goes up again at the `[`
224
+ // If we're at zero and encounter a non-class character then we clip the class there
225
+ if (depth === 0 && !ALLOWED_CLASS_CHARACTERS.test(char)) {
226
+ return input.substring(0, match.index);
227
+ }
228
+ }
229
+ return input;
230
+ } // Regular utilities
231
+ // {{modifier}:}*{namespace}{-{suffix}}*{/{opacityModifier}}?
232
+ // Arbitrary values
233
+ // {{modifier}:}*{namespace}-[{arbitraryValue}]{/{opacityModifier}}?
234
+ // arbitraryValue: no whitespace, balanced quotes unless within quotes, balanced brackets unless within quotes
235
+ // Arbitrary properties
236
+ // {{modifier}:}*[{validCssPropertyName}:{arbitraryValue}]
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>_default
8
+ });
9
+ function _default(_context) {
10
+ return (root, result)=>{
11
+ let found = false;
12
+ root.walkAtRules("tailwind", (node)=>{
13
+ if (found) return false;
14
+ if (node.parent && node.parent.type !== "root") {
15
+ found = true;
16
+ node.warn(result, [
17
+ "Nested @tailwind rules were detected, but are not supported.",
18
+ "Consider using a prefix to scope Tailwind's classes: https://tailwindcss.com/docs/configuration#prefix",
19
+ "Alternatively, use the important selector strategy: https://tailwindcss.com/docs/configuration#selector-strategy"
20
+ ].join("\n"));
21
+ return false;
22
+ }
23
+ });
24
+ root.walkRules((rule)=>{
25
+ if (found) return false;
26
+ rule.walkRules((nestedRule)=>{
27
+ found = true;
28
+ nestedRule.warn(result, [
29
+ "Nested CSS was detected, but CSS nesting has not been configured correctly.",
30
+ "Please enable a CSS nesting plugin *before* Tailwind in your configuration.",
31
+ "See how here: https://tailwindcss.com/docs/using-with-preprocessors#nesting"
32
+ ].join("\n"));
33
+ return false;
34
+ });
35
+ });
36
+ };
37
+ }