tailwindcss 0.0.0-insiders.ea139f2 → 0.0.0-insiders.ea4e1cd

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 (236) 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 -1
  5. package/defaultConfig.d.ts +3 -0
  6. package/defaultConfig.js +2 -1
  7. package/defaultTheme.d.ts +4 -0
  8. package/defaultTheme.js +2 -1
  9. package/lib/cli/build/deps.js +62 -0
  10. package/lib/cli/build/index.js +54 -0
  11. package/lib/cli/build/plugin.js +378 -0
  12. package/lib/cli/build/utils.js +88 -0
  13. package/lib/cli/build/watching.js +182 -0
  14. package/lib/cli/help/index.js +73 -0
  15. package/lib/cli/index.js +230 -0
  16. package/lib/cli/init/index.js +63 -0
  17. package/lib/cli-peer-dependencies.js +28 -7
  18. package/lib/cli.js +4 -703
  19. package/lib/corePluginList.js +12 -3
  20. package/lib/corePlugins.js +2373 -1863
  21. package/lib/css/preflight.css +10 -8
  22. package/lib/featureFlags.js +49 -26
  23. package/lib/index.js +1 -31
  24. package/lib/lib/cacheInvalidation.js +92 -0
  25. package/lib/lib/collapseAdjacentRules.js +30 -10
  26. package/lib/lib/collapseDuplicateDeclarations.js +60 -4
  27. package/lib/lib/content.js +181 -0
  28. package/lib/lib/defaultExtractor.js +243 -0
  29. package/lib/lib/detectNesting.js +21 -10
  30. package/lib/lib/evaluateTailwindFunctions.js +115 -50
  31. package/lib/lib/expandApplyAtRules.js +467 -161
  32. package/lib/lib/expandTailwindAtRules.js +160 -133
  33. package/lib/lib/findAtConfigPath.js +46 -0
  34. package/lib/lib/generateRules.js +553 -200
  35. package/lib/lib/getModuleDependencies.js +88 -37
  36. package/lib/lib/load-config.js +42 -0
  37. package/lib/lib/normalizeTailwindDirectives.js +46 -33
  38. package/lib/lib/offsets.js +306 -0
  39. package/lib/lib/partitionApplyAtRules.js +58 -0
  40. package/lib/lib/regex.js +74 -0
  41. package/lib/lib/remap-bitfield.js +89 -0
  42. package/lib/lib/resolveDefaultsAtRules.js +98 -58
  43. package/lib/lib/setupContextUtils.js +773 -321
  44. package/lib/lib/setupTrackingContext.js +70 -75
  45. package/lib/lib/sharedState.js +78 -10
  46. package/lib/lib/substituteScreenAtRules.js +14 -10
  47. package/lib/oxide/cli/build/deps.js +89 -0
  48. package/lib/oxide/cli/build/index.js +53 -0
  49. package/lib/oxide/cli/build/plugin.js +375 -0
  50. package/lib/oxide/cli/build/utils.js +87 -0
  51. package/lib/oxide/cli/build/watching.js +179 -0
  52. package/lib/oxide/cli/help/index.js +72 -0
  53. package/lib/oxide/cli/index.js +214 -0
  54. package/lib/oxide/cli/init/index.js +52 -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 +21 -0
  60. package/lib/postcss-plugins/nesting/plugin.js +89 -0
  61. package/lib/processTailwindFeatures.js +39 -26
  62. package/lib/public/colors.js +272 -246
  63. package/lib/public/create-plugin.js +9 -5
  64. package/lib/public/default-config.js +10 -6
  65. package/lib/public/default-theme.js +10 -6
  66. package/lib/public/load-config.js +12 -0
  67. package/lib/public/resolve-config.js +11 -6
  68. package/lib/util/applyImportantSelector.js +36 -0
  69. package/lib/util/bigSign.js +6 -1
  70. package/lib/util/buildMediaQuery.js +13 -6
  71. package/lib/util/cloneDeep.js +9 -6
  72. package/lib/util/cloneNodes.js +23 -3
  73. package/lib/util/color.js +70 -38
  74. package/lib/util/colorNames.js +752 -0
  75. package/lib/util/configurePlugins.js +7 -2
  76. package/lib/util/createPlugin.js +8 -6
  77. package/lib/util/createUtilityPlugin.js +16 -16
  78. package/lib/util/dataTypes.js +173 -108
  79. package/lib/util/defaults.js +14 -3
  80. package/lib/util/escapeClassName.js +13 -8
  81. package/lib/util/escapeCommas.js +7 -2
  82. package/lib/util/flattenColorPalette.js +11 -12
  83. package/lib/util/formatVariantSelector.js +228 -151
  84. package/lib/util/getAllConfigs.js +33 -12
  85. package/lib/util/hashConfig.js +9 -4
  86. package/lib/util/isKeyframeRule.js +7 -2
  87. package/lib/util/isPlainObject.js +7 -2
  88. package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
  89. package/lib/util/log.js +27 -13
  90. package/lib/util/nameClass.js +27 -10
  91. package/lib/util/negateValue.js +25 -8
  92. package/lib/util/normalizeConfig.js +139 -65
  93. package/lib/util/normalizeScreens.js +131 -11
  94. package/lib/util/parseAnimationValue.js +44 -40
  95. package/lib/util/parseBoxShadowValue.js +34 -23
  96. package/lib/util/parseDependency.js +39 -55
  97. package/lib/util/parseGlob.js +36 -0
  98. package/lib/util/parseObjectStyles.js +15 -10
  99. package/lib/util/pluginUtils.js +159 -69
  100. package/lib/util/prefixSelector.js +30 -12
  101. package/lib/util/pseudoElements.js +229 -0
  102. package/lib/util/removeAlphaVariables.js +31 -0
  103. package/lib/util/resolveConfig.js +97 -75
  104. package/lib/util/resolveConfigPath.js +30 -12
  105. package/lib/util/responsive.js +11 -6
  106. package/lib/util/splitAtTopLevelOnly.js +51 -0
  107. package/lib/util/tap.js +6 -1
  108. package/lib/util/toColorValue.js +7 -3
  109. package/lib/util/toPath.js +26 -3
  110. package/lib/util/transformThemeValue.js +40 -30
  111. package/lib/util/validateConfig.js +37 -0
  112. package/lib/util/validateFormalSyntax.js +26 -0
  113. package/lib/util/withAlphaVariable.js +27 -15
  114. package/loadConfig.d.ts +4 -0
  115. package/loadConfig.js +2 -0
  116. package/nesting/index.js +2 -12
  117. package/package.json +66 -57
  118. package/peers/index.js +75964 -55560
  119. package/plugin.d.ts +11 -0
  120. package/plugin.js +2 -1
  121. package/resolveConfig.d.ts +12 -0
  122. package/resolveConfig.js +2 -1
  123. package/scripts/generate-types.js +105 -0
  124. package/scripts/release-channel.js +18 -0
  125. package/scripts/release-notes.js +21 -0
  126. package/scripts/swap-engines.js +40 -0
  127. package/scripts/type-utils.js +27 -0
  128. package/src/cli/build/deps.js +56 -0
  129. package/src/cli/build/index.js +49 -0
  130. package/src/cli/build/plugin.js +444 -0
  131. package/src/cli/build/utils.js +76 -0
  132. package/src/cli/build/watching.js +229 -0
  133. package/src/cli/help/index.js +70 -0
  134. package/src/cli/index.js +216 -0
  135. package/src/cli/init/index.js +79 -0
  136. package/src/cli-peer-dependencies.js +7 -1
  137. package/src/cli.js +4 -765
  138. package/src/corePluginList.js +1 -1
  139. package/src/corePlugins.js +786 -306
  140. package/src/css/preflight.css +10 -8
  141. package/src/featureFlags.js +21 -5
  142. package/src/index.js +1 -34
  143. package/src/lib/cacheInvalidation.js +52 -0
  144. package/src/lib/collapseAdjacentRules.js +21 -2
  145. package/src/lib/collapseDuplicateDeclarations.js +66 -1
  146. package/src/lib/content.js +208 -0
  147. package/src/lib/defaultExtractor.js +217 -0
  148. package/src/lib/detectNesting.js +9 -1
  149. package/src/lib/evaluateTailwindFunctions.js +79 -8
  150. package/src/lib/expandApplyAtRules.js +515 -153
  151. package/src/lib/expandTailwindAtRules.js +115 -86
  152. package/src/lib/findAtConfigPath.js +48 -0
  153. package/src/lib/generateRules.js +545 -147
  154. package/src/lib/getModuleDependencies.js +70 -30
  155. package/src/lib/load-config.ts +31 -0
  156. package/src/lib/normalizeTailwindDirectives.js +7 -1
  157. package/src/lib/offsets.js +373 -0
  158. package/src/lib/partitionApplyAtRules.js +52 -0
  159. package/src/lib/regex.js +74 -0
  160. package/src/lib/remap-bitfield.js +82 -0
  161. package/src/lib/resolveDefaultsAtRules.js +59 -17
  162. package/src/lib/setupContextUtils.js +701 -175
  163. package/src/lib/setupTrackingContext.js +51 -62
  164. package/src/lib/sharedState.js +58 -7
  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 +12 -2
  180. package/src/public/colors.js +22 -0
  181. package/src/public/default-config.js +1 -1
  182. package/src/public/default-theme.js +2 -2
  183. package/src/public/load-config.js +2 -0
  184. package/src/util/applyImportantSelector.js +27 -0
  185. package/src/util/buildMediaQuery.js +5 -3
  186. package/src/util/cloneNodes.js +19 -2
  187. package/src/util/color.js +44 -12
  188. package/src/util/colorNames.js +150 -0
  189. package/src/util/dataTypes.js +51 -16
  190. package/src/util/defaults.js +6 -0
  191. package/src/util/formatVariantSelector.js +264 -144
  192. package/src/util/getAllConfigs.js +21 -2
  193. package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
  194. package/src/util/log.js +11 -7
  195. package/src/util/nameClass.js +4 -0
  196. package/src/util/negateValue.js +11 -3
  197. package/src/util/normalizeConfig.js +57 -5
  198. package/src/util/normalizeScreens.js +105 -7
  199. package/src/util/parseBoxShadowValue.js +4 -3
  200. package/src/util/parseDependency.js +37 -42
  201. package/src/util/parseGlob.js +24 -0
  202. package/src/util/pluginUtils.js +123 -24
  203. package/src/util/prefixSelector.js +30 -10
  204. package/src/util/pseudoElements.js +170 -0
  205. package/src/util/removeAlphaVariables.js +24 -0
  206. package/src/util/resolveConfig.js +74 -26
  207. package/src/util/resolveConfigPath.js +12 -1
  208. package/src/util/splitAtTopLevelOnly.js +52 -0
  209. package/src/util/toPath.js +23 -1
  210. package/src/util/transformThemeValue.js +13 -3
  211. package/src/util/validateConfig.js +26 -0
  212. package/src/util/validateFormalSyntax.js +34 -0
  213. package/src/util/withAlphaVariable.js +1 -1
  214. package/stubs/.gitignore +1 -0
  215. package/stubs/.prettierrc.json +6 -0
  216. package/stubs/{defaultConfig.stub.js → config.full.js} +206 -166
  217. package/stubs/postcss.config.js +6 -0
  218. package/stubs/tailwind.config.cjs +2 -0
  219. package/stubs/tailwind.config.js +2 -0
  220. package/stubs/tailwind.config.ts +3 -0
  221. package/types/config.d.ts +368 -0
  222. package/types/generated/.gitkeep +0 -0
  223. package/types/generated/colors.d.ts +298 -0
  224. package/types/generated/corePluginList.d.ts +1 -0
  225. package/types/generated/default-theme.d.ts +371 -0
  226. package/types/index.d.ts +7 -0
  227. package/CHANGELOG.md +0 -1843
  228. package/lib/constants.js +0 -37
  229. package/lib/lib/setupWatchingContext.js +0 -288
  230. package/nesting/plugin.js +0 -41
  231. package/scripts/install-integrations.js +0 -27
  232. package/scripts/rebuildFixtures.js +0 -68
  233. package/src/constants.js +0 -17
  234. package/src/lib/setupWatchingContext.js +0 -311
  235. /package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -0
  236. /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
