tailwindcss 0.0.0-insiders.f4635e0 → 0.0.0-insiders.f4a2ccd

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 (238) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +15 -7
  3. package/colors.d.ts +3 -0
  4. package/colors.js +2 -304
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -4
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -4
  9. package/lib/cli/build/deps.js +54 -0
  10. package/lib/cli/build/index.js +52 -0
  11. package/lib/cli/build/plugin.js +376 -0
  12. package/lib/cli/build/utils.js +78 -0
  13. package/lib/cli/build/watching.js +180 -0
  14. package/lib/cli/help/index.js +71 -0
  15. package/lib/cli/index.js +230 -0
  16. package/lib/cli/init/index.js +61 -0
  17. package/lib/cli-peer-dependencies.js +22 -14
  18. package/lib/cli.js +4 -762
  19. package/lib/corePluginList.js +182 -5
  20. package/lib/corePlugins.js +4109 -2952
  21. package/lib/css/preflight.css +24 -9
  22. package/lib/featureFlags.js +68 -50
  23. package/lib/index.js +5 -30
  24. package/lib/lib/cacheInvalidation.js +90 -0
  25. package/lib/lib/collapseAdjacentRules.js +52 -36
  26. package/lib/lib/collapseDuplicateDeclarations.js +83 -0
  27. package/lib/lib/content.js +177 -0
  28. package/lib/lib/defaultExtractor.js +241 -0
  29. package/lib/lib/detectNesting.js +39 -17
  30. package/lib/lib/evaluateTailwindFunctions.js +203 -161
  31. package/lib/lib/expandApplyAtRules.js +503 -221
  32. package/lib/lib/expandTailwindAtRules.js +255 -243
  33. package/lib/lib/findAtConfigPath.js +44 -0
  34. package/lib/lib/generateRules.js +831 -317
  35. package/lib/lib/getModuleDependencies.js +93 -49
  36. package/lib/lib/load-config.js +36 -0
  37. package/lib/lib/normalizeTailwindDirectives.js +79 -60
  38. package/lib/lib/offsets.js +304 -0
  39. package/lib/lib/partitionApplyAtRules.js +56 -0
  40. package/lib/lib/regex.js +60 -0
  41. package/lib/lib/remap-bitfield.js +87 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +150 -94
  43. package/lib/lib/setupContextUtils.js +1197 -685
  44. package/lib/lib/setupTrackingContext.js +150 -177
  45. package/lib/lib/sharedState.js +70 -21
  46. package/lib/lib/substituteScreenAtRules.js +26 -28
  47. package/lib/oxide/cli/build/deps.js +81 -0
  48. package/lib/oxide/cli/build/index.js +51 -0
  49. package/lib/oxide/cli/build/plugin.js +373 -0
  50. package/lib/oxide/cli/build/utils.js +77 -0
  51. package/lib/oxide/cli/build/watching.js +177 -0
  52. package/lib/oxide/cli/help/index.js +70 -0
  53. package/lib/oxide/cli/index.js +214 -0
  54. package/lib/oxide/cli/init/index.js +50 -0
  55. package/lib/oxide/cli.js +5 -0
  56. package/lib/oxide/postcss-plugin.js +2 -0
  57. package/lib/plugin.js +98 -0
  58. package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
  59. package/lib/postcss-plugins/nesting/index.js +19 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +87 -0
  61. package/lib/processTailwindFeatures.js +58 -56
  62. package/lib/public/colors.js +353 -0
  63. package/lib/public/create-plugin.js +15 -0
  64. package/lib/public/default-config.js +16 -0
  65. package/lib/public/default-theme.js +16 -0
  66. package/lib/public/load-config.js +10 -0
  67. package/lib/public/resolve-config.js +22 -0
  68. package/lib/util/applyImportantSelector.js +22 -0
  69. package/lib/util/bigSign.js +7 -6
  70. package/lib/util/buildMediaQuery.js +21 -32
  71. package/lib/util/cloneDeep.js +16 -14
  72. package/lib/util/cloneNodes.js +29 -15
  73. package/lib/util/color.js +104 -66
  74. package/lib/util/configurePlugins.js +17 -15
  75. package/lib/util/createPlugin.js +23 -26
  76. package/lib/util/createUtilityPlugin.js +46 -46
  77. package/lib/util/dataTypes.js +266 -0
  78. package/lib/util/defaults.js +20 -15
  79. package/lib/util/escapeClassName.js +18 -17
  80. package/lib/util/escapeCommas.js +7 -6
  81. package/lib/util/flattenColorPalette.js +13 -12
  82. package/lib/util/formatVariantSelector.js +341 -0
  83. package/lib/util/getAllConfigs.js +44 -18
  84. package/lib/util/hashConfig.js +15 -12
  85. package/lib/util/isKeyframeRule.js +7 -6
  86. package/lib/util/isPlainObject.js +11 -11
  87. package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
  88. package/lib/util/log.js +52 -33
  89. package/lib/util/nameClass.js +35 -29
  90. package/lib/util/negateValue.js +31 -17
  91. package/lib/util/normalizeConfig.js +294 -0
  92. package/lib/util/normalizeScreens.js +170 -0
  93. package/lib/util/parseAnimationValue.js +85 -54
  94. package/lib/util/parseBoxShadowValue.js +84 -0
  95. package/lib/util/parseDependency.js +41 -70
  96. package/lib/util/parseGlob.js +34 -0
  97. package/lib/util/parseObjectStyles.js +30 -24
  98. package/lib/util/pluginUtils.js +234 -288
  99. package/lib/util/prefixSelector.js +33 -19
  100. package/lib/util/removeAlphaVariables.js +29 -0
  101. package/lib/util/resolveConfig.js +221 -256
  102. package/lib/util/resolveConfigPath.js +55 -48
  103. package/lib/util/responsive.js +18 -14
  104. package/lib/util/splitAtTopLevelOnly.js +49 -0
  105. package/lib/util/tap.js +8 -7
  106. package/lib/util/toColorValue.js +7 -6
  107. package/lib/util/toPath.js +27 -8
  108. package/lib/util/transformThemeValue.js +67 -28
  109. package/lib/util/validateConfig.js +24 -0
  110. package/lib/util/validateFormalSyntax.js +24 -0
  111. package/lib/util/withAlphaVariable.js +67 -57
  112. package/loadConfig.d.ts +4 -0
  113. package/loadConfig.js +2 -0
  114. package/nesting/index.js +2 -12
  115. package/package.json +69 -66
  116. package/peers/index.js +76328 -84169
  117. package/plugin.d.ts +11 -0
  118. package/plugin.js +1 -2
  119. package/resolveConfig.d.ts +12 -0
  120. package/resolveConfig.js +2 -7
  121. package/scripts/create-plugin-list.js +2 -2
  122. package/scripts/generate-types.js +105 -0
  123. package/scripts/release-channel.js +18 -0
  124. package/scripts/release-notes.js +21 -0
  125. package/scripts/swap-engines.js +40 -0
  126. package/scripts/type-utils.js +27 -0
  127. package/src/cli/build/deps.js +56 -0
  128. package/src/cli/build/index.js +49 -0
  129. package/src/cli/build/plugin.js +444 -0
  130. package/src/cli/build/utils.js +76 -0
  131. package/src/cli/build/watching.js +229 -0
  132. package/src/cli/help/index.js +70 -0
  133. package/src/cli/index.js +216 -0
  134. package/src/cli/init/index.js +79 -0
  135. package/src/cli-peer-dependencies.js +7 -1
  136. package/src/cli.js +4 -756
  137. package/src/corePluginList.js +1 -1
  138. package/src/corePlugins.js +2526 -1956
  139. package/src/css/preflight.css +24 -9
  140. package/src/featureFlags.js +33 -10
  141. package/src/index.js +4 -33
  142. package/src/lib/cacheInvalidation.js +52 -0
  143. package/src/lib/collapseAdjacentRules.js +21 -2
  144. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  145. package/src/lib/content.js +208 -0
  146. package/src/lib/defaultExtractor.js +217 -0
  147. package/src/lib/detectNesting.js +30 -3
  148. package/src/lib/evaluateTailwindFunctions.js +84 -10
  149. package/src/lib/expandApplyAtRules.js +509 -153
  150. package/src/lib/expandTailwindAtRules.js +125 -104
  151. package/src/lib/findAtConfigPath.js +48 -0
  152. package/src/lib/generateRules.js +678 -70
  153. package/src/lib/getModuleDependencies.js +70 -30
  154. package/src/lib/load-config.ts +27 -0
  155. package/src/lib/normalizeTailwindDirectives.js +10 -3
  156. package/src/lib/offsets.js +373 -0
  157. package/src/lib/partitionApplyAtRules.js +52 -0
  158. package/src/lib/regex.js +74 -0
  159. package/src/lib/remap-bitfield.js +82 -0
  160. package/src/lib/resolveDefaultsAtRules.js +105 -47
  161. package/src/lib/setupContextUtils.js +848 -247
  162. package/src/lib/setupTrackingContext.js +53 -64
  163. package/src/lib/sharedState.js +60 -6
  164. package/src/lib/substituteScreenAtRules.js +6 -3
  165. package/src/oxide/cli/build/deps.ts +91 -0
  166. package/src/oxide/cli/build/index.ts +47 -0
  167. package/src/oxide/cli/build/plugin.ts +442 -0
  168. package/src/oxide/cli/build/utils.ts +74 -0
  169. package/src/oxide/cli/build/watching.ts +225 -0
  170. package/src/oxide/cli/help/index.ts +69 -0
  171. package/src/oxide/cli/index.ts +204 -0
  172. package/src/oxide/cli/init/index.ts +59 -0
  173. package/src/oxide/cli.ts +1 -0
  174. package/src/oxide/postcss-plugin.ts +1 -0
  175. package/src/plugin.js +107 -0
  176. package/src/postcss-plugins/nesting/README.md +42 -0
  177. package/src/postcss-plugins/nesting/index.js +13 -0
  178. package/src/postcss-plugins/nesting/plugin.js +80 -0
  179. package/src/processTailwindFeatures.js +18 -3
  180. package/src/public/colors.js +322 -0
  181. package/src/public/create-plugin.js +2 -0
  182. package/src/public/default-config.js +4 -0
  183. package/src/public/default-theme.js +4 -0
  184. package/src/public/load-config.js +2 -0
  185. package/src/public/resolve-config.js +7 -0
  186. package/src/util/applyImportantSelector.js +19 -0
  187. package/src/util/buildMediaQuery.js +14 -16
  188. package/src/util/cloneNodes.js +19 -2
  189. package/src/util/color.js +43 -11
  190. package/src/util/createUtilityPlugin.js +2 -11
  191. package/src/util/dataTypes.js +281 -0
  192. package/src/util/defaults.js +6 -0
  193. package/src/util/formatVariantSelector.js +412 -0
  194. package/src/util/getAllConfigs.js +21 -2
  195. package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
  196. package/src/util/log.js +23 -22
  197. package/src/util/nameClass.js +6 -2
  198. package/src/util/negateValue.js +15 -5
  199. package/src/util/normalizeConfig.js +318 -0
  200. package/src/util/normalizeScreens.js +140 -0
  201. package/src/util/parseAnimationValue.js +7 -1
  202. package/src/util/parseBoxShadowValue.js +72 -0
  203. package/src/util/parseDependency.js +37 -38
  204. package/src/util/parseGlob.js +24 -0
  205. package/src/util/pluginUtils.js +219 -219
  206. package/src/util/prefixSelector.js +30 -13
  207. package/src/util/removeAlphaVariables.js +24 -0
  208. package/src/util/resolveConfig.js +86 -91
  209. package/src/util/resolveConfigPath.js +12 -1
  210. package/src/util/splitAtTopLevelOnly.js +52 -0
  211. package/src/util/toPath.js +23 -1
  212. package/src/util/transformThemeValue.js +33 -8
  213. package/src/util/validateConfig.js +13 -0
  214. package/src/util/validateFormalSyntax.js +34 -0
  215. package/src/util/withAlphaVariable.js +14 -9
  216. package/stubs/.gitignore +1 -0
  217. package/stubs/.prettierrc.json +6 -0
  218. package/stubs/{defaultConfig.stub.js → config.full.js} +332 -249
  219. package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
  220. package/stubs/postcss.config.js +6 -0
  221. package/stubs/tailwind.config.cjs +2 -0
  222. package/stubs/tailwind.config.js +2 -0
  223. package/stubs/tailwind.config.ts +3 -0
  224. package/types/config.d.ts +373 -0
  225. package/types/generated/.gitkeep +0 -0
  226. package/types/generated/colors.d.ts +298 -0
  227. package/types/generated/corePluginList.d.ts +1 -0
  228. package/types/generated/default-theme.d.ts +347 -0
  229. package/types/index.d.ts +7 -0
  230. package/CHANGELOG.md +0 -1742
  231. package/lib/constants.js +0 -37
  232. package/lib/lib/setupWatchingContext.js +0 -331
  233. package/nesting/plugin.js +0 -41
  234. package/scripts/install-integrations.js +0 -27
  235. package/scripts/rebuildFixtures.js +0 -68
  236. package/src/constants.js +0 -17
  237. package/src/lib/setupWatchingContext.js +0 -307
  238. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
