tailwindcss 0.0.0-insiders.bd970d0 → 0.0.0-insiders.bda8421
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 +1 -2
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +12 -15
- package/lib/cli/build/plugin.js +107 -167
- package/lib/cli/build/utils.js +13 -13
- package/lib/cli/build/watching.js +10 -10
- package/lib/cli/help/index.js +11 -11
- package/lib/cli/index.js +60 -61
- package/lib/cli/init/index.js +16 -16
- package/lib/cli-peer-dependencies.js +36 -0
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +4 -1
- package/lib/corePlugins.js +2018 -1905
- package/lib/css/preflight.css +18 -12
- package/lib/featureFlags.js +17 -23
- package/lib/index.js +1 -1
- package/lib/lib/cacheInvalidation.js +3 -3
- package/lib/lib/collapseAdjacentRules.js +6 -6
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/content.js +39 -32
- package/lib/lib/defaultExtractor.js +40 -17
- package/lib/lib/evaluateTailwindFunctions.js +23 -23
- package/lib/lib/expandApplyAtRules.js +37 -18
- package/lib/lib/expandTailwindAtRules.js +49 -85
- package/lib/lib/findAtConfigPath.js +5 -5
- package/lib/lib/generateRules.js +82 -55
- package/lib/lib/getModuleDependencies.js +23 -23
- package/lib/lib/load-config.js +21 -6
- package/lib/lib/normalizeTailwindDirectives.js +36 -21
- package/lib/lib/offsets.js +97 -48
- package/lib/lib/partitionApplyAtRules.js +2 -2
- package/lib/lib/regex.js +5 -5
- package/lib/lib/resolveDefaultsAtRules.js +27 -25
- package/lib/lib/setupContextUtils.js +195 -167
- package/lib/lib/setupTrackingContext.js +4 -5
- package/lib/lib/sharedState.js +10 -10
- package/lib/lib/substituteScreenAtRules.js +4 -4
- package/lib/plugin.js +8 -124
- package/lib/postcss-plugins/nesting/index.js +2 -2
- package/lib/postcss-plugins/nesting/plugin.js +11 -11
- package/lib/processTailwindFeatures.js +3 -5
- package/lib/public/colors.js +264 -264
- package/lib/util/applyImportantSelector.js +2 -2
- package/lib/util/buildMediaQuery.js +2 -2
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +19 -19
- package/lib/util/createUtilityPlugin.js +3 -3
- package/lib/util/dataTypes.js +170 -113
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +24 -19
- package/lib/util/getAllConfigs.js +4 -5
- package/lib/util/isKeyframeRule.js +1 -1
- package/lib/util/isPlainObject.js +2 -2
- package/lib/util/isSyntacticallyValidPropertyValue.js +10 -10
- package/lib/util/log.js +6 -23
- package/lib/util/nameClass.js +4 -4
- package/lib/util/negateValue.js +8 -8
- package/lib/util/normalizeConfig.js +63 -94
- package/lib/util/normalizeScreens.js +18 -18
- package/lib/util/parseAnimationValue.js +38 -38
- package/lib/util/parseBoxShadowValue.js +18 -18
- package/lib/util/parseDependency.js +4 -4
- package/lib/util/parseGlob.js +4 -4
- package/lib/util/parseObjectStyles.js +1 -1
- package/lib/util/pluginUtils.js +36 -21
- package/lib/util/prefixSelector.js +4 -4
- package/lib/util/pseudoElements.js +72 -69
- package/lib/util/removeAlphaVariables.js +1 -1
- package/lib/util/resolveConfig.js +11 -15
- package/lib/util/resolveConfigPath.js +6 -6
- package/lib/util/responsive.js +1 -1
- package/lib/util/splitAtTopLevelOnly.js +3 -3
- package/lib/util/toColorValue.js +1 -1
- package/lib/util/toPath.js +2 -2
- package/lib/util/transformThemeValue.js +24 -24
- package/lib/util/validateConfig.js +9 -20
- package/lib/util/validateFormalSyntax.js +5 -5
- package/lib/util/withAlphaVariable.js +5 -5
- package/lib/value-parser/index.js +5 -5
- package/lib/value-parser/parse.js +43 -43
- package/lib/value-parser/stringify.js +11 -11
- package/lib/value-parser/unit.js +5 -5
- package/lib/value-parser/walk.js +1 -1
- package/nesting/index.d.ts +4 -0
- package/package.json +41 -36
- package/peers/index.js +96503 -0
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +0 -4
- package/src/cli/build/plugin.js +53 -85
- package/src/cli/build/watching.js +1 -1
- package/src/cli/index.js +0 -1
- package/src/cli-peer-dependencies.js +15 -0
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +118 -31
- package/src/css/preflight.css +18 -12
- package/src/featureFlags.js +3 -5
- package/src/lib/content.js +39 -30
- package/src/lib/defaultExtractor.js +29 -6
- package/src/lib/expandApplyAtRules.js +24 -0
- package/src/lib/expandTailwindAtRules.js +19 -56
- package/src/lib/generateRules.js +39 -8
- package/src/lib/load-config.ts +13 -0
- package/src/lib/normalizeTailwindDirectives.js +27 -0
- package/src/lib/offsets.js +62 -3
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +79 -39
- package/src/plugin.js +0 -86
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/cloneNodes.js +35 -14
- package/src/util/dataTypes.js +72 -6
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/log.js +0 -24
- package/src/util/normalizeConfig.js +11 -38
- package/src/util/pluginUtils.js +20 -0
- package/src/util/pseudoElements.js +4 -0
- package/src/util/validateConfig.js +0 -10
- package/stubs/config.full.js +68 -8
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +1 -0
- package/stubs/postcss.config.js +1 -0
- package/types/config.d.ts +12 -5
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +28 -9
- package/types/index.d.ts +7 -3
- package/index.css +0 -5
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/handleImportAtRules.js +0 -50
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/handleImportAtRules.js +0 -34
package/lib/css/preflight.css
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
4. Use the user's configured `sans` font-family by default.
|
|
25
25
|
5. Use the user's configured `sans` font-feature-settings by default.
|
|
26
26
|
6. Use the user's configured `sans` font-variation-settings by default.
|
|
27
|
+
7. Disable tap highlights on iOS
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
30
|
html,
|
|
@@ -35,6 +36,7 @@ html,
|
|
|
35
36
|
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
36
37
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
37
38
|
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
39
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
/*
|
|
@@ -100,8 +102,10 @@ strong {
|
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
/*
|
|
103
|
-
1. Use the user's configured `mono` font
|
|
104
|
-
2.
|
|
105
|
+
1. Use the user's configured `mono` font-family by default.
|
|
106
|
+
2. Use the user's configured `mono` font-feature-settings by default.
|
|
107
|
+
3. Use the user's configured `mono` font-variation-settings by default.
|
|
108
|
+
4. Correct the odd `em` font sizing in all browsers.
|
|
105
109
|
*/
|
|
106
110
|
|
|
107
111
|
code,
|
|
@@ -109,7 +113,9 @@ kbd,
|
|
|
109
113
|
samp,
|
|
110
114
|
pre {
|
|
111
115
|
font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
|
|
112
|
-
font-
|
|
116
|
+
font-feature-settings: theme('fontFamily.mono[1].fontFeatureSettings', normal); /* 2 */
|
|
117
|
+
font-variation-settings: theme('fontFamily.mono[1].fontVariationSettings', normal); /* 3 */
|
|
118
|
+
font-size: 1em; /* 4 */
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
/*
|
|
@@ -169,6 +175,7 @@ textarea {
|
|
|
169
175
|
font-size: 100%; /* 1 */
|
|
170
176
|
font-weight: inherit; /* 1 */
|
|
171
177
|
line-height: inherit; /* 1 */
|
|
178
|
+
letter-spacing: inherit; /* 1 */
|
|
172
179
|
color: inherit; /* 1 */
|
|
173
180
|
margin: 0; /* 2 */
|
|
174
181
|
padding: 0; /* 3 */
|
|
@@ -189,9 +196,9 @@ select {
|
|
|
189
196
|
*/
|
|
190
197
|
|
|
191
198
|
button,
|
|
192
|
-
[type='button'],
|
|
193
|
-
[type='reset'],
|
|
194
|
-
[type='submit'] {
|
|
199
|
+
input:where([type='button']),
|
|
200
|
+
input:where([type='reset']),
|
|
201
|
+
input:where([type='submit']) {
|
|
195
202
|
-webkit-appearance: button; /* 1 */
|
|
196
203
|
background-color: transparent; /* 2 */
|
|
197
204
|
background-image: none; /* 2 */
|
|
@@ -267,7 +274,7 @@ summary {
|
|
|
267
274
|
}
|
|
268
275
|
|
|
269
276
|
/*
|
|
270
|
-
Removes the default spacing for appropriate elements.
|
|
277
|
+
Removes the default spacing and border for appropriate elements.
|
|
271
278
|
*/
|
|
272
279
|
|
|
273
280
|
blockquote,
|
|
@@ -303,6 +310,9 @@ menu {
|
|
|
303
310
|
padding: 0;
|
|
304
311
|
}
|
|
305
312
|
|
|
313
|
+
/*
|
|
314
|
+
Reset default styling for dialogs.
|
|
315
|
+
*/
|
|
306
316
|
dialog {
|
|
307
317
|
padding: 0;
|
|
308
318
|
}
|
|
@@ -338,7 +348,6 @@ button,
|
|
|
338
348
|
/*
|
|
339
349
|
Make sure disabled buttons don't get the pointer cursor.
|
|
340
350
|
*/
|
|
341
|
-
|
|
342
351
|
:disabled {
|
|
343
352
|
cursor: default;
|
|
344
353
|
}
|
|
@@ -371,10 +380,7 @@ video {
|
|
|
371
380
|
height: auto;
|
|
372
381
|
}
|
|
373
382
|
|
|
374
|
-
/*
|
|
375
|
-
Make elements with the HTML hidden attribute stay hidden by default.
|
|
376
|
-
*/
|
|
377
|
-
|
|
383
|
+
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
378
384
|
[hidden] {
|
|
379
385
|
display: none;
|
|
380
386
|
}
|
package/lib/featureFlags.js
CHANGED
|
@@ -9,9 +9,6 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
featureFlags: function() {
|
|
13
|
-
return featureFlags;
|
|
14
|
-
},
|
|
15
12
|
flagEnabled: function() {
|
|
16
13
|
return flagEnabled;
|
|
17
14
|
},
|
|
@@ -31,54 +28,51 @@ function _interop_require_default(obj) {
|
|
|
31
28
|
}
|
|
32
29
|
let defaults = {
|
|
33
30
|
optimizeUniversalDefaults: false,
|
|
31
|
+
generalizedModifiers: true,
|
|
34
32
|
disableColorOpacityUtilitiesByDefault: false,
|
|
35
|
-
relativeContentPathsByDefault: false
|
|
36
|
-
oxideParser: true,
|
|
37
|
-
logicalSiblingUtilities: false
|
|
33
|
+
relativeContentPathsByDefault: false
|
|
38
34
|
};
|
|
39
35
|
let featureFlags = {
|
|
40
36
|
future: [
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'logicalSiblingUtilities'
|
|
37
|
+
"hoverOnlyWhenSupported",
|
|
38
|
+
"respectDefaultRingColorOpacity",
|
|
39
|
+
"disableColorOpacityUtilitiesByDefault",
|
|
40
|
+
"relativeContentPathsByDefault"
|
|
46
41
|
],
|
|
47
42
|
experimental: [
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
"optimizeUniversalDefaults",
|
|
44
|
+
"generalizedModifiers"
|
|
50
45
|
]
|
|
51
46
|
};
|
|
52
47
|
function flagEnabled(config, flag) {
|
|
53
48
|
if (featureFlags.future.includes(flag)) {
|
|
54
|
-
var _config_future
|
|
49
|
+
var _config_future;
|
|
55
50
|
var _config_future_flag, _ref;
|
|
56
|
-
return config.future ===
|
|
51
|
+
return config.future === "all" || ((_ref = (_config_future_flag = config === null || config === void 0 ? void 0 : (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
|
|
57
52
|
}
|
|
58
53
|
if (featureFlags.experimental.includes(flag)) {
|
|
59
|
-
var _config_experimental
|
|
54
|
+
var _config_experimental;
|
|
60
55
|
var _config_experimental_flag, _ref1;
|
|
61
|
-
return config.experimental ===
|
|
56
|
+
return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
|
|
62
57
|
}
|
|
63
58
|
return false;
|
|
64
59
|
}
|
|
65
60
|
function experimentalFlagsEnabled(config) {
|
|
66
|
-
|
|
67
|
-
if (config.experimental === 'all') {
|
|
61
|
+
if (config.experimental === "all") {
|
|
68
62
|
return featureFlags.experimental;
|
|
69
63
|
}
|
|
70
64
|
var _config_experimental;
|
|
71
|
-
return Object.keys((_config_experimental =
|
|
65
|
+
return Object.keys((_config_experimental = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
72
66
|
}
|
|
73
67
|
function issueFlagNotices(config) {
|
|
74
68
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
75
69
|
return;
|
|
76
70
|
}
|
|
77
71
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
78
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(
|
|
79
|
-
_log.default.warn(
|
|
72
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
|
73
|
+
_log.default.warn("experimental-flags-enabled", [
|
|
80
74
|
`You have enabled experimental features: ${changes}`,
|
|
81
|
-
|
|
75
|
+
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
|
|
82
76
|
]);
|
|
83
77
|
}
|
|
84
78
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
module.exports = require(
|
|
2
|
+
module.exports = require("./plugin");
|
|
@@ -72,16 +72,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
72
72
|
* @param {string} str
|
|
73
73
|
*/ function getHash(str) {
|
|
74
74
|
try {
|
|
75
|
-
return _crypto.default.createHash(
|
|
75
|
+
return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
|
|
76
76
|
} catch (err) {
|
|
77
|
-
return
|
|
77
|
+
return "";
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
function hasContentChanged(sourcePath, root) {
|
|
81
81
|
let css = root.toString();
|
|
82
82
|
// We only care about files with @tailwind directives
|
|
83
83
|
// Other files use an existing context
|
|
84
|
-
if (!css.includes(
|
|
84
|
+
if (!css.includes("@tailwind")) {
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
|
|
@@ -10,11 +10,11 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
let comparisonMap = {
|
|
12
12
|
atrule: [
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
"name",
|
|
14
|
+
"params"
|
|
15
15
|
],
|
|
16
16
|
rule: [
|
|
17
|
-
|
|
17
|
+
"selector"
|
|
18
18
|
]
|
|
19
19
|
};
|
|
20
20
|
let types = new Set(Object.keys(comparisonMap));
|
|
@@ -32,9 +32,9 @@ function collapseAdjacentRules() {
|
|
|
32
32
|
}
|
|
33
33
|
let properties = comparisonMap[node.type];
|
|
34
34
|
var _node_property, _currentRule_property;
|
|
35
|
-
if (node.type ===
|
|
35
|
+
if (node.type === "atrule" && node.name === "font-face") {
|
|
36
36
|
currentRule = node;
|
|
37
|
-
} else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property :
|
|
37
|
+
} else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property : "").replace(/\s+/g, " ") === ((_currentRule_property = currentRule[property]) !== null && _currentRule_property !== void 0 ? _currentRule_property : "").replace(/\s+/g, " "))) {
|
|
38
38
|
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
39
39
|
if (node.nodes) {
|
|
40
40
|
currentRule.append(node.nodes);
|
|
@@ -50,7 +50,7 @@ function collapseAdjacentRules() {
|
|
|
50
50
|
// explicitly does not handle rule nesting on its own as
|
|
51
51
|
// the user is expected to use a nesting plugin
|
|
52
52
|
root.each((node)=>{
|
|
53
|
-
if (node.type ===
|
|
53
|
+
if (node.type === "atrule") {
|
|
54
54
|
collapseRulesIn(node);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
@@ -74,7 +74,7 @@ function collapseDuplicateDeclarations() {
|
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
let UNITLESS_NUMBER = Symbol(
|
|
77
|
+
let UNITLESS_NUMBER = Symbol("unitless-number");
|
|
78
78
|
function resolveUnit(input) {
|
|
79
79
|
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
|
80
80
|
if (result) {
|
package/lib/lib/content.js
CHANGED
|
@@ -21,45 +21,49 @@ const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
|
21
21
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
22
22
|
const _isglob = /*#__PURE__*/ _interop_require_default(require("is-glob"));
|
|
23
23
|
const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
24
|
-
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
25
24
|
const _parseGlob = require("../util/parseGlob");
|
|
26
25
|
const _sharedState = require("./sharedState");
|
|
27
|
-
const _oxide = require("@tailwindcss/oxide");
|
|
28
26
|
function _interop_require_default(obj) {
|
|
29
27
|
return obj && obj.__esModule ? obj : {
|
|
30
28
|
default: obj
|
|
31
29
|
};
|
|
32
30
|
}
|
|
33
|
-
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
base: process.cwd()
|
|
44
|
-
});
|
|
45
|
-
_sharedState.env.DEBUG && console.timeEnd('Calculating resolve content paths');
|
|
46
|
-
tailwindConfig.content.files.splice(idx, 1, ...resolved);
|
|
47
|
-
}
|
|
31
|
+
/*!
|
|
32
|
+
* Modified version of normalize-path, original license below
|
|
33
|
+
*
|
|
34
|
+
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
35
|
+
*
|
|
36
|
+
* Copyright (c) 2014-2018, Jon Schlinkert.
|
|
37
|
+
* Released under the MIT License.
|
|
38
|
+
*/ function normalizePath(path) {
|
|
39
|
+
if (typeof path !== "string") {
|
|
40
|
+
throw new TypeError("expected path to be a string");
|
|
48
41
|
}
|
|
49
|
-
if (
|
|
50
|
-
|
|
42
|
+
if (path === "\\" || path === "/") return "/";
|
|
43
|
+
var len = path.length;
|
|
44
|
+
if (len <= 1) return path;
|
|
45
|
+
// ensure that win32 namespaces has two leading slashes, so that the path is
|
|
46
|
+
// handled properly by the win32 version of path.parse() after being normalized
|
|
47
|
+
// https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx#namespaces
|
|
48
|
+
var prefix = "";
|
|
49
|
+
if (len > 4 && path[3] === "\\") {
|
|
50
|
+
var ch = path[2];
|
|
51
|
+
if ((ch === "?" || ch === ".") && path.slice(0, 2) === "\\\\") {
|
|
52
|
+
path = path.slice(2);
|
|
53
|
+
prefix = "//";
|
|
54
|
+
}
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
// Modified part: instead of purely splitting on `\\` and `/`, we split on
|
|
57
|
+
// `/` and `\\` that is _not_ followed by any of the following characters: ()[]
|
|
58
|
+
// This is to ensure that we keep the escaping of brackets and parentheses
|
|
59
|
+
let segs = path.split(/[/\\]+(?![\(\)\[\]])/);
|
|
60
|
+
return prefix + segs.join("/");
|
|
53
61
|
}
|
|
54
62
|
function parseCandidateFiles(context, tailwindConfig) {
|
|
55
|
-
let files =
|
|
56
|
-
skip: [
|
|
57
|
-
context.userConfigPath
|
|
58
|
-
]
|
|
59
|
-
});
|
|
63
|
+
let files = tailwindConfig.content.files;
|
|
60
64
|
// Normalize the file globs
|
|
61
|
-
files = files.filter((filePath)=>typeof filePath ===
|
|
62
|
-
files = files.map(
|
|
65
|
+
files = files.filter((filePath)=>typeof filePath === "string");
|
|
66
|
+
files = files.map(normalizePath);
|
|
63
67
|
// Split into included and excluded globs
|
|
64
68
|
let tasks = _fastglob.default.generateTasks(files);
|
|
65
69
|
/** @type {ContentPath[]} */ let included = [];
|
|
@@ -86,6 +90,9 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
86
90
|
* @param {boolean} ignore
|
|
87
91
|
* @returns {ContentPath}
|
|
88
92
|
*/ function parseFilePath(filePath, ignore) {
|
|
93
|
+
// Escape special characters in the file path such as: ()[]
|
|
94
|
+
// But only if the special character isn't already escaped
|
|
95
|
+
filePath = filePath.replace(/(?<!\\)([\[\]\(\)])/g, "\\$1");
|
|
89
96
|
let contentPath = {
|
|
90
97
|
original: filePath,
|
|
91
98
|
base: filePath,
|
|
@@ -107,7 +114,7 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
107
114
|
// Afaik, this technically shouldn't be needed but there's probably
|
|
108
115
|
// some internal, direct path matching with a normalized path in
|
|
109
116
|
// a package which can't handle mixed directory separators
|
|
110
|
-
let base = (
|
|
117
|
+
let base = normalizePath(contentPath.base);
|
|
111
118
|
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
|
112
119
|
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
|
113
120
|
base = _fastglob.default.escapePath(base);
|
|
@@ -155,13 +162,13 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
155
162
|
base: resolvedPath
|
|
156
163
|
});
|
|
157
164
|
}
|
|
158
|
-
} catch
|
|
165
|
+
} catch {
|
|
159
166
|
// TODO: log this?
|
|
160
167
|
}
|
|
161
168
|
return paths;
|
|
162
169
|
}
|
|
163
170
|
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
164
|
-
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw ===
|
|
171
|
+
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === "string").map(({ raw , extension ="html" })=>({
|
|
165
172
|
content: raw,
|
|
166
173
|
extension
|
|
167
174
|
}));
|
|
@@ -187,7 +194,7 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
187
194
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
188
195
|
let mTimesToCommit = new Map();
|
|
189
196
|
let changedFiles = new Set();
|
|
190
|
-
_sharedState.env.DEBUG && console.time(
|
|
197
|
+
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
191
198
|
let files = _fastglob.default.sync(paths, {
|
|
192
199
|
absolute: true
|
|
193
200
|
});
|
|
@@ -199,7 +206,7 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
199
206
|
mTimesToCommit.set(file, modified);
|
|
200
207
|
}
|
|
201
208
|
}
|
|
202
|
-
_sharedState.env.DEBUG && console.timeEnd(
|
|
209
|
+
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
|
|
203
210
|
return [
|
|
204
211
|
changedFiles,
|
|
205
212
|
mTimesToCommit
|
|
@@ -56,20 +56,19 @@ function defaultExtractor(context) {
|
|
|
56
56
|
/** @type {(string|string)[]} */ let results = [];
|
|
57
57
|
for (let pattern of patterns){
|
|
58
58
|
var _content_match;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
];
|
|
59
|
+
for (let result of (_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []){
|
|
60
|
+
results.push(clipAtBalancedParens(result));
|
|
61
|
+
}
|
|
63
62
|
}
|
|
64
|
-
return results
|
|
63
|
+
return results;
|
|
65
64
|
};
|
|
66
65
|
}
|
|
67
66
|
function* buildRegExps(context) {
|
|
68
67
|
let separator = context.tailwindConfig.separator;
|
|
69
|
-
let prefix = context.tailwindConfig.prefix !==
|
|
68
|
+
let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
|
|
70
69
|
/-?/,
|
|
71
70
|
_regex.escape(context.tailwindConfig.prefix)
|
|
72
|
-
])) :
|
|
71
|
+
])) : "";
|
|
73
72
|
let utility = _regex.any([
|
|
74
73
|
// Arbitrary properties (without square brackets)
|
|
75
74
|
/\[[^\s:'"`]+:[^\s\[\]]+\]/,
|
|
@@ -77,16 +76,25 @@ function* buildRegExps(context) {
|
|
|
77
76
|
// This is a targeted fix to continue to allow theme()
|
|
78
77
|
// with square brackets to work in arbitrary properties
|
|
79
78
|
// while fixing a problem with the regex matching too much
|
|
80
|
-
/\[[^\s:'"
|
|
79
|
+
/\[[^\s:'"`\]]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
|
|
81
80
|
// Utilities
|
|
82
81
|
_regex.pattern([
|
|
83
82
|
// Utility Name / Group Name
|
|
84
|
-
|
|
83
|
+
_regex.any([
|
|
84
|
+
/-?(?:\w+)/,
|
|
85
|
+
// This is here to make sure @container supports everything that other utilities do
|
|
86
|
+
/@(?:\w+)/
|
|
87
|
+
]),
|
|
85
88
|
// Normal/Arbitrary values
|
|
86
89
|
_regex.optional(_regex.any([
|
|
87
90
|
_regex.pattern([
|
|
88
91
|
// Arbitrary values
|
|
89
|
-
|
|
92
|
+
_regex.any([
|
|
93
|
+
/-(?:\w+-)*\['[^\s]+'\]/,
|
|
94
|
+
/-(?:\w+-)*\["[^\s]+"\]/,
|
|
95
|
+
/-(?:\w+-)*\[`[^\s]+`\]/,
|
|
96
|
+
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/
|
|
97
|
+
]),
|
|
90
98
|
// Not immediately followed by an `{[(`
|
|
91
99
|
/(?![{([]])/,
|
|
92
100
|
// optionally followed by an opacity modifier
|
|
@@ -94,7 +102,12 @@ function* buildRegExps(context) {
|
|
|
94
102
|
]),
|
|
95
103
|
_regex.pattern([
|
|
96
104
|
// Arbitrary values
|
|
97
|
-
|
|
105
|
+
_regex.any([
|
|
106
|
+
/-(?:\w+-)*\['[^\s]+'\]/,
|
|
107
|
+
/-(?:\w+-)*\["[^\s]+"\]/,
|
|
108
|
+
/-(?:\w+-)*\[`[^\s]+`\]/,
|
|
109
|
+
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s\[\]]+\]/
|
|
110
|
+
]),
|
|
98
111
|
// Not immediately followed by an `{[(`
|
|
99
112
|
/(?![{([]])/,
|
|
100
113
|
// optionally followed by an opacity modifier
|
|
@@ -113,6 +126,11 @@ function* buildRegExps(context) {
|
|
|
113
126
|
/@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
|
|
114
127
|
separator
|
|
115
128
|
]),
|
|
129
|
+
// With variant modifier (e.g.: group-[..]/modifier)
|
|
130
|
+
_regex.pattern([
|
|
131
|
+
/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/[\w_-]+/,
|
|
132
|
+
separator
|
|
133
|
+
]),
|
|
116
134
|
_regex.pattern([
|
|
117
135
|
/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
|
|
118
136
|
separator
|
|
@@ -124,6 +142,11 @@ function* buildRegExps(context) {
|
|
|
124
142
|
]),
|
|
125
143
|
// With quotes allowed
|
|
126
144
|
_regex.any([
|
|
145
|
+
// With variant modifier (e.g.: group-[..]/modifier)
|
|
146
|
+
_regex.pattern([
|
|
147
|
+
/([^\s"'`\[\\]+-)?\[[^\s`]+\]\/[\w_-]+/,
|
|
148
|
+
separator
|
|
149
|
+
]),
|
|
127
150
|
_regex.pattern([
|
|
128
151
|
/([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
|
|
129
152
|
separator
|
|
@@ -137,9 +160,9 @@ function* buildRegExps(context) {
|
|
|
137
160
|
for (const variantPattern of variantPatterns){
|
|
138
161
|
yield _regex.pattern([
|
|
139
162
|
// Variants
|
|
140
|
-
|
|
163
|
+
"((?=((",
|
|
141
164
|
variantPattern,
|
|
142
|
-
|
|
165
|
+
")+))\\2)?",
|
|
143
166
|
// Important (optional)
|
|
144
167
|
/!?/,
|
|
145
168
|
prefix,
|
|
@@ -168,7 +191,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
168
191
|
* @param {string} input
|
|
169
192
|
*/ function clipAtBalancedParens(input) {
|
|
170
193
|
// We are care about this for arbitrary values
|
|
171
|
-
if (!input.includes(
|
|
194
|
+
if (!input.includes("-[")) {
|
|
172
195
|
return input;
|
|
173
196
|
}
|
|
174
197
|
let depth = 0;
|
|
@@ -192,15 +215,15 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
192
215
|
let inStringType = openStringTypes[openStringTypes.length - 1];
|
|
193
216
|
if (char === inStringType) {
|
|
194
217
|
openStringTypes.pop();
|
|
195
|
-
} else if (char === "'" || char === '"' || char ===
|
|
218
|
+
} else if (char === "'" || char === '"' || char === "`") {
|
|
196
219
|
openStringTypes.push(char);
|
|
197
220
|
}
|
|
198
221
|
if (inStringType) {
|
|
199
222
|
continue;
|
|
200
|
-
} else if (char ===
|
|
223
|
+
} else if (char === "[") {
|
|
201
224
|
depth++;
|
|
202
225
|
continue;
|
|
203
|
-
} else if (char ===
|
|
226
|
+
} else if (char === "]") {
|
|
204
227
|
depth--;
|
|
205
228
|
continue;
|
|
206
229
|
}
|
|
@@ -24,31 +24,31 @@ function _interop_require_default(obj) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
function isObject(input) {
|
|
27
|
-
return typeof input ===
|
|
27
|
+
return typeof input === "object" && input !== null;
|
|
28
28
|
}
|
|
29
29
|
function findClosestExistingPath(theme, path) {
|
|
30
30
|
let parts = (0, _toPath.toPath)(path);
|
|
31
31
|
do {
|
|
32
32
|
parts.pop();
|
|
33
33
|
if ((0, _dlv.default)(theme, parts) !== undefined) break;
|
|
34
|
-
}while (parts.length)
|
|
34
|
+
}while (parts.length);
|
|
35
35
|
return parts.length ? parts : undefined;
|
|
36
36
|
}
|
|
37
37
|
function pathToString(path) {
|
|
38
|
-
if (typeof path ===
|
|
38
|
+
if (typeof path === "string") return path;
|
|
39
39
|
return path.reduce((acc, cur, i)=>{
|
|
40
|
-
if (cur.includes(
|
|
40
|
+
if (cur.includes(".")) return `${acc}[${cur}]`;
|
|
41
41
|
return i === 0 ? cur : `${acc}.${cur}`;
|
|
42
|
-
},
|
|
42
|
+
}, "");
|
|
43
43
|
}
|
|
44
44
|
function list(items) {
|
|
45
|
-
return items.map((key)=>`'${key}'`).join(
|
|
45
|
+
return items.map((key)=>`'${key}'`).join(", ");
|
|
46
46
|
}
|
|
47
47
|
function listKeys(obj) {
|
|
48
48
|
return list(Object.keys(obj));
|
|
49
49
|
}
|
|
50
50
|
function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
51
|
-
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g,
|
|
51
|
+
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, "");
|
|
52
52
|
const pathSegments = Array.isArray(path) ? path : (0, _toPath.toPath)(pathString);
|
|
53
53
|
const value = (0, _dlv.default)(config.theme, pathSegments, defaultValue);
|
|
54
54
|
if (value === undefined) {
|
|
@@ -87,7 +87,7 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
|
87
87
|
error
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
|
-
if (!(typeof value ===
|
|
90
|
+
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
|
|
91
91
|
let error = `'${pathString}' was found but does not resolve to a string.`;
|
|
92
92
|
if (isObject(value)) {
|
|
93
93
|
let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
|
|
@@ -115,11 +115,11 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
|
115
115
|
function extractArgs(node, vNodes, functions) {
|
|
116
116
|
vNodes = vNodes.map((vNode)=>resolveVNode(node, vNode, functions));
|
|
117
117
|
let args = [
|
|
118
|
-
|
|
118
|
+
""
|
|
119
119
|
];
|
|
120
120
|
for (let vNode of vNodes){
|
|
121
|
-
if (vNode.type ===
|
|
122
|
-
args.push(
|
|
121
|
+
if (vNode.type === "div" && vNode.value === ",") {
|
|
122
|
+
args.push("");
|
|
123
123
|
} else {
|
|
124
124
|
args[args.length - 1] += _index.default.stringify(vNode);
|
|
125
125
|
}
|
|
@@ -127,9 +127,9 @@ function extractArgs(node, vNodes, functions) {
|
|
|
127
127
|
return args;
|
|
128
128
|
}
|
|
129
129
|
function resolveVNode(node, vNode, functions) {
|
|
130
|
-
if (vNode.type ===
|
|
130
|
+
if (vNode.type === "function" && functions[vNode.value] !== undefined) {
|
|
131
131
|
let args = extractArgs(node, vNode.nodes, functions);
|
|
132
|
-
vNode.type =
|
|
132
|
+
vNode.type = "word";
|
|
133
133
|
vNode.value = functions[vNode.value](node, ...args);
|
|
134
134
|
}
|
|
135
135
|
return vNode;
|
|
@@ -142,8 +142,8 @@ function resolveFunctions(node, input, functions) {
|
|
|
142
142
|
}).toString();
|
|
143
143
|
}
|
|
144
144
|
let nodeTypePropertyMap = {
|
|
145
|
-
atrule:
|
|
146
|
-
decl:
|
|
145
|
+
atrule: "params",
|
|
146
|
+
decl: "value"
|
|
147
147
|
};
|
|
148
148
|
/**
|
|
149
149
|
* @param {string} path
|
|
@@ -151,7 +151,7 @@ let nodeTypePropertyMap = {
|
|
|
151
151
|
*/ function* toPaths(path) {
|
|
152
152
|
// Strip quotes from beginning and end of string
|
|
153
153
|
// This allows the alpha value to be present inside of quotes
|
|
154
|
-
path = path.replace(/^['"]+|['"]+$/g,
|
|
154
|
+
path = path.replace(/^['"]+|['"]+$/g, "");
|
|
155
155
|
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
|
|
156
156
|
let alpha = undefined;
|
|
157
157
|
yield [
|
|
@@ -188,18 +188,18 @@ function _default(context) {
|
|
|
188
188
|
let config = context.tailwindConfig;
|
|
189
189
|
let functions = {
|
|
190
190
|
theme: (node, path, ...defaultValue)=>{
|
|
191
|
-
let { isValid, value, error, alpha
|
|
191
|
+
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
192
192
|
if (!isValid) {
|
|
193
|
-
var _parentNode_raws_tailwind
|
|
193
|
+
var _parentNode_raws_tailwind;
|
|
194
194
|
let parentNode = node.parent;
|
|
195
|
-
let candidate = (
|
|
195
|
+
let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
|
|
196
196
|
if (parentNode && candidate !== undefined) {
|
|
197
197
|
// Remove this utility from any caches
|
|
198
198
|
context.markInvalidUtilityNode(parentNode);
|
|
199
199
|
// Remove the CSS node from the markup
|
|
200
200
|
parentNode.remove();
|
|
201
201
|
// Show a warning
|
|
202
|
-
_log.default.warn(
|
|
202
|
+
_log.default.warn("invalid-theme-key-in-class", [
|
|
203
203
|
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`
|
|
204
204
|
]);
|
|
205
205
|
return;
|
|
@@ -207,7 +207,7 @@ function _default(context) {
|
|
|
207
207
|
throw node.error(error);
|
|
208
208
|
}
|
|
209
209
|
let maybeColor = (0, _pluginUtils.parseColorFormat)(value);
|
|
210
|
-
let isColorFunction = maybeColor !== undefined && typeof maybeColor ===
|
|
210
|
+
let isColorFunction = maybeColor !== undefined && typeof maybeColor === "function";
|
|
211
211
|
if (alpha !== undefined || isColorFunction) {
|
|
212
212
|
if (alpha === undefined) {
|
|
213
213
|
alpha = 1.0;
|
|
@@ -217,9 +217,9 @@ function _default(context) {
|
|
|
217
217
|
return value;
|
|
218
218
|
},
|
|
219
219
|
screen: (node, screen)=>{
|
|
220
|
-
screen = screen.replace(/^['"]+/g,
|
|
220
|
+
screen = screen.replace(/^['"]+/g, "").replace(/['"]+$/g, "");
|
|
221
221
|
let screens = (0, _normalizeScreens.normalizeScreens)(config.theme.screens);
|
|
222
|
-
let screenDefinition = screens.find(({ name
|
|
222
|
+
let screenDefinition = screens.find(({ name })=>name === screen);
|
|
223
223
|
if (!screenDefinition) {
|
|
224
224
|
throw node.error(`The '${screen}' screen does not exist in your theme.`);
|
|
225
225
|
}
|