tailwindcss 0.0.0-insiders.ea80db2 → 0.0.0-insiders.eae2b7a
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/README.md +13 -9
- package/defaultTheme.d.ts +2 -1
- package/index.css +5 -0
- package/lib/cli/build/index.js +57 -0
- package/lib/cli/build/plugin.js +427 -0
- package/lib/cli/build/utils.js +88 -0
- package/lib/cli/build/watching.js +182 -0
- package/lib/cli/help/index.js +73 -0
- package/lib/cli/index.js +231 -0
- package/lib/cli/init/index.js +63 -0
- package/lib/cli.js +1 -759
- package/lib/corePluginList.js +12 -3
- package/lib/corePlugins.js +2308 -1739
- package/lib/css/preflight.css +13 -5
- package/lib/featureFlags.js +50 -25
- package/lib/index.js +1 -40
- package/lib/lib/cacheInvalidation.js +48 -25
- package/lib/lib/collapseAdjacentRules.js +17 -10
- package/lib/lib/collapseDuplicateDeclarations.js +13 -8
- package/lib/lib/content.js +207 -0
- package/lib/lib/defaultExtractor.js +232 -33
- package/lib/lib/detectNesting.js +21 -10
- package/lib/lib/evaluateTailwindFunctions.js +117 -50
- package/lib/lib/expandApplyAtRules.js +316 -215
- package/lib/lib/expandTailwindAtRules.js +167 -115
- package/lib/lib/findAtConfigPath.js +46 -0
- package/lib/lib/generateRules.js +444 -211
- package/lib/lib/getModuleDependencies.js +88 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +29 -39
- package/lib/lib/offsets.js +306 -0
- package/lib/lib/partitionApplyAtRules.js +13 -8
- package/lib/lib/regex.js +74 -0
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +96 -74
- package/lib/lib/setupContextUtils.js +672 -300
- package/lib/lib/setupTrackingContext.js +63 -68
- package/lib/lib/sharedState.js +44 -17
- package/lib/lib/substituteScreenAtRules.js +14 -10
- package/lib/plugin.js +160 -0
- package/lib/postcss-plugins/nesting/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +10 -6
- package/lib/postcss-plugins/nesting/plugin.js +24 -20
- package/lib/processTailwindFeatures.js +34 -29
- package/lib/public/colors.js +272 -246
- package/lib/public/create-plugin.js +9 -5
- package/lib/public/default-config.js +10 -6
- package/lib/public/default-theme.js +10 -6
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +11 -6
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +6 -1
- package/lib/util/buildMediaQuery.js +13 -6
- package/lib/util/cloneDeep.js +9 -6
- package/lib/util/cloneNodes.js +12 -3
- package/lib/util/color.js +66 -50
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +7 -2
- package/lib/util/createPlugin.js +8 -5
- package/lib/util/createUtilityPlugin.js +13 -9
- package/lib/util/dataTypes.js +182 -111
- package/lib/util/defaults.js +12 -7
- package/lib/util/escapeClassName.js +13 -8
- package/lib/util/escapeCommas.js +7 -2
- package/lib/util/flattenColorPalette.js +11 -10
- package/lib/util/formatVariantSelector.js +228 -151
- package/lib/util/getAllConfigs.js +33 -12
- package/lib/util/hashConfig.js +9 -4
- package/lib/util/isKeyframeRule.js +7 -2
- package/lib/util/isPlainObject.js +7 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
- package/lib/util/log.js +40 -13
- package/lib/util/nameClass.js +27 -10
- package/lib/util/negateValue.js +25 -8
- package/lib/util/normalizeConfig.js +155 -87
- package/lib/util/normalizeScreens.js +127 -8
- package/lib/util/parseAnimationValue.js +44 -40
- package/lib/util/parseBoxShadowValue.js +33 -62
- package/lib/util/parseDependency.js +39 -55
- package/lib/util/parseGlob.js +36 -0
- package/lib/util/parseObjectStyles.js +15 -10
- package/lib/util/pluginUtils.js +154 -59
- package/lib/util/prefixSelector.js +29 -10
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +31 -0
- package/lib/util/resolveConfig.js +96 -95
- package/lib/util/resolveConfigPath.js +29 -10
- package/lib/util/responsive.js +11 -6
- package/lib/util/splitAtTopLevelOnly.js +51 -0
- package/lib/util/tap.js +6 -1
- package/lib/util/toColorValue.js +7 -2
- package/lib/util/toPath.js +22 -4
- package/lib/util/transformThemeValue.js +40 -26
- package/lib/util/validateConfig.js +48 -0
- package/lib/util/validateFormalSyntax.js +26 -0
- package/lib/util/withAlphaVariable.js +27 -15
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +54 -52
- package/plugin.d.ts +10 -5
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +53 -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/index.js +53 -0
- package/src/cli/build/plugin.js +465 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +229 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +217 -0
- package/src/cli/init/index.js +79 -0
- package/src/cli.js +1 -836
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +576 -106
- package/src/css/preflight.css +13 -5
- package/src/featureFlags.js +17 -3
- package/src/index.js +1 -42
- package/src/lib/collapseAdjacentRules.js +5 -1
- package/src/lib/content.js +240 -0
- package/src/lib/defaultExtractor.js +202 -35
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +82 -8
- package/src/lib/expandApplyAtRules.js +322 -189
- package/src/lib/expandTailwindAtRules.js +82 -59
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +413 -132
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +373 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/src/lib/setupContextUtils.js +570 -151
- package/src/lib/setupTrackingContext.js +44 -58
- package/src/lib/sharedState.js +13 -4
- package/src/plugin.js +128 -0
- package/src/postcss-plugins/nesting/README.md +2 -2
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +5 -1
- package/src/util/color.js +34 -17
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +67 -23
- package/src/util/formatVariantSelector.js +264 -144
- package/src/util/getAllConfigs.js +21 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +25 -1
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +78 -20
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +3 -50
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +118 -23
- package/src/util/prefixSelector.js +28 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +70 -62
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +52 -0
- package/src/util/toPath.js +1 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +36 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +215 -165
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
- package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
- package/stubs/postcss.config.js +5 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +102 -56
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +372 -0
- package/types/index.d.ts +7 -1
- package/CHANGELOG.md +0 -2099
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/constants.js +0 -37
- package/peers/index.js +0 -75156
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -9
- package/src/constants.js +0 -17
- package/types.d.ts +0 -1
package/lib/util/log.js
CHANGED
|
@@ -2,29 +2,57 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
dim: function() {
|
|
13
|
+
return dim;
|
|
14
|
+
},
|
|
15
|
+
default: function() {
|
|
16
|
+
return _default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
|
|
20
|
+
function _interop_require_default(obj) {
|
|
9
21
|
return obj && obj.__esModule ? obj : {
|
|
10
22
|
default: obj
|
|
11
23
|
};
|
|
12
24
|
}
|
|
13
25
|
let alreadyShown = new Set();
|
|
14
26
|
function log(type, messages, key) {
|
|
15
|
-
if (process.env.JEST_WORKER_ID
|
|
27
|
+
if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
|
|
16
28
|
if (key && alreadyShown.has(key)) return;
|
|
17
29
|
if (key) alreadyShown.add(key);
|
|
18
|
-
console.warn(
|
|
19
|
-
messages.forEach((message)=>console.warn(type,
|
|
20
|
-
);
|
|
30
|
+
console.warn("");
|
|
31
|
+
messages.forEach((message)=>console.warn(type, "-", message));
|
|
21
32
|
}
|
|
22
33
|
function dim(input) {
|
|
23
34
|
return _picocolors.default.dim(input);
|
|
24
35
|
}
|
|
25
|
-
|
|
36
|
+
const _default = {
|
|
37
|
+
group (key, cb) {
|
|
38
|
+
if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) return;
|
|
39
|
+
if (key && alreadyShown.has(key)) return;
|
|
40
|
+
if (key) alreadyShown.add(key);
|
|
41
|
+
console.warn("");
|
|
42
|
+
cb({
|
|
43
|
+
info (messages) {
|
|
44
|
+
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.cyan("info")), "-", message));
|
|
45
|
+
},
|
|
46
|
+
warn (messages) {
|
|
47
|
+
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.yellow("warn")), "-", message));
|
|
48
|
+
},
|
|
49
|
+
risk (messages) {
|
|
50
|
+
messages.forEach((message)=>console.warn(_picocolors.default.bold(_picocolors.default.magenta("risk")), "-", message));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
},
|
|
26
54
|
info (key, messages) {
|
|
27
|
-
log(_picocolors.default.bold(_picocolors.default.cyan(
|
|
55
|
+
log(_picocolors.default.bold(_picocolors.default.cyan("info")), ...Array.isArray(key) ? [
|
|
28
56
|
key
|
|
29
57
|
] : [
|
|
30
58
|
messages,
|
|
@@ -32,7 +60,7 @@ var _default = {
|
|
|
32
60
|
]);
|
|
33
61
|
},
|
|
34
62
|
warn (key, messages) {
|
|
35
|
-
log(_picocolors.default.bold(_picocolors.default.yellow(
|
|
63
|
+
log(_picocolors.default.bold(_picocolors.default.yellow("warn")), ...Array.isArray(key) ? [
|
|
36
64
|
key
|
|
37
65
|
] : [
|
|
38
66
|
messages,
|
|
@@ -40,7 +68,7 @@ var _default = {
|
|
|
40
68
|
]);
|
|
41
69
|
},
|
|
42
70
|
risk (key, messages) {
|
|
43
|
-
log(_picocolors.default.bold(_picocolors.default.magenta(
|
|
71
|
+
log(_picocolors.default.bold(_picocolors.default.magenta("risk")), ...Array.isArray(key) ? [
|
|
44
72
|
key
|
|
45
73
|
] : [
|
|
46
74
|
messages,
|
|
@@ -48,4 +76,3 @@ var _default = {
|
|
|
48
76
|
]);
|
|
49
77
|
}
|
|
50
78
|
};
|
|
51
|
-
exports.default = _default;
|
package/lib/util/nameClass.js
CHANGED
|
@@ -2,31 +2,48 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
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
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("./escapeClassName"));
|
|
23
|
+
const _escapeCommas = /*#__PURE__*/ _interop_require_default(require("./escapeCommas"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
11
25
|
return obj && obj.__esModule ? obj : {
|
|
12
26
|
default: obj
|
|
13
27
|
};
|
|
14
28
|
}
|
|
15
29
|
function asClass(name) {
|
|
16
|
-
return (0, _escapeCommas
|
|
30
|
+
return (0, _escapeCommas.default)(`.${(0, _escapeClassName.default)(name)}`);
|
|
17
31
|
}
|
|
18
32
|
function nameClass(classPrefix, key) {
|
|
19
33
|
return asClass(formatClass(classPrefix, key));
|
|
20
34
|
}
|
|
21
35
|
function formatClass(classPrefix, key) {
|
|
22
|
-
if (key ===
|
|
36
|
+
if (key === "DEFAULT") {
|
|
23
37
|
return classPrefix;
|
|
24
38
|
}
|
|
25
|
-
if (key ===
|
|
39
|
+
if (key === "-" || key === "-DEFAULT") {
|
|
26
40
|
return `-${classPrefix}`;
|
|
27
41
|
}
|
|
28
|
-
if (key.startsWith(
|
|
42
|
+
if (key.startsWith("-")) {
|
|
29
43
|
return `-${classPrefix}${key}`;
|
|
30
44
|
}
|
|
45
|
+
if (key.startsWith("/")) {
|
|
46
|
+
return `${classPrefix}${key}`;
|
|
47
|
+
}
|
|
31
48
|
return `${classPrefix}-${key}`;
|
|
32
49
|
}
|
package/lib/util/negateValue.js
CHANGED
|
@@ -2,18 +2,35 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return negateValue;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function negateValue(value) {
|
|
7
12
|
value = `${value}`;
|
|
8
|
-
if (value ===
|
|
9
|
-
return
|
|
13
|
+
if (value === "0") {
|
|
14
|
+
return "0";
|
|
10
15
|
}
|
|
11
16
|
// Flip sign of numbers
|
|
12
17
|
if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
|
|
13
|
-
return value.replace(/^[+-]?/, (sign)=>sign ===
|
|
14
|
-
);
|
|
18
|
+
return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
|
|
15
19
|
}
|
|
16
|
-
|
|
17
|
-
|
|
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 = [
|
|
25
|
+
"var",
|
|
26
|
+
"calc",
|
|
27
|
+
"min",
|
|
28
|
+
"max",
|
|
29
|
+
"clamp"
|
|
30
|
+
];
|
|
31
|
+
for (const fn of numericFunctions){
|
|
32
|
+
if (value.includes(`${fn}(`)) {
|
|
33
|
+
return `calc(${value} * -1)`;
|
|
34
|
+
}
|
|
18
35
|
}
|
|
19
36
|
}
|
|
@@ -2,28 +2,52 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
5
|
+
Object.defineProperty(exports, "normalizeConfig", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return normalizeConfig;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _featureFlags = require("../featureFlags");
|
|
12
|
+
const _log = /*#__PURE__*/ _interop_require_wildcard(require("./log"));
|
|
13
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
14
|
+
if (typeof WeakMap !== "function") return null;
|
|
15
|
+
var cacheBabelInterop = new WeakMap();
|
|
16
|
+
var cacheNodeInterop = new WeakMap();
|
|
17
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
18
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
19
|
+
})(nodeInterop);
|
|
20
|
+
}
|
|
21
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
22
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
9
23
|
return obj;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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];
|
|
22
43
|
}
|
|
23
44
|
}
|
|
24
|
-
newObj.default = obj;
|
|
25
|
-
return newObj;
|
|
26
45
|
}
|
|
46
|
+
newObj.default = obj;
|
|
47
|
+
if (cache) {
|
|
48
|
+
cache.set(obj, newObj);
|
|
49
|
+
}
|
|
50
|
+
return newObj;
|
|
27
51
|
}
|
|
28
52
|
function normalizeConfig(config) {
|
|
29
53
|
// Quick structure validation
|
|
@@ -41,6 +65,9 @@ function normalizeConfig(config) {
|
|
|
41
65
|
* transform?: TransformerFn | { [extension: string]: TransformerFn }
|
|
42
66
|
* }
|
|
43
67
|
*/ let valid = (()=>{
|
|
68
|
+
if (config.content === "auto") {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
44
71
|
// `config.purge` should not exist anymore
|
|
45
72
|
if (config.purge) {
|
|
46
73
|
return false;
|
|
@@ -50,45 +77,45 @@ function normalizeConfig(config) {
|
|
|
50
77
|
return false;
|
|
51
78
|
}
|
|
52
79
|
// `config.content` should be an object or an array
|
|
53
|
-
if (!Array.isArray(config.content) && !(typeof config.content ===
|
|
80
|
+
if (!Array.isArray(config.content) && !(typeof config.content === "object" && config.content !== null)) {
|
|
54
81
|
return false;
|
|
55
82
|
}
|
|
56
83
|
// When `config.content` is an array, it should consist of FilePaths or RawFiles
|
|
57
84
|
if (Array.isArray(config.content)) {
|
|
58
85
|
return config.content.every((path)=>{
|
|
59
86
|
// `path` can be a string
|
|
60
|
-
if (typeof path ===
|
|
87
|
+
if (typeof path === "string") return true;
|
|
61
88
|
// `path` can be an object { raw: string, extension?: string }
|
|
62
89
|
// `raw` must be a string
|
|
63
|
-
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !==
|
|
90
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
64
91
|
// `extension` (if provided) should also be a string
|
|
65
|
-
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !==
|
|
92
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
66
93
|
return false;
|
|
67
94
|
}
|
|
68
95
|
return true;
|
|
69
96
|
});
|
|
70
97
|
}
|
|
71
98
|
// When `config.content` is an object
|
|
72
|
-
if (typeof config.content ===
|
|
73
|
-
// Only `files`, `extract
|
|
99
|
+
if (typeof config.content === "object" && config.content !== null) {
|
|
100
|
+
// Only `files`, `relative`, `extract`, and `transform` can exist in `config.content`
|
|
74
101
|
if (Object.keys(config.content).some((key)=>![
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
102
|
+
"files",
|
|
103
|
+
"relative",
|
|
104
|
+
"extract",
|
|
105
|
+
"transform"
|
|
106
|
+
].includes(key))) {
|
|
80
107
|
return false;
|
|
81
108
|
}
|
|
82
109
|
// `config.content.files` should exist of FilePaths or RawFiles
|
|
83
110
|
if (Array.isArray(config.content.files)) {
|
|
84
111
|
if (!config.content.files.every((path)=>{
|
|
85
112
|
// `path` can be a string
|
|
86
|
-
if (typeof path ===
|
|
113
|
+
if (typeof path === "string") return true;
|
|
87
114
|
// `path` can be an object { raw: string, extension?: string }
|
|
88
115
|
// `raw` must be a string
|
|
89
|
-
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !==
|
|
116
|
+
if (typeof (path === null || path === void 0 ? void 0 : path.raw) !== "string") return false;
|
|
90
117
|
// `extension` (if provided) should also be a string
|
|
91
|
-
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !==
|
|
118
|
+
if ((path === null || path === void 0 ? void 0 : path.extension) && typeof (path === null || path === void 0 ? void 0 : path.extension) !== "string") {
|
|
92
119
|
return false;
|
|
93
120
|
}
|
|
94
121
|
return true;
|
|
@@ -96,23 +123,27 @@ function normalizeConfig(config) {
|
|
|
96
123
|
return false;
|
|
97
124
|
}
|
|
98
125
|
// `config.content.extract` is optional, and can be a Function or a Record<String, Function>
|
|
99
|
-
if (typeof config.content.extract ===
|
|
126
|
+
if (typeof config.content.extract === "object") {
|
|
100
127
|
for (let value of Object.values(config.content.extract)){
|
|
101
|
-
if (typeof value !==
|
|
128
|
+
if (typeof value !== "function") {
|
|
102
129
|
return false;
|
|
103
130
|
}
|
|
104
131
|
}
|
|
105
|
-
} else if (!(config.content.extract === undefined || typeof config.content.extract ===
|
|
132
|
+
} else if (!(config.content.extract === undefined || typeof config.content.extract === "function")) {
|
|
106
133
|
return false;
|
|
107
134
|
}
|
|
108
135
|
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
109
|
-
if (typeof config.content.transform ===
|
|
136
|
+
if (typeof config.content.transform === "object") {
|
|
110
137
|
for (let value of Object.values(config.content.transform)){
|
|
111
|
-
if (typeof value !==
|
|
138
|
+
if (typeof value !== "function") {
|
|
112
139
|
return false;
|
|
113
140
|
}
|
|
114
141
|
}
|
|
115
|
-
} else if (!(config.content.transform === undefined || typeof config.content.transform ===
|
|
142
|
+
} else if (!(config.content.transform === undefined || typeof config.content.transform === "function")) {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
// `config.content.relative` is optional and can be a boolean
|
|
146
|
+
if (typeof config.content.relative !== "boolean" && typeof config.content.relative !== "undefined") {
|
|
116
147
|
return false;
|
|
117
148
|
}
|
|
118
149
|
}
|
|
@@ -121,63 +152,91 @@ function normalizeConfig(config) {
|
|
|
121
152
|
return false;
|
|
122
153
|
})();
|
|
123
154
|
if (!valid) {
|
|
124
|
-
_log.default.warn(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
155
|
+
_log.default.warn("purge-deprecation", [
|
|
156
|
+
"The `purge`/`content` options have changed in Tailwind CSS v3.0.",
|
|
157
|
+
"Update your configuration file to eliminate this warning.",
|
|
158
|
+
"https://tailwindcss.com/docs/upgrade-guide#configure-content-sources"
|
|
128
159
|
]);
|
|
129
160
|
}
|
|
130
161
|
// Normalize the `safelist`
|
|
131
162
|
config.safelist = (()=>{
|
|
132
|
-
var
|
|
163
|
+
var _purge_options;
|
|
133
164
|
let { content , purge , safelist } = config;
|
|
134
165
|
if (Array.isArray(safelist)) return safelist;
|
|
135
166
|
if (Array.isArray(content === null || content === void 0 ? void 0 : content.safelist)) return content.safelist;
|
|
136
167
|
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.safelist)) return purge.safelist;
|
|
137
|
-
if (Array.isArray(purge === null || purge === void 0 ? void 0 : (
|
|
168
|
+
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;
|
|
169
|
+
return [];
|
|
170
|
+
})();
|
|
171
|
+
// Normalize the `blocklist`
|
|
172
|
+
config.blocklist = (()=>{
|
|
173
|
+
let { blocklist } = config;
|
|
174
|
+
if (Array.isArray(blocklist)) {
|
|
175
|
+
if (blocklist.every((item)=>typeof item === "string")) {
|
|
176
|
+
return blocklist;
|
|
177
|
+
}
|
|
178
|
+
_log.default.warn("blocklist-invalid", [
|
|
179
|
+
"The `blocklist` option must be an array of strings.",
|
|
180
|
+
"https://tailwindcss.com/docs/content-configuration#discarding-classes"
|
|
181
|
+
]);
|
|
182
|
+
}
|
|
138
183
|
return [];
|
|
139
184
|
})();
|
|
140
185
|
// Normalize prefix option
|
|
141
|
-
if (typeof config.prefix ===
|
|
142
|
-
_log.default.warn(
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
186
|
+
if (typeof config.prefix === "function") {
|
|
187
|
+
_log.default.warn("prefix-function", [
|
|
188
|
+
"As of Tailwind CSS v3.0, `prefix` cannot be a function.",
|
|
189
|
+
"Update `prefix` in your configuration to be a string to eliminate this warning.",
|
|
190
|
+
"https://tailwindcss.com/docs/upgrade-guide#prefix-cannot-be-a-function"
|
|
146
191
|
]);
|
|
147
|
-
config.prefix =
|
|
192
|
+
config.prefix = "";
|
|
148
193
|
} else {
|
|
149
|
-
var
|
|
150
|
-
config.prefix = (
|
|
194
|
+
var _config_prefix;
|
|
195
|
+
config.prefix = (_config_prefix = config.prefix) !== null && _config_prefix !== void 0 ? _config_prefix : "";
|
|
151
196
|
}
|
|
152
197
|
// Normalize the `content`
|
|
153
198
|
config.content = {
|
|
199
|
+
relative: (()=>{
|
|
200
|
+
let { content } = config;
|
|
201
|
+
if (content === null || content === void 0 ? void 0 : content.relative) {
|
|
202
|
+
return content.relative;
|
|
203
|
+
}
|
|
204
|
+
return (0, _featureFlags.flagEnabled)(config, "relativeContentPathsByDefault");
|
|
205
|
+
})(),
|
|
154
206
|
files: (()=>{
|
|
155
207
|
let { content , purge } = config;
|
|
156
|
-
if (
|
|
157
|
-
if (
|
|
208
|
+
if (content === undefined && purge === undefined) return [];
|
|
209
|
+
if (purge) {
|
|
210
|
+
if (Array.isArray(purge)) return purge;
|
|
211
|
+
if (Array.isArray(purge === null || purge === void 0 ? void 0 : purge.content)) return purge.content;
|
|
212
|
+
return [];
|
|
213
|
+
}
|
|
158
214
|
if (Array.isArray(content)) return content;
|
|
159
215
|
if (Array.isArray(content === null || content === void 0 ? void 0 : content.content)) return content.content;
|
|
160
216
|
if (Array.isArray(content === null || content === void 0 ? void 0 : content.files)) return content.files;
|
|
217
|
+
if (content === "auto") return [
|
|
218
|
+
"auto"
|
|
219
|
+
];
|
|
161
220
|
return [];
|
|
162
221
|
})(),
|
|
163
222
|
extract: (()=>{
|
|
164
223
|
let extract = (()=>{
|
|
165
|
-
var
|
|
166
|
-
if ((
|
|
167
|
-
if ((
|
|
168
|
-
if ((
|
|
169
|
-
if ((
|
|
170
|
-
if ((
|
|
171
|
-
if ((
|
|
224
|
+
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;
|
|
225
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.extract) return config.purge.extract;
|
|
226
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.extract) return config.content.extract;
|
|
227
|
+
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;
|
|
228
|
+
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;
|
|
229
|
+
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;
|
|
230
|
+
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;
|
|
172
231
|
return {};
|
|
173
232
|
})();
|
|
174
233
|
let extractors = {};
|
|
175
234
|
let defaultExtractor = (()=>{
|
|
176
|
-
var
|
|
177
|
-
if ((
|
|
235
|
+
var _config_purge, _config_purge_options, _config_content, _config_content_options;
|
|
236
|
+
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) {
|
|
178
237
|
return config.purge.options.defaultExtractor;
|
|
179
238
|
}
|
|
180
|
-
if ((
|
|
239
|
+
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) {
|
|
181
240
|
return config.content.options.defaultExtractor;
|
|
182
241
|
}
|
|
183
242
|
return undefined;
|
|
@@ -186,7 +245,7 @@ function normalizeConfig(config) {
|
|
|
186
245
|
extractors.DEFAULT = defaultExtractor;
|
|
187
246
|
}
|
|
188
247
|
// Functions
|
|
189
|
-
if (typeof extract ===
|
|
248
|
+
if (typeof extract === "function") {
|
|
190
249
|
extractors.DEFAULT = extract;
|
|
191
250
|
} else if (Array.isArray(extract)) {
|
|
192
251
|
for (let { extensions , extractor } of extract !== null && extract !== void 0 ? extract : []){
|
|
@@ -194,47 +253,56 @@ function normalizeConfig(config) {
|
|
|
194
253
|
extractors[extension] = extractor;
|
|
195
254
|
}
|
|
196
255
|
}
|
|
197
|
-
} else if (typeof extract ===
|
|
256
|
+
} else if (typeof extract === "object" && extract !== null) {
|
|
198
257
|
Object.assign(extractors, extract);
|
|
199
258
|
}
|
|
200
259
|
return extractors;
|
|
201
260
|
})(),
|
|
202
261
|
transform: (()=>{
|
|
203
262
|
let transform = (()=>{
|
|
204
|
-
var
|
|
205
|
-
if ((
|
|
206
|
-
if ((
|
|
207
|
-
if ((
|
|
208
|
-
if ((
|
|
263
|
+
var _config_purge, _config_content, _config_purge1, _config_purge_transform, _config_content1, _config_content_transform;
|
|
264
|
+
if ((_config_purge = config.purge) === null || _config_purge === void 0 ? void 0 : _config_purge.transform) return config.purge.transform;
|
|
265
|
+
if ((_config_content = config.content) === null || _config_content === void 0 ? void 0 : _config_content.transform) return config.content.transform;
|
|
266
|
+
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;
|
|
267
|
+
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;
|
|
209
268
|
return {};
|
|
210
269
|
})();
|
|
211
270
|
let transformers = {};
|
|
212
|
-
if (typeof transform ===
|
|
271
|
+
if (typeof transform === "function") {
|
|
213
272
|
transformers.DEFAULT = transform;
|
|
214
273
|
}
|
|
215
|
-
if (typeof transform ===
|
|
274
|
+
if (typeof transform === "object" && transform !== null) {
|
|
216
275
|
Object.assign(transformers, transform);
|
|
217
276
|
}
|
|
218
277
|
return transformers;
|
|
219
278
|
})()
|
|
220
279
|
};
|
|
280
|
+
// Force disable the `oxideParser` feature flag when using unsupported features.
|
|
281
|
+
// TODO: Remove once we have prefix or separator support in the oxide parser.
|
|
282
|
+
if (config.prefix !== "" || config.separator !== ":") {
|
|
283
|
+
if (config.experimental === "all") {
|
|
284
|
+
config.experimental = {};
|
|
285
|
+
for(let key in _featureFlags.featureFlags.experimental){
|
|
286
|
+
config.experimental[key] = true;
|
|
287
|
+
}
|
|
288
|
+
} else {
|
|
289
|
+
var _config_experimental;
|
|
290
|
+
config.experimental = (_config_experimental = config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {};
|
|
291
|
+
}
|
|
292
|
+
config.experimental.oxideParser = false;
|
|
293
|
+
}
|
|
221
294
|
// Validate globs to prevent bogus globs.
|
|
222
295
|
// E.g.: `./src/*.{html}` is invalid, the `{html}` should just be `html`
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
296
|
+
if (config.content.files !== "auto") {
|
|
297
|
+
for (let file of config.content.files){
|
|
298
|
+
if (typeof file === "string" && /{([^,]*?)}/g.test(file)) {
|
|
299
|
+
_log.default.warn("invalid-glob-braces", [
|
|
300
|
+
`The glob pattern ${(0, _log.dim)(file)} in your Tailwind CSS configuration is invalid.`,
|
|
301
|
+
`Update it to ${(0, _log.dim)(file.replace(/{([^,]*?)}/g, "$1"))} to silence this warning.`
|
|
302
|
+
]);
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
230
305
|
}
|
|
231
306
|
}
|
|
232
|
-
if (config.content.files.length === 0) {
|
|
233
|
-
_log.default.warn('content-problems', [
|
|
234
|
-
'The `content` option in your Tailwind CSS configuration is missing or empty.',
|
|
235
|
-
'Configure your content sources or your generated CSS will be missing styles.',
|
|
236
|
-
'https://tailwindcss.com/docs/content-configuration',
|
|
237
|
-
]);
|
|
238
|
-
}
|
|
239
307
|
return config;
|
|
240
308
|
}
|