package/lib/constants.js DELETED
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.defaultPostCssConfigStubFile = exports.simpleConfigStubFile = exports.defaultConfigStubFile = exports.supportedPostCssConfigFile = exports.supportedConfigFiles = exports.cjsPostCssConfigFile = exports.cjsConfigFile = exports.defaultPostCssConfigFile = exports.defaultConfigFile = exports.cli = void 0;
7
-
8
- var _path = _interopRequireDefault(require("path"));
9
-
10
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
-
12
- const cli = 'tailwind';
13
- exports.cli = cli;
14
- const defaultConfigFile = './tailwind.config.js';
15
- exports.defaultConfigFile = defaultConfigFile;
16
- const defaultPostCssConfigFile = './postcss.config.js';
17
- exports.defaultPostCssConfigFile = defaultPostCssConfigFile;
18
- const cjsConfigFile = './tailwind.config.cjs';
19
- exports.cjsConfigFile = cjsConfigFile;
20
- const cjsPostCssConfigFile = './postcss.config.cjs';
21
- exports.cjsPostCssConfigFile = cjsPostCssConfigFile;
22
- const supportedConfigFiles = [cjsConfigFile, defaultConfigFile];
23
- exports.supportedConfigFiles = supportedConfigFiles;
24
- const supportedPostCssConfigFile = [cjsPostCssConfigFile, defaultPostCssConfigFile];
25
- exports.supportedPostCssConfigFile = supportedPostCssConfigFile;
26
-
27
- const defaultConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultConfig.stub.js');
28
-
29
- exports.defaultConfigStubFile = defaultConfigStubFile;
30
-
31
- const simpleConfigStubFile = _path.default.resolve(__dirname, '../stubs/simpleConfig.stub.js');
32
-
33
- exports.simpleConfigStubFile = simpleConfigStubFile;
34
-
35
- const defaultPostCssConfigStubFile = _path.default.resolve(__dirname, '../stubs/defaultPostCssConfig.stub.js');
36
-
37
- exports.defaultPostCssConfigStubFile = defaultPostCssConfigStubFile;
@@ -1,331 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = setupWatchingContext;
7
-
8
- var _fs = _interopRequireDefault(require("fs"));
9
-
10
- var _path = _interopRequireDefault(require("path"));
11
-
12
- var _tmp = _interopRequireDefault(require("tmp"));
13
-
14
- var _chokidar = _interopRequireDefault(require("chokidar"));
15
-
16
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
17
-
18
- var _quickLru = _interopRequireDefault(require("quick-lru"));
19
-
20
- var _normalizePath = _interopRequireDefault(require("normalize-path"));
21
-
22
- var _hashConfig = _interopRequireDefault(require("../util/hashConfig"));
23
-
24
- var _log = _interopRequireDefault(require("../util/log"));
25
-
26
- var _getModuleDependencies = _interopRequireDefault(require("../lib/getModuleDependencies"));
27
-
28
- var _resolveConfig = _interopRequireDefault(require("../../resolveConfig"));
29
-
30
- var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath"));
31
-
32
- var _setupContextUtils = require("./setupContextUtils");
33
-
34
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
-
36
- // This is used to trigger rebuilds. Just updating the timestamp
37
- // is significantly faster than actually writing to the file (10x).
38
- function touch(filename) {
39
- let time = new Date();
40
-
41
- try {
42
- _fs.default.utimesSync(filename, time, time);
43
- } catch (err) {
44
- _fs.default.closeSync(_fs.default.openSync(filename, 'w'));
45
- }
46
- }
47
-
48
- let watchers = new WeakMap();
49
-
50
- function getWatcher(context) {
51
- if (watchers.has(context)) {
52
- return watchers.get(context);
53
- }
54
-
55
- return null;
56
- }
57
-
58
- function setWatcher(context, watcher) {
59
- return watchers.set(context, watcher);
60
- }
61
-
62
- let touchFiles = new WeakMap();
63
-
64
- function getTouchFile(context) {
65
- if (touchFiles.has(context)) {
66
- return touchFiles.get(context);
67
- }
68
-
69
- return null;
70
- }
71
-
72
- function setTouchFile(context, touchFile) {
73
- return touchFiles.set(context, touchFile);
74
- }
75
-
76
- let configPaths = new WeakMap();
77
-
78
- function getConfigPath(context, configOrPath) {
79
- if (!configPaths.has(context)) {
80
- configPaths.set(context, (0, _resolveConfigPath.default)(configOrPath));
81
- }
82
-
83
- return configPaths.get(context);
84
- }
85
-
86
- function rebootWatcher(context, configPath, configDependencies, candidateFiles) {
87
- let touchFile = getTouchFile(context);
88
-
89
- if (touchFile === null) {
90
- touchFile = _tmp.default.fileSync().name;
91
- setTouchFile(context, touchFile);
92
- touch(touchFile);
93
- }
94
-
95
- let watcher = getWatcher(context);
96
- Promise.resolve(watcher ? watcher.close() : null).then(() => {
97
- _log.default.info(['Tailwind CSS is watching for changes...', 'https://tailwindcss.com/docs/just-in-time-mode#watch-mode-and-one-off-builds']);
98
-
99
- watcher = _chokidar.default.watch([...candidateFiles, ...configDependencies], {
100
- ignoreInitial: true
101
- });
102
- setWatcher(context, watcher);
103
- watcher.on('add', file => {
104
- let changedFile = _path.default.resolve('.', file);
105
-
106
- let content = _fs.default.readFileSync(changedFile, 'utf8');
107
-
108
- let extension = _path.default.extname(changedFile).slice(1);
109
-
110
- context.changedContent.push({
111
- content,
112
- extension
113
- });
114
- touch(touchFile);
115
- });
116
- watcher.on('change', file => {
117
- // If it was a config dependency, touch the config file to trigger a new context.
118
- // This is not really that clean of a solution but it's the fastest, because we
119
- // can do a very quick check on each build to see if the config has changed instead
120
- // of having to get all of the module dependencies and check every timestamp each
121
- // time.
122
- if (configDependencies.has(file)) {
123
- for (let dependency of configDependencies) {
124
- delete require.cache[require.resolve(dependency)];
125
- }
126
-
127
- touch(configPath);
128
- } else {
129
- let changedFile = _path.default.resolve('.', file);
130
-
131
- let content = _fs.default.readFileSync(changedFile, 'utf8');
132
-
133
- let extension = _path.default.extname(changedFile).slice(1);
134
-
135
- context.changedContent.push({
136
- content,
137
- extension
138
- });
139
- touch(touchFile);
140
- }
141
- });
142
- watcher.on('unlink', file => {
143
- // Touch the config file if any of the dependencies are deleted.
144
- if (configDependencies.has(file)) {
145
- for (let dependency of configDependencies) {
146
- delete require.cache[require.resolve(dependency)];
147
- }
148
-
149
- touch(configPath);
150
- }
151
- });
152
- });
153
- }
154
-
155
- let configPathCache = new _quickLru.default({
156
- maxSize: 100
157
- });
158
- let configDependenciesCache = new WeakMap();
159
-
160
- function getConfigDependencies(context) {
161
- if (!configDependenciesCache.has(context)) {
162
- configDependenciesCache.set(context, new Set());
163
- }
164
-
165
- return configDependenciesCache.get(context);
166
- }
167
-
168
- let candidateFilesCache = new WeakMap();
169
-
170
- function getCandidateFiles(context, tailwindConfig) {
171
- if (candidateFilesCache.has(context)) {
172
- return candidateFilesCache.get(context);
173
- }
174
-
175
- let candidateFiles = tailwindConfig.content.content.filter(item => typeof item === 'string').map(contentPath => (0, _normalizePath.default)(_path.default.resolve(contentPath)));
176
- return candidateFilesCache.set(context, candidateFiles).get(context);
177
- } // Get the config object based on a path
178
-
179
-
180
- function getTailwindConfig(configOrPath) {
181
- let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
182
-
183
- if (userConfigPath !== null) {
184
- let [prevConfig, prevModified = -Infinity, prevConfigHash] = configPathCache.get(userConfigPath) || [];
185
-
186
- let modified = _fs.default.statSync(userConfigPath).mtimeMs; // It hasn't changed (based on timestamp)
187
-
188
-
189
- if (modified <= prevModified) {
190
- return [prevConfig, userConfigPath, prevConfigHash, [userConfigPath]];
191
- } // It has changed (based on timestamp), or first run
192
-
193
-
194
- delete require.cache[userConfigPath];
195
- let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
196
- let newHash = (0, _hashConfig.default)(newConfig);
197
- configPathCache.set(userConfigPath, [newConfig, modified, newHash]);
198
- return [newConfig, userConfigPath, newHash, [userConfigPath]];
199
- } // It's a plain object, not a path
200
-
201
-
202
- let newConfig = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
203
- return [newConfig, null, (0, _hashConfig.default)(newConfig), []];
204
- }
205
-
206
- function resolvedChangedContent(context, candidateFiles) {
207
- let changedContent = context.tailwindConfig.content.content.filter(item => typeof item.raw === 'string').concat(context.tailwindConfig.content.safelist).concat(context.safelist()).map(({
208
- raw,
209
- extension
210
- }) => ({
211
- content: raw,
212
- extension
213
- }));
214
-
215
- for (let changedFile of resolveChangedFiles(context, candidateFiles)) {
216
- let content = _fs.default.readFileSync(changedFile, 'utf8');
217
-
218
- let extension = _path.default.extname(changedFile).slice(1);
219
-
220
- changedContent.push({
221
- content,
222
- extension
223
- });
224
- }
225
-
226
- return changedContent;
227
- }
228
-
229
- let scannedContentCache = new WeakMap();
230
-
231
- function resolveChangedFiles(context, candidateFiles) {
232
- let changedFiles = new Set(); // If we're not set up and watching files ourselves, we need to do
233
- // the work of grabbing all of the template files for candidate
234
- // detection.
235
-
236
- if (!scannedContentCache.has(context)) {
237
- let files = _fastGlob.default.sync(candidateFiles);
238
-
239
- for (let file of files) {
240
- changedFiles.add(file);
241
- }
242
-
243
- scannedContentCache.set(context, true);
244
- }
245
-
246
- return changedFiles;
247
- } // DISABLE_TOUCH = FALSE
248
- // Retrieve an existing context from cache if possible (since contexts are unique per
249
- // source path), or set up a new one (including setting up watchers and registering
250
- // plugins) then return it
251
-
252
-
253
- function setupWatchingContext(configOrPath) {
254
- return ({
255
- tailwindDirectives,
256
- registerDependency
257
- }) => {
258
- return (root, result) => {
259
- let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
260
- let contextDependencies = new Set(configDependencies); // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
261
- // to be dependencies of the context. Can reuse the context even if they change.
262
- // We may want to think about `@layer` being part of this trigger too, but it's tough
263
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
264
- // in another file since independent sources are effectively isolated.
265
-
266
- if (tailwindDirectives.size > 0) {
267
- // Add current css file as a context dependencies.
268
- contextDependencies.add(result.opts.from); // Add all css @import dependencies as context dependencies.
269
-
270
- for (let message of result.messages) {
271
- if (message.type === 'dependency') {
272
- contextDependencies.add(message.file);
273
- }
274
- }
275
- }
276
-
277
- let [context, isNewContext] = (0, _setupContextUtils.getContext)(tailwindDirectives, root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
278
- let candidateFiles = getCandidateFiles(context, tailwindConfig);
279
- let contextConfigDependencies = getConfigDependencies(context);
280
-
281
- for (let file of configDependencies) {
282
- registerDependency({
283
- type: 'dependency',
284
- file
285
- });
286
- }
287
-
288
- context.disposables.push(oldContext => {
289
- let watcher = getWatcher(oldContext);
290
-
291
- if (watcher !== null) {
292
- watcher.close();
293
- }
294
- });
295
- let configPath = getConfigPath(context, configOrPath);
296
-
297
- if (configPath !== null) {
298
- for (let dependency of (0, _getModuleDependencies.default)(configPath)) {
299
- if (dependency.file === configPath) {
300
- continue;
301
- }
302
-
303
- contextConfigDependencies.add(dependency.file);
304
- }
305
- }
306
-
307
- if (isNewContext) {
308
- rebootWatcher(context, configPath, contextConfigDependencies, candidateFiles);
309
- } // Register our temp file as a dependency — we write to this file
310
- // to trigger rebuilds.
311
-
312
-
313
- let touchFile = getTouchFile(context);
314
-
315
- if (touchFile) {
316
- registerDependency({
317
- type: 'dependency',
318
- file: touchFile
319
- });
320
- }
321
-
322
- if (tailwindDirectives.size > 0) {
323
- for (let changedContent of resolvedChangedContent(context, candidateFiles)) {
324
- context.changedContent.push(changedContent);
325
- }
326
- }
327
-
328
- return context;
329
- };
330
- };
331
- }
package/nesting/plugin.js DELETED
@@ -1,41 +0,0 @@
1
- let postcss = require('postcss')
2
- let postcssNested = require('postcss-nested')
3
-
4
- module.exports = function nesting(opts = postcssNested) {
5
- return (root, result) => {
6
- root.walkAtRules('screen', (rule) => {
7
- rule.name = 'media'
8
- rule.params = `screen(${rule.params})`
9
- })
10
-
11
- root.walkAtRules('apply', (rule) => {
12
- rule.before(postcss.decl({ prop: '__apply', value: rule.params, source: rule.source }))
13
- rule.remove()
14
- })
15
-
16
- let plugin = (() => {
17
- if (typeof opts === 'function') {
18
- return opts
19
- }
20
-
21
- if (typeof opts === 'string') {
22
- return require(opts)
23
- }
24
-
25
- if (Object.keys(opts).length <= 0) {
26
- return postcssNested
27
- }
28
-
29
- throw new Error('tailwindcss/nesting should be loaded with a nesting plugin.')
30
- })()
31
-
32
- postcss([plugin]).process(root, result.opts).sync()
33
-
34
- root.walkDecls('__apply', (decl) => {
35
- decl.before(postcss.atRule({ name: 'apply', params: decl.value, source: decl.source }))
36
- decl.remove()
37
- })
38
-
39
- return root
40
- }
41
- }
@@ -1,27 +0,0 @@
1
- let fs = require('fs/promises')
2
- let { spawn } = require('child_process')
3
- let path = require('path')
4
- let root = process.cwd()
5
-
6
- function npmInstall(cwd) {
7
- return new Promise((resolve) => {
8
- let childProcess = spawn('npm', ['install'], { cwd })
9
- childProcess.on('exit', resolve)
10
- })
11
- }
12
-
13
- async function install() {
14
- let base = path.resolve(root, 'integrations')
15
- let ignoreFolders = ['node_modules']
16
- let integrations = (await fs.readdir(base, { withFileTypes: true }))
17
- .filter((integration) => integration.isDirectory())
18
- .filter((integration) => !ignoreFolders.includes(integration.name))
19
- .map((folder) => path.resolve(base, folder.name))
20
- .concat([base])
21
- .map((integration) => npmInstall(integration))
22
-
23
- await Promise.all(integrations)
24
- console.log('Done!')
25
- }
26
-
27
- install()
@@ -1,68 +0,0 @@
1
- import fs from 'fs'
2
- import postcss from 'postcss'
3
- import tailwind from '..'
4
-
5
- function build({ from, to, config }) {
6
- return new Promise((resolve, reject) => {
7
- console.log(`Processing ./${from}...`)
8
-
9
- fs.readFile(`./${from}`, (err, css) => {
10
- if (err) throw err
11
-
12
- return postcss([tailwind(config)])
13
- .process(css, {
14
- from: undefined,
15
- })
16
- .then((result) => {
17
- fs.writeFileSync(`./${to}`, result.css)
18
- return result
19
- })
20
- .then(resolve)
21
- .catch((error) => {
22
- console.log(error)
23
- reject()
24
- })
25
- })
26
- })
27
- }
28
-
29
- console.info('\nRebuilding fixtures...\n')
30
-
31
- Promise.all([
32
- build({
33
- from: 'tests/fixtures/tailwind-input.css',
34
- to: 'tests/fixtures/tailwind-output.css',
35
- config: {},
36
- }),
37
- build({
38
- from: 'tests/fixtures/tailwind-input.css',
39
- to: 'tests/fixtures/tailwind-output-important.css',
40
- config: { important: true },
41
- }),
42
- build({
43
- from: 'tests/fixtures/tailwind-input.css',
44
- to: 'tests/fixtures/tailwind-output-no-color-opacity.css',
45
- config: {
46
- corePlugins: {
47
- textOpacity: false,
48
- backgroundOpacity: false,
49
- borderOpacity: false,
50
- placeholderOpacity: false,
51
- divideOpacity: false,
52
- },
53
- },
54
- }),
55
- build({
56
- from: 'tests/fixtures/tailwind-input.css',
57
- to: 'tests/fixtures/tailwind-output-flagged.css',
58
- config: {
59
- future: 'all',
60
- experimental: 'all',
61
- },
62
- }),
63
- ]).then(() => {
64
- console.log('\nFinished rebuilding fixtures.')
65
- console.log(
66
- '\nPlease triple check that the fixture output matches what you expect before committing this change.'
67
- )
68
- })
package/src/constants.js DELETED
@@ -1,17 +0,0 @@
1
- import path from 'path'
2
-
3
- export const cli = 'tailwind'
4
- export const defaultConfigFile = './tailwind.config.js'
5
- export const defaultPostCssConfigFile = './postcss.config.js'
6
- export const cjsConfigFile = './tailwind.config.cjs'
7
- export const cjsPostCssConfigFile = './postcss.config.cjs'
8
-
9
- export const supportedConfigFiles = [cjsConfigFile, defaultConfigFile]
10
- export const supportedPostCssConfigFile = [cjsPostCssConfigFile, defaultPostCssConfigFile]
11
-
12
- export const defaultConfigStubFile = path.resolve(__dirname, '../stubs/defaultConfig.stub.js')
13
- export const simpleConfigStubFile = path.resolve(__dirname, '../stubs/simpleConfig.stub.js')
14
- export const defaultPostCssConfigStubFile = path.resolve(
15
- __dirname,
16
- '../stubs/defaultPostCssConfig.stub.js'
17
- )