tailwindcss 0.0.0-insiders.df011dc → 0.0.0-insiders.e2d5f21

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 (120) hide show
  1. package/CHANGELOG.md +106 -1
  2. package/README.md +1 -1
  3. package/colors.js +1 -304
  4. package/defaultConfig.js +1 -4
  5. package/defaultTheme.js +1 -4
  6. package/lib/cli-peer-dependencies.js +4 -9
  7. package/lib/cli.js +646 -705
  8. package/lib/constants.js +15 -15
  9. package/lib/corePluginList.js +174 -4
  10. package/lib/corePlugins.js +3637 -2934
  11. package/lib/css/preflight.css +14 -1
  12. package/lib/featureFlags.js +44 -44
  13. package/lib/index.js +25 -24
  14. package/lib/lib/collapseAdjacentRules.js +33 -35
  15. package/lib/lib/collapseDuplicateDeclarations.js +29 -0
  16. package/lib/lib/detectNesting.js +34 -0
  17. package/lib/lib/evaluateTailwindFunctions.js +134 -155
  18. package/lib/lib/expandApplyAtRules.js +183 -200
  19. package/lib/lib/expandTailwindAtRules.js +219 -232
  20. package/lib/lib/generateRules.js +478 -311
  21. package/lib/lib/getModuleDependencies.js +36 -41
  22. package/lib/lib/normalizeTailwindDirectives.js +66 -58
  23. package/lib/lib/resolveDefaultsAtRules.js +110 -90
  24. package/lib/lib/setupContextUtils.js +740 -580
  25. package/lib/lib/setupTrackingContext.js +142 -162
  26. package/lib/lib/setupWatchingContext.js +235 -278
  27. package/lib/lib/sharedState.js +7 -17
  28. package/lib/lib/substituteScreenAtRules.js +22 -26
  29. package/lib/processTailwindFeatures.js +38 -44
  30. package/lib/public/colors.js +329 -0
  31. package/lib/public/create-plugin.js +13 -0
  32. package/lib/public/default-config.js +14 -0
  33. package/lib/public/default-theme.js +14 -0
  34. package/lib/public/resolve-config.js +19 -0
  35. package/lib/util/bigSign.js +3 -5
  36. package/lib/util/buildMediaQuery.js +15 -31
  37. package/lib/util/cloneDeep.js +14 -13
  38. package/lib/util/cloneNodes.js +9 -13
  39. package/lib/util/color.js +69 -59
  40. package/lib/util/configurePlugins.js +13 -14
  41. package/lib/util/createPlugin.js +21 -24
  42. package/lib/util/createUtilityPlugin.js +47 -45
  43. package/lib/util/dataTypes.js +231 -0
  44. package/lib/util/defaults.js +10 -14
  45. package/lib/util/escapeClassName.js +12 -14
  46. package/lib/util/escapeCommas.js +3 -5
  47. package/lib/util/flattenColorPalette.js +14 -10
  48. package/lib/util/formatVariantSelector.js +186 -0
  49. package/lib/util/getAllConfigs.js +23 -16
  50. package/lib/util/hashConfig.js +10 -10
  51. package/lib/util/isKeyframeRule.js +3 -5
  52. package/lib/util/isPlainObject.js +7 -10
  53. package/lib/util/isValidArbitraryValue.js +64 -0
  54. package/lib/util/log.js +39 -30
  55. package/lib/util/nameClass.js +23 -23
  56. package/lib/util/negateValue.js +14 -15
  57. package/lib/util/normalizeConfig.js +208 -0
  58. package/lib/util/normalizeScreens.js +58 -0
  59. package/lib/util/parseAnimationValue.js +82 -53
  60. package/lib/util/parseBoxShadowValue.js +77 -0
  61. package/lib/util/parseDependency.js +49 -60
  62. package/lib/util/parseObjectStyles.js +23 -20
  63. package/lib/util/pluginUtils.js +153 -285
  64. package/lib/util/prefixSelector.js +14 -16
  65. package/lib/util/resolveConfig.js +194 -249
  66. package/lib/util/resolveConfigPath.js +38 -45
  67. package/lib/util/responsive.js +12 -11
  68. package/lib/util/tap.js +4 -6
  69. package/lib/util/toColorValue.js +4 -5
  70. package/lib/util/toPath.js +4 -6
  71. package/lib/util/transformThemeValue.js +57 -26
  72. package/lib/util/withAlphaVariable.js +56 -54
  73. package/package.json +27 -37
  74. package/peers/index.js +73099 -84294
  75. package/plugin.js +1 -3
  76. package/resolveConfig.js +1 -7
  77. package/scripts/create-plugin-list.js +2 -2
  78. package/src/cli.js +27 -18
  79. package/src/corePluginList.js +1 -1
  80. package/src/corePlugins.js +2124 -1968
  81. package/src/css/preflight.css +14 -1
  82. package/src/featureFlags.js +12 -6
  83. package/src/lib/collapseDuplicateDeclarations.js +28 -0
  84. package/src/lib/detectNesting.js +39 -0
  85. package/src/lib/evaluateTailwindFunctions.js +5 -2
  86. package/src/lib/expandTailwindAtRules.js +24 -32
  87. package/src/lib/generateRules.js +230 -20
  88. package/src/lib/normalizeTailwindDirectives.js +3 -2
  89. package/src/lib/resolveDefaultsAtRules.js +46 -30
  90. package/src/lib/setupContextUtils.js +275 -113
  91. package/src/lib/setupTrackingContext.js +9 -8
  92. package/src/lib/setupWatchingContext.js +12 -7
  93. package/src/lib/sharedState.js +1 -4
  94. package/src/lib/substituteScreenAtRules.js +6 -3
  95. package/src/processTailwindFeatures.js +8 -1
  96. package/src/public/colors.js +300 -0
  97. package/src/public/create-plugin.js +2 -0
  98. package/src/public/default-config.js +4 -0
  99. package/src/public/default-theme.js +4 -0
  100. package/src/public/resolve-config.js +7 -0
  101. package/src/util/buildMediaQuery.js +14 -18
  102. package/src/util/createUtilityPlugin.js +2 -11
  103. package/src/util/dataTypes.js +246 -0
  104. package/src/util/formatVariantSelector.js +196 -0
  105. package/src/util/isValidArbitraryValue.js +61 -0
  106. package/src/util/log.js +18 -21
  107. package/src/util/nameClass.js +10 -6
  108. package/src/util/negateValue.js +4 -2
  109. package/src/util/normalizeConfig.js +249 -0
  110. package/src/util/normalizeScreens.js +42 -0
  111. package/src/util/parseAnimationValue.js +7 -1
  112. package/src/util/parseBoxShadowValue.js +71 -0
  113. package/src/util/parseDependency.js +4 -0
  114. package/src/util/pluginUtils.js +101 -204
  115. package/src/util/prefixSelector.js +1 -4
  116. package/src/util/resolveConfig.js +12 -65
  117. package/src/util/transformThemeValue.js +22 -7
  118. package/src/util/withAlphaVariable.js +13 -8
  119. package/stubs/defaultConfig.stub.js +163 -97
  120. package/stubs/simpleConfig.stub.js +0 -1
