tailwindcss 0.0.0-insiders.605d8cd → 0.0.0-insiders.6069a81
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 +3 -3
- package/lib/cli/build/plugin.js +3 -1
- package/lib/css/preflight.css +1 -1
- package/lib/lib/content.js +66 -0
- package/lib/lib/expandTailwindAtRules.js +2 -2
- package/lib/lib/resolveDefaultsAtRules.js +13 -15
- package/lib/util/dataTypes.js +2 -1
- package/lib/util/removeAlphaVariables.js +2 -0
- package/lib/util/withAlphaVariable.js +2 -2
- package/package.json +29 -29
- package/peers/index.js +7236 -6038
- package/src/cli/build/plugin.js +6 -2
- package/src/css/preflight.css +1 -1
- package/src/lib/content.js +87 -0
- package/src/lib/expandTailwindAtRules.js +1 -1
- package/src/lib/resolveDefaultsAtRules.js +11 -13
- package/src/util/dataTypes.js +2 -0
- package/src/util/removeAlphaVariables.js +2 -0
- package/src/util/withAlphaVariable.js +2 -2
- package/types/config.d.ts +1 -1
package/README.md
CHANGED
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=
|
|
16
|
+
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=main" alt="Build Status"></a>
|
|
17
17
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
18
18
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
|
19
|
-
<a href="https://github.com/tailwindcss/tailwindcss/blob/
|
|
19
|
+
<a href="https://github.com/tailwindcss/tailwindcss/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
|
|
20
20
|
</p>
|
|
21
21
|
|
|
22
22
|
---
|
|
@@ -37,4 +37,4 @@ For casual chit-chat with others using the framework:
|
|
|
37
37
|
|
|
38
38
|
## Contributing
|
|
39
39
|
|
|
40
|
-
If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/
|
|
40
|
+
If you're interested in contributing to Tailwind CSS, please read our [contributing docs](https://github.com/tailwindcss/tailwindcss/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**.
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -166,7 +166,9 @@ let state = {
|
|
|
166
166
|
// Resolve globs from the content config
|
|
167
167
|
// TODO: When we make the postcss plugin async-capable this can become async
|
|
168
168
|
let files = _fastglob.default.sync(this.contentPatterns.all);
|
|
169
|
+
let checkBroadPattern = (0, _content.createBroadPatternCheck)(this.contentPatterns.all);
|
|
169
170
|
for (let file of files){
|
|
171
|
+
checkBroadPattern(file);
|
|
170
172
|
content.push({
|
|
171
173
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
172
174
|
extension: _path.default.extname(file).slice(1)
|
|
@@ -277,7 +279,7 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
277
279
|
if (input) {
|
|
278
280
|
return _fs.default.promises.readFile(_path.default.resolve(input), "utf8");
|
|
279
281
|
}
|
|
280
|
-
// No input file provided, fallback to default
|
|
282
|
+
// No input file provided, fallback to default at-rules
|
|
281
283
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
282
284
|
}
|
|
283
285
|
async function build() {
|
package/lib/css/preflight.css
CHANGED
package/lib/lib/content.js
CHANGED
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
},
|
|
16
16
|
resolvedChangedContent: function() {
|
|
17
17
|
return resolvedChangedContent;
|
|
18
|
+
},
|
|
19
|
+
createBroadPatternCheck: function() {
|
|
20
|
+
return createBroadPatternCheck;
|
|
18
21
|
}
|
|
19
22
|
});
|
|
20
23
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
@@ -24,6 +27,8 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
|
24
27
|
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
25
28
|
const _parseGlob = require("../util/parseGlob");
|
|
26
29
|
const _sharedState = require("./sharedState");
|
|
30
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
31
|
+
const _micromatch = /*#__PURE__*/ _interop_require_default(require("micromatch"));
|
|
27
32
|
function _interop_require_default(obj) {
|
|
28
33
|
return obj && obj.__esModule ? obj : {
|
|
29
34
|
default: obj
|
|
@@ -152,6 +157,65 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
152
157
|
mTimesToCommit
|
|
153
158
|
];
|
|
154
159
|
}
|
|
160
|
+
const LARGE_DIRECTORIES = [
|
|
161
|
+
"node_modules"
|
|
162
|
+
];
|
|
163
|
+
// Ensures that `node_modules` has to match as-is, otherwise `mynode_modules`
|
|
164
|
+
// would match as well, but that is not a known large directory.
|
|
165
|
+
const LARGE_DIRECTORIES_REGEX = new RegExp(`(${LARGE_DIRECTORIES.map((dir)=>String.raw`\b${dir}\b`).join("|")})`);
|
|
166
|
+
function createBroadPatternCheck(paths) {
|
|
167
|
+
// Detect whether a glob pattern might be too broad. This means that it:
|
|
168
|
+
// - Includes `**`
|
|
169
|
+
// - Does not include any of the known large directories (e.g.: node_modules)
|
|
170
|
+
let maybeBroadPattern = paths.some((path)=>path.includes("**") && !LARGE_DIRECTORIES_REGEX.test(path));
|
|
171
|
+
// Didn't detect any potentially broad patterns, so we can skip further
|
|
172
|
+
// checks.
|
|
173
|
+
if (!maybeBroadPattern) {
|
|
174
|
+
return ()=>{};
|
|
175
|
+
}
|
|
176
|
+
// All glob matchers
|
|
177
|
+
let matchers = [];
|
|
178
|
+
// All glob matchers that explicitly contain any of the known large
|
|
179
|
+
// directories (e.g.: node_modules).
|
|
180
|
+
let explicitMatchers = [];
|
|
181
|
+
// Create matchers for all paths
|
|
182
|
+
for (let path of paths){
|
|
183
|
+
let matcher = _micromatch.default.matcher(path);
|
|
184
|
+
if (LARGE_DIRECTORIES_REGEX.test(path)) {
|
|
185
|
+
explicitMatchers.push(matcher);
|
|
186
|
+
}
|
|
187
|
+
matchers.push(matcher);
|
|
188
|
+
}
|
|
189
|
+
// Keep track of whether we already warned about the broad pattern issue or
|
|
190
|
+
// not. The `log.warn` function already does something similar where we only
|
|
191
|
+
// output the log once. However, with this we can also skip the other checks
|
|
192
|
+
// when we already warned about the broad pattern.
|
|
193
|
+
let warned = false;
|
|
194
|
+
/**
|
|
195
|
+
* @param {string} file
|
|
196
|
+
*/ return (file)=>{
|
|
197
|
+
if (warned) return; // Already warned about the broad pattern
|
|
198
|
+
if (explicitMatchers.some((matcher)=>matcher(file))) return; // Explicitly included, so we can skip further checks
|
|
199
|
+
// When a broad pattern is used, we have to double check that the file was
|
|
200
|
+
// not explicitly included in the globs.
|
|
201
|
+
let matchingGlobIndex = matchers.findIndex((matcher)=>matcher(file));
|
|
202
|
+
if (matchingGlobIndex === -1) return; // This should never happen
|
|
203
|
+
let matchingGlob = paths[matchingGlobIndex];
|
|
204
|
+
// Create relative paths to make the output a bit more readable.
|
|
205
|
+
let relativeMatchingGlob = _path.default.relative(process.cwd(), matchingGlob);
|
|
206
|
+
if (relativeMatchingGlob[0] !== ".") relativeMatchingGlob = `./${relativeMatchingGlob}`;
|
|
207
|
+
let largeDirectory = LARGE_DIRECTORIES.find((directory)=>file.includes(directory));
|
|
208
|
+
if (largeDirectory) {
|
|
209
|
+
warned = true;
|
|
210
|
+
_log.default.warn("broad-content-glob-pattern", [
|
|
211
|
+
`Your \`content\` configuration includes a pattern which looks like it's accidentally matching all of \`${largeDirectory}\` and can cause serious performance issues.`,
|
|
212
|
+
`Pattern: \`${relativeMatchingGlob}\``,
|
|
213
|
+
`See our documentation for recommendations:`,
|
|
214
|
+
"https://tailwindcss.com/docs/content-configuration#pattern-recommendations"
|
|
215
|
+
]);
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
155
219
|
/**
|
|
156
220
|
*
|
|
157
221
|
* @param {ContentPath[]} candidateFiles
|
|
@@ -160,12 +224,14 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
160
224
|
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
161
225
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
162
226
|
let mTimesToCommit = new Map();
|
|
227
|
+
let checkBroadPattern = createBroadPatternCheck(paths);
|
|
163
228
|
let changedFiles = new Set();
|
|
164
229
|
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
165
230
|
let files = _fastglob.default.sync(paths, {
|
|
166
231
|
absolute: true
|
|
167
232
|
});
|
|
168
233
|
for (let file of files){
|
|
234
|
+
checkBroadPattern(file);
|
|
169
235
|
let prevModified = fileModifiedMap.get(file) || -Infinity;
|
|
170
236
|
let modified = _fs.default.statSync(file).mtimeMs;
|
|
171
237
|
if (modified > prevModified) {
|
|
@@ -203,8 +203,8 @@ function expandTailwindAtRules(context) {
|
|
|
203
203
|
// Replace any Tailwind directives with generated CSS
|
|
204
204
|
if (layerNodes.base) {
|
|
205
205
|
layerNodes.base.before((0, _cloneNodes.default)([
|
|
206
|
-
...
|
|
207
|
-
...
|
|
206
|
+
...defaultNodes,
|
|
207
|
+
...baseNodes
|
|
208
208
|
], layerNodes.base.source, {
|
|
209
209
|
layer: "base"
|
|
210
210
|
}));
|
|
@@ -120,21 +120,19 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
120
120
|
selectors.add(selector);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
if (
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
universal.before(universalRule);
|
|
137
|
-
}
|
|
123
|
+
if (selectorGroups.size === 0) {
|
|
124
|
+
universal.remove();
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
for (let [, selectors] of selectorGroups){
|
|
128
|
+
let universalRule = _postcss.default.rule({
|
|
129
|
+
source: universal.source
|
|
130
|
+
});
|
|
131
|
+
universalRule.selectors = [
|
|
132
|
+
...selectors
|
|
133
|
+
];
|
|
134
|
+
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
135
|
+
universal.before(universalRule);
|
|
138
136
|
}
|
|
139
137
|
universal.remove();
|
|
140
138
|
}
|
package/lib/util/dataTypes.js
CHANGED
|
@@ -174,7 +174,8 @@ function normalizeAttributeSelectors(value) {
|
|
|
174
174
|
"conic-gradient",
|
|
175
175
|
"repeating-radial-gradient",
|
|
176
176
|
"repeating-linear-gradient",
|
|
177
|
-
"repeating-conic-gradient"
|
|
177
|
+
"repeating-conic-gradient",
|
|
178
|
+
"anchor-size"
|
|
178
179
|
];
|
|
179
180
|
return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match)=>{
|
|
180
181
|
let result = "";
|
|
@@ -25,6 +25,8 @@ function removeAlphaVariables(container, toRemove) {
|
|
|
25
25
|
for (let varName of toRemove){
|
|
26
26
|
if (decl.value.includes(`/ var(${varName})`)) {
|
|
27
27
|
decl.value = decl.value.replace(`/ var(${varName})`, "");
|
|
28
|
+
} else if (decl.value.includes(`/ var(${varName}, 1)`)) {
|
|
29
|
+
decl.value = decl.value.replace(`/ var(${varName}, 1)`, "");
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
});
|
|
@@ -44,7 +44,7 @@ function withAlphaVariable({ color , property , variable }) {
|
|
|
44
44
|
p,
|
|
45
45
|
color({
|
|
46
46
|
opacityVariable: variable,
|
|
47
|
-
opacityValue: `var(${variable})`
|
|
47
|
+
opacityValue: `var(${variable}, 1)`
|
|
48
48
|
})
|
|
49
49
|
];
|
|
50
50
|
}))
|
|
@@ -71,7 +71,7 @@ function withAlphaVariable({ color , property , variable }) {
|
|
|
71
71
|
p,
|
|
72
72
|
(0, _color.formatColor)({
|
|
73
73
|
...parsed,
|
|
74
|
-
alpha: `var(${variable})`
|
|
74
|
+
alpha: `var(${variable}, 1)`
|
|
75
75
|
})
|
|
76
76
|
];
|
|
77
77
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.6069a81",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -43,49 +43,49 @@
|
|
|
43
43
|
"*.js"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@swc/cli": "
|
|
47
|
-
"@swc/core": "
|
|
48
|
-
"@swc/jest": "
|
|
49
|
-
"@swc/register": "
|
|
50
|
-
"autoprefixer": "^10.4.
|
|
51
|
-
"browserslist": "^4.
|
|
52
|
-
"concurrently": "^8.
|
|
53
|
-
"cssnano": "^6.
|
|
54
|
-
"esbuild": "^0.
|
|
55
|
-
"eslint": "^8.
|
|
56
|
-
"eslint-config-prettier": "^8.
|
|
46
|
+
"@swc/cli": "0.1.62",
|
|
47
|
+
"@swc/core": "1.3.55",
|
|
48
|
+
"@swc/jest": "0.2.26",
|
|
49
|
+
"@swc/register": "0.1.10",
|
|
50
|
+
"autoprefixer": "^10.4.20",
|
|
51
|
+
"browserslist": "^4.24.0",
|
|
52
|
+
"concurrently": "^8.2.2",
|
|
53
|
+
"cssnano": "^6.1.2",
|
|
54
|
+
"esbuild": "^0.24.0",
|
|
55
|
+
"eslint": "^8.57.1",
|
|
56
|
+
"eslint-config-prettier": "^8.10.0",
|
|
57
57
|
"eslint-plugin-prettier": "^4.2.1",
|
|
58
|
-
"jest": "^29.
|
|
59
|
-
"jest-diff": "^29.
|
|
60
|
-
"lightningcss": "1.
|
|
58
|
+
"jest": "^29.7.0",
|
|
59
|
+
"jest-diff": "^29.7.0",
|
|
60
|
+
"lightningcss": "1.27.0",
|
|
61
61
|
"prettier": "^2.8.8",
|
|
62
|
-
"rimraf": "^5.0.
|
|
63
|
-
"source-map-js": "^1.
|
|
64
|
-
"turbo": "^1.
|
|
62
|
+
"rimraf": "^5.0.10",
|
|
63
|
+
"source-map-js": "^1.2.1",
|
|
64
|
+
"turbo": "^1.13.4"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@alloc/quick-lru": "^5.2.0",
|
|
68
68
|
"arg": "^5.0.2",
|
|
69
|
-
"chokidar": "^3.
|
|
69
|
+
"chokidar": "^3.6.0",
|
|
70
70
|
"didyoumean": "^1.2.2",
|
|
71
71
|
"dlv": "^1.1.3",
|
|
72
|
-
"fast-glob": "^3.3.
|
|
72
|
+
"fast-glob": "^3.3.2",
|
|
73
73
|
"glob-parent": "^6.0.2",
|
|
74
74
|
"is-glob": "^4.0.3",
|
|
75
|
-
"jiti": "^1.21.
|
|
75
|
+
"jiti": "^1.21.6",
|
|
76
76
|
"lilconfig": "^2.1.0",
|
|
77
|
-
"micromatch": "^4.0.
|
|
77
|
+
"micromatch": "^4.0.8",
|
|
78
78
|
"normalize-path": "^3.0.0",
|
|
79
79
|
"object-hash": "^3.0.0",
|
|
80
|
-
"picocolors": "^1.
|
|
81
|
-
"postcss": "^8.4.
|
|
80
|
+
"picocolors": "^1.1.1",
|
|
81
|
+
"postcss": "^8.4.47",
|
|
82
82
|
"postcss-import": "^15.1.0",
|
|
83
83
|
"postcss-js": "^4.0.1",
|
|
84
|
-
"postcss-load-config": "^4.0.
|
|
85
|
-
"postcss-nested": "^6.0
|
|
86
|
-
"postcss-selector-parser": "^6.
|
|
87
|
-
"resolve": "^1.22.
|
|
88
|
-
"sucrase": "^3.
|
|
84
|
+
"postcss-load-config": "^4.0.2",
|
|
85
|
+
"postcss-nested": "^6.2.0",
|
|
86
|
+
"postcss-selector-parser": "^6.1.2",
|
|
87
|
+
"resolve": "^1.22.8",
|
|
88
|
+
"sucrase": "^3.35.0"
|
|
89
89
|
},
|
|
90
90
|
"browserslist": [
|
|
91
91
|
"> 1%",
|