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.
- package/CHANGELOG.md +106 -1
- package/README.md +1 -1
- package/colors.js +1 -304
- package/defaultConfig.js +1 -4
- package/defaultTheme.js +1 -4
- package/lib/cli-peer-dependencies.js +4 -9
- package/lib/cli.js +646 -705
- package/lib/constants.js +15 -15
- package/lib/corePluginList.js +174 -4
- package/lib/corePlugins.js +3637 -2934
- package/lib/css/preflight.css +14 -1
- package/lib/featureFlags.js +44 -44
- package/lib/index.js +25 -24
- package/lib/lib/collapseAdjacentRules.js +33 -35
- package/lib/lib/collapseDuplicateDeclarations.js +29 -0
- package/lib/lib/detectNesting.js +34 -0
- package/lib/lib/evaluateTailwindFunctions.js +134 -155
- package/lib/lib/expandApplyAtRules.js +183 -200
- package/lib/lib/expandTailwindAtRules.js +219 -232
- package/lib/lib/generateRules.js +478 -311
- package/lib/lib/getModuleDependencies.js +36 -41
- package/lib/lib/normalizeTailwindDirectives.js +66 -58
- package/lib/lib/resolveDefaultsAtRules.js +110 -90
- package/lib/lib/setupContextUtils.js +740 -580
- package/lib/lib/setupTrackingContext.js +142 -162
- package/lib/lib/setupWatchingContext.js +235 -278
- package/lib/lib/sharedState.js +7 -17
- package/lib/lib/substituteScreenAtRules.js +22 -26
- package/lib/processTailwindFeatures.js +38 -44
- package/lib/public/colors.js +329 -0
- package/lib/public/create-plugin.js +13 -0
- package/lib/public/default-config.js +14 -0
- package/lib/public/default-theme.js +14 -0
- package/lib/public/resolve-config.js +19 -0
- package/lib/util/bigSign.js +3 -5
- package/lib/util/buildMediaQuery.js +15 -31
- package/lib/util/cloneDeep.js +14 -13
- package/lib/util/cloneNodes.js +9 -13
- package/lib/util/color.js +69 -59
- package/lib/util/configurePlugins.js +13 -14
- package/lib/util/createPlugin.js +21 -24
- package/lib/util/createUtilityPlugin.js +47 -45
- package/lib/util/dataTypes.js +231 -0
- package/lib/util/defaults.js +10 -14
- package/lib/util/escapeClassName.js +12 -14
- package/lib/util/escapeCommas.js +3 -5
- package/lib/util/flattenColorPalette.js +14 -10
- package/lib/util/formatVariantSelector.js +186 -0
- package/lib/util/getAllConfigs.js +23 -16
- package/lib/util/hashConfig.js +10 -10
- package/lib/util/isKeyframeRule.js +3 -5
- package/lib/util/isPlainObject.js +7 -10
- package/lib/util/isValidArbitraryValue.js +64 -0
- package/lib/util/log.js +39 -30
- package/lib/util/nameClass.js +23 -23
- package/lib/util/negateValue.js +14 -15
- package/lib/util/normalizeConfig.js +208 -0
- package/lib/util/normalizeScreens.js +58 -0
- package/lib/util/parseAnimationValue.js +82 -53
- package/lib/util/parseBoxShadowValue.js +77 -0
- package/lib/util/parseDependency.js +49 -60
- package/lib/util/parseObjectStyles.js +23 -20
- package/lib/util/pluginUtils.js +153 -285
- package/lib/util/prefixSelector.js +14 -16
- package/lib/util/resolveConfig.js +194 -249
- package/lib/util/resolveConfigPath.js +38 -45
- package/lib/util/responsive.js +12 -11
- package/lib/util/tap.js +4 -6
- package/lib/util/toColorValue.js +4 -5
- package/lib/util/toPath.js +4 -6
- package/lib/util/transformThemeValue.js +57 -26
- package/lib/util/withAlphaVariable.js +56 -54
- package/package.json +27 -37
- package/peers/index.js +73099 -84294
- package/plugin.js +1 -3
- package/resolveConfig.js +1 -7
- package/scripts/create-plugin-list.js +2 -2
- package/src/cli.js +27 -18
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +2124 -1968
- package/src/css/preflight.css +14 -1
- package/src/featureFlags.js +12 -6
- package/src/lib/collapseDuplicateDeclarations.js +28 -0
- package/src/lib/detectNesting.js +39 -0
- package/src/lib/evaluateTailwindFunctions.js +5 -2
- package/src/lib/expandTailwindAtRules.js +24 -32
- package/src/lib/generateRules.js +230 -20
- package/src/lib/normalizeTailwindDirectives.js +3 -2
- package/src/lib/resolveDefaultsAtRules.js +46 -30
- package/src/lib/setupContextUtils.js +275 -113
- package/src/lib/setupTrackingContext.js +9 -8
- package/src/lib/setupWatchingContext.js +12 -7
- package/src/lib/sharedState.js +1 -4
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/processTailwindFeatures.js +8 -1
- package/src/public/colors.js +300 -0
- package/src/public/create-plugin.js +2 -0
- package/src/public/default-config.js +4 -0
- package/src/public/default-theme.js +4 -0
- package/src/public/resolve-config.js +7 -0
- package/src/util/buildMediaQuery.js +14 -18
- package/src/util/createUtilityPlugin.js +2 -11
- package/src/util/dataTypes.js +246 -0
- package/src/util/formatVariantSelector.js +196 -0
- package/src/util/isValidArbitraryValue.js +61 -0
- package/src/util/log.js +18 -21
- package/src/util/nameClass.js +10 -6
- package/src/util/negateValue.js +4 -2
- package/src/util/normalizeConfig.js +249 -0
- package/src/util/normalizeScreens.js +42 -0
- package/src/util/parseAnimationValue.js +7 -1
- package/src/util/parseBoxShadowValue.js +71 -0
- package/src/util/parseDependency.js +4 -0
- package/src/util/pluginUtils.js +101 -204
- package/src/util/prefixSelector.js +1 -4
- package/src/util/resolveConfig.js +12 -65
- package/src/util/transformThemeValue.js +22 -7
- package/src/util/withAlphaVariable.js +13 -8
- package/stubs/defaultConfig.stub.js +163 -97
- package/stubs/simpleConfig.stub.js +0 -1
|
@@ -1,289 +1,234 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
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
|
|
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) {
|
|
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
|
-
|
|
20
|
+
return typeof input === 'function';
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function isObject(input) {
|
|
31
|
-
|
|
23
|
+
return typeof input === 'object' && input !== null;
|
|
32
24
|
}
|
|
33
|
-
|
|
34
25
|
function mergeWith(target, ...sources) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
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
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
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
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
14
13
|
function isObject(value) {
|
|
15
|
-
|
|
14
|
+
return typeof value === 'object' && value !== null;
|
|
16
15
|
}
|
|
17
|
-
|
|
18
16
|
function isEmpty(obj) {
|
|
19
|
-
|
|
17
|
+
return Object.keys(obj).length === 0;
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
function isString(value) {
|
|
23
|
-
|
|
20
|
+
return typeof value === 'string' || value instanceof String;
|
|
24
21
|
}
|
|
25
|
-
|
|
26
22
|
function resolveConfigPath(pathOrConfig) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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
|
+
}
|
package/lib/util/responsive.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
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
|
-
|
|
13
|
-
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
14
13
|
function responsive(rules) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
package/lib/util/toColorValue.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.default = toColorValue;
|
|
7
|
-
|
|
8
6
|
function toColorValue(maybeFunction) {
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
return typeof maybeFunction === 'function' ? maybeFunction({
|
|
8
|
+
}) : maybeFunction;
|
|
9
|
+
}
|
package/lib/util/toPath.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
5
|
exports.toPath = toPath;
|
|
7
|
-
|
|
8
6
|
function toPath(path) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
7
|
+
if (Array.isArray(path)) return path;
|
|
8
|
+
return path.split(/[\.\]\[]+/g);
|
|
9
|
+
}
|