@@ -1,289 +1,234 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = resolveConfig;
7
-
8
6
  var _negateValue = _interopRequireDefault(require("./negateValue"));
9
-
10
7
  var _corePluginList = _interopRequireDefault(require("../corePluginList"));
11
-
12
8
  var _configurePlugins = _interopRequireDefault(require("./configurePlugins"));
13
-
14
- var _defaultConfig = _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
15
-
16
- var _colors = _interopRequireDefault(require("../../colors"));
17
-
18
- var _log = _interopRequireDefault(require("./log"));
19
-
9
+ var _defaultConfigStub = _interopRequireDefault(require("../../stubs/defaultConfig.stub"));
10
+ var _colors = _interopRequireDefault(require("../public/colors"));
20
11
  var _defaults = require("./defaults");
21
-
22
12
  var _toPath = require("./toPath");
23
-
24
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
-
13
+ var _normalizeConfig = require("./normalizeConfig");
14
+ function _interopRequireDefault(obj) {
15
+ return obj && obj.__esModule ? obj : {
16
+ default: obj
17
+ };
18
+ }
26
19
  function isFunction(input) {
27
- return typeof input === 'function';
20
+ return typeof input === 'function';
28
21
  }
29
-
30
22
  function isObject(input) {
31
- return typeof input === 'object' && input !== null;
23
+ return typeof input === 'object' && input !== null;
32
24
  }