@@ -1,26 +1,35 @@
1
+ // @ts-check
1
2
  "use strict";
2
3
  Object.defineProperty(exports, "__esModule", {
3
4
  value: true
4
5
  });
5
- exports.default = setupTrackingContext;
6
- var _fs = _interopRequireDefault(require("fs"));
7
- var _path = _interopRequireDefault(require("path"));
8
- var _fastGlob = _interopRequireDefault(require("fast-glob"));
9
- var _quickLru = _interopRequireDefault(require("quick-lru"));
10
- var _normalizePath = _interopRequireDefault(require("normalize-path"));
11
- var _hashConfig = _interopRequireDefault(require("../util/hashConfig"));
12
- var _getModuleDependencies = _interopRequireDefault(require("../lib/getModuleDependencies"));
13
- var _resolveConfig = _interopRequireDefault(require("../public/resolve-config"));
14
- var _resolveConfigPath = _interopRequireDefault(require("../util/resolveConfigPath"));
15
- var _sharedState = require("./sharedState");
16
- var _setupContextUtils = require("./setupContextUtils");
17
- var _parseDependency = _interopRequireDefault(require("../util/parseDependency"));
18
- function _interopRequireDefault(obj) {
6
+ Object.defineProperty(exports, // DISABLE_TOUCH = TRUE
7
+ // Retrieve an existing context from cache if possible (since contexts are unique per
8
+ // source path), or set up a new one (including setting up watchers and registering
9
+ // plugins) then return it
10
+ "default", {
11
+ enumerable: true,
12
+ get: function() {
13
+ return setupTrackingContext;
14
+ }
15
+ });
16
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
17
+ const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
18
+ const _hashConfig = /*#__PURE__*/ _interop_require_default(require("../util/hashConfig"));
19
+ const _resolveconfig = /*#__PURE__*/ _interop_require_default(require("../public/resolve-config"));
20
+ const _resolveConfigPath = /*#__PURE__*/ _interop_require_default(require("../util/resolveConfigPath"));
21
+ const _setupContextUtils = require("./setupContextUtils");
22
+ const _parseDependency = /*#__PURE__*/ _interop_require_default(require("../util/parseDependency"));
23
+ const _validateConfig = require("../util/validateConfig.js");
24
+ const _content = require("./content.js");
25
+ const _loadconfig = require("../lib/load-config");
26
+ const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("./getModuleDependencies"));
27
+ function _interop_require_default(obj) {
19
28
  return obj && obj.__esModule ? obj : {
20
29
  default: obj
21
30
  };
22
31
  }
