tailwindcss 0.0.0-oxide-insiders.a7fe2fe → 0.0.0-oxide-insiders.7f555c4

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 (108) hide show
  1. package/lib/cli/build/deps.js +34 -18
  2. package/lib/cli/build/index.js +45 -12
  3. package/lib/cli/build/plugin.js +273 -90
  4. package/lib/cli/build/utils.js +56 -24
  5. package/lib/cli/build/watching.js +156 -38
  6. package/lib/cli/help/index.js +61 -16
  7. package/lib/cli/index.js +121 -62
  8. package/lib/cli/init/index.js +47 -23
  9. package/lib/cli-peer-dependencies.js +23 -13
  10. package/lib/cli.js +5 -1
  11. package/lib/corePluginList.js +7 -4
  12. package/lib/corePlugins.js +855 -386
  13. package/lib/featureFlags.js +43 -18
  14. package/lib/lib/cacheInvalidation.js +78 -30
  15. package/lib/lib/collapseAdjacentRules.js +46 -23
  16. package/lib/lib/collapseDuplicateDeclarations.js +70 -27
  17. package/lib/lib/content.js +134 -41
  18. package/lib/lib/defaultExtractor.js +201 -96
  19. package/lib/lib/detectNesting.js +38 -12
  20. package/lib/lib/evaluateTailwindFunctions.js +192 -103
  21. package/lib/lib/expandApplyAtRules.js +488 -181
  22. package/lib/lib/expandTailwindAtRules.js +240 -70
  23. package/lib/lib/findAtConfigPath.js +34 -15
  24. package/lib/lib/generateRules.js +775 -353
  25. package/lib/lib/getModuleDependencies.js +67 -29
  26. package/lib/lib/load-config.js +27 -17
  27. package/lib/lib/normalizeTailwindDirectives.js +73 -27
  28. package/lib/lib/offsets.js +227 -62
  29. package/lib/lib/partitionApplyAtRules.js +53 -29
  30. package/lib/lib/regex.js +50 -28
  31. package/lib/lib/remap-bitfield.js +86 -9
  32. package/lib/lib/resolveDefaultsAtRules.js +123 -53
  33. package/lib/lib/setupContextUtils.js +1117 -584
  34. package/lib/lib/setupTrackingContext.js +149 -58
  35. package/lib/lib/sharedState.js +71 -23
  36. package/lib/lib/substituteScreenAtRules.js +19 -9
  37. package/lib/oxide/cli/build/deps.js +46 -23
  38. package/lib/oxide/cli/build/index.js +44 -12
  39. package/lib/oxide/cli/build/plugin.js +271 -89
  40. package/lib/oxide/cli/build/utils.js +55 -24
  41. package/lib/oxide/cli/build/watching.js +153 -36
  42. package/lib/oxide/cli/help/index.js +60 -16
  43. package/lib/oxide/cli/index.js +128 -67
  44. package/lib/oxide/cli/init/index.js +40 -19
  45. package/lib/oxide/cli.js +3 -2
  46. package/lib/plugin.js +58 -31
  47. package/lib/postcss-plugins/nesting/index.js +13 -7
  48. package/lib/postcss-plugins/nesting/plugin.js +65 -20
  49. package/lib/processTailwindFeatures.js +41 -10
  50. package/lib/public/colors.js +25 -16
  51. package/lib/public/create-plugin.js +11 -6
  52. package/lib/public/default-config.js +12 -6
  53. package/lib/public/default-theme.js +12 -6
  54. package/lib/public/load-config.js +9 -5
  55. package/lib/public/resolve-config.js +10 -6
  56. package/lib/util/applyImportantSelector.js +28 -17
  57. package/lib/util/bigSign.js +9 -6
  58. package/lib/util/buildMediaQuery.js +19 -10
  59. package/lib/util/cloneDeep.js +19 -9
  60. package/lib/util/cloneNodes.js +29 -14
  61. package/lib/util/color.js +87 -47
  62. package/lib/util/colorNames.js +752 -0
  63. package/lib/util/configurePlugins.js +18 -9
  64. package/lib/util/createPlugin.js +17 -8
  65. package/lib/util/createUtilityPlugin.js +30 -16
  66. package/lib/util/dataTypes.js +189 -38
  67. package/lib/util/defaults.js +21 -9
  68. package/lib/util/escapeClassName.js +15 -9
  69. package/lib/util/escapeCommas.js +9 -6
  70. package/lib/util/flattenColorPalette.js +11 -7
  71. package/lib/util/formatVariantSelector.js +209 -60
  72. package/lib/util/getAllConfigs.js +44 -35
  73. package/lib/util/hashConfig.js +12 -8
  74. package/lib/util/isKeyframeRule.js +10 -7
  75. package/lib/util/isPlainObject.js +14 -9
  76. package/lib/util/isSyntacticallyValidPropertyValue.js +45 -14
  77. package/lib/util/log.js +20 -9
  78. package/lib/util/nameClass.js +31 -10
  79. package/lib/util/negateValue.js +28 -10
  80. package/lib/util/normalizeConfig.js +242 -63
  81. package/lib/util/normalizeScreens.js +145 -70
  82. package/lib/util/parseAnimationValue.js +64 -14
  83. package/lib/util/parseBoxShadowValue.js +63 -14
  84. package/lib/util/parseDependency.js +39 -13
  85. package/lib/util/parseGlob.js +25 -8
  86. package/lib/util/parseObjectStyles.js +29 -18
  87. package/lib/util/pluginUtils.js +196 -77
  88. package/lib/util/prefixSelector.js +31 -12
  89. package/lib/util/pseudoElements.js +116 -34
  90. package/lib/util/removeAlphaVariables.js +23 -8
  91. package/lib/util/resolveConfig.js +224 -105
  92. package/lib/util/resolveConfigPath.js +45 -15
  93. package/lib/util/responsive.js +10 -6
  94. package/lib/util/splitAtTopLevelOnly.js +46 -10
  95. package/lib/util/tap.js +11 -7
  96. package/lib/util/toColorValue.js +10 -7
  97. package/lib/util/toPath.js +28 -8
  98. package/lib/util/transformThemeValue.js +49 -14
  99. package/lib/util/validateConfig.js +25 -15
  100. package/lib/util/validateFormalSyntax.js +14 -6
  101. package/lib/util/withAlphaVariable.js +54 -30
  102. package/package.json +18 -22
  103. package/peers/index.js +57849 -43101
  104. package/src/lib/expandTailwindAtRules.js +1 -1
  105. package/src/lib/setupTrackingContext.js +1 -1
  106. package/src/util/color.js +1 -1
  107. package/src/util/colorNames.js +150 -0
  108. package/src/util/pseudoElements.js +4 -4