33
-
34
25
  function mergeWith(target, ...sources) {
35
- let customizer = sources.pop();
36
-
37
- for (let source of sources) {
38
- for (let k in source) {
39
- let merged = customizer(target[k], source[k]);
40
-
41
- if (merged === undefined) {
42
- if (isObject(target[k]) && isObject(source[k])) {
43
- target[k] = mergeWith(target[k], source[k], customizer);
44
- } else {
45
- target[k] = source[k];
26
+ let customizer = sources.pop();
27
+ for (let source of sources){
28
+ for(let k in source){
29
+ let merged = customizer(target[k], source[k]);
30
+ if (merged === undefined) {
31
+ if (isObject(target[k]) && isObject(source[k])) {
32
+ target[k] = mergeWith(target[k], source[k], customizer);
33
+ } else {
34
+ target[k] = source[k];
35
+ }
36
+ } else {
37
+ target[k] = merged;
38
+ }
46
39
  }
47
- } else {
48
- target[k] = merged;
49
- }
50
40
  }
51
- }
52
-
53
- return target;
41
+ return target;
54
42
  }
55
-
56
43
  const configUtils = {
57
- colors: _colors.default,
58
-
59
- negative(scale) {
60
- return Object.keys(scale).filter(key => scale[key] !== '0').reduce((negativeScale, key) => ({ ...negativeScale,
61
- [`-${key}`]: (0, _negateValue.default)(scale[key])
62
- }), {});
63
- },
64
-
65
- breakpoints(screens) {
66
- return Object.keys(screens).filter(key => typeof screens[key] === 'string').reduce((breakpoints, key) => ({ ...breakpoints,
67
- [`screen-${key}`]: screens[key]
68
- }), {});
69
- }
70
-
44
+ colors: _colors.default,
45
+ negative (scale) {
46
+ // TODO: Log that this function isn't really needed anymore?
47
+ return Object.keys(scale).filter((key)=>scale[key] !== '0'
48
+ ).reduce((negativeScale, key)=>{
49
+ let negativeValue = (0, _negateValue).default(scale[key]);
50
+ if (negativeValue !== undefined) {
51
+ negativeScale[`-${key}`] = negativeValue;
52
+ }
53
+ return negativeScale;
54
+ }, {
55
+ });
56
+ },
57
+ breakpoints (screens) {
58
+ return Object.keys(screens).filter((key)=>typeof screens[key] === 'string'
59
+ ).reduce((breakpoints, key)=>({
60
+ ...breakpoints,
61
+ [`screen-${key}`]: screens[key]
62
+ })
63
+ , {
64
+ });
65
+ }
71
66
  };
72
-
73
- function value(valueToResolve, ...args) {
74
- return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
67
+ function value1(valueToResolve, ...args) {
68
+ return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
75
69
  }
76
-
77
70
  function collectExtends(items) {
78
- return items.reduce((merged, {
79
- extend
80
- }) => {
81
- return mergeWith(merged, extend, (mergedValue, extendValue) => {
82
- if (mergedValue === undefined) {
83
- return [extendValue];
84
- }
85
-
86
- if (Array.isArray(mergedValue)) {
87
- return [extendValue, ...mergedValue];
88
- }
89
-
90
- return [extendValue, mergedValue];
71
+ return items.reduce((merged, { extend })=>{
72
+ return mergeWith(merged, extend, (mergedValue, extendValue)=>{
73
+ if (mergedValue === undefined) {
74
+ return [
75
+ extendValue
76
+ ];
77
+ }
78
+ if (Array.isArray(mergedValue)) {
79
+ return [
80
+ extendValue,
81
+ ...mergedValue
82
+ ];
83
+ }
84
+ return [
85
+ extendValue,
86
+ mergedValue
87
+ ];
88
+ });
89
+ }, {
91
90
  });
92
- }, {});
93
91
  }
94
-
95
92
  function mergeThemes(themes) {
96
- return { ...themes.reduce((merged, theme) => (0, _defaults.defaults)(merged, theme), {}),
97
- // In order to resolve n config objects, we combine all of their `extend` properties
98
- // into arrays instead of objects so they aren't overridden.
99
- extend: collectExtends(themes)
100
- };
93
+ return {
94
+ ...themes.reduce((merged, theme)=>(0, _defaults).defaults(merged, theme)
95
+ , {
96
+ }),
97
+ // In order to resolve n config objects, we combine all of their `extend` properties
98
+ // into arrays instead of objects so they aren't overridden.
99
+ extend: collectExtends(themes)
100
+ };
101
101
  }
102
-
103
102
  function mergeExtensionCustomizer(merged, value) {
104
- // When we have an array of objects, we do want to merge it
105
- if (Array.isArray(merged) && isObject(merged[0])) {
106
- return merged.concat(value);
107
- } // When the incoming value is an array, and the existing config is an object, prepend the existing object
108
-
109
-
110
- if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
111
- return [merged, ...value];
112
- } // Override arrays (for example for font-families, box-shadows, ...)
113
-
114
-
115
- if (Array.isArray(value)) {
116
- return value;
117
- } // Execute default behaviour
118
-
119
-
120
- return undefined;
121
- }
122
-
123
- function mergeExtensions({
124
- extend,
125
- ...theme
126
- }) {
127
- return mergeWith(theme, extend, (themeValue, extensions) => {
128
- // The `extend` property is an array, so we need to check if it contains any functions
129
- if (!isFunction(themeValue) && !extensions.some(isFunction)) {
130
- return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
103
+ // When we have an array of objects, we do want to merge it
104
+ if (Array.isArray(merged) && isObject(merged[0])) {
105
+ return merged.concat(value);
131
106
  }
132
-
133
- return (resolveThemePath, utils) => mergeWith({}, ...[themeValue, ...extensions].map(e => value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
134
- });
107
+ // When the incoming value is an array, and the existing config is an object, prepend the existing object
108
+ if (Array.isArray(value) && isObject(value[0]) && isObject(merged)) {
109
+ return [
110
+ merged,
111
+ ...value
112
+ ];
113
+ }
114
+ // Override arrays (for example for font-families, box-shadows, ...)
115
+ if (Array.isArray(value)) {
116
+ return value;
117
+ }
118
+ // Execute default behaviour
119
+ return undefined;
120
+ }
121
+ function mergeExtensions({ extend , ...theme }) {
122
+ return mergeWith(theme, extend, (themeValue, extensions)=>{
123
+ // The `extend` property is an array, so we need to check if it contains any functions
124
+ if (!isFunction(themeValue) && !extensions.some(isFunction)) {
125
+ return mergeWith({
126
+ }, themeValue, ...extensions, mergeExtensionCustomizer);
127
+ }
128
+ return (resolveThemePath, utils)=>mergeWith({
129
+ }, ...[
130
+ themeValue,
131
+ ...extensions
132
+ ].map((e)=>value1(e, resolveThemePath, utils)
133
+ ), mergeExtensionCustomizer)
134
+ ;
135
+ });
135
136
  }
136
-
137
137
  function resolveFunctionKeys(object) {
138
- const resolvePath = (key, defaultValue) => {
139
- const path = (0, _toPath.toPath)(key);
140
- let index = 0;
141
- let val = object;
142
-
143
- while (val !== undefined && val !== null && index < path.length) {
144
- val = val[path[index++]];
145
- val = isFunction(val) ? val(resolvePath, configUtils) : val;
146
- }
147
-
148
- return val === undefined ? defaultValue : val;
149
- };
150
-
151
- resolvePath.theme = resolvePath;
152
-
153
- for (let key in configUtils) {
154
- resolvePath[key] = configUtils[key];
155
- }
156
-
157
- return Object.keys(object).reduce((resolved, key) => {
158
- return { ...resolved,
159
- [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
138
+ const resolvePath = (key, defaultValue)=>{
139
+ const path = (0, _toPath).toPath(key);
140
+ let index = 0;
141
+ let val = object;
142
+ while(val !== undefined && val !== null && index < path.length){
143
+ val = val[path[index++]];
144
+ val = isFunction(val) ? val(resolvePath, configUtils) : val;
145
+ }
146
+ return val === undefined ? defaultValue : val;
160
147
  };
161
- }, {});
148
+ resolvePath.theme = resolvePath;
149
+ for(let key1 in configUtils){
150
+ resolvePath[key1] = configUtils[key1];
151
+ }
152
+ return Object.keys(object).reduce((resolved, key)=>{
153
+ return {
154
+ ...resolved,
155
+ [key]: isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key]
156
+ };
157
+ }, {
158
+ });
162
159
  }
163
-
164
160
  function extractPluginConfigs(configs) {
165
- let allConfigs = [];
166
- configs.forEach(config => {
167
- var _config$plugins;
168
-
169
- allConfigs = [...allConfigs, config];
170
- const plugins = (_config$plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config$plugins !== void 0 ? _config$plugins : [];
171
-
172
- if (plugins.length === 0) {
173
- return;
174
- }
175
-
176
- plugins.forEach(plugin => {
177
- var _plugin$config, _plugin;
178
-
179
- if (plugin.__isOptionsFunction) {
180
- plugin = plugin();
181
- }
182
-
183
- allConfigs = [...allConfigs, ...extractPluginConfigs([(_plugin$config = (_plugin = plugin) === null || _plugin === void 0 ? void 0 : _plugin.config) !== null && _plugin$config !== void 0 ? _plugin$config : {}])];
161
+ let allConfigs = [];
162
+ configs.forEach((config)=>{
163
+ allConfigs = [
164
+ ...allConfigs,
165
+ config
166
+ ];
167
+ var ref1;
168
+ const plugins = (ref1 = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref1 !== void 0 ? ref1 : [];
169
+ if (plugins.length === 0) {
170
+ return;
171
+ }
172
+ plugins.forEach((plugin)=>{
173
+ if (plugin.__isOptionsFunction) {
174
+ plugin = plugin();
175
+ }
176
+ var ref;
177
+ allConfigs = [
178
+ ...allConfigs,
179
+ ...extractPluginConfigs([
180
+ (ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {
181
+ }
182
+ ])
183
+ ];
184
+ });
184
185
  });
185
- });
186
- return allConfigs;
186
+ return allConfigs;
187
187
  }
188
-
189
188
  function resolveCorePlugins(corePluginConfigs) {
190
- const result = [...corePluginConfigs].reduceRight((resolved, corePluginConfig) => {
191
- if (isFunction(corePluginConfig)) {
192
- return corePluginConfig({
193
- corePlugins: resolved
194
- });
195
- }
196
-
197
- return (0, _configurePlugins.default)(corePluginConfig, resolved);
198
- }, _corePluginList.default);
199
- return result;
189
+ const result = [
190
+ ...corePluginConfigs
191
+ ].reduceRight((resolved, corePluginConfig)=>{
192
+ if (isFunction(corePluginConfig)) {
193
+ return corePluginConfig({
194
+ corePlugins: resolved
195
+ });
196
+ }
197
+ return (0, _configurePlugins).default(corePluginConfig, resolved);
198
+ }, _corePluginList.default);
199
+ return result;
200
200
  }
201
-
202
201
  function resolvePluginLists(pluginLists) {
203
- const result = [...pluginLists].reduceRight((resolved, pluginList) => {
204
- return [...resolved, ...pluginList];
205
- }, []);
206
- return result;
202
+ const result = [
203
+ ...pluginLists
204
+ ].reduceRight((resolved, pluginList)=>{
205
+ return [
206
+ ...resolved,
207
+ ...pluginList
208
+ ];
209
+ }, []);
210
+ return result;
207
211
  }
208
-
209
212
  function resolveConfig(configs) {
210
- let allConfigs = [...extractPluginConfigs(configs), {
211
- prefix: '',
212
- important: false,
213
- separator: ':',
214
- variantOrder: _defaultConfig.default.variantOrder
215
- }];
216
- return normalizeConfig((0, _defaults.defaults)({
217
- theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map(t => {
218
- var _t$theme;
219
-
220
- return (_t$theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t$theme !== void 0 ? _t$theme : {};
221
- })))),
222
- corePlugins: resolveCorePlugins(allConfigs.map(c => c.corePlugins)),
223
- plugins: resolvePluginLists(configs.map(c => {
224
- var _c$plugins;
225
-
226
- return (_c$plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c$plugins !== void 0 ? _c$plugins : [];
227
- }))
228
- }, ...allConfigs));
213
+ let allConfigs = [
214
+ ...extractPluginConfigs(configs),
215
+ {
216
+ prefix: '',
217
+ important: false,
218
+ separator: ':',
219
+ variantOrder: _defaultConfigStub.default.variantOrder
220
+ },
221
+ ];
222
+ var ref, ref2;
223
+ return (0, _normalizeConfig).normalizeConfig((0, _defaults).defaults({
224
+ theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
225
+ return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {
226
+ };
227
+ })))),
228
+ corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins
229
+ )),
230
+ plugins: resolvePluginLists(configs.map((c)=>{
231
+ return (ref2 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref2 !== void 0 ? ref2 : [];
232
+ }))
233
+ }, ...allConfigs));
229
234
  }
230
-
231
- let warnedAbout = new Set();
232
-
233
- function normalizeConfig(config) {
234
- var _config$content, _config$purge, _config$content2, _config$purge2, _config$content3, _config$purge3;
235
-
236
- if (!warnedAbout.has('purge-deprecation') && config.hasOwnProperty('purge')) {
237
- _log.default.warn(['The `purge` option in your tailwind.config.js file has been deprecated.', 'Please rename this to `content` instead.']);
238
-
239
- warnedAbout.add('purge-deprecation');
240
- }
241
-
242
- config.content = {
243
- content: (() => {
244
- let {
245
- content,
246
- purge
247
- } = config;
248
- if (Array.isArray(purge)) return purge;
249
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
250
- if (Array.isArray(content)) return content;
251
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
252
- return [];
253
- })(),
254
- safelist: (() => {
255
- let {
256
- content,
257
- purge
258
- } = config;
259
-
260
- let [safelistKey, safelistPaths] = (() => {
261
- var _purge$options;
262
-
263
- if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return ['content.safelist', content.safelist];
264
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return ['purge.safelist', purge.safelist];
265
- if (Array.isArray(purge === null || purge === void 0 ? void 0 : (_purge$options = purge.options) === null || _purge$options === void 0 ? void 0 : _purge$options.safelist)) return ['purge.options.safelist', purge.options.safelist];
266
- return [null, []];
267
- })();
268
-
269
- return safelistPaths.map(content => {
270
- if (typeof content === 'string') {
271
- return {
272
- raw: content,
273
- extension: 'html'
274
- };
275
- }
276
-
277
- if (content instanceof RegExp) {
278
- throw new Error(`Values inside '${safelistKey}' can only be of type 'string', found 'regex'.`);
279
- }
280
-
281
- throw new Error(`Values inside '${safelistKey}' can only be of type 'string', found '${typeof content}'.`);
282
- });
283
- })(),
284
- extract: ((_config$content = config.content) === null || _config$content === void 0 ? void 0 : _config$content.extract) || ((_config$purge = config.purge) === null || _config$purge === void 0 ? void 0 : _config$purge.extract) || {},
285
- options: ((_config$content2 = config.content) === null || _config$content2 === void 0 ? void 0 : _config$content2.options) || ((_config$purge2 = config.purge) === null || _config$purge2 === void 0 ? void 0 : _config$purge2.options) || {},
286
- transform: ((_config$content3 = config.content) === null || _config$content3 === void 0 ? void 0 : _config$content3.transform) || ((_config$purge3 = config.purge) === null || _config$purge3 === void 0 ? void 0 : _config$purge3.transform) || {}
287
- };
288
- return config;
289
- }
@@ -1,59 +1,52 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = resolveConfigPath;
7
-
8
6
  var _fs = _interopRequireDefault(require("fs"));
9
-
10
7
  var _path = _interopRequireDefault(require("path"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
14
13
  function isObject(value) {
15
- return typeof value === 'object' && value !== null;
14
+ return typeof value === 'object' && value !== null;
16
15
  }
17
-
18
16
  function isEmpty(obj) {
19
- return Object.keys(obj).length === 0;
17
+ return Object.keys(obj).length === 0;
20
18
  }
21
-
22
19
  function isString(value) {
23
- return typeof value === 'string' || value instanceof String;
20
+ return typeof value === 'string' || value instanceof String;
24
21
  }
25
-
26
22
  function resolveConfigPath(pathOrConfig) {
27
- // require('tailwindcss')({ theme: ..., variants: ... })
28
- if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
29
- return null;
30
- } // require('tailwindcss')({ config: 'custom-config.js' })
31
-
32
-
33
- if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
34
- return _path.default.resolve(pathOrConfig.config);
35
- } // require('tailwindcss')({ config: { theme: ..., variants: ... } })
36
-
37
-
38
- if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
23
+ // require('tailwindcss')({ theme: ..., variants: ... })
24
+ if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
25
+ return null;
26
+ }
27
+ // require('tailwindcss')({ config: 'custom-config.js' })
28
+ if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
29
+ return _path.default.resolve(pathOrConfig.config);
30
+ }
31
+ // require('tailwindcss')({ config: { theme: ..., variants: ... } })
32
+ if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
33
+ return null;
34
+ }
35
+ // require('tailwindcss')('custom-config.js')
36
+ if (isString(pathOrConfig)) {
37
+ return _path.default.resolve(pathOrConfig);
38
+ }
39
+ // require('tailwindcss')
40
+ for (const configFile of [
41
+ './tailwind.config.js',
42
+ './tailwind.config.cjs'
43
+ ]){
44
+ try {
45
+ const configPath = _path.default.resolve(configFile);
46
+ _fs.default.accessSync(configPath);
47
+ return configPath;
48
+ } catch (err) {
49
+ }
50
+ }
39
51
  return null;
40
- } // require('tailwindcss')('custom-config.js')
41
-
42
-
43
- if (isString(pathOrConfig)) {
44
- return _path.default.resolve(pathOrConfig);
45
- } // require('tailwindcss')
46
-
47
-
48
- for (const configFile of ['./tailwind.config.js', './tailwind.config.cjs']) {
49
- try {
50
- const configPath = _path.default.resolve(configFile);
51
-
52
- _fs.default.accessSync(configPath);
53
-
54
- return configPath;
55
- } catch (err) {}
56
- }
57
-
58
- return null;
59
- }
52
+ }
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = responsive;
7
-
8
6
  var _postcss = _interopRequireDefault(require("postcss"));
9
-
10
7
  var _cloneNodes = _interopRequireDefault(require("./cloneNodes"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
8
+ function _interopRequireDefault(obj) {
9
+ return obj && obj.__esModule ? obj : {
10
+ default: obj
11
+ };
12
+ }
14
13
  function responsive(rules) {
15
- return _postcss.default.atRule({
16
- name: 'responsive'
17
- }).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [rules]));
18
- }
14
+ return _postcss.default.atRule({
15
+ name: 'responsive'
16
+ }).append((0, _cloneNodes).default(Array.isArray(rules) ? rules : [
17
+ rules
18
+ ]));
19
+ }
package/lib/util/tap.js CHANGED
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.tap = tap;
7
-
8
6
  function tap(value, mutator) {
9
- mutator(value);
10
- return value;
11
- }
7
+ mutator(value);
8
+ return value;
9
+ }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.default = toColorValue;
7
-
8
6
  function toColorValue(maybeFunction) {
9
- return typeof maybeFunction === 'function' ? maybeFunction({}) : maybeFunction;
10
- }
7
+ return typeof maybeFunction === 'function' ? maybeFunction({
8
+ }) : maybeFunction;
9
+ }
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
5
  exports.toPath = toPath;
7
-
8
6
  function toPath(path) {
9
- if (Array.isArray(path)) return path;
10
- return path.split(/[\.\]\[]+/g);
11
- }
7
+ if (Array.isArray(path)) return path;
8
+ return path.split(/[\.\]\[]+/g);
9
+ }