tailwindcss 0.0.0-insiders.fda68f7 → 0.0.0-oxide.6bf5e56
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 +603 -2
- package/LICENSE +1 -2
- package/README.md +14 -6
- package/colors.d.ts +3 -0
- package/colors.js +2 -304
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -4
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -4
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +48 -0
- package/lib/cli/build/plugin.js +367 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +178 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +18 -0
- package/lib/cli/init/index.js +46 -0
- package/lib/cli/shared.js +13 -0
- package/lib/cli-peer-dependencies.js +22 -14
- package/lib/cli.js +217 -743
- package/lib/constants.js +41 -34
- package/lib/corePluginList.js +178 -5
- package/lib/corePlugins.js +3879 -2941
- package/lib/css/preflight.css +22 -9
- package/lib/featureFlags.js +61 -50
- package/lib/index.js +45 -28
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +52 -36
- package/lib/lib/collapseDuplicateDeclarations.js +83 -0
- package/lib/lib/content.js +176 -0
- package/lib/lib/defaultExtractor.js +236 -0
- package/lib/lib/detectNesting.js +37 -0
- package/lib/lib/evaluateTailwindFunctions.js +203 -161
- package/lib/lib/expandApplyAtRules.js +502 -221
- package/lib/lib/expandTailwindAtRules.js +258 -243
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +775 -320
- package/lib/lib/getModuleDependencies.js +44 -46
- package/lib/lib/normalizeTailwindDirectives.js +79 -60
- package/lib/lib/offsets.js +217 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/resolveDefaultsAtRules.js +150 -94
- package/lib/lib/setupContextUtils.js +1146 -599
- package/lib/lib/setupTrackingContext.js +129 -177
- package/lib/lib/sharedState.js +53 -21
- package/lib/lib/substituteScreenAtRules.js +26 -28
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +19 -0
- package/lib/postcss-plugins/nesting/plugin.js +87 -0
- package/lib/processTailwindFeatures.js +58 -53
- package/lib/public/colors.js +331 -0
- package/lib/public/create-plugin.js +15 -0
- package/lib/public/default-config.js +16 -0
- package/lib/public/default-theme.js +16 -0
- package/lib/public/resolve-config.js +22 -0
- package/lib/util/bigSign.js +7 -6
- package/lib/util/buildMediaQuery.js +21 -32
- package/lib/util/cloneDeep.js +16 -14
- package/lib/util/cloneNodes.js +29 -15
- package/lib/util/color.js +90 -66
- package/lib/util/configurePlugins.js +17 -15
- package/lib/util/createPlugin.js +23 -26
- package/lib/util/createUtilityPlugin.js +46 -46
- package/lib/util/dataTypes.js +242 -0
- package/lib/util/defaults.js +20 -15
- package/lib/util/escapeClassName.js +18 -17
- package/lib/util/escapeCommas.js +7 -6
- package/lib/util/flattenColorPalette.js +13 -12
- package/lib/util/formatVariantSelector.js +285 -0
- package/lib/util/getAllConfigs.js +44 -18
- package/lib/util/hashConfig.js +15 -12
- package/lib/util/isKeyframeRule.js +7 -6
- package/lib/util/isPlainObject.js +11 -11
- package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
- package/lib/util/log.js +52 -33
- package/lib/util/nameClass.js +37 -26
- package/lib/util/negateValue.js +31 -17
- package/lib/util/normalizeConfig.js +281 -0
- package/lib/util/normalizeScreens.js +170 -0
- package/lib/util/parseAnimationValue.js +85 -54
- package/lib/util/parseBoxShadowValue.js +84 -0
- package/lib/util/parseDependency.js +41 -70
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +30 -24
- package/lib/util/pluginUtils.js +252 -287
- package/lib/util/prefixSelector.js +20 -20
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +221 -256
- package/lib/util/resolveConfigPath.js +43 -48
- package/lib/util/responsive.js +18 -14
- package/lib/util/splitAtTopLevelOnly.js +43 -0
- package/lib/util/tap.js +8 -7
- package/lib/util/toColorValue.js +7 -6
- package/lib/util/toPath.js +27 -8
- package/lib/util/transformThemeValue.js +67 -28
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +67 -57
- package/nesting/index.js +2 -12
- package/package.json +60 -65
- package/peers/index.js +76445 -84221
- package/plugin.d.ts +11 -0
- package/plugin.js +1 -2
- package/resolveConfig.d.ts +12 -0
- package/resolveConfig.js +2 -7
- package/scripts/create-plugin-list.js +2 -2
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +439 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +227 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +3 -0
- package/src/cli/init/index.js +50 -0
- package/src/cli/shared.js +6 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +50 -575
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +2405 -1948
- package/src/css/preflight.css +22 -9
- package/src/featureFlags.js +26 -10
- package/src/index.js +19 -6
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/content.js +212 -0
- package/src/lib/defaultExtractor.js +211 -0
- package/src/lib/detectNesting.js +39 -0
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +508 -153
- package/src/lib/expandTailwindAtRules.js +130 -104
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +596 -70
- package/src/lib/normalizeTailwindDirectives.js +10 -3
- package/src/lib/offsets.js +270 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/resolveDefaultsAtRules.js +105 -47
- package/src/lib/setupContextUtils.js +828 -196
- package/src/lib/setupTrackingContext.js +19 -54
- package/src/lib/sharedState.js +45 -7
- package/src/lib/substituteScreenAtRules.js +6 -3
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +19 -2
- 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 -16
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +31 -14
- package/src/util/createUtilityPlugin.js +2 -11
- package/src/util/dataTypes.js +256 -0
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +319 -0
- package/src/util/getAllConfigs.js +19 -0
- package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
- package/src/util/log.js +23 -22
- package/src/util/nameClass.js +14 -6
- package/src/util/negateValue.js +15 -5
- package/src/util/normalizeConfig.js +300 -0
- package/src/util/normalizeScreens.js +140 -0
- package/src/util/parseAnimationValue.js +7 -1
- package/src/util/parseBoxShadowValue.js +72 -0
- package/src/util/parseDependency.js +37 -38
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +216 -197
- package/src/util/prefixSelector.js +7 -8
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +86 -91
- package/src/util/splitAtTopLevelOnly.js +45 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +33 -8
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +14 -9
- package/stubs/defaultConfig.stub.js +186 -117
- package/stubs/simpleConfig.stub.js +1 -1
- package/types/config.d.ts +362 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +276 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +342 -0
- package/types/index.d.ts +7 -0
- package/lib/lib/setupWatchingContext.js +0 -331
- package/nesting/plugin.js +0 -41
- package/src/lib/setupWatchingContext.js +0 -306
|
@@ -1,289 +1,254 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function isFunction(input) {
|
|
27
|
-
return typeof input === 'function';
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveConfig
|
|
8
|
+
});
|
|
9
|
+
const _negateValue = /*#__PURE__*/ _interopRequireDefault(require("./negateValue"));
|
|
10
|
+
const _corePluginList = /*#__PURE__*/ _interopRequireDefault(require("../corePluginList"));
|
|
11
|
+
const _configurePlugins = /*#__PURE__*/ _interopRequireDefault(require("./configurePlugins"));
|
|
12
|
+
const _colors = /*#__PURE__*/ _interopRequireDefault(require("../public/colors"));
|
|
13
|
+
const _defaults = require("./defaults");
|
|
14
|
+
const _toPath = require("./toPath");
|
|
15
|
+
const _normalizeConfig = require("./normalizeConfig");
|
|
16
|
+
const _isPlainObject = /*#__PURE__*/ _interopRequireDefault(require("./isPlainObject"));
|
|
17
|
+
const _cloneDeep = require("./cloneDeep");
|
|
18
|
+
const _pluginUtils = require("./pluginUtils");
|
|
19
|
+
const _withAlphaVariable = require("./withAlphaVariable");
|
|
20
|
+
const _toColorValue = /*#__PURE__*/ _interopRequireDefault(require("./toColorValue"));
|
|
21
|
+
function _interopRequireDefault(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return typeof input === 'object' && input !== null;
|
|
26
|
+
function isFunction(input) {
|
|
27
|
+
return typeof input === "function";
|
|
32
28
|
}
|
|
33
|
-
|
|
34
29
|
function mergeWith(target, ...sources) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
let customizer = sources.pop();
|
|
31
|
+
for (let source of sources){
|
|
32
|
+
for(let k in source){
|
|
33
|
+
let merged = customizer(target[k], source[k]);
|
|
34
|
+
if (merged === undefined) {
|
|
35
|
+
if ((0, _isPlainObject.default)(target[k]) && (0, _isPlainObject.default)(source[k])) {
|
|
36
|
+
target[k] = mergeWith({}, target[k], source[k], customizer);
|
|
37
|
+
} else {
|
|
38
|
+
target[k] = source[k];
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
target[k] = merged;
|
|
42
|
+
}
|
|
46
43
|
}
|
|
47
|
-
} else {
|
|
48
|
-
target[k] = merged;
|
|
49
|
-
}
|
|
50
44
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return target;
|
|
45
|
+
return target;
|
|
54
46
|
}
|
|
55
|
-
|
|
56
47
|
const configUtils = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
colors: _colors.default,
|
|
49
|
+
negative (scale) {
|
|
50
|
+
// TODO: Log that this function isn't really needed anymore?
|
|
51
|
+
return Object.keys(scale).filter((key)=>scale[key] !== "0").reduce((negativeScale, key)=>{
|
|
52
|
+
let negativeValue = (0, _negateValue.default)(scale[key]);
|
|
53
|
+
if (negativeValue !== undefined) {
|
|
54
|
+
negativeScale[`-${key}`] = negativeValue;
|
|
55
|
+
}
|
|
56
|
+
return negativeScale;
|
|
57
|
+
}, {});
|
|
58
|
+
},
|
|
59
|
+
breakpoints (screens) {
|
|
60
|
+
return Object.keys(screens).filter((key)=>typeof screens[key] === "string").reduce((breakpoints, key)=>({
|
|
61
|
+
...breakpoints,
|
|
62
|
+
[`screen-${key}`]: screens[key]
|
|
63
|
+
}), {});
|
|
64
|
+
}
|
|
71
65
|
};
|
|
72
|
-
|
|
73
66
|
function value(valueToResolve, ...args) {
|
|
74
|
-
|
|
67
|
+
return isFunction(valueToResolve) ? valueToResolve(...args) : valueToResolve;
|
|
75
68
|
}
|
|
76
|
-
|
|
77
69
|
function collectExtends(items) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
70
|
+
return items.reduce((merged, { extend })=>{
|
|
71
|
+
return mergeWith(merged, extend, (mergedValue, extendValue)=>{
|
|
72
|
+
if (mergedValue === undefined) {
|
|
73
|
+
return [
|
|
74
|
+
extendValue
|
|
75
|
+
];
|
|
76
|
+
}
|
|
77
|
+
if (Array.isArray(mergedValue)) {
|
|
78
|
+
return [
|
|
79
|
+
extendValue,
|
|
80
|
+
...mergedValue
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
extendValue,
|
|
85
|
+
mergedValue
|
|
86
|
+
];
|
|
87
|
+
});
|
|
88
|
+
}, {});
|
|
93
89
|
}
|
|
94
|
-
|
|
95
90
|
function mergeThemes(themes) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
91
|
+
return {
|
|
92
|
+
...themes.reduce((merged, theme)=>(0, _defaults.defaults)(merged, theme), {}),
|
|
93
|
+
// In order to resolve n config objects, we combine all of their `extend` properties
|
|
94
|
+
// into arrays instead of objects so they aren't overridden.
|
|
95
|
+
extend: collectExtends(themes)
|
|
96
|
+
};
|
|
101
97
|
}
|
|
102
|
-
|
|
103
98
|
function mergeExtensionCustomizer(merged, value) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
// When we have an array of objects, we do want to merge it
|
|
100
|
+
if (Array.isArray(merged) && (0, _isPlainObject.default)(merged[0])) {
|
|
101
|
+
return merged.concat(value);
|
|
102
|
+
}
|
|
103
|
+
// When the incoming value is an array, and the existing config is an object, prepend the existing object
|
|
104
|
+
if (Array.isArray(value) && (0, _isPlainObject.default)(value[0]) && (0, _isPlainObject.default)(merged)) {
|
|
105
|
+
return [
|
|
106
|
+
merged,
|
|
107
|
+
...value
|
|
108
|
+
];
|
|
109
|
+
}
|
|
110
|
+
// Override arrays (for example for font-families, box-shadows, ...)
|
|
111
|
+
if (Array.isArray(value)) {
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
// Execute default behaviour
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
function mergeExtensions({ extend , ...theme }) {
|
|
118
|
+
return mergeWith(theme, extend, (themeValue, extensions)=>{
|
|
119
|
+
// The `extend` property is an array, so we need to check if it contains any functions
|
|
120
|
+
if (!isFunction(themeValue) && !extensions.some(isFunction)) {
|
|
121
|
+
return mergeWith({}, themeValue, ...extensions, mergeExtensionCustomizer);
|
|
122
|
+
}
|
|
123
|
+
return (resolveThemePath, utils)=>mergeWith({}, ...[
|
|
124
|
+
themeValue,
|
|
125
|
+
...extensions
|
|
126
|
+
].map((e)=>value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
127
|
+
});
|
|
121
128
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param {string} key
|
|
132
|
+
* @return {Iterable<string[] & {alpha: string | undefined}>}
|
|
133
|
+
*/ function* toPaths(key) {
|
|
134
|
+
let path = (0, _toPath.toPath)(key);
|
|
135
|
+
if (path.length === 0) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
yield path;
|
|
139
|
+
if (Array.isArray(key)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let pattern = /^(.*?)\s*\/\s*([^/]+)$/;
|
|
143
|
+
let matches = key.match(pattern);
|
|
144
|
+
if (matches !== null) {
|
|
145
|
+
let [, prefix, alpha] = matches;
|
|
146
|
+
let newPath = (0, _toPath.toPath)(prefix);
|
|
147
|
+
newPath.alpha = alpha;
|
|
148
|
+
yield newPath;
|
|
131
149
|
}
|
|
132
|
-
|
|
133
|
-
return (resolveThemePath, utils) => mergeWith({}, ...[themeValue, ...extensions].map(e => value(e, resolveThemePath, utils)), mergeExtensionCustomizer);
|
|
134
|
-
});
|
|
135
150
|
}
|
|
136
|
-
|
|
137
151
|
function resolveFunctionKeys(object) {
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
// theme('colors.red.500 / 0.5') -> ['colors', 'red', '500 / 0', '5]
|
|
153
|
+
const resolvePath = (key, defaultValue)=>{
|
|
154
|
+
for (const path of toPaths(key)){
|
|
155
|
+
let index = 0;
|
|
156
|
+
let val = object;
|
|
157
|
+
while(val !== undefined && val !== null && index < path.length){
|
|
158
|
+
val = val[path[index++]];
|
|
159
|
+
let shouldResolveAsFn = isFunction(val) && (path.alpha === undefined || index <= path.length - 1);
|
|
160
|
+
val = shouldResolveAsFn ? val(resolvePath, configUtils) : val;
|
|
161
|
+
}
|
|
162
|
+
if (val !== undefined) {
|
|
163
|
+
if (path.alpha !== undefined) {
|
|
164
|
+
let normalized = (0, _pluginUtils.parseColorFormat)(val);
|
|
165
|
+
return (0, _withAlphaVariable.withAlphaValue)(normalized, path.alpha, (0, _toColorValue.default)(normalized));
|
|
166
|
+
}
|
|
167
|
+
if ((0, _isPlainObject.default)(val)) {
|
|
168
|
+
return (0, _cloneDeep.cloneDeep)(val);
|
|
169
|
+
}
|
|
170
|
+
return val;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return defaultValue;
|
|
160
174
|
};
|
|
161
|
-
|
|
175
|
+
Object.assign(resolvePath, {
|
|
176
|
+
theme: resolvePath,
|
|
177
|
+
...configUtils
|
|
178
|
+
});
|
|
179
|
+
return Object.keys(object).reduce((resolved, key)=>{
|
|
180
|
+
resolved[key] = isFunction(object[key]) ? object[key](resolvePath, configUtils) : object[key];
|
|
181
|
+
return resolved;
|
|
182
|
+
}, {});
|
|
162
183
|
}
|
|
163
|
-
|
|
164
184
|
function extractPluginConfigs(configs) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
185
|
+
let allConfigs = [];
|
|
186
|
+
configs.forEach((config)=>{
|
|
187
|
+
allConfigs = [
|
|
188
|
+
...allConfigs,
|
|
189
|
+
config
|
|
190
|
+
];
|
|
191
|
+
var ref;
|
|
192
|
+
const plugins = (ref = config === null || config === void 0 ? void 0 : config.plugins) !== null && ref !== void 0 ? ref : [];
|
|
193
|
+
if (plugins.length === 0) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
plugins.forEach((plugin)=>{
|
|
197
|
+
if (plugin.__isOptionsFunction) {
|
|
198
|
+
plugin = plugin();
|
|
199
|
+
}
|
|
200
|
+
var ref;
|
|
201
|
+
allConfigs = [
|
|
202
|
+
...allConfigs,
|
|
203
|
+
...extractPluginConfigs([
|
|
204
|
+
(ref = plugin === null || plugin === void 0 ? void 0 : plugin.config) !== null && ref !== void 0 ? ref : {}
|
|
205
|
+
])
|
|
206
|
+
];
|
|
207
|
+
});
|
|
184
208
|
});
|
|
185
|
-
|
|
186
|
-
return allConfigs;
|
|
209
|
+
return allConfigs;
|
|
187
210
|
}
|
|
188
|
-
|
|
189
211
|
function resolveCorePlugins(corePluginConfigs) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
const result = [
|
|
213
|
+
...corePluginConfigs
|
|
214
|
+
].reduceRight((resolved, corePluginConfig)=>{
|
|
215
|
+
if (isFunction(corePluginConfig)) {
|
|
216
|
+
return corePluginConfig({
|
|
217
|
+
corePlugins: resolved
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return (0, _configurePlugins.default)(corePluginConfig, resolved);
|
|
221
|
+
}, _corePluginList.default);
|
|
222
|
+
return result;
|
|
200
223
|
}
|
|
201
|
-
|
|
202
224
|
function resolvePluginLists(pluginLists) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
const result = [
|
|
226
|
+
...pluginLists
|
|
227
|
+
].reduceRight((resolved, pluginList)=>{
|
|
228
|
+
return [
|
|
229
|
+
...resolved,
|
|
230
|
+
...pluginList
|
|
231
|
+
];
|
|
232
|
+
}, []);
|
|
233
|
+
return result;
|
|
207
234
|
}
|
|
208
|
-
|
|
209
235
|
function resolveConfig(configs) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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));
|
|
229
|
-
}
|
|
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'.`);
|
|
236
|
+
let allConfigs = [
|
|
237
|
+
...extractPluginConfigs(configs),
|
|
238
|
+
{
|
|
239
|
+
prefix: "",
|
|
240
|
+
important: false,
|
|
241
|
+
separator: ":"
|
|
279
242
|
}
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}
|
|
243
|
+
];
|
|
244
|
+
var ref, ref1;
|
|
245
|
+
return (0, _normalizeConfig.normalizeConfig)((0, _defaults.defaults)({
|
|
246
|
+
theme: resolveFunctionKeys(mergeExtensions(mergeThemes(allConfigs.map((t)=>{
|
|
247
|
+
return (ref = t === null || t === void 0 ? void 0 : t.theme) !== null && ref !== void 0 ? ref : {};
|
|
248
|
+
})))),
|
|
249
|
+
corePlugins: resolveCorePlugins(allConfigs.map((c)=>c.corePlugins)),
|
|
250
|
+
plugins: resolvePluginLists(configs.map((c)=>{
|
|
251
|
+
return (ref1 = c === null || c === void 0 ? void 0 : c.plugins) !== null && ref1 !== void 0 ? ref1 : [];
|
|
252
|
+
}))
|
|
253
|
+
}, ...allConfigs));
|
|
254
|
+
}
|
|
@@ -1,59 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>resolveConfigPath
|
|
8
|
+
});
|
|
9
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
10
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
14
16
|
function isObject(value) {
|
|
15
|
-
|
|
17
|
+
return typeof value === "object" && value !== null;
|
|
16
18
|
}
|
|
17
|
-
|
|
18
19
|
function isEmpty(obj) {
|
|
19
|
-
|
|
20
|
+
return Object.keys(obj).length === 0;
|
|
20
21
|
}
|
|
21
|
-
|
|
22
22
|
function isString(value) {
|
|
23
|
-
|
|
23
|
+
return typeof value === "string" || value instanceof String;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
function resolveConfigPath(pathOrConfig) {
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
// require('tailwindcss')({ theme: ..., variants: ... })
|
|
27
|
+
if (isObject(pathOrConfig) && pathOrConfig.config === undefined && !isEmpty(pathOrConfig)) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
// require('tailwindcss')({ config: 'custom-config.js' })
|
|
31
|
+
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isString(pathOrConfig.config)) {
|
|
32
|
+
return _path.default.resolve(pathOrConfig.config);
|
|
33
|
+
}
|
|
34
|
+
// require('tailwindcss')({ config: { theme: ..., variants: ... } })
|
|
35
|
+
if (isObject(pathOrConfig) && pathOrConfig.config !== undefined && isObject(pathOrConfig.config)) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
// require('tailwindcss')('custom-config.js')
|
|
39
|
+
if (isString(pathOrConfig)) {
|
|
40
|
+
return _path.default.resolve(pathOrConfig);
|
|
41
|
+
}
|
|
42
|
+
// require('tailwindcss')
|
|
43
|
+
for (const configFile of [
|
|
44
|
+
"./tailwind.config.js",
|
|
45
|
+
"./tailwind.config.cjs"
|
|
46
|
+
]){
|
|
47
|
+
try {
|
|
48
|
+
const configPath = _path.default.resolve(configFile);
|
|
49
|
+
_fs.default.accessSync(configPath);
|
|
50
|
+
return configPath;
|
|
51
|
+
} catch (err) {}
|
|
52
|
+
}
|
|
29
53
|
return null;
|
|
30
|
-
|
|
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)) {
|
|
39
|
-
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
|
-
}
|
|
54
|
+
}
|
package/lib/util/responsive.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>responsive
|
|
8
|
+
});
|
|
9
|
+
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
10
|
+
const _cloneNodes = /*#__PURE__*/ _interopRequireDefault(require("./cloneNodes"));
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
14
16
|
function responsive(rules) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
return _postcss.default.atRule({
|
|
18
|
+
name: "responsive"
|
|
19
|
+
}).append((0, _cloneNodes.default)(Array.isArray(rules) ? rules : [
|
|
20
|
+
rules
|
|
21
|
+
]));
|
|
22
|
+
}
|