@@ -1,137 +1,256 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>resolveConfig
3
+ value: true
7
4
  });
8
- const _negateValue = _interopRequireDefault(require("./negateValue")), _corePluginList = _interopRequireDefault(require("../corePluginList")), _configurePlugins = _interopRequireDefault(require("./configurePlugins")), _colors = _interopRequireDefault(require("../public/colors")), _defaults = require("./defaults"), _toPath = require("./toPath"), _normalizeConfig = require("./normalizeConfig"), _isPlainObject = _interopRequireDefault(require("./isPlainObject")), _cloneDeep = require("./cloneDeep"), _pluginUtils = require("./pluginUtils"), _withAlphaVariable = require("./withAlphaVariable"), _toColorValue = _interopRequireDefault(require("./toColorValue"));
9
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return resolveConfig;
9
+ }
10
+ });
11
+ const _negateValue = /*#__PURE__*/ _interop_require_default(require("./negateValue"));
12
+ const _corePluginList = /*#__PURE__*/ _interop_require_default(require("../corePluginList"));
13
+ const _configurePlugins = /*#__PURE__*/ _interop_require_default(require("./configurePlugins"));
14
+ const _colors = /*#__PURE__*/ _interop_require_default(require("../public/colors"));
15
+ const _defaults = require("./defaults");
16
+ const _toPath = require("./toPath");
17
+ const _normalizeConfig = require("./normalizeConfig");
18
+ const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("./isPlainObject"));
19
+ const _cloneDeep = require("./cloneDeep");
20
+ const _pluginUtils = require("./pluginUtils");
21
+ const _withAlphaVariable = require("./withAlphaVariable");
22
+ const _toColorValue = /*#__PURE__*/ _interop_require_default(require("./toColorValue"));
23
+ function _interop_require_default(obj) {
10
24
  return obj && obj.__esModule ? obj : {
11
25
  default: obj
12
26
  };
13
27
  }
