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
@@ -1,190 +1,142 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.default = setupTrackingContext;
7
-
8
- var _fs = _interopRequireDefault(require("fs"));
9
-
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
13
-
14
- var _quickLru = _interopRequireDefault(require("quick-lru"));
15
-
16
- var _normalizePath = _interopRequireDefault(require("normalize-path"));
17
-
18
- var _hashConfig = _interopRequireDefault(require("../util/hashConfig"));
19
-
20
- var _getModuleDependencies = _interopRequireDefault(require("../lib/getModuleDependencies"));
21
-
22
- var _resolveConfig = _interopRequireDefault(require("../../resolveConfig"));
23
-
24
- var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath"));
25
-
26
- var _sharedState = require("./sharedState");
27
-
28
- var _setupContextUtils = require("./setupContextUtils");
29
-
30
- var _parseDependency = _interopRequireDefault(require("../util/parseDependency"));
31
-
32
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
-
5
+ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
6
+ // Retrieve an existing context from cache if possible (since contexts are unique per
7
+ // source path), or set up a new one (including setting up watchers and registering
8
+ // plugins) then return it
9
+ "default", {
10
+ enumerable: true,
11
+ get: ()=>setupTrackingContext
12
+ });
13
+ const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
14
+ const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
15
+ const _hashConfig = /*#__PURE__*/ _interopRequireDefault(require("../util/hashConfig"));
16
+ const _getModuleDependencies = /*#__PURE__*/ _interopRequireDefault(require("../lib/getModuleDependencies"));
17
+ const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../public/resolve-config"));
18
+ const _resolveConfigPath = /*#__PURE__*/ _interopRequireDefault(require("../util/resolveConfigPath"));
19
+ const _setupContextUtils = require("./setupContextUtils");
20
+ const _parseDependency = /*#__PURE__*/ _interopRequireDefault(require("../util/parseDependency"));
21
+ const _validateConfigJs = require("../util/validateConfig.js");
22
+ const _contentJs = require("./content.js");
23
+ function _interopRequireDefault(obj) {
24
+ return obj && obj.__esModule ? obj : {
25
+ default: obj
26
+ };
27
+ }
34
28
  let configPathCache = new _quickLru.default({
35
- maxSize: 100
29
+ maxSize: 100
36
30
  });
37
31
  let candidateFilesCache = new WeakMap();
38
-
39
32
  function getCandidateFiles(context, tailwindConfig) {
40
- if (candidateFilesCache.has(context)) {
41
- return candidateFilesCache.get(context);
42
- }
43
-
44
- let candidateFiles = tailwindConfig.content.content.filter(item => typeof item === 'string').map(contentPath => (0, _normalizePath.default)(_path.default.resolve(contentPath)));
45
- return candidateFilesCache.set(context, candidateFiles).get(context);
46
- } // Get the config object based on a path
47
-
48
-
49
- function getTailwindConfig(configOrPath) {
50
- let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
51
-
52
- if (userConfigPath !== null) {
53
- let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
54
- let newDeps = (0, _getModuleDependencies.default)(userConfigPath).map(dep => dep.file);
55
- let modified = false;
56
- let newModified = new Map();
57
-
58
- for (let file of newDeps) {
59
- let time = _fs.default.statSync(file).mtimeMs;
60
-
61
- newModified.set(file, time);
62
-
63
- if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
64
- modified = true;
65
- }
66
- } // It hasn't changed (based on timestamps)
67
-
68
-
69
- if (!modified) {
70
- return [prevConfig, userConfigPath, prevConfigHash, prevDeps];
71
- } // It has changed (based on timestamps), or first run
72
-
73
-
74
- for (let file of newDeps) {
75
- delete require.cache[file];
33
+ if (candidateFilesCache.has(context)) {
34
+ return candidateFilesCache.get(context);
76
35
  }
77
-
78
- let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
79
- let newHash = (0, _hashConfig.default)(newConfig);
80
- configPathCache.set(userConfigPath, [newConfig, newHash, newDeps, newModified]);
81
- return [newConfig, userConfigPath, newHash, newDeps];
82
- } // It's a plain object, not a path
83
-
84
-
85
- let newConfig = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
86
- return [newConfig, null, (0, _hashConfig.default)(newConfig), []];
36
+ let candidateFiles = (0, _contentJs.parseCandidateFiles)(context, tailwindConfig);
37
+ return candidateFilesCache.set(context, candidateFiles).get(context);
87
38
  }