23
- let configPathCache = new _quickLru.default({
32
+ let configPathCache = new _quicklru.default({
24
33
  maxSize: 100
25
34
  });
26
35
  let candidateFilesCache = new WeakMap();
@@ -28,18 +37,15 @@ function getCandidateFiles(context, tailwindConfig) {
28
37
  if (candidateFilesCache.has(context)) {
29
38
  return candidateFilesCache.get(context);
30
39
  }
31
- let candidateFiles = tailwindConfig.content.files.filter((item)=>typeof item === 'string'
32
- ).map((contentPath)=>(0, _normalizePath).default(contentPath)
33
- );
40
+ let candidateFiles = (0, _content.parseCandidateFiles)(context, tailwindConfig);
34
41
  return candidateFilesCache.set(context, candidateFiles).get(context);
35
42
  }
36
43
  // Get the config object based on a path
37
44
  function getTailwindConfig(configOrPath) {
38
- let userConfigPath = (0, _resolveConfigPath).default(configOrPath);
45
+ let userConfigPath = (0, _resolveConfigPath.default)(configOrPath);
39
46
  if (userConfigPath !== null) {
40
47
  let [prevConfig, prevConfigHash, prevDeps, prevModified] = configPathCache.get(userConfigPath) || [];
41
- let newDeps = (0, _getModuleDependencies).default(userConfigPath).map((dep)=>dep.file
42
- );
48
+ let newDeps = (0, _getModuleDependencies.default)(userConfigPath);
43
49
  let modified = false;
44
50
  let newModified = new Map();
45
51
  for (let file of newDeps){
@@ -59,11 +65,11 @@ function getTailwindConfig(configOrPath) {
59
65
  ];
60
66
  }
61
67
  // It has changed (based on timestamps), or first run
62
- for (let file1 of newDeps){
63
- delete require.cache[file1];
68
+ for (let file of newDeps){
69
+ delete require.cache[file];
64
70
  }
65
- let newConfig = (0, _resolveConfig).default(require(userConfigPath));
66
- let newHash = (0, _hashConfig).default(newConfig);
71
+ let newConfig = (0, _validateConfig.validateConfig)((0, _resolveconfig.default)((0, _loadconfig.loadConfig)(userConfigPath)));
72
+ let newHash = (0, _hashConfig.default)(newConfig);
67
73
  configPathCache.set(userConfigPath, [
68
74
  newConfig,
69
75
  newHash,
@@ -78,92 +84,81 @@ function getTailwindConfig(configOrPath) {
78
84
  ];
79
85
  }
80
86
  // It's a plain object, not a path
81
- let newConfig = (0, _resolveConfig).default(configOrPath.config === undefined ? configOrPath : configOrPath.config);
87
+ let newConfig = (0, _resolveconfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
88
+ newConfig = (0, _validateConfig.validateConfig)(newConfig);
82
89
  return [
83
90
  newConfig,
84
91
  null,
85
- (0, _hashConfig).default(newConfig),
92
+ (0, _hashConfig.default)(newConfig),
86
93
  []
87
94
  ];
88
95
  }
89
- function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
90
- let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string'
91
- ).map(({ raw , extension ='html' })=>({
92
- content: raw,
93
- extension
94
- })
95
- );
96
- for (let changedFile of resolveChangedFiles(candidateFiles, fileModifiedMap)){
97
- let content = _fs.default.readFileSync(changedFile, 'utf8');
98
- let extension = _path.default.extname(changedFile).slice(1);
99
- changedContent.push({
100
- content,
101
- extension
102
- });
103
- }
104
- return changedContent;
105
- }
106
- function resolveChangedFiles(candidateFiles, fileModifiedMap) {
107
- let changedFiles = new Set();
108
- _sharedState.env.DEBUG && console.time('Finding changed files');
109
- let files = _fastGlob.default.sync(candidateFiles);
110
- for (let file of files){
111
- let prevModified = fileModifiedMap.has(file) ? fileModifiedMap.get(file) : -Infinity;
112
- let modified = _fs.default.statSync(file).mtimeMs;
113
- if (modified > prevModified) {
114
- changedFiles.add(file);
115
- fileModifiedMap.set(file, modified);
116
- }
117
- }
118
- _sharedState.env.DEBUG && console.timeEnd('Finding changed files');
119
- return changedFiles;
120
- }
121
96
  function setupTrackingContext(configOrPath) {
122
97
  return ({ tailwindDirectives , registerDependency })=>{
123
98
  return (root, result)=>{
124
99
  let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
125
100
  let contextDependencies = new Set(configDependencies);
126
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
127
- // to be dependencies of the context. Can reuse the context even if they change.
128
- // We may want to think about `@layer` being part of this trigger too, but it's tough
129
- // because it's impossible for a layer in one file to end up in the actual @tailwind rule
130
- // in another file since independent sources are effectively isolated.
101
+ // If there are no @tailwind or @apply rules, we don't consider this CSS
102
+ // file or its dependencies to be dependencies of the context. Can reuse
103
+ // the context even if they change. We may want to think about `@layer`
104
+ // being part of this trigger too, but it's tough because it's impossible
105
+ // for a layer in one file to end up in the actual @tailwind rule in
106
+ // another file since independent sources are effectively isolated.
131
107
  if (tailwindDirectives.size > 0) {
132
108
  // Add current css file as a context dependencies.
133
109
  contextDependencies.add(result.opts.from);
134
110
  // Add all css @import dependencies as context dependencies.
135
111
  for (let message of result.messages){
136
- if (message.type === 'dependency') {
112
+ if (message.type === "dependency") {
137
113
  contextDependencies.add(message.file);
138
114
  }
139
115
  }
140
116
  }
141
- let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
117
+ let [context, , mTimesToCommit] = (0, _setupContextUtils.getContext)(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
118
+ let fileModifiedMap = (0, _setupContextUtils.getFileModifiedMap)(context);
142
119
  let candidateFiles = getCandidateFiles(context, tailwindConfig);
143
- // If there are no @tailwind rules, we don't consider this CSS file or it's dependencies
144
- // to be dependencies of the context. Can reuse the context even if they change.
120
+ // If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
121
+ // dependencies to be dependencies of the context. Can reuse the context even if they change.
145
122
  // We may want to think about `@layer` being part of this trigger too, but it's tough
146
123
  // because it's impossible for a layer in one file to end up in the actual @tailwind rule
147
124
  // in another file since independent sources are effectively isolated.
148
125
  if (tailwindDirectives.size > 0) {
149
- let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
150
126
  // Add template paths as postcss dependencies.
151
- for (let fileOrGlob of candidateFiles){
152
- let dependency = (0, _parseDependency).default(fileOrGlob);
153
- if (dependency) {
127
+ for (let contentPath of candidateFiles){
128
+ for (let dependency of (0, _parseDependency.default)(contentPath)){
154
129
  registerDependency(dependency);
155
130
  }
156
131
  }
157
- for (let changedContent of resolvedChangedContent(context, candidateFiles, fileModifiedMap)){
158
- context.changedContent.push(changedContent);
132
+ let [changedContent, contentMTimesToCommit] = (0, _content.resolvedChangedContent)(context, candidateFiles, fileModifiedMap);
133
+ for (let content of changedContent){
134
+ context.changedContent.push(content);
135
+ }
136
+ // Add the mtimes of the content files to the commit list
137
+ // We can overwrite the existing values because unconditionally
138
+ // This is because:
139
+ // 1. Most of the files here won't be in the map yet
140
+ // 2. If they are that means it's a context dependency
141
+ // and we're reading this after the context. This means
142
+ // that the mtime we just read is strictly >= the context
143
+ // mtime. Unless the user / os is doing something weird
144
+ // in which the mtime would be going backwards. If that
145
+ // happens there's already going to be problems.
146
+ for (let [path, mtime] of contentMTimesToCommit.entries()){
147
+ mTimesToCommit.set(path, mtime);
159
148
  }
160
149
  }
161
150
  for (let file of configDependencies){
162
151
  registerDependency({
163
- type: 'dependency',
152
+ type: "dependency",
164
153
  file
165
154
  });
166
155
  }
156
+ // "commit" the new modified time for all context deps
157
+ // We do this here because we want content tracking to
158
+ // read the "old" mtime even when it's a context dependency.
159
+ for (let [path, mtime] of mTimesToCommit.entries()){
160
+ fileModifiedMap.set(path, mtime);
161
+ }
167
162
  return context;
168
163
  };
169
164
  };
@@ -2,18 +2,86 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
6
- const env = {
7
- TAILWIND_MODE: process.env.TAILWIND_MODE,
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: function() {
13
+ return env;
14
+ },
15
+ contextMap: function() {
16
+ return contextMap;
17
+ },
18
+ configContextMap: function() {
19
+ return configContextMap;
20
+ },
21
+ contextSourcesMap: function() {
22
+ return contextSourcesMap;
23
+ },
24
+ sourceHashMap: function() {
25
+ return sourceHashMap;
26
+ },
27
+ NOT_ON_DEMAND: function() {
28
+ return NOT_ON_DEMAND;
29
+ },
30
+ NONE: function() {
31
+ return NONE;
32
+ },
33
+ resolveDebug: function() {
34
+ return resolveDebug;
35
+ }
36
+ });
37
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../package.json"));
38
+ function _interop_require_default(obj) {
39
+ return obj && obj.__esModule ? obj : {
40
+ default: obj
41
+ };
42
+ }
43
+ const env = typeof process !== "undefined" ? {
8
44
  NODE_ENV: process.env.NODE_ENV,
9
- DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
10
- TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
11
- TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
45
+ DEBUG: resolveDebug(process.env.DEBUG),
46
+ ENGINE: _packagejson.default.tailwindcss.engine
47
+ } : {
48
+ NODE_ENV: "production",
49
+ DEBUG: false,
50
+ ENGINE: _packagejson.default.tailwindcss.engine
12
51
  };
13
- exports.env = env;
14
52
  const contextMap = new Map();
15
- exports.contextMap = contextMap;
16
53
  const configContextMap = new Map();
17
- exports.configContextMap = configContextMap;
18
54
  const contextSourcesMap = new Map();
19
- exports.contextSourcesMap = contextSourcesMap;
55
+ const sourceHashMap = new Map();
56
+ const NOT_ON_DEMAND = new String("*");
57
+ const NONE = Symbol("__NONE__");
58
+ function resolveDebug(debug) {
59
+ if (debug === undefined) {
60
+ return false;
61
+ }
62
+ // Environment variables are strings, so convert to boolean
63
+ if (debug === "true" || debug === "1") {
64
+ return true;
65
+ }
66
+ if (debug === "false" || debug === "0") {
67
+ return false;
68
+ }
69
+ // Keep the debug convention into account:
70
+ // DEBUG=* -> This enables all debug modes
71
+ // DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
72
+ // DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
73
+ // DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
74
+ if (debug === "*") {
75
+ return true;
76
+ }
77
+ let debuggers = debug.split(",").map((d)=>d.split(":")[0]);
78
+ // Ignoring tailwindcss
79
+ if (debuggers.includes("-tailwindcss")) {
80
+ return false;
81
+ }
82
+ // Including tailwindcss
83
+ if (debuggers.includes("tailwindcss")) {
84
+ return true;
85
+ }
86
+ return false;
87
+ }
@@ -2,26 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- exports.default = _default;
6
- var _normalizeScreens = require("../util/normalizeScreens");
7
- var _buildMediaQuery = _interopRequireDefault(require("../util/buildMediaQuery"));
8
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return _default;
9
+ }
10
+ });
11
+ const _normalizeScreens = require("../util/normalizeScreens");
12
+ const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
13
+ function _interop_require_default(obj) {
9
14
  return obj && obj.__esModule ? obj : {
10
15
  default: obj
11
16
  };
12
17
  }
13
18
  function _default({ tailwindConfig: { theme } }) {
14
19
  return function(css) {
15
- css.walkAtRules('screen', (atRule)=>{
20
+ css.walkAtRules("screen", (atRule)=>{
16
21
  let screen = atRule.params;
17
- let screens = (0, _normalizeScreens).normalizeScreens(theme.screens);
18
- let screenDefinition = screens.find(({ name })=>name === screen
19
- );
22
+ let screens = (0, _normalizeScreens.normalizeScreens)(theme.screens);
23
+ let screenDefinition = screens.find(({ name })=>name === screen);
20
24
  if (!screenDefinition) {
21
25
  throw atRule.error(`No \`${screen}\` screen found.`);
22
26
  }
23
- atRule.name = 'media';
24
- atRule.params = (0, _buildMediaQuery).default(screenDefinition);
27
+ atRule.name = "media";
28
+ atRule.params = (0, _buildMediaQuery.default)(screenDefinition);
25
29
  });
26
30
  };
27
31
  }
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
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
+ lazyLightningCss: function() {
13
+ return lazyLightningCss;
14
+ },
15
+ lightningcss: function() {
16
+ return lightningcss;
17
+ },
18
+ loadPostcss: function() {
19
+ return loadPostcss;
20
+ },
21
+ loadPostcssImport: function() {
22
+ return loadPostcssImport;
23
+ }
24
+ });
25
+ const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../../package.json"));
26
+ const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
27
+ const _index = require("../../../../peers/index");
28
+ function _interop_require_default(obj) {
29
+ return obj && obj.__esModule ? obj : {
30
+ default: obj
31
+ };
32
+ }
33
+ function lazyLightningCss() {
34
+ // TODO: Make this lazy/bundled
35
+ return require("lightningcss");
36
+ }
37
+ let lightningCss;
38
+ function loadLightningCss() {
39
+ if (lightningCss) {
40
+ return lightningCss;
41
+ }
42
+ // Try to load a local version first
43
+ try {
44
+ return lightningCss = require("lightningcss");
45
+ } catch {}
46
+ return lightningCss = lazyLightningCss();
47
+ }
48
+ async function lightningcss(shouldMinify, result) {
49
+ let css = loadLightningCss();
50
+ try {
51
+ let transformed = css.transform({
52
+ filename: result.opts.from || "input.css",
53
+ code: Buffer.from(result.css, "utf-8"),
54
+ minify: shouldMinify,
55
+ sourceMap: !!result.map,
56
+ inputSourceMap: result.map ? result.map.toString() : undefined,
57
+ targets: css.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
58
+ drafts: {
59
+ nesting: true
60
+ }
61
+ });
62
+ return Object.assign(result, {
63
+ css: transformed.code.toString("utf8"),
64
+ map: result.map ? Object.assign(result.map, {
65
+ toString () {
66
+ return transformed.map.toString();
67
+ }
68
+ }) : result.map
69
+ });
70
+ } catch (err) {
71
+ console.error("Unable to use Lightning CSS. Using raw version instead.");
72
+ console.error(err);
73
+ return result;
74
+ }
75
+ }
76
+ function loadPostcss() {
77
+ // Try to load a local `postcss` version first
78
+ try {
79
+ return require("postcss");
80
+ } catch {}
81
+ return (0, _index.lazyPostcss)();
82
+ }
83
+ function loadPostcssImport() {
84
+ // Try to load a local `postcss-import` version first
85
+ try {
86
+ return require("postcss-import");
87
+ } catch {}
88
+ return (0, _index.lazyPostcssImport)();
89
+ }
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "build", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return build;
9
+ }
10
+ });
11
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
12
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
13
+ const _resolveConfigPath = require("../../../util/resolveConfigPath");
14
+ const _plugin = require("./plugin");
15
+ function _interop_require_default(obj) {
16
+ return obj && obj.__esModule ? obj : {
17
+ default: obj
18
+ };
19
+ }
20
+ async function build(args) {
21
+ let input = args["--input"];
22
+ let shouldWatch = args["--watch"];
23
+ // TODO: Deprecate this in future versions
24
+ if (!input && args["_"][1]) {
25
+ console.error("[deprecation] Running tailwindcss without -i, please provide an input file.");
26
+ input = args["--input"] = args["_"][1];
27
+ }
28
+ if (input && input !== "-" && !_fs.default.existsSync(input = _path.default.resolve(input))) {
29
+ console.error(`Specified input file ${args["--input"]} does not exist.`);
30
+ process.exit(9);
31
+ }
32
+ if (args["--config"] && !_fs.default.existsSync(args["--config"] = _path.default.resolve(args["--config"]))) {
33
+ console.error(`Specified config file ${args["--config"]} does not exist.`);
34
+ process.exit(9);
35
+ }
36
+ // TODO: Reference the @config path here if exists
37
+ let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
38
+ let processor = await (0, _plugin.createProcessor)(args, configPath);
39
+ if (shouldWatch) {
40
+ // Abort the watcher if stdin is closed to avoid zombie processes
41
+ // You can disable this behavior with --watch=always
42
+ if (args["--watch"] !== "always") {
43
+ process.stdin.on("end", ()=>process.exit(0));
44
+ }
45
+ process.stdin.resume();
46
+ await processor.watch();
47
+ } else {
48
+ await processor.build().catch((e)=>{
49
+ console.error(e);
50
+ process.exit(1);
51
+ });
52
+ }
53
+ }