14
28
  function isFunction(input) {
15
- return "function" == typeof input;
29
+ return typeof input === "function";
16
30
  }
17
31
  function mergeWith(target, ...sources) {
18
32
  let customizer = sources.pop();
19
- for (let source of sources)for(let k in source){
20
- let merged = customizer(target[k], source[k]);
21
- void 0 === merged ? (0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k]) ? target[k] = mergeWith({}, target[k], source[k], customizer) : target[k] = source[k] : target[k] = merged;
33
+ for (let source of sources){
34
+ for(let k in source){
35
+ let merged = customizer(target[k], source[k]);
36
+ if (merged === undefined) {
37
+ if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
38
+ target[k] = mergeWith({}, target[k], source[k], customizer);
39
+ } else {
40
+ target[k] = source[k];
41
+ }
42
+ } else {
43
+ target[k] = merged;
44
+ }
45
+ }
22
46
  }
23
47
  return target;
24
48
  }
25
49
  const configUtils = {
26
50
  colors: _colors.default,
27
- negative: (scale)=>Object.keys(scale).filter((key)=>"0" !== scale[key]).reduce((negativeScale, key)=>{
51
+ negative (scale) {
52
+ // TODO: Log that this function isn't really needed anymore?
53
+ return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
28
54
  let negativeValue = (0, _negateValue.default)(scale[key]);
29
- return void 0 !== negativeValue && (negativeScale[`-${key}`] = negativeValue), negativeScale;
30
- }, {}),
31
- breakpoints: (screens)=>Object.keys(screens).filter((key)=>"string" == typeof screens[key]).reduce((breakpoints, key)=>({
55
+ if (negativeValue !== undefined) {
56
+ negativeScale[`-${key}`] = negativeValue;
57
+ }
58
+ return negativeScale;
59
+ }, {});
60
+ },
61
+ breakpoints (screens) {
62
+ return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
32
63
  ...breakpoints,
33
64
  [`screen-${key}`]: screens[key]
34
- }), {})
65
+ }), {});
66
+ }
35
67
  };