88
-
89
- function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
90
- let changedContent = context.tailwindConfig.content.content.filter(item => typeof item.raw === 'string').concat(context.tailwindConfig.content.safelist).map(({
91
- raw,
92
- extension
93
- }) => ({
94
- content: raw,
95
- extension
96
- }));
97
-
98
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)) {
99
- let content = _fs.default.readFileSync(changedFile, 'utf8');
100
-
101
- let extension = _path.default.extname(changedFile).slice(1);
102
-
103
- changedContent.push({
104
- content,
105
- extension
106
- });
107
- }
108
-
109
- return changedContent;
110
- }
111
-
112
- function resolveChangedFiles(candidateFiles, fileModifiedMap) {
113
- let changedFiles = new Set();
114
- _sharedState.env.DEBUG && console.time('Finding changed files');
115
-
116
- let files = _fastGlob.default.sync(candidateFiles);
117
-
118
- for (let file of files) {
119
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
120
-
121
- let modified = _fs.default.statSync(file).mtimeMs;
122
-
123
- if (modified > prevModified) {
124
- changedFiles.add(file);
125
- fileModifiedMap.set(file, modified);
126
- }
127
- }
128
-
129
- _sharedState.env.DEBUG && console.timeEnd('Finding changed files');
130
- return changedFiles;
131
- } // DISABLE_TOUCH = TRUE
132
- // Retrieve an existing context from cache if possible (since contexts are unique per
133
- // source path), or set up a new one (including setting up watchers and registering
134
- // plugins) then return it
135
-
136
-
137
- function setupTrackingContext(configOrPath) {
138
- return ({
139
- tailwindDirectives,
140
- registerDependency
141
- }) => {
142
- return (root, result) => {
143
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
144
- let contextDependencies = new Set(configDependencies); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
145
- // to be dependencies of the context. Can reuse the context even if they change.
146
- // We may want to think about `@layer` being part of this trigger too, but it's tough
147
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
148
- // in another file since independent sources are effectively isolated.
149
-
150
- if (tailwindDirectives.size > 0) {
151
- // Add current css file as a context dependencies.
152
- contextDependencies.add(result.opts.from); // Add all css @import dependencies as context dependencies.
153
-
154
- for (let message of result.messages) {
155
- if (message.type === 'dependency') {
156
- contextDependencies.add(message.file);
157
- }
39
+ // Get the config object based on a path
40
+ function getTailwindConfig(configOrPath) {
41
+ let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
42
+ if (userConfigPath !== null) {
43
+ let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
44
+ let newDeps = (0, _getModuleDependencies.default)(userConfigPath).map((dep)=>dep.file);
45
+ let modified = false;
46
+ let newModified = new Map();
47
+ for (let file of newDeps){
48
+ let time = _fs.default.statSync(file).mtimeMs;
49
+ newModified.set(file, time);
50
+ if (!prevModified || !prevModified.has(file) || time > prevModified.get(file)) {
51
+ modified = true;
52
+ }
158
53
  }
159
- }
160
-
161
- let [context] = (0, _setupContextUtils.getContext)(tailwindDirectives, root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
162
- let candidateFiles = getCandidateFiles(context, tailwindConfig); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
163
- // to be dependencies of the context. Can reuse the context even if they change.
164
- // We may want to think about `@layer` being part of this trigger too, but it's tough
165
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
166
- // in another file since independent sources are effectively isolated.
167
-
168
- if (tailwindDirectives.size > 0) {
169
- let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context); // Add template paths as postcss dependencies.
170
-
171
- for (let fileOrGlob of candidateFiles) {
172
- registerDependency((0, _parseDependency.default)(fileOrGlob));
54
+ // It hasn't changed (based on timestamps)
55
+ if (!modified) {
56
+ return [
57
+ prevConfig,
58
+ userConfigPath,
59
+ prevConfigHash,
60
+ prevDeps
61
+ ];
173
62
  }
174
-
175
- for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)) {
176
- context.changedContent.push(changedContent);
63
+ // It has changed (based on timestamps), or first run
64
+ for (let file1 of newDeps){
65
+ delete require.cache[file1];
177
66
  }
178
- }
179
-
180
- for (let file of configDependencies) {
181
- registerDependency({
182
- type: 'dependency',
183
- file
184
- });
185
- }
186
-
187
- return context;
67
+ let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
68
+ newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
69
+ let newHash = (0, _hashConfig.default)(newConfig);
70
+ configPathCache.set(userConfigPath, [
71
+ newConfig,
72
+ newHash,
73
+ newDeps,
74
+ newModified
75
+ ]);
76
+ return [
77
+ newConfig,
78
+ userConfigPath,
79
+ newHash,
80
+ newDeps
81
+ ];
82
+ }
83
+ // It's a plain object, not a path
84
+ let newConfig1 = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
85
+ newConfig1 = (0, _validateConfigJs.validateConfig)(newConfig1);
86
+ return [
87
+ newConfig1,
88
+ null,
89
+ (0, _hashConfig.default)(newConfig1),
90
+ []
91
+ ];
92
+ }
93
+ function setupTrackingContext(configOrPath) {
94
+ return ({ tailwindDirectives , registerDependency })=>{
95
+ return (root, result)=>{
96
+ let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
97
+ let contextDependencies = new Set(configDependencies);
98
+ // If there are no @tailwind or @apply rules, we don't consider this CSS
99
+ // file or its dependencies to be dependencies of the context. Can reuse
100
+ // the context even if they change. We may want to think about `@layer`
101
+ // being part of this trigger too, but it's tough because it's impossible
102
+ // for a layer in one file to end up in the actual @tailwind rule in
103
+ // another file since independent sources are effectively isolated.
104
+ if (tailwindDirectives.size > 0) {
105
+ // Add current css file as a context dependencies.
106
+ contextDependencies.add(result.opts.from);
107
+ // Add all css @import dependencies as context dependencies.
108
+ for (let message of result.messages){
109
+ if (message.type === "dependency") {
110
+ contextDependencies.add(message.file);
111
+ }
112
+ }
113
+ }
114
+ let [context] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
115
+ let candidateFiles = getCandidateFiles(context, tailwindConfig);
116
+ // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
117
+ // dependencies to be dependencies of the context. Can reuse the context even if they change.
118
+ // We may want to think about `@layer` being part of this trigger too, but it's tough
119
+ // because it's impossible for a layer in one file to end up in the actual @tailwind rule
120
+ // in another file since independent sources are effectively isolated.
121
+ if (tailwindDirectives.size > 0) {
122
+ let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
123
+ // Add template paths as postcss dependencies.
124
+ for (let contentPath of candidateFiles){
125
+ for (let dependency of (0, _parseDependency.default)(contentPath)){
126
+ registerDependency(dependency);
127
+ }
128
+ }
129
+ for (let changedContent of (0, _contentJs.resolvedChangedContent)(context, candidateFiles, fileModifiedMap)){
130
+ context.changedContent.push(changedContent);
131
+ }
132
+ }
133
+ for (let file of configDependencies){
134
+ registerDependency({
135
+ type: "dependency",
136
+ file
137
+ });
138
+ }
139
+ return context;
140
+ };
188
141
  };
189
- };
190
- }
142
+ }
@@ -1,29 +1,61 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
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
+ env: ()=>env,
13
+ contextMap: ()=>contextMap,
14
+ configContextMap: ()=>configContextMap,
15
+ contextSourcesMap: ()=>contextSourcesMap,
16
+ sourceHashMap: ()=>sourceHashMap,
17
+ NOT_ON_DEMAND: ()=>NOT_ON_DEMAND,
18
+ NONE: ()=>NONE,
19
+ resolveDebug: ()=>resolveDebug
5
20
  });
