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.
- package/lib/cli/build/deps.js +34 -18
- package/lib/cli/build/index.js +45 -12
- package/lib/cli/build/plugin.js +273 -90
- package/lib/cli/build/utils.js +56 -24
- package/lib/cli/build/watching.js +156 -38
- package/lib/cli/help/index.js +61 -16
- package/lib/cli/index.js +121 -62
- package/lib/cli/init/index.js +47 -23
- package/lib/cli-peer-dependencies.js +23 -13
- package/lib/cli.js +5 -1
- package/lib/corePluginList.js +7 -4
- package/lib/corePlugins.js +855 -386
- package/lib/featureFlags.js +43 -18
- package/lib/lib/cacheInvalidation.js +78 -30
- package/lib/lib/collapseAdjacentRules.js +46 -23
- package/lib/lib/collapseDuplicateDeclarations.js +70 -27
- package/lib/lib/content.js +134 -41
- package/lib/lib/defaultExtractor.js +201 -96
- package/lib/lib/detectNesting.js +38 -12
- package/lib/lib/evaluateTailwindFunctions.js +192 -103
- package/lib/lib/expandApplyAtRules.js +488 -181
- package/lib/lib/expandTailwindAtRules.js +240 -70
- package/lib/lib/findAtConfigPath.js +34 -15
- package/lib/lib/generateRules.js +775 -353
- package/lib/lib/getModuleDependencies.js +67 -29
- package/lib/lib/load-config.js +27 -17
- package/lib/lib/normalizeTailwindDirectives.js +73 -27
- package/lib/lib/offsets.js +227 -62
- package/lib/lib/partitionApplyAtRules.js +53 -29
- package/lib/lib/regex.js +50 -28
- package/lib/lib/remap-bitfield.js +86 -9
- package/lib/lib/resolveDefaultsAtRules.js +123 -53
- package/lib/lib/setupContextUtils.js +1117 -584
- package/lib/lib/setupTrackingContext.js +149 -58
- package/lib/lib/sharedState.js +71 -23
- package/lib/lib/substituteScreenAtRules.js +19 -9
- package/lib/oxide/cli/build/deps.js +46 -23
- package/lib/oxide/cli/build/index.js +44 -12
- package/lib/oxide/cli/build/plugin.js +271 -89
- package/lib/oxide/cli/build/utils.js +55 -24
- package/lib/oxide/cli/build/watching.js +153 -36
- package/lib/oxide/cli/help/index.js +60 -16
- package/lib/oxide/cli/index.js +128 -67
- package/lib/oxide/cli/init/index.js +40 -19
- package/lib/oxide/cli.js +3 -2
- package/lib/plugin.js +58 -31
- package/lib/postcss-plugins/nesting/index.js +13 -7
- package/lib/postcss-plugins/nesting/plugin.js +65 -20
- package/lib/processTailwindFeatures.js +41 -10
- package/lib/public/colors.js +25 -16
- package/lib/public/create-plugin.js +11 -6
- package/lib/public/default-config.js +12 -6
- package/lib/public/default-theme.js +12 -6
- package/lib/public/load-config.js +9 -5
- package/lib/public/resolve-config.js +10 -6
- package/lib/util/applyImportantSelector.js +28 -17
- package/lib/util/bigSign.js +9 -6
- package/lib/util/buildMediaQuery.js +19 -10
- package/lib/util/cloneDeep.js +19 -9
- package/lib/util/cloneNodes.js +29 -14
- package/lib/util/color.js +87 -47
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +18 -9
- package/lib/util/createPlugin.js +17 -8
- package/lib/util/createUtilityPlugin.js +30 -16
- package/lib/util/dataTypes.js +189 -38
- package/lib/util/defaults.js +21 -9
- package/lib/util/escapeClassName.js +15 -9
- package/lib/util/escapeCommas.js +9 -6
- package/lib/util/flattenColorPalette.js +11 -7
- package/lib/util/formatVariantSelector.js +209 -60
- package/lib/util/getAllConfigs.js +44 -35
- package/lib/util/hashConfig.js +12 -8
- package/lib/util/isKeyframeRule.js +10 -7
- package/lib/util/isPlainObject.js +14 -9
- package/lib/util/isSyntacticallyValidPropertyValue.js +45 -14
- package/lib/util/log.js +20 -9
- package/lib/util/nameClass.js +31 -10
- package/lib/util/negateValue.js +28 -10
- package/lib/util/normalizeConfig.js +242 -63
- package/lib/util/normalizeScreens.js +145 -70
- package/lib/util/parseAnimationValue.js +64 -14
- package/lib/util/parseBoxShadowValue.js +63 -14
- package/lib/util/parseDependency.js +39 -13
- package/lib/util/parseGlob.js +25 -8
- package/lib/util/parseObjectStyles.js +29 -18
- package/lib/util/pluginUtils.js +196 -77
- package/lib/util/prefixSelector.js +31 -12
- package/lib/util/pseudoElements.js +116 -34
- package/lib/util/removeAlphaVariables.js +23 -8
- package/lib/util/resolveConfig.js +224 -105
- package/lib/util/resolveConfigPath.js +45 -15
- package/lib/util/responsive.js +10 -6
- package/lib/util/splitAtTopLevelOnly.js +46 -10
- package/lib/util/tap.js +11 -7
- package/lib/util/toColorValue.js +10 -7
- package/lib/util/toPath.js +28 -8
- package/lib/util/transformThemeValue.js +49 -14
- package/lib/util/validateConfig.js +25 -15
- package/lib/util/validateFormalSyntax.js +14 -6
- package/lib/util/withAlphaVariable.js +54 -30
- package/package.json +18 -22
- package/peers/index.js +57849 -43101
- package/src/lib/expandTailwindAtRules.js +1 -1
- package/src/lib/setupTrackingContext.js +1 -1
- package/src/util/color.js +1 -1
- package/src/util/colorNames.js +150 -0
- package/src/util/pseudoElements.js +4 -4
package/lib/util/nameClass.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value:
|
|
4
|
-
})
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
5
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
6
|
-
enumerable:
|
|
7
|
+
enumerable: true,
|
|
7
8
|
get: all[name]
|
|
8
9
|
});
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
asClass: function() {
|
|
13
|
+
return asClass;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return nameClass;
|
|
17
|
+
},
|
|
18
|
+
formatClass: function() {
|
|
19
|
+
return formatClass;
|
|
20
|
+
}
|
|
13
21
|
});
|
|
14
|
-
const _escapeClassName =
|
|
15
|
-
|
|
22
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("./escapeClassName"));
|
|
23
|
+
const _escapeCommas = /*#__PURE__*/ _interop_require_default(require("./escapeCommas"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
16
25
|
return obj && obj.__esModule ? obj : {
|
|
17
26
|
default: obj
|
|
18
27
|
};
|
|
@@ -24,5 +33,17 @@ function nameClass(classPrefix, key) {
|
|
|
24
33
|
return asClass(formatClass(classPrefix, key));
|
|
25
34
|
}
|
|
26
35
|
function formatClass(classPrefix, key) {
|
|
27
|
-
|
|
36
|
+
if (key === "DEFAULT") {
|
|
37
|
+
return classPrefix;
|
|
38
|
+
}
|
|
39
|
+
if (key === "-" || key === "-DEFAULT") {
|
|
40
|
+
return `-${classPrefix}`;
|
|
41
|
+
}
|
|
42
|
+
if (key.startsWith("-")) {
|
|
43
|
+
return `-${classPrefix}${key}`;
|
|
44
|
+
}
|
|
45
|
+
if (key.startsWith("/")) {
|
|
46
|
+
return `${classPrefix}${key}`;
|
|
47
|
+
}
|
|
48
|
+
return `${classPrefix}-${key}`;
|
|
28
49
|
}
|
package/lib/util/negateValue.js
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return negateValue;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
2
11
|
function negateValue(value) {
|
|
3
|
-
|
|
4
|
-
if (
|
|
5
|
-
|
|
12
|
+
value = `${value}`;
|
|
13
|
+
if (value === "0") {
|
|
14
|
+
return "0";
|
|
15
|
+
}
|
|
16
|
+
// Flip sign of numbers
|
|
17
|
+
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
|
18
|
+
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
|
19
|
+
}
|
|
20
|
+
// What functions we support negating numeric values for
|
|
21
|
+
// var() isn't inherently a numeric function but we support it anyway
|
|
22
|
+
// The trigonometric functions are omitted because you'll need to use calc(…) with them _anyway_
|
|
23
|
+
// to produce generally useful results and that will be covered already
|
|
24
|
+
let numericFunctions = [
|
|
6
25
|
"var",
|
|
7
26
|
"calc",
|
|
8
27
|
"min",
|
|
9
28
|
"max",
|
|
10
29
|
"clamp"
|
|
11
|
-
]
|
|
30
|
+
];
|
|
31
|
+
for (const fn of numericFunctions){
|
|
32
|
+
if (value.includes(`${fn}(`)) {
|
|
33
|
+
return `calc(${value} * -1)`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
12
36
|
}
|
|
13
|
-
Object.defineProperty(exports, "__esModule", {
|
|
14
|
-
value: !0
|
|
15
|
-
}), Object.defineProperty(exports, "default", {
|
|
16
|
-
enumerable: !0,
|
|
17
|
-
get: ()=>negateValue
|
|
18
|
-
});
|
|
@@ -1,103 +1,282 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value:
|
|
4
|
-
}), Object.defineProperty(exports, "normalizeConfig", {
|
|
5
|
-
enumerable: !0,
|
|
6
|
-
get: ()=>normalizeConfig
|
|
3
|
+
value: true
|
|
7
4
|
});
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
var cache = _getRequireWildcardCache(nodeInterop);
|
|
14
|
-
if (cache && cache.has(obj)) return cache.get(obj);
|
|
15
|
-
var newObj = {}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
16
|
-
for(var key in obj)if ("default" !== key && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
17
|
-
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
18
|
-
desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key];
|
|
5
|
+
Object.defineProperty(exports, "normalizeConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return normalizeConfig;
|
|
19
9
|
}
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
});
|
|
11
|
+
const _featureFlags = require("../featureFlags");
|
|
12
|
+
const _log = /*#__PURE__*/ _interop_require_wildcard(require("./log"));
|
|
22
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
23
|
-
if ("function"
|
|
24
|
-
var cacheBabelInterop = new WeakMap()
|
|
14
|
+
if (typeof WeakMap !== "function") return null;
|
|
15
|
+
var cacheBabelInterop = new WeakMap();
|
|
16
|
+
var cacheNodeInterop = new WeakMap();
|
|
25
17
|
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
26
18
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
19
|
})(nodeInterop);
|
|
28
20
|
}
|
|
21
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
22
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
25
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
26
|
+
return {
|
|
27
|
+
default: obj
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
31
|
+
if (cache && cache.has(obj)) {
|
|
32
|
+
return cache.get(obj);
|
|
33
|
+
}
|
|
34
|
+
var newObj = {};
|
|
35
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
36
|
+
for(var key in obj){
|
|
37
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
38
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
39
|
+
if (desc && (desc.get || desc.set)) {
|
|
40
|
+
Object.defineProperty(newObj, key, desc);
|
|
41
|
+
} else {
|
|
42
|
+
newObj[key] = obj[key];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
newObj.default = obj;
|
|
47
|
+
if (cache) {
|
|
48
|
+
cache.set(obj, newObj);
|
|
49
|
+
}
|
|
50
|
+
return newObj;
|
|
51
|
+
}
|
|
29
52
|
function normalizeConfig(config) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
// Quick structure validation
|
|
54
|
+
/**
|
|
55
|
+
* type FilePath = string
|
|
56
|
+
* type RawFile = { raw: string, extension?: string }
|
|
57
|
+
* type ExtractorFn = (content: string) => Array<string>
|
|
58
|
+
* type TransformerFn = (content: string) => string
|
|
59
|
+
*
|
|
60
|
+
* type Content =
|
|
61
|
+
* | Array<FilePath | RawFile>
|
|
62
|
+
* | {
|
|
63
|
+
* files: Array<FilePath | RawFile>,
|
|
64
|
+
* extract?: ExtractorFn | { [extension: string]: ExtractorFn }
|
|
65
|
+
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
|
66
|
+
* }
|
|
67
|
+
*/ let valid = (()=>{
|
|
68
|
+
// `config.purge` should not exist anymore
|
|
69
|
+
if (config.purge) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
// `config.content` should exist
|
|
73
|
+
if (!config.content) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
// `config.content` should be an object or an array
|
|
77
|
+
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
81
|
+
if (Array.isArray(config.content)) {
|
|
82
|
+
return config.content.every((path)=>{
|
|
83
|
+
// `path` can be a string
|
|
84
|
+
if (typeof path === "string") return true;
|
|
85
|
+
// `path` can be an object { raw: string, extension?: string }
|
|
86
|
+
// `raw` must be a string
|
|
87
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
88
|
+
// `extension` (if provided) should also be a string
|
|
89
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// When `config.content` is an object
|
|
96
|
+
if (typeof config.content === "object" && config.content !== null) {
|
|
97
|
+
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
|
36
98
|
if (Object.keys(config.content).some((key)=>![
|
|
37
99
|
"files",
|
|
38
100
|
"relative",
|
|
39
101
|
"extract",
|
|
40
102
|
"transform"
|
|
41
|
-
].includes(key)))
|
|
103
|
+
].includes(key))) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
// `config.content.files` should exist of FilePaths or RawFiles
|
|
42
107
|
if (Array.isArray(config.content.files)) {
|
|
43
|
-
if (!config.content.files.every((path)=>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
108
|
+
if (!config.content.files.every((path)=>{
|
|
109
|
+
// `path` can be a string
|
|
110
|
+
if (typeof path === "string") return true;
|
|
111
|
+
// `path` can be an object { raw: string, extension?: string }
|
|
112
|
+
// `raw` must be a string
|
|
113
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
114
|
+
// `extension` (if provided) should also be a string
|
|
115
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
})) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
|
123
|
+
if (typeof config.content.extract === "object") {
|
|
124
|
+
for (let value of Object.values(config.content.extract)){
|
|
125
|
+
if (typeof value !== "function") {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
133
|
+
if (typeof config.content.transform === "object") {
|
|
134
|
+
for (let value of Object.values(config.content.transform)){
|
|
135
|
+
if (typeof value !== "function") {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
// `config.content.relative` is optional and can be a boolean
|
|
143
|
+
if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
51
146
|
}
|
|
52
|
-
return
|
|
147
|
+
return true;
|
|
53
148
|
}
|
|
54
|
-
return
|
|
55
|
-
})()
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
149
|
+
return false;
|
|
150
|
+
})();
|
|
151
|
+
if (!valid) {
|
|
152
|
+
_log.default.warn("purge-deprecation", [
|
|
153
|
+
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
|
154
|
+
"Update your configuration file to eliminate this warning.",
|
|
155
|
+
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
|
156
|
+
]);
|
|
157
|
+
}
|
|
158
|
+
// Normalize the `safelist`
|
|
159
|
+
config.safelist = (()=>{
|
|
60
160
|
var _purge_options;
|
|
61
161
|
let { content , purge , safelist } = config;
|
|
62
|
-
|
|
63
|
-
|
|
162
|
+
if (Array.isArray(safelist)) return safelist;
|
|
163
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
|
164
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
|
165
|
+
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;
|
|
166
|
+
return [];
|
|
167
|
+
})();
|
|
168
|
+
// Normalize the `blocklist`
|
|
169
|
+
config.blocklist = (()=>{
|
|
64
170
|
let { blocklist } = config;
|
|
65
171
|
if (Array.isArray(blocklist)) {
|
|
66
|
-
if (blocklist.every((item)=>"string"
|
|
172
|
+
if (blocklist.every((item)=>typeof item === "string")) {
|
|
173
|
+
return blocklist;
|
|
174
|
+
}
|
|
67
175
|
_log.default.warn("blocklist-invalid", [
|
|
68
176
|
"The `blocklist` option must be an array of strings.",
|
|
69
177
|
"https://tailwindcss.com/docs/content-configuration#discarding-classes"
|
|
70
178
|
]);
|
|
71
179
|
}
|
|
72
180
|
return [];
|
|
73
|
-
})()
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
181
|
+
})();
|
|
182
|
+
// Normalize prefix option
|
|
183
|
+
if (typeof config.prefix === "function") {
|
|
184
|
+
_log.default.warn("prefix-function", [
|
|
185
|
+
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
|
186
|
+
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
|
187
|
+
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
|
188
|
+
]);
|
|
189
|
+
config.prefix = "";
|
|
190
|
+
} else {
|
|
191
|
+
var _config_prefix;
|
|
192
|
+
config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
|
|
193
|
+
}
|
|
194
|
+
// Normalize the `content`
|
|
195
|
+
config.content = {
|
|
78
196
|
relative: (()=>{
|
|
79
197
|
let { content } = config;
|
|
80
|
-
|
|
198
|
+
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
199
|
+
return content.relative;
|
|
200
|
+
}
|
|
201
|
+
return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
|
|
81
202
|
})(),
|
|
82
203
|
files: (()=>{
|
|
83
204
|
let { content , purge } = config;
|
|
84
|
-
|
|
205
|
+
if (Array.isArray(purge)) return purge;
|
|
206
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
|
207
|
+
if (Array.isArray(content)) return content;
|
|
208
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
|
209
|
+
if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
|
|
210
|
+
return [];
|
|
85
211
|
})(),
|
|
86
212
|
extract: (()=>{
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
213
|
+
let extract = (()=>{
|
|
214
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_extract, _config_content1, _config_content_extract, _config_purge2, _config_purge_options, _config_content2, _config_content_options;
|
|
215
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
|
|
216
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
|
|
217
|
+
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_extract = _config_purge1.extract) === null || _config_purge_extract === void 0 ? void 0 : _config_purge_extract.DEFAULT) return config.purge.extract.DEFAULT;
|
|
218
|
+
if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_extract = _config_content1.extract) === null || _config_content_extract === void 0 ? void 0 : _config_content_extract.DEFAULT) return config.content.extract.DEFAULT;
|
|
219
|
+
if ((_config_purge2 = config.purge) === null || _config_purge2 === void 0 ? void 0 : (_config_purge_options = _config_purge2.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.extractors) return config.purge.options.extractors;
|
|
220
|
+
if ((_config_content2 = config.content) === null || _config_content2 === void 0 ? void 0 : (_config_content_options = _config_content2.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.extractors) return config.content.options.extractors;
|
|
221
|
+
return {};
|
|
222
|
+
})();
|
|
223
|
+
let extractors = {};
|
|
224
|
+
let defaultExtractor = (()=>{
|
|
225
|
+
var _config_purge, _config_purge_options, _config_content, _config_content_options;
|
|
226
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : (_config_purge_options = _config_purge.options) === null || _config_purge_options === void 0 ? void 0 : _config_purge_options.defaultExtractor) {
|
|
227
|
+
return config.purge.options.defaultExtractor;
|
|
228
|
+
}
|
|
229
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : (_config_content_options = _config_content.options) === null || _config_content_options === void 0 ? void 0 : _config_content_options.defaultExtractor) {
|
|
230
|
+
return config.content.options.defaultExtractor;
|
|
231
|
+
}
|
|
232
|
+
return undefined;
|
|
233
|
+
})();
|
|
234
|
+
if (defaultExtractor !== undefined) {
|
|
235
|
+
extractors.DEFAULT = defaultExtractor;
|
|
236
|
+
}
|
|
237
|
+
// Functions
|
|
238
|
+
if (typeof extract === "function") {
|
|
239
|
+
extractors.DEFAULT = extract;
|
|
240
|
+
} else if (Array.isArray(extract)) {
|
|
241
|
+
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
242
|
+
for (let extension of extensions){
|
|
243
|
+
extractors[extension] = extractor;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
} else if (typeof extract === "object" && extract !== null) {
|
|
247
|
+
Object.assign(extractors, extract);
|
|
248
|
+
}
|
|
92
249
|
return extractors;
|
|
93
250
|
})(),
|
|
94
|
-
transform: (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
251
|
+
transform: (()=>{
|
|
252
|
+
let transform = (()=>{
|
|
253
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
|
|
254
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
|
|
255
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
|
|
256
|
+
if ((_config_purge1 = config.purge) === null || _config_purge1 === void 0 ? void 0 : (_config_purge_transform = _config_purge1.transform) === null || _config_purge_transform === void 0 ? void 0 : _config_purge_transform.DEFAULT) return config.purge.transform.DEFAULT;
|
|
257
|
+
if ((_config_content1 = config.content) === null || _config_content1 === void 0 ? void 0 : (_config_content_transform = _config_content1.transform) === null || _config_content_transform === void 0 ? void 0 : _config_content_transform.DEFAULT) return config.content.transform.DEFAULT;
|
|
258
|
+
return {};
|
|
259
|
+
})();
|
|
260
|
+
let transformers = {};
|
|
261
|
+
if (typeof transform === "function") {
|
|
262
|
+
transformers.DEFAULT = transform;
|
|
263
|
+
}
|
|
264
|
+
if (typeof transform === "object" && transform !== null) {
|
|
265
|
+
Object.assign(transformers, transform);
|
|
266
|
+
}
|
|
267
|
+
return transformers;
|
|
268
|
+
})()
|
|
269
|
+
};
|
|
270
|
+
// Validate globs to prevent bogus globs.
|
|
271
|
+
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
272
|
+
for (let file of config.content.files){
|
|
273
|
+
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
274
|
+
_log.default.warn("invalid-glob-braces", [
|
|
275
|
+
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
|
276
|
+
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
|
277
|
+
]);
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
101
280
|
}
|
|
102
281
|
return config;
|
|
103
282
|
}
|