68
+ function value(valueToResolve, ...args) {
69
+ return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
70
+ }
71
+ function collectExtends(items) {
72
+ return items.reduce((merged, { extend })=>{
73
+ return mergeWith(merged, extend, (mergedValue, extendValue)=>{
74
+ if (mergedValue === undefined) {
75
+ return [
76
+ extendValue
77
+ ];
78
+ }
79
+ if (Array.isArray(mergedValue)) {
80
+ return [
81
+ extendValue,
82
+ ...mergedValue
83
+ ];
84
+ }
85
+ return [
86
+ extendValue,
87
+ mergedValue
88
+ ];
89
+ });
90
+ }, {});
91
+ }
92
+ function mergeThemes(themes) {
93
+ return {
94
+ ...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
95
+ // In order to resolve n config objects, we combine all of their `extend` properties
96
+ // into arrays instead of objects so they aren't overridden.
97
+ extend: collectExtends(themes)
98
+ };
99
+ }
36
100
  function mergeExtensionCustomizer(merged, value) {
37
- return Array.isArray(merged) && (0, _isPlainObject.default)(merged[0]) ? merged.concat(value) : Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged) ? [
38
- merged,
39
- ...value
40
- ] : Array.isArray(value) ? value : void 0;
101
+ // When we have an array of objects, we do want to merge it
102
+ if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
103
+ return merged.concat(value);
104
+ }
105
+ // When the incoming value is an array, and the existing config is an object, prepend the existing object
106
+ if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
107
+ return [
108
+ merged,
109
+ ...value
110
+ ];
111
+ }
112
+ // Override arrays (for example for font-families, box-shadows, ...)
113
+ if (Array.isArray(value)) {
114
+ return value;
115
+ }
116
+ // Execute default behaviour
117
+ return undefined;
118
+ }
119
+ function mergeExtensions({ extend , ...theme }) {
120
+ return mergeWith(theme, extend, (themeValue, extensions)=>{
121
+ // The `extend` property is an array, so we need to check if it contains any functions
122
+ if (!isFunction(themeValue) && !extensions.some(isFunction)) {
123
+ return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
124
+ }
125
+ return (resolveThemePath, utils)=>mergeWith({}, ...[
126
+ themeValue,
127
+ ...extensions
128
+ ].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
129
+ });
130
+ }
131
+ /**
132
+ *
133
+ * @param {string} key
134
+ * @return {Iterable<string[] & {alpha: string | undefined}>}
135
+ */ function* toPaths(key) {
136
+ let path = (0, _toPath.toPath)(key);
137
+ if (path.length === 0) {
138
+ return;
139
+ }
140
+ yield path;
141
+ if (Array.isArray(key)) {
142
+ return;
143
+ }
144
+ let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
145
+ let matches = key.match(pattern);
146
+ if (matches !== null) {
147
+ let [, prefix, alpha] = matches;
148
+ let newPath = (0, _toPath.toPath)(prefix);
149
+ newPath.alpha = alpha;
150
+ yield newPath;
151
+ }
152
+ }
153
+ function resolveFunctionKeys(object) {
154
+ // theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
155
+ const resolvePath = (key, defaultValue)=>{
156
+ for (const path of toPaths(key)){
157
+ let index = 0;
158
+ let val = object;
159
+ while(val !== undefined && val !== null && index < path.length){
160
+ val = val[path[index++]];
161
+ let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
162
+ val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
163
+ }
164
+ if (val !== undefined) {
165
+ if (path.alpha !== undefined) {
166
+ let normalized = (0, _pluginUtils.parseColorFormat)(val);
167
+ return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
168
+ }
169
+ if ((0, _isPlainObject.default)(val)) {
170
+ return (0, _cloneDeep.cloneDeep)(val);
171
+ }
172
+ return val;
173
+ }
174
+ }
175
+ return defaultValue;
176
+ };
177
+ Object.assign(resolvePath, {
178
+ theme: resolvePath,
179
+ ...configUtils
180
+ });
181
+ return Object.keys(object).reduce((resolved, key)=>{
182
+ resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
183
+ return resolved;
184
+ }, {});
185
+ }
186
+ function extractPluginConfigs(configs) {
187
+ let allConfigs = [];
188
+ configs.forEach((config)=>{
189
+ allConfigs = [
190
+ ...allConfigs,
191
+ config
192
+ ];
193
+ var _config_plugins;
194
+ const plugins = (_config_plugins = config === null || config === void 0 ? void 0 : config.plugins) !== null && _config_plugins !== void 0 ? _config_plugins : [];
195
+ if (plugins.length === 0) {
196
+ return;
197
+ }
198
+ plugins.forEach((plugin)=>{
199
+ if (plugin.__isOptionsFunction) {
200
+ plugin = plugin();
201
+ }
202
+ var _plugin_config;
203
+ allConfigs = [
204
+ ...allConfigs,
205
+ ...extractPluginConfigs([
206
+ (_plugin_config = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && _plugin_config !== void 0 ? _plugin_config : {}
207
+ ])
208
+ ];
209
+ });
210
+ });
211
+ return allConfigs;
212
+ }
213
+ function resolveCorePlugins(corePluginConfigs) {
214
+ const result = [
215
+ ...corePluginConfigs
216
+ ].reduceRight((resolved, corePluginConfig)=>{
217
+ if (isFunction(corePluginConfig)) {
218
+ return corePluginConfig({
219
+ corePlugins: resolved
220
+ });
221
+ }
222
+ return (0, _configurePlugins.default)(corePluginConfig, resolved);
223
+ }, _corePluginList.default);
224
+ return result;
225
+ }
226
+ function resolvePluginLists(pluginLists) {
227
+ const result = [
228
+ ...pluginLists
229
+ ].reduceRight((resolved, pluginList)=>{
230
+ return [
231
+ ...resolved,
232
+ ...pluginList
233
+ ];
234
+ }, []);
235
+ return result;
41
236
  }
42
237
  function resolveConfig(configs) {
43
- var _t_theme, _c_plugins, themes;
44
238
  let allConfigs = [
45
- ...function extractPluginConfigs(configs) {
46
- let allConfigs = [];
47
- return configs.forEach((config)=>{
48
- var _config_plugins;
49
- allConfigs = [
50
- ...allConfigs,
51
- config
52
- ];
53
- let plugins = null !== (_config_plugins = null == config ? void 0 : config.plugins) && void 0 !== _config_plugins ? _config_plugins : [];
54
- 0 !== plugins.length && plugins.forEach((plugin)=>{
55
- var _plugin_config;
56
- plugin.__isOptionsFunction && (plugin = plugin()), allConfigs = [
57
- ...allConfigs,
58
- ...extractPluginConfigs([
59
- null !== (_plugin_config = null == plugin ? void 0 : plugin.config) && void 0 !== _plugin_config ? _plugin_config : {}
60
- ])
61
- ];
62
- });
63
- }), allConfigs;
64
- }(configs),
239
+ ...extractPluginConfigs(configs),
65
240
  {
66
241
  prefix: "",
67
- important: !1,
242
+ important: false,
68
243
  separator: ":"
69
244
  }
70
245
  ];
246
+ var _t_theme, _c_plugins;
71
247
  return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
72
- theme: function(object) {
73
- let resolvePath = (key, defaultValue)=>{
74
- for (let path of function*(key) {
75
- let path = (0, _toPath.toPath)(key);
76
- if (0 === path.length || (yield path, Array.isArray(key))) return;
77
- let matches = key.match(/^(.*?)\s*\/\s*([^/]+)$/);
78
- if (null !== matches) {
79
- let [, prefix, alpha] = matches, newPath = (0, _toPath.toPath)(prefix);
80
- newPath.alpha = alpha, yield newPath;
81
- }
82
- }(key)){
83
- let index = 0, val = object;
84
- for(; null != val && index < path.length;)val = isFunction(val = val[path[index++]]) && (void 0 === path.alpha || index <= path.length - 1) ? val(resolvePath, configUtils) : val;
85
- if (void 0 !== val) {
86
- if (void 0 !== path.alpha) {
87
- let normalized = (0, _pluginUtils.parseColorFormat)(val);
88
- return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
89
- }
90
- if ((0, _isPlainObject.default)(val)) return (0, _cloneDeep.cloneDeep)(val);
91
- return val;
92
- }
93
- }
94
- return defaultValue;
95
- };
96
- return Object.assign(resolvePath, {
97
- theme: resolvePath,
98
- ...configUtils
99
- }), Object.keys(object).reduce((resolved, key)=>(resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key], resolved), {});
100
- }(function({ extend , ...theme }) {
101
- return mergeWith(theme, extend, (themeValue, extensions)=>isFunction(themeValue) || extensions.some(isFunction) ? (resolveThemePath, utils)=>mergeWith({}, ...[
102
- themeValue,
103
- ...extensions
104
- ].map((e)=>(function(valueToResolve, ...args) {
105
- return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
106
- })(e, resolveThemePath, utils)), mergeExtensionCustomizer) : mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer));
107
- }({
108
- ...(themes = allConfigs.map((t)=>null !== (_t_theme = null == t ? void 0 : t.theme) && void 0 !== _t_theme ? _t_theme : {})).reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
109
- extend: themes.reduce((merged, { extend })=>mergeWith(merged, extend, (mergedValue, extendValue)=>void 0 === mergedValue ? [
110
- extendValue
111
- ] : Array.isArray(mergedValue) ? [
112
- extendValue,
113
- ...mergedValue
114
- ] : [
115
- extendValue,
116
- mergedValue
117
- ]), {})
118
- })),
119
- corePlugins: function(corePluginConfigs) {
120
- let result = [
121
- ...corePluginConfigs
122
- ].reduceRight((resolved, corePluginConfig)=>isFunction(corePluginConfig) ? corePluginConfig({
123
- corePlugins: resolved
124
- }) : (0, _configurePlugins.default)(corePluginConfig, resolved), _corePluginList.default);
125
- return result;
126
- }(allConfigs.map((c)=>c.corePlugins)),
127
- plugins: function(pluginLists) {
128
- let result = [
129
- ...pluginLists
130
- ].reduceRight((resolved, pluginList)=>[
131
- ...resolved,
132
- ...pluginList
133
- ], []);
134
- return result;
135
- }(configs.map((c)=>null !== (_c_plugins = null == c ? void 0 : c.plugins) && void 0 !== _c_plugins ? _c_plugins : []))
248
+ theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
249
+ return (_t_theme = t === null || t === void 0 ? void 0 : t.theme) !== null && _t_theme !== void 0 ? _t_theme : {};
250
+ })))),
251
+ corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
252
+ plugins: resolvePluginLists(configs.map((c)=>{
253
+ return (_c_plugins = c === null || c === void 0 ? void 0 : c.plugins) !== null && _c_plugins !== void 0 ? _c_plugins : [];
254
+ }))
136
255
  }, ...allConfigs));