6
- exports.contentMatchCache = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
7
-
8
- var _quickLru = _interopRequireDefault(require("quick-lru"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
21
  const env = {
13
- TAILWIND_MODE: process.env.TAILWIND_MODE,
14
- NODE_ENV: process.env.NODE_ENV,
15
- DEBUG: process.env.DEBUG !== undefined,
16
- TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
17
- TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
22
+ NODE_ENV: process.env.NODE_ENV,
23
+ DEBUG: resolveDebug(process.env.DEBUG),
24
+ OXIDE: process.env.OXIDE
18
25
  };
19
- exports.env = env;
20
26
  const contextMap = new Map();
21
- exports.contextMap = contextMap;
22
27
  const configContextMap = new Map();
23
- exports.configContextMap = configContextMap;
24
28
  const contextSourcesMap = new Map();
25
- exports.contextSourcesMap = contextSourcesMap;
26
- const contentMatchCache = new _quickLru.default({
27
- maxSize: 25000
28
- });
29
- exports.contentMatchCache = contentMatchCache;
29
+ const sourceHashMap = new Map();
30
+ const NOT_ON_DEMAND = new String("*");
31
+ const NONE = Symbol("__NONE__");
32
+ function resolveDebug(debug) {
33
+ if (debug === undefined) {
34
+ return false;
35
+ }
36
+ // Environment variables are strings, so convert to boolean
37
+ if (debug === "true" || debug === "1") {
38
+ return true;
39
+ }
40
+ if (debug === "false" || debug === "0") {
41
+ return false;
42
+ }
43
+ // Keep the debug convention into account:
44
+ // DEBUG=* -> This enables all debug modes
45
+ // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
46
+ // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
47
+ // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
48
+ if (debug === "*") {
49
+ return true;
50
+ }
51
+ let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
52
+ // Ignoring tailwindcss
53
+ if (debuggers.includes("-tailwindcss")) {
54
+ return false;
55
+ }
56
+ // Including tailwindcss
57
+ if (debuggers.includes("tailwindcss")) {
58
+ return true;
59
+ }
60
+ return false;
61
+ }
@@ -1,31 +1,29 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- exports.default = _default;
7
-
8
- var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- function _default({
13
- tailwindConfig: {
14
- theme
15
- }
16
- }) {
17
- return function (css) {
18
- css.walkAtRules('screen', atRule => {
19
- var _theme$screens, _theme$screens$hasOwn;
20
-
21
- const screen = atRule.params;
22
-
23
- if (!((_theme$screens = theme.screens) !== null && _theme$screens !== void 0 && (_theme$screens$hasOwn = _theme$screens.hasOwnProperty) !== null && _theme$screens$hasOwn !== void 0 && _theme$screens$hasOwn.call(_theme$screens, screen))) {
24
- throw atRule.error(`No \`${screen}\` screen found.`);
25
- }
26
-
27
- atRule.name = 'media';
28
- atRule.params = (0, _buildMediaQuery.default)(theme.screens[screen]);
29
- });
30
- };
31
- }
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: ()=>_default
8
+ });
9
+ const _normalizeScreens = require("../util/normalizeScreens");
10
+ const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("../util/buildMediaQuery"));
11
+ function _interopRequireDefault(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function _default({ tailwindConfig: { theme } }) {
17
+ return function(css) {
18
+ css.walkAtRules("screen", (atRule)=>{
19
+ let screen = atRule.params;
20
+ let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
21
+ let screenDefinition = screens.find(({ name })=>name === screen);
22
+ if (!screenDefinition) {
23
+ throw atRule.error(`No \`${screen}\` screen found.`);
24
+ }
25
+ atRule.name = "media";
26
+ atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
27
+ });
28
+ };
29
+ }
@@ -1,6 +1,6 @@
1
1
  # tailwindcss/nesting
2
2
 
3
- This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
3
+ This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
4
4
 
5
5
  Add it to your PostCSS configuration, somewhere before Tailwind itself:
6
6
 
@@ -18,7 +18,7 @@ module.exports = {
18
18
 
19
19
  By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
20
20
 
21
- If you'd rather use [postcss-nesting](https://github.com/jonathantneal/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
21
+ If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
22
22
 
23
23
  ```shell
24
24
  npm install postcss-nesting
@@ -0,0 +1,19 @@
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
+ const _plugin = require("./plugin");
10
+ const _default = Object.assign(function(opts) {
11
+ return {
12
+ postcssPlugin: "tailwindcss/nesting",
13
+ Once (root, { result }) {
14
+ return (0, _plugin.nesting)(opts)(root, result);
15
+ }
16
+ };
17
+ }, {
18
+ postcss: true
19
+ });
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "nesting", {
6
+ enumerable: true,
7
+ get: ()=>nesting
8
+ });
9
+ const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
10
+ const _postcssNested = /*#__PURE__*/ _interopRequireDefault(require("postcss-nested"));
11
+ function _interopRequireDefault(obj) {
12
+ return obj && obj.__esModule ? obj : {
13
+ default: obj
14
+ };
15
+ }
16
+ function nesting(opts = _postcssNested.default) {
17
+ return (root, result)=>{
18
+ root.walkAtRules("screen", (rule)=>{
19
+ rule.name = "media";
20
+ rule.params = `screen(${rule.params})`;
21
+ });
22
+ root.walkAtRules("apply", (rule)=>{
23
+ rule.before(_postcss.default.decl({
24
+ prop: "__apply",
25
+ value: rule.params,
26
+ source: rule.source
27
+ }));
28
+ rule.remove();
29
+ });
30
+ let plugin = (()=>{
31
+ var ref;
32
+ if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (ref = opts.hasOwnProperty) === null || ref === void 0 ? void 0 : ref.call(opts, "postcssPlugin"))) {
33
+ return opts;
34
+ }
35
+ if (typeof opts === "string") {
36
+ return require(opts);
37
+ }
38
+ if (Object.keys(opts).length <= 0) {
39
+ return _postcssNested.default;
40
+ }
41
+ throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
42
+ })();
43
+ (0, _postcss.default)([
44
+ plugin
45
+ ]).process(root, result.opts).sync();
46
+ root.walkDecls("__apply", (decl)=>{
47
+ decl.before(_postcss.default.atRule({
48
+ name: "apply",
49
+ params: decl.value,
50
+ source: decl.source
51
+ }));
52
+ decl.remove();
53
+ });
54
+ /**
55
+ * Use a private PostCSS API to remove the "clean" flag from the entire AST.
56
+ * This is done because running process() on the AST will set the "clean"
57
+ * flag on all nodes, which we don't want.
58
+ *
59
+ * This causes downstream plugins using the visitor API to be skipped.
60
+ *
61
+ * This is guarded because the PostCSS API is not public
62
+ * and may change in future versions of PostCSS.
63
+ *
64
+ * See https://github.com/postcss/postcss/issues/1712 for more details
65
+ *
66
+ * @param {import('postcss').Node} node
67
+ */ function markDirty(node) {
68
+ if (!("markDirty" in node)) {
69
+ return;
70
+ }
71
+ // Traverse the tree down to the leaf nodes
72
+ if (node.nodes) {
73
+ node.nodes.forEach((n)=>markDirty(n));
74
+ }
75
+ // If it's a leaf node mark it as dirty
76
+ // We do this here because marking a node as dirty
77
+ // will walk up the tree and mark all parents as dirty
78
+ // resulting in a lot of unnecessary work if we did this
79
+ // for every single node
80
+ if (!node.nodes) {
81
+ node.markDirty();
82
+ }
83
+ }
84
+ markDirty(root);
85
+ return root;
86
+ };
87
+ }