tailwindcss 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -6
- package/lib/cli/build/deps.js +17 -9
- package/lib/cli/build/index.js +10 -8
- package/lib/cli/build/plugin.js +27 -25
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +12 -10
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +4 -4
- package/lib/cli/init/index.js +8 -6
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +3 -1
- package/lib/corePlugins.js +41 -35
- package/lib/featureFlags.js +14 -9
- package/lib/index.js +1 -5
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +3 -1
- package/lib/lib/collapseDuplicateDeclarations.js +10 -8
- package/lib/lib/content.js +18 -14
- package/lib/lib/defaultExtractor.js +6 -4
- package/lib/lib/detectNesting.js +3 -1
- package/lib/lib/evaluateTailwindFunctions.js +18 -16
- package/lib/lib/expandApplyAtRules.js +37 -40
- package/lib/lib/expandTailwindAtRules.js +15 -13
- package/lib/lib/findAtConfigPath.js +6 -4
- package/lib/lib/generateRules.js +37 -31
- package/lib/lib/getModuleDependencies.js +10 -8
- package/lib/lib/load-config.js +5 -3
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +7 -5
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +3 -1
- package/lib/lib/resolveDefaultsAtRules.js +24 -20
- package/lib/lib/setupContextUtils.js +67 -57
- package/lib/lib/setupTrackingContext.js +26 -24
- package/lib/lib/sharedState.js +28 -24
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +16 -8
- package/lib/oxide/cli/build/index.js +6 -4
- package/lib/oxide/cli/build/plugin.js +19 -17
- package/lib/oxide/cli/build/utils.js +18 -8
- package/lib/oxide/cli/build/watching.js +10 -8
- package/lib/oxide/cli/help/index.js +6 -4
- package/lib/oxide/cli/index.js +4 -4
- package/lib/oxide/cli/init/index.js +6 -4
- package/lib/plugin.js +7 -7
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +8 -6
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +5 -3
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +5 -3
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +9 -10
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +3 -1
- package/lib/util/color.js +10 -6
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +5 -3
- package/lib/util/dataTypes.js +45 -15
- package/lib/util/defaults.js +6 -4
- package/lib/util/escapeClassName.js +7 -5
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +28 -108
- package/lib/util/getAllConfigs.js +6 -4
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +3 -1
- package/lib/util/normalizeConfig.js +7 -5
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +30 -18
- package/lib/util/prefixSelector.js +6 -4
- package/lib/util/pseudoElements.js +225 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +10 -8
- package/lib/util/resolveConfigPath.js +9 -5
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +3 -1
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +5 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/package.json +30 -34
- package/peers/index.js +65828 -48819
- package/src/cli/build/plugin.js +1 -1
- package/src/cli.js +1 -1
- package/src/corePlugins.js +16 -17
- package/src/featureFlags.js +2 -3
- package/src/index.js +1 -5
- package/src/lib/defaultExtractor.js +1 -1
- package/src/lib/expandApplyAtRules.js +2 -8
- package/src/lib/expandTailwindAtRules.js +3 -3
- package/src/lib/setupTrackingContext.js +1 -1
- package/src/lib/sharedState.js +0 -15
- package/src/oxide/cli/build/plugin.ts +1 -1
- package/src/plugin.js +1 -1
- package/src/util/applyImportantSelector.js +2 -5
- package/src/util/color.js +1 -1
- package/src/util/colorNames.js +150 -0
- package/src/util/formatVariantSelector.js +2 -124
- package/src/util/pluginUtils.js +1 -5
- package/src/util/pseudoElements.js +170 -0
package/lib/featureFlags.js
CHANGED
|
@@ -9,14 +9,19 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
flagEnabled: ()
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
flagEnabled: function() {
|
|
13
|
+
return flagEnabled;
|
|
14
|
+
},
|
|
15
|
+
issueFlagNotices: function() {
|
|
16
|
+
return issueFlagNotices;
|
|
17
|
+
},
|
|
18
|
+
default: function() {
|
|
19
|
+
return _default;
|
|
20
|
+
}
|
|
15
21
|
});
|
|
16
|
-
const _picocolors = /*#__PURE__*/
|
|
17
|
-
const _log = /*#__PURE__*/
|
|
18
|
-
|
|
19
|
-
function _interopRequireDefault(obj) {
|
|
22
|
+
const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
|
|
23
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("./util/log"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
20
25
|
return obj && obj.__esModule ? obj : {
|
|
21
26
|
default: obj
|
|
22
27
|
};
|
|
@@ -25,10 +30,10 @@ let defaults = {
|
|
|
25
30
|
optimizeUniversalDefaults: false,
|
|
26
31
|
generalizedModifiers: true,
|
|
27
32
|
get disableColorOpacityUtilitiesByDefault () {
|
|
28
|
-
return
|
|
33
|
+
return false;
|
|
29
34
|
},
|
|
30
35
|
get relativeContentPathsByDefault () {
|
|
31
|
-
return
|
|
36
|
+
return false;
|
|
32
37
|
}
|
|
33
38
|
};
|
|
34
39
|
let featureFlags = {
|
package/lib/index.js
CHANGED
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "hasContentChanged", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return hasContentChanged;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _crypto = /*#__PURE__*/
|
|
10
|
-
const _sharedState = /*#__PURE__*/
|
|
11
|
-
function
|
|
11
|
+
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
12
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -21,7 +23,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
21
23
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
24
|
})(nodeInterop);
|
|
23
25
|
}
|
|
24
|
-
function
|
|
26
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
27
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
28
|
return obj;
|
|
27
29
|
}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return collapseDuplicateDeclarations;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function collapseDuplicateDeclarations() {
|
|
10
12
|
return (root)=>{
|
|
@@ -51,21 +53,21 @@ function collapseDuplicateDeclarations() {
|
|
|
51
53
|
// with the same unit but the last one in the list.
|
|
52
54
|
for (let declarations of byProperty.values()){
|
|
53
55
|
let byUnit = new Map();
|
|
54
|
-
for (let
|
|
55
|
-
let unit = resolveUnit(
|
|
56
|
+
for (let decl of declarations){
|
|
57
|
+
let unit = resolveUnit(decl.value);
|
|
56
58
|
if (unit === null) {
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
59
61
|
if (!byUnit.has(unit)) {
|
|
60
62
|
byUnit.set(unit, new Set());
|
|
61
63
|
}
|
|
62
|
-
byUnit.get(unit).add(
|
|
64
|
+
byUnit.get(unit).add(decl);
|
|
63
65
|
}
|
|
64
|
-
for (let
|
|
66
|
+
for (let declarations of byUnit.values()){
|
|
65
67
|
// Get all but the last one
|
|
66
|
-
let removableDeclarations = Array.from(
|
|
67
|
-
for (let
|
|
68
|
-
|
|
68
|
+
let removableDeclarations = Array.from(declarations).slice(0, -1);
|
|
69
|
+
for (let decl of removableDeclarations){
|
|
70
|
+
decl.remove();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
package/lib/lib/content.js
CHANGED
|
@@ -10,17 +10,21 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
parseCandidateFiles: ()
|
|
14
|
-
|
|
13
|
+
parseCandidateFiles: function() {
|
|
14
|
+
return parseCandidateFiles;
|
|
15
|
+
},
|
|
16
|
+
resolvedChangedContent: function() {
|
|
17
|
+
return resolvedChangedContent;
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
|
-
const _fs = /*#__PURE__*/
|
|
17
|
-
const _path = /*#__PURE__*/
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
21
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
22
|
+
const _isglob = /*#__PURE__*/ _interop_require_default(require("is-glob"));
|
|
23
|
+
const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
24
|
+
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
21
25
|
const _parseGlob = require("../util/parseGlob");
|
|
22
26
|
const _sharedState = require("./sharedState");
|
|
23
|
-
function
|
|
27
|
+
function _interop_require_default(obj) {
|
|
24
28
|
return obj && obj.__esModule ? obj : {
|
|
25
29
|
default: obj
|
|
26
30
|
};
|
|
@@ -29,9 +33,9 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
29
33
|
let files = tailwindConfig.content.files;
|
|
30
34
|
// Normalize the file globs
|
|
31
35
|
files = files.filter((filePath)=>typeof filePath === "string");
|
|
32
|
-
files = files.map(
|
|
36
|
+
files = files.map(_normalizepath.default);
|
|
33
37
|
// Split into included and excluded globs
|
|
34
|
-
let tasks =
|
|
38
|
+
let tasks = _fastglob.default.generateTasks(files);
|
|
35
39
|
/** @type {ContentPath[]} */ let included = [];
|
|
36
40
|
/** @type {ContentPath[]} */ let excluded = [];
|
|
37
41
|
for (const task of tasks){
|
|
@@ -63,7 +67,7 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
63
67
|
pattern: filePath,
|
|
64
68
|
glob: null
|
|
65
69
|
};
|
|
66
|
-
if ((0,
|
|
70
|
+
if ((0, _isglob.default)(filePath)) {
|
|
67
71
|
Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
|
|
68
72
|
}
|
|
69
73
|
return contentPath;
|
|
@@ -77,10 +81,10 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
77
81
|
// Afaik, this technically shouldn't be needed but there's probably
|
|
78
82
|
// some internal, direct path matching with a normalized path in
|
|
79
83
|
// a package which can't handle mixed directory separators
|
|
80
|
-
let base = (0,
|
|
84
|
+
let base = (0, _normalizepath.default)(contentPath.base);
|
|
81
85
|
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
|
82
86
|
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
|
83
|
-
base =
|
|
87
|
+
base = _fastglob.default.escapePath(base);
|
|
84
88
|
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
|
|
85
89
|
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
|
|
86
90
|
return contentPath;
|
|
@@ -158,7 +162,7 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
158
162
|
let mTimesToCommit = new Map();
|
|
159
163
|
let changedFiles = new Set();
|
|
160
164
|
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
161
|
-
let files =
|
|
165
|
+
let files = _fastglob.default.sync(paths, {
|
|
162
166
|
absolute: true
|
|
163
167
|
});
|
|
164
168
|
for (let file of files){
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "defaultExtractor", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return defaultExtractor;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _featureFlags = require("../featureFlags");
|
|
10
|
-
const _regex = /*#__PURE__*/
|
|
12
|
+
const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
|
|
11
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
12
14
|
if (typeof WeakMap !== "function") return null;
|
|
13
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -16,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
16
18
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
17
19
|
})(nodeInterop);
|
|
18
20
|
}
|
|
19
|
-
function
|
|
21
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
20
22
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
21
23
|
return obj;
|
|
22
24
|
}
|
|
@@ -77,7 +79,7 @@ function* buildRegExps(context) {
|
|
|
77
79
|
// This is a targeted fix to continue to allow theme()
|
|
78
80
|
// with square brackets to work in arbitrary properties
|
|
79
81
|
// while fixing a problem with the regex matching too much
|
|
80
|
-
/\[[^\s:'"`]+:[^\s]+?\[[^\s]
|
|
82
|
+
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
|
|
81
83
|
// Utilities
|
|
82
84
|
_regex.pattern([
|
|
83
85
|
// Utility Name / Group Name
|
package/lib/lib/detectNesting.js
CHANGED
|
@@ -4,19 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _dlv = /*#__PURE__*/
|
|
10
|
-
const _didyoumean = /*#__PURE__*/
|
|
11
|
-
const _transformThemeValue = /*#__PURE__*/
|
|
12
|
-
const
|
|
11
|
+
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
12
|
+
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
|
|
13
|
+
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
14
|
+
const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("postcss-value-parser"));
|
|
13
15
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
14
|
-
const _buildMediaQuery = /*#__PURE__*/
|
|
16
|
+
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
15
17
|
const _toPath = require("../util/toPath");
|
|
16
18
|
const _withAlphaVariable = require("../util/withAlphaVariable");
|
|
17
19
|
const _pluginUtils = require("../util/pluginUtils");
|
|
18
|
-
const _log = /*#__PURE__*/
|
|
19
|
-
function
|
|
20
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
20
22
|
return obj && obj.__esModule ? obj : {
|
|
21
23
|
default: obj
|
|
22
24
|
};
|
|
@@ -86,22 +88,22 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
|
|
89
|
-
let
|
|
91
|
+
let error = `'${pathString}' was found but does not resolve to a string.`;
|
|
90
92
|
if (isObject(value)) {
|
|
91
|
-
let
|
|
93
|
+
let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
|
|
92
94
|
...pathSegments,
|
|
93
95
|
key
|
|
94
96
|
]).isValid);
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
+
if (validKeys.length) {
|
|
98
|
+
error += ` Did you mean something like '${pathToString([
|
|
97
99
|
...pathSegments,
|
|
98
|
-
|
|
100
|
+
validKeys[0]
|
|
99
101
|
])}'?`;
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
return {
|
|
103
105
|
isValid: false,
|
|
104
|
-
error
|
|
106
|
+
error
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
109
|
const [themeSection] = pathSegments;
|
|
@@ -119,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
|
|
|
119
121
|
if (vNode.type === "div" && vNode.value === ",") {
|
|
120
122
|
args.push("");
|
|
121
123
|
} else {
|
|
122
|
-
args[args.length - 1] +=
|
|
124
|
+
args[args.length - 1] += _postcssvalueparser.default.stringify(vNode);
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
return args;
|
|
@@ -133,7 +135,7 @@ function resolveVNode(node, vNode, functions) {
|
|
|
133
135
|
return vNode;
|
|
134
136
|
}
|
|
135
137
|
function resolveFunctions(node, input, functions) {
|
|
136
|
-
return (0,
|
|
138
|
+
return (0, _postcssvalueparser.default)(input).walk((vNode)=>{
|
|
137
139
|
resolveVNode(node, vNode, functions);
|
|
138
140
|
}).toString();
|
|
139
141
|
}
|
|
@@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return expandApplyAtRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _postcss = /*#__PURE__*/
|
|
10
|
-
const
|
|
11
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
12
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
11
13
|
const _generateRules = require("./generateRules");
|
|
12
|
-
const _escapeClassName = /*#__PURE__*/
|
|
14
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
13
15
|
const _applyImportantSelector = require("../util/applyImportantSelector");
|
|
14
|
-
const
|
|
15
|
-
function
|
|
16
|
+
const _pseudoElements = require("../util/pseudoElements");
|
|
17
|
+
function _interop_require_default(obj) {
|
|
16
18
|
return obj && obj.__esModule ? obj : {
|
|
17
19
|
default: obj
|
|
18
20
|
};
|
|
@@ -25,7 +27,7 @@ function _interopRequireDefault(obj) {
|
|
|
25
27
|
]
|
|
26
28
|
});
|
|
27
29
|
container.walkRules((rule)=>{
|
|
28
|
-
(0,
|
|
30
|
+
(0, _postcssselectorparser.default)((selectors)=>{
|
|
29
31
|
selectors.walkClasses((classSelector)=>{
|
|
30
32
|
let parentSelector = classSelector.parent.toString();
|
|
31
33
|
let classes = groups.get(parentSelector);
|
|
@@ -42,7 +44,7 @@ function _interopRequireDefault(obj) {
|
|
|
42
44
|
groups: normalizedGroups
|
|
43
45
|
});
|
|
44
46
|
}
|
|
45
|
-
let selectorExtractor = (0,
|
|
47
|
+
let selectorExtractor = (0, _postcssselectorparser.default)();
|
|
46
48
|
/**
|
|
47
49
|
* @param {string} ruleSelectors
|
|
48
50
|
*/ function extractSelectors(ruleSelectors) {
|
|
@@ -311,11 +313,11 @@ function processApply(root, context, localCache) {
|
|
|
311
313
|
// Sort tag names before class names (but only sort each group (separated by a combinator)
|
|
312
314
|
// separately and not in total)
|
|
313
315
|
// This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
|
|
314
|
-
for (let
|
|
316
|
+
for (let sel of replaced){
|
|
315
317
|
let groups = [
|
|
316
318
|
[]
|
|
317
319
|
];
|
|
318
|
-
for (let node of
|
|
320
|
+
for (let node of sel.nodes){
|
|
319
321
|
if (node.type === "combinator") {
|
|
320
322
|
groups.push(node);
|
|
321
323
|
groups.push([]);
|
|
@@ -324,7 +326,7 @@ function processApply(root, context, localCache) {
|
|
|
324
326
|
last.push(node);
|
|
325
327
|
}
|
|
326
328
|
}
|
|
327
|
-
|
|
329
|
+
sel.nodes = [];
|
|
328
330
|
for (let group of groups){
|
|
329
331
|
if (Array.isArray(group)) {
|
|
330
332
|
group.sort((a, b)=>{
|
|
@@ -340,7 +342,7 @@ function processApply(root, context, localCache) {
|
|
|
340
342
|
return 0;
|
|
341
343
|
});
|
|
342
344
|
}
|
|
343
|
-
|
|
345
|
+
sel.nodes = sel.nodes.concat(group);
|
|
344
346
|
}
|
|
345
347
|
}
|
|
346
348
|
sel.replaceWith(...replaced);
|
|
@@ -358,15 +360,15 @@ function processApply(root, context, localCache) {
|
|
|
358
360
|
candidates,
|
|
359
361
|
apply.source
|
|
360
362
|
]);
|
|
361
|
-
let [
|
|
363
|
+
let [applyCandidates, important] = extractApplyCandidates(apply.params);
|
|
362
364
|
if (apply.parent.type === "atrule") {
|
|
363
365
|
if (apply.parent.name === "screen") {
|
|
364
366
|
let screenType = apply.parent.params;
|
|
365
|
-
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${
|
|
367
|
+
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates.map((c)=>`${screenType}:${c}`).join(" ")} instead.`);
|
|
366
368
|
}
|
|
367
369
|
throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
|
|
368
370
|
}
|
|
369
|
-
for (let applyCandidate of
|
|
371
|
+
for (let applyCandidate of applyCandidates){
|
|
370
372
|
if ([
|
|
371
373
|
prefix(context, "group"),
|
|
372
374
|
prefix(context, "peer")
|
|
@@ -385,16 +387,16 @@ function processApply(root, context, localCache) {
|
|
|
385
387
|
]);
|
|
386
388
|
}
|
|
387
389
|
}
|
|
388
|
-
for (let [parent, [
|
|
390
|
+
for (let [parent, [candidates, atApplySource]] of perParentApplies){
|
|
389
391
|
let siblings = [];
|
|
390
|
-
for (let [
|
|
392
|
+
for (let [applyCandidate, important, rules] of candidates){
|
|
391
393
|
let potentialApplyCandidates = [
|
|
392
|
-
|
|
394
|
+
applyCandidate,
|
|
393
395
|
...extractBaseCandidates([
|
|
394
|
-
|
|
396
|
+
applyCandidate
|
|
395
397
|
], context.tailwindConfig.separator)
|
|
396
398
|
];
|
|
397
|
-
for (let [meta, node] of
|
|
399
|
+
for (let [meta, node] of rules){
|
|
398
400
|
let parentClasses = extractClasses(parent);
|
|
399
401
|
let nodeClasses = extractClasses(node);
|
|
400
402
|
// When we encounter a rule like `.dark .a, .b { … }` we only want to be left with `[.dark, .a]` if the base applyCandidate is `.a` or with `[.b]` if the base applyCandidate is `.b`
|
|
@@ -425,20 +427,20 @@ function processApply(root, context, localCache) {
|
|
|
425
427
|
nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
|
|
426
428
|
let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
|
|
427
429
|
if (intersects) {
|
|
428
|
-
throw node.error(`You cannot \`@apply\` the \`${
|
|
430
|
+
throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
|
|
429
431
|
}
|
|
430
|
-
let
|
|
432
|
+
let root = _postcss.default.root({
|
|
431
433
|
nodes: [
|
|
432
434
|
node.clone()
|
|
433
435
|
]
|
|
434
436
|
});
|
|
435
437
|
// Make sure every node in the entire tree points back at the @apply rule that generated it
|
|
436
|
-
|
|
438
|
+
root.walk((node)=>{
|
|
437
439
|
node.source = atApplySource;
|
|
438
440
|
});
|
|
439
441
|
let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
|
|
440
442
|
if (canRewriteSelector) {
|
|
441
|
-
|
|
443
|
+
root.walkRules((rule)=>{
|
|
442
444
|
// Let's imagine you have the following structure:
|
|
443
445
|
//
|
|
444
446
|
// .foo {
|
|
@@ -470,7 +472,7 @@ function processApply(root, context, localCache) {
|
|
|
470
472
|
// would have replaced this with something that didn't exist and
|
|
471
473
|
// therefore it removed the selector altogether. In this specific
|
|
472
474
|
// case it would result in `{}` instead of `.something-unrelated {}`
|
|
473
|
-
if (!extractClasses(rule).some((candidate)=>candidate ===
|
|
475
|
+
if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate)) {
|
|
474
476
|
rule.remove();
|
|
475
477
|
return;
|
|
476
478
|
}
|
|
@@ -480,34 +482,29 @@ function processApply(root, context, localCache) {
|
|
|
480
482
|
// We do *not* want to do this for user CSS that happens to be structured the same
|
|
481
483
|
let isGenerated = parent.raws.tailwind !== undefined;
|
|
482
484
|
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
|
483
|
-
rule.selector = replaceSelector(parentSelector, rule.selector,
|
|
485
|
+
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
|
|
484
486
|
// And then re-add it if it was removed
|
|
485
487
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
486
488
|
rule.selector = (0, _applyImportantSelector.applyImportantSelector)(rule.selector, importantSelector);
|
|
487
489
|
}
|
|
488
490
|
rule.walkDecls((d)=>{
|
|
489
|
-
d.important = meta.important ||
|
|
491
|
+
d.important = meta.important || important;
|
|
490
492
|
});
|
|
491
493
|
// Move pseudo elements to the end of the selector (if necessary)
|
|
492
|
-
let selector = (0,
|
|
493
|
-
selector.each((sel)=>
|
|
494
|
-
let [pseudoElements] = (0, _formatVariantSelectorJs.collectPseudoElements)(sel);
|
|
495
|
-
if (pseudoElements.length > 0) {
|
|
496
|
-
sel.nodes.push(...pseudoElements.sort(_formatVariantSelectorJs.sortSelector));
|
|
497
|
-
}
|
|
498
|
-
});
|
|
494
|
+
let selector = (0, _postcssselectorparser.default)().astSync(rule.selector);
|
|
495
|
+
selector.each((sel)=>(0, _pseudoElements.movePseudos)(sel));
|
|
499
496
|
rule.selector = selector.toString();
|
|
500
497
|
});
|
|
501
498
|
}
|
|
502
499
|
// It could be that the node we were inserted was removed because the class didn't match
|
|
503
500
|
// If that was the *only* rule in the parent, then we have nothing add so we skip it
|
|
504
|
-
if (!
|
|
501
|
+
if (!root.nodes[0]) {
|
|
505
502
|
continue;
|
|
506
503
|
}
|
|
507
504
|
// Insert it
|
|
508
505
|
siblings.push([
|
|
509
506
|
meta.sort,
|
|
510
|
-
|
|
507
|
+
root.nodes[0]
|
|
511
508
|
]);
|
|
512
509
|
}
|
|
513
510
|
}
|
|
@@ -516,13 +513,13 @@ function processApply(root, context, localCache) {
|
|
|
516
513
|
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
|
|
517
514
|
parent.after(nodes);
|
|
518
515
|
}
|
|
519
|
-
for (let
|
|
516
|
+
for (let apply of applies){
|
|
520
517
|
// If there are left-over declarations, just remove the @apply
|
|
521
|
-
if (
|
|
522
|
-
|
|
518
|
+
if (apply.parent.nodes.length > 1) {
|
|
519
|
+
apply.remove();
|
|
523
520
|
} else {
|
|
524
521
|
// The node is empty, drop the full node
|
|
525
|
-
|
|
522
|
+
apply.parent.remove();
|
|
526
523
|
}
|
|
527
524
|
}
|
|
528
525
|
// Do it again, in case we have other `@apply` rules
|
|
@@ -4,16 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return expandTailwindAtRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const
|
|
11
|
-
const _sharedState = /*#__PURE__*/
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
13
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
12
14
|
const _generateRules = require("./generateRules");
|
|
13
|
-
const _log = /*#__PURE__*/
|
|
14
|
-
const _cloneNodes = /*#__PURE__*/
|
|
15
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
16
|
+
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
|
|
15
17
|
const _defaultExtractor = require("./defaultExtractor");
|
|
16
|
-
function
|
|
18
|
+
function _interop_require_default(obj) {
|
|
17
19
|
return obj && obj.__esModule ? obj : {
|
|
18
20
|
default: obj
|
|
19
21
|
};
|
|
@@ -26,7 +28,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
26
28
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
27
29
|
})(nodeInterop);
|
|
28
30
|
}
|
|
29
|
-
function
|
|
31
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
30
32
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
31
33
|
return obj;
|
|
32
34
|
}
|
|
@@ -79,7 +81,7 @@ let extractorCache = new WeakMap();
|
|
|
79
81
|
// up these regexes by 50% that could cut initial build time by like 20%.
|
|
80
82
|
function getClassCandidates(content, extractor, candidates, seen) {
|
|
81
83
|
if (!extractorCache.has(extractor)) {
|
|
82
|
-
extractorCache.set(extractor, new
|
|
84
|
+
extractorCache.set(extractor, new _quicklru.default({
|
|
83
85
|
maxSize: 25000
|
|
84
86
|
}));
|
|
85
87
|
}
|
|
@@ -96,8 +98,8 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
96
98
|
} else {
|
|
97
99
|
let extractorMatches = extractor(line).filter((s)=>s !== "!*");
|
|
98
100
|
let lineMatchesSet = new Set(extractorMatches);
|
|
99
|
-
for (let
|
|
100
|
-
candidates.add(
|
|
101
|
+
for (let match of lineMatchesSet){
|
|
102
|
+
candidates.add(match);
|
|
101
103
|
}
|
|
102
104
|
extractorCache.get(extractor).set(line, lineMatchesSet);
|
|
103
105
|
}
|
|
@@ -152,7 +154,7 @@ function expandTailwindAtRules(context) {
|
|
|
152
154
|
]);
|
|
153
155
|
let seen = new Set();
|
|
154
156
|
env.DEBUG && console.time("Reading changed files");
|
|
155
|
-
if (
|
|
157
|
+
if (false) {
|
|
156
158
|
// TODO: Pass through or implement `extractor`
|
|
157
159
|
for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
|
|
158
160
|
candidates.add(candidate);
|
|
@@ -176,7 +178,7 @@ function expandTailwindAtRules(context) {
|
|
|
176
178
|
let classCacheCount = context.classCache.size;
|
|
177
179
|
env.DEBUG && console.time("Generate rules");
|
|
178
180
|
env.DEBUG && console.time("Sorting candidates");
|
|
179
|
-
let sortedCandidates =
|
|
181
|
+
let sortedCandidates = false ? candidates : new Set([
|
|
180
182
|
...candidates
|
|
181
183
|
].sort((a, z)=>{
|
|
182
184
|
if (a === z) return 0;
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "findAtConfigPath", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return findAtConfigPath;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _fs = /*#__PURE__*/
|
|
10
|
-
const _path = /*#__PURE__*/
|
|
11
|
-
function
|
|
11
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|