137
256
  }
@@ -1,17 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), function(target, all) {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
5
6
  for(var name in all)Object.defineProperty(target, name, {
6
- enumerable: !0,
7
+ enumerable: true,
7
8
  get: all[name]
8
9
  });
9
- }(exports, {
10
- default: ()=>resolveConfigPath,
11
- resolveDefaultConfigPath: ()=>resolveDefaultConfigPath
10
+ }
11
+ _export(exports, {
12
+ default: function() {
13
+ return resolveConfigPath;
14
+ },
15
+ resolveDefaultConfigPath: function() {
16
+ return resolveDefaultConfigPath;
17
+ }
12
18
  });
13
- const _fs = _interopRequireDefault(require("fs")), _path = _interopRequireDefault(require("path"));
14
- function _interopRequireDefault(obj) {
19
+ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
20
+ const _path = /*#__PURE__*/ _interop_require_default(require("path"));
21
+ function _interop_require_default(obj) {
15
22
  return obj && obj.__esModule ? obj : {
16
23
  default: obj
17
24
  };
@@ -23,18 +30,41 @@ const defaultConfigFiles = [
23
30
  "./tailwind.config.ts"
24
31
  ];
25
32
  function isObject(value) {
26
- return "object" == typeof value && null !== value;
33
+ return typeof value === "object" && value !== null;
34
+ }
35
+ function isEmpty(obj) {
36
+ return Object.keys(obj).length === 0;
27
37
  }
28
38
  function isString(value) {
29
- return "string" == typeof value || value instanceof String;
39
+ return typeof value === "string" || value instanceof String;
30
40
  }
31
41
  function resolveConfigPath(pathOrConfig) {
32
- return isObject(pathOrConfig) && void 0 === pathOrConfig.config && 0 !== Object.keys(pathOrConfig).length ? null : isObject(pathOrConfig) && void 0 !== pathOrConfig.config && isString(pathOrConfig.config) ? _path.default.resolve(pathOrConfig.config) : isObject(pathOrConfig) && void 0 !== pathOrConfig.config && isObject(pathOrConfig.config) ? null : isString(pathOrConfig) ? _path.default.resolve(pathOrConfig) : resolveDefaultConfigPath();
42
+ // require('tailwindcss')({ theme: ..., variants: ... })
43
+ if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
44
+ return null;
45
+ }
46
+ // require('tailwindcss')({ config: 'custom-config.js' })
47
+ if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
48
+ return _path.default.resolve(pathOrConfig.config);
49
+ }
50
+ // require('tailwindcss')({ config: { theme: ..., variants: ... } })
51
+ if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
52
+ return null;
53
+ }
54
+ // require('tailwindcss')('custom-config.js')
55
+ if (isString(pathOrConfig)) {
56
+ return _path.default.resolve(pathOrConfig);
57
+ }
58
+ // require('tailwindcss')
59
+ return resolveDefaultConfigPath();
33
60
  }
34
61
  function resolveDefaultConfigPath() {
35
- for (let configFile of defaultConfigFiles)try {
36
- let configPath = _path.default.resolve(configFile);
37
- return _fs.default.accessSync(configPath), configPath;
38
- } catch (err) {}
62
+ for (const configFile of defaultConfigFiles){
63
+ try {
64
+ const configPath = _path.default.resolve(configFile);
65
+ _fs.default.accessSync(configPath);
66
+ return configPath;
67
+ } catch (err) {}
68
+ }
39
69
  return null;
40
70
  }
@@ -1,12 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", {
3
- value: !0
4
- }), Object.defineProperty(exports, "default", {
5
- enumerable: !0,
6
- get: ()=>responsive
3
+ value: true
7
4
  });
8
- const _postcss = _interopRequireDefault(require("postcss")), _cloneNodes = _interopRequireDefault(require("./cloneNodes"));
9
- function _interopRequireDefault(obj) {
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return responsive;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("./cloneNodes"));
13
+ function _interop_require_default(obj) {
10
14
  return obj && obj.__esModule ? obj : {
11
15
  default: obj
12
16
  };
@@ -1,15 +1,51 @@
1
- "use strict";
1
+ /**
2
+ * This splits a string on a top-level character.
3
+ *
4
+ * Regex doesn't support recursion (at least not the JS-flavored version).
5
+ * So we have to use a tiny state machine to keep track of paren placement.
6
+ *
7
+ * Expected behavior using commas:
8
+ * var(--a, 0 0 1px rgb(0, 0, 0)), 0 0 1px rgb(0, 0, 0)
9
+ * ─┬─ ┬ ┬ ┬
10
+ * x x x ╰──────── Split because top-level
11
+ * ╰──────────────┴──┴───────────── Ignored b/c inside >= 1 levels of parens
12
+ *
13
+ * @param {string} input
14
+ * @param {string} separator
15
+ */ "use strict";
16
+ Object.defineProperty(exports, "__esModule", {
17
+ value: true
18
+ });
19
+ Object.defineProperty(exports, "splitAtTopLevelOnly", {
20
+ enumerable: true,
21
+ get: function() {
22
+ return splitAtTopLevelOnly;
23
+ }
24
+ });
2
25
  function splitAtTopLevelOnly(input, separator) {
3
- let stack = [], parts = [], lastPos = 0, isEscaped = !1;
26
+ let stack = [];
27
+ let parts = [];
28
+ let lastPos = 0;
29
+ let isEscaped = false;
4
30
  for(let idx = 0; idx < input.length; idx++){
5
31
  let char = input[idx];
6
- 0 !== stack.length || char !== separator[0] || isEscaped || 1 !== separator.length && input.slice(idx, idx + separator.length) !== separator || (parts.push(input.slice(lastPos, idx)), lastPos = idx + separator.length), isEscaped ? isEscaped = !1 : "\\" === char && (isEscaped = !0), "(" === char || "[" === char || "{" === char ? stack.push(char) : (")" === char && "(" === stack[stack.length - 1] || "]" === char && "[" === stack[stack.length - 1] || "}" === char && "{" === stack[stack.length - 1]) && stack.pop();
32
+ if (stack.length === 0 && char === separator[0] && !isEscaped) {
33
+ if (separator.length === 1 || input.slice(idx, idx + separator.length) === separator) {
34
+ parts.push(input.slice(lastPos, idx));
35
+ lastPos = idx + separator.length;
36
+ }
37
+ }
38
+ if (isEscaped) {
39
+ isEscaped = false;
40
+ } else if (char === "\\") {
41
+ isEscaped = true;
42
+ }
43
+ if (char === "(" || char === "[" || char === "{") {
44
+ stack.push(char);
45
+ } else if (char === ")" && stack[stack.length - 1] === "(" || char === "]" && stack[stack.length - 1] === "[" || char === "}" && stack[stack.length - 1] === "{") {
46
+ stack.pop();
47
+ }
7
48
  }
8
- return parts.push(input.slice(lastPos)), parts;
49
+ parts.push(input.slice(lastPos));
50
+ return parts;
9
51
  }
10
- Object.defineProperty(exports, "__esModule", {
11
- value: !0
12
- }), Object.defineProperty(exports, "splitAtTopLevelOnly", {
13
- enumerable: !0,
14
- get: ()=>splitAtTopLevelOnly
15
- });
package/lib/util/tap.js CHANGED
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
- function tap(value, mutator) {
3
- return mutator(value), value;
4
- }
5
2
  Object.defineProperty(exports, "__esModule", {
6
- value: !0
7
- }), Object.defineProperty(exports, "tap", {
8
- enumerable: !0,
9
- get: ()=>tap
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "tap", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return tap;
9
+ }
10
10
  });
11
+ function tap(value, mutator) {
12
+ mutator(value);
13
+ return value;
14
+ }
@@ -1,10 +1,13 @@
1
1
  "use strict";
2
- function toColorValue(maybeFunction) {
3
- return "function" == typeof maybeFunction ? maybeFunction({}) : maybeFunction;
4
- }
5
2
  Object.defineProperty(exports, "__esModule", {
6
- value: !0
7
- }), Object.defineProperty(exports, "default", {
8
- enumerable: !0,
9
- get: ()=>toColorValue
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "default", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return toColorValue;
9
+ }
10
10
  });
11
+ function toColorValue(maybeFunction) {
12
+ return typeof maybeFunction === "function" ? maybeFunction({}) : maybeFunction;
13
+ }
@@ -1,12 +1,32 @@
1
- "use strict";
1
+ /**
2
+ * Parse a path string into an array of path segments.
3
+ *
4
+ * Square bracket notation `a[b]` may be used to "escape" dots that would otherwise be interpreted as path separators.
5
+ *
6
+ * Example:
7
+ * a -> ['a']
8
+ * a.b.c -> ['a', 'b', 'c']
9
+ * a[b].c -> ['a', 'b', 'c']
10
+ * a[b.c].e.f -> ['a', 'b.c', 'e', 'f']
11
+ * a[b][c][d] -> ['a', 'b', 'c', 'd']
12
+ *
13
+ * @param {string|string[]} path
14
+ **/ "use strict";
15
+ Object.defineProperty(exports, "__esModule", {
16
+ value: true
17
+ });
18
+ Object.defineProperty(exports, "toPath", {
19
+ enumerable: true,
20
+ get: function() {
21
+ return toPath;
22
+ }
23
+ });
2
24
  function toPath(path) {
3
25
  if (Array.isArray(path)) return path;
4
- if (path.split("[").length - 1 != path.split("]").length - 1) throw Error(`Path is invalid. Has unbalanced brackets: ${path}`);
26
+ let openBrackets = path.split("[").length - 1;
27
+ let closedBrackets = path.split("]").length - 1;
28
+ if (openBrackets !== closedBrackets) {
29
+ throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
30
+ }
5
31
  return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
6
32
  }
7
- Object.defineProperty(exports, "__esModule", {
8
- value: !0
9
- }), Object.defineProperty(exports, "toPath", {
10
- enumerable: !0,
11
- get: ()=>toPath
12
- });