tailwindcss 3.2.3 → 3.2.5
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 +56 -1
- package/README.md +1 -1
- package/lib/cli/build/index.js +5 -1
- package/lib/cli/build/plugin.js +50 -34
- package/lib/cli/build/watching.js +6 -3
- package/lib/cli/index.js +231 -10
- package/lib/cli/init/index.js +2 -2
- package/lib/cli.js +4 -226
- package/lib/corePlugins.js +45 -27
- package/lib/featureFlags.js +8 -8
- package/lib/index.js +4 -46
- package/lib/lib/collapseAdjacentRules.js +2 -2
- package/lib/lib/collapseDuplicateDeclarations.js +2 -2
- package/lib/lib/content.js +16 -16
- package/lib/lib/defaultExtractor.js +10 -5
- package/lib/lib/detectNesting.js +7 -1
- package/lib/lib/evaluateTailwindFunctions.js +4 -4
- package/lib/lib/expandApplyAtRules.js +2 -2
- package/lib/lib/expandTailwindAtRules.js +35 -9
- package/lib/lib/findAtConfigPath.js +3 -3
- package/lib/lib/generateRules.js +105 -50
- package/lib/lib/offsets.js +88 -1
- package/lib/lib/remap-bitfield.js +87 -0
- package/lib/lib/resolveDefaultsAtRules.js +4 -4
- package/lib/lib/setupContextUtils.js +122 -79
- package/lib/lib/setupTrackingContext.js +25 -4
- package/lib/lib/sharedState.js +19 -1
- package/lib/oxide/cli/build/deps.js +81 -0
- package/lib/oxide/cli/build/index.js +47 -0
- package/lib/oxide/cli/build/plugin.js +364 -0
- package/lib/oxide/cli/build/utils.js +77 -0
- package/lib/oxide/cli/build/watching.js +177 -0
- package/lib/oxide/cli/help/index.js +70 -0
- package/lib/oxide/cli/index.js +220 -0
- package/lib/oxide/cli/init/index.js +35 -0
- package/lib/oxide/cli.js +5 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +98 -0
- package/lib/postcss-plugins/nesting/plugin.js +2 -2
- package/lib/util/cloneNodes.js +2 -2
- package/lib/util/color.js +20 -6
- package/lib/util/createUtilityPlugin.js +2 -2
- package/lib/util/dataTypes.js +26 -2
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +3 -3
- package/lib/util/formatVariantSelector.js +171 -105
- package/lib/util/getAllConfigs.js +2 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +2 -2
- package/lib/util/negateValue.js +2 -2
- package/lib/util/normalizeConfig.js +36 -22
- package/lib/util/pluginUtils.js +38 -40
- package/lib/util/prefixSelector.js +22 -8
- package/lib/util/resolveConfig.js +8 -10
- package/oxide-node-api-shim/index.js +21 -0
- package/oxide-node-api-shim/package.json +5 -0
- package/package.json +32 -19
- package/peers/index.js +61 -42
- package/resolveConfig.d.ts +11 -2
- package/scripts/swap-engines.js +40 -0
- package/src/cli/build/index.js +6 -2
- package/src/cli/build/plugin.js +31 -9
- package/src/cli/build/watching.js +6 -3
- package/src/cli/index.js +234 -3
- package/src/cli.js +4 -220
- package/src/corePlugins.js +31 -3
- package/src/index.js +4 -46
- package/src/lib/content.js +12 -17
- package/src/lib/defaultExtractor.js +9 -3
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/expandTailwindAtRules.js +37 -6
- package/src/lib/generateRules.js +90 -28
- package/src/lib/offsets.js +104 -1
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +99 -56
- package/src/lib/setupTrackingContext.js +31 -6
- package/src/lib/sharedState.js +17 -0
- package/src/oxide/cli/build/deps.ts +91 -0
- package/src/oxide/cli/build/index.ts +47 -0
- package/src/oxide/cli/build/plugin.ts +436 -0
- package/src/oxide/cli/build/utils.ts +74 -0
- package/src/oxide/cli/build/watching.ts +225 -0
- package/src/oxide/cli/help/index.ts +69 -0
- package/src/oxide/cli/index.ts +212 -0
- package/src/oxide/cli/init/index.ts +32 -0
- package/src/oxide/cli.ts +1 -0
- package/src/oxide/postcss-plugin.ts +1 -0
- package/src/plugin.js +107 -0
- package/src/util/color.js +17 -2
- package/src/util/dataTypes.js +29 -4
- package/src/util/formatVariantSelector.js +215 -122
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +18 -0
- package/src/util/pluginUtils.js +22 -19
- package/src/util/prefixSelector.js +28 -10
- package/src/util/resolveConfig.js +0 -2
- package/stubs/defaultConfig.stub.js +149 -165
- package/types/config.d.ts +7 -2
- package/types/generated/default-theme.d.ts +77 -77
- package/lib/cli/shared.js +0 -12
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/shared.js +0 -5
package/lib/cli.js
CHANGED
|
@@ -1,229 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const _arg = /*#__PURE__*/ _interopRequireDefault(require("arg"));
|
|
8
|
-
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
9
|
-
const _build = require("./cli/build");
|
|
10
|
-
const _help = require("./cli/help");
|
|
11
|
-
const _init = require("./cli/init");
|
|
12
|
-
function _interopRequireDefault(obj) {
|
|
13
|
-
return obj && obj.__esModule ? obj : {
|
|
14
|
-
default: obj
|
|
15
|
-
};
|
|
3
|
+
if (process.env.OXIDE) {
|
|
4
|
+
module.exports = require("./oxide/cli");
|
|
5
|
+
} else {
|
|
6
|
+
module.exports = require("./cli/index");
|
|
16
7
|
}
|
|
17
|
-
function isESM() {
|
|
18
|
-
const pkgPath = _path.default.resolve("./package.json");
|
|
19
|
-
try {
|
|
20
|
-
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
|
|
21
|
-
return pkg.type && pkg.type === "module";
|
|
22
|
-
} catch (err) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
let configs = isESM() ? {
|
|
27
|
-
tailwind: "tailwind.config.cjs",
|
|
28
|
-
postcss: "postcss.config.cjs"
|
|
29
|
-
} : {
|
|
30
|
-
tailwind: "tailwind.config.js",
|
|
31
|
-
postcss: "postcss.config.js"
|
|
32
|
-
};
|
|
33
|
-
// ---
|
|
34
|
-
function oneOf(...options) {
|
|
35
|
-
return Object.assign((value = true)=>{
|
|
36
|
-
for (let option of options){
|
|
37
|
-
let parsed = option(value);
|
|
38
|
-
if (parsed === value) {
|
|
39
|
-
return parsed;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new Error("...");
|
|
43
|
-
}, {
|
|
44
|
-
manualParsing: true
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
let commands = {
|
|
48
|
-
init: {
|
|
49
|
-
run: _init.init,
|
|
50
|
-
args: {
|
|
51
|
-
"--full": {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
description: `Initialize a full \`${configs.tailwind}\` file`
|
|
54
|
-
},
|
|
55
|
-
"--postcss": {
|
|
56
|
-
type: Boolean,
|
|
57
|
-
description: `Initialize a \`${configs.postcss}\` file`
|
|
58
|
-
},
|
|
59
|
-
"-f": "--full",
|
|
60
|
-
"-p": "--postcss"
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
build: {
|
|
64
|
-
run: _build.build,
|
|
65
|
-
args: {
|
|
66
|
-
"--input": {
|
|
67
|
-
type: String,
|
|
68
|
-
description: "Input file"
|
|
69
|
-
},
|
|
70
|
-
"--output": {
|
|
71
|
-
type: String,
|
|
72
|
-
description: "Output file"
|
|
73
|
-
},
|
|
74
|
-
"--watch": {
|
|
75
|
-
type: Boolean,
|
|
76
|
-
description: "Watch for changes and rebuild as needed"
|
|
77
|
-
},
|
|
78
|
-
"--poll": {
|
|
79
|
-
type: Boolean,
|
|
80
|
-
description: "Use polling instead of filesystem events when watching"
|
|
81
|
-
},
|
|
82
|
-
"--content": {
|
|
83
|
-
type: String,
|
|
84
|
-
description: "Content paths to use for removing unused classes"
|
|
85
|
-
},
|
|
86
|
-
"--purge": {
|
|
87
|
-
type: String,
|
|
88
|
-
deprecated: true
|
|
89
|
-
},
|
|
90
|
-
"--postcss": {
|
|
91
|
-
type: oneOf(String, Boolean),
|
|
92
|
-
description: "Load custom PostCSS configuration"
|
|
93
|
-
},
|
|
94
|
-
"--minify": {
|
|
95
|
-
type: Boolean,
|
|
96
|
-
description: "Minify the output"
|
|
97
|
-
},
|
|
98
|
-
"--config": {
|
|
99
|
-
type: String,
|
|
100
|
-
description: "Path to a custom config file"
|
|
101
|
-
},
|
|
102
|
-
"--no-autoprefixer": {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
description: "Disable autoprefixer"
|
|
105
|
-
},
|
|
106
|
-
"-c": "--config",
|
|
107
|
-
"-i": "--input",
|
|
108
|
-
"-o": "--output",
|
|
109
|
-
"-m": "--minify",
|
|
110
|
-
"-w": "--watch",
|
|
111
|
-
"-p": "--poll"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
let sharedFlags = {
|
|
116
|
-
"--help": {
|
|
117
|
-
type: Boolean,
|
|
118
|
-
description: "Display usage information"
|
|
119
|
-
},
|
|
120
|
-
"-h": "--help"
|
|
121
|
-
};
|
|
122
|
-
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
|
123
|
-
(0, _help.help)({
|
|
124
|
-
usage: [
|
|
125
|
-
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
126
|
-
"tailwindcss init [--full] [--postcss] [options...]"
|
|
127
|
-
],
|
|
128
|
-
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
129
|
-
options: {
|
|
130
|
-
...commands.build.args,
|
|
131
|
-
...sharedFlags
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
process.exit(0);
|
|
135
|
-
}
|
|
136
|
-
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
|
137
|
-
if (commands[command] === undefined) {
|
|
138
|
-
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
|
139
|
-
// TODO: Deprecate this in future versions
|
|
140
|
-
// Check if non-existing command, might be a file.
|
|
141
|
-
command = "build";
|
|
142
|
-
} else {
|
|
143
|
-
(0, _help.help)({
|
|
144
|
-
message: `Invalid command: ${command}`,
|
|
145
|
-
usage: [
|
|
146
|
-
"tailwindcss <command> [options]"
|
|
147
|
-
],
|
|
148
|
-
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
149
|
-
options: sharedFlags
|
|
150
|
-
});
|
|
151
|
-
process.exit(1);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
// Execute command
|
|
155
|
-
let { args: flags , run } = commands[command];
|
|
156
|
-
let args = (()=>{
|
|
157
|
-
try {
|
|
158
|
-
let result = (0, _arg.default)(Object.fromEntries(Object.entries({
|
|
159
|
-
...flags,
|
|
160
|
-
...sharedFlags
|
|
161
|
-
}).filter(([_key, value])=>{
|
|
162
|
-
var ref;
|
|
163
|
-
return !(value === null || value === void 0 ? void 0 : (ref = value.type) === null || ref === void 0 ? void 0 : ref.manualParsing);
|
|
164
|
-
}).map(([key, value])=>[
|
|
165
|
-
key,
|
|
166
|
-
typeof value === "object" ? value.type : value
|
|
167
|
-
])), {
|
|
168
|
-
permissive: true
|
|
169
|
-
});
|
|
170
|
-
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
|
171
|
-
for(let i = result["_"].length - 1; i >= 0; --i){
|
|
172
|
-
let flag = result["_"][i];
|
|
173
|
-
if (!flag.startsWith("-")) continue;
|
|
174
|
-
let flagName = flag;
|
|
175
|
-
let handler = flags[flag];
|
|
176
|
-
// Resolve flagName & handler
|
|
177
|
-
while(typeof handler === "string"){
|
|
178
|
-
flagName = handler;
|
|
179
|
-
handler = flags[handler];
|
|
180
|
-
}
|
|
181
|
-
if (!handler) continue;
|
|
182
|
-
let args = [];
|
|
183
|
-
let offset = i + 1;
|
|
184
|
-
// Parse args for current flag
|
|
185
|
-
while(result["_"][offset] && !result["_"][offset].startsWith("-")){
|
|
186
|
-
args.push(result["_"][offset++]);
|
|
187
|
-
}
|
|
188
|
-
// Cleanup manually parsed flags + args
|
|
189
|
-
result["_"].splice(i, 1 + args.length);
|
|
190
|
-
// Set the resolved value in the `result` object
|
|
191
|
-
result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
|
|
192
|
-
}
|
|
193
|
-
// Ensure that the `command` is always the first argument in the `args`.
|
|
194
|
-
// This is important so that we don't have to check if a default command
|
|
195
|
-
// (build) was used or not from within each plugin.
|
|
196
|
-
//
|
|
197
|
-
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
|
198
|
-
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
|
199
|
-
if (result["_"][0] !== command) {
|
|
200
|
-
result["_"].unshift(command);
|
|
201
|
-
}
|
|
202
|
-
return result;
|
|
203
|
-
} catch (err) {
|
|
204
|
-
if (err.code === "ARG_UNKNOWN_OPTION") {
|
|
205
|
-
(0, _help.help)({
|
|
206
|
-
message: err.message,
|
|
207
|
-
usage: [
|
|
208
|
-
"tailwindcss <command> [options]"
|
|
209
|
-
],
|
|
210
|
-
options: sharedFlags
|
|
211
|
-
});
|
|
212
|
-
process.exit(1);
|
|
213
|
-
}
|
|
214
|
-
throw err;
|
|
215
|
-
}
|
|
216
|
-
})();
|
|
217
|
-
if (args["--help"]) {
|
|
218
|
-
(0, _help.help)({
|
|
219
|
-
options: {
|
|
220
|
-
...flags,
|
|
221
|
-
...sharedFlags
|
|
222
|
-
},
|
|
223
|
-
usage: [
|
|
224
|
-
`tailwindcss ${command} [options]`
|
|
225
|
-
]
|
|
226
|
-
});
|
|
227
|
-
process.exit(0);
|
|
228
|
-
}
|
|
229
|
-
run(args, configs);
|
package/lib/corePlugins.js
CHANGED
|
@@ -212,14 +212,14 @@ let variantPlugins = {
|
|
|
212
212
|
}
|
|
213
213
|
let variants = {
|
|
214
214
|
group: (_, { modifier })=>modifier ? [
|
|
215
|
-
`:merge(.group\\/${modifier})`,
|
|
215
|
+
`:merge(.group\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
216
216
|
" &"
|
|
217
217
|
] : [
|
|
218
218
|
`:merge(.group)`,
|
|
219
219
|
" &"
|
|
220
220
|
],
|
|
221
221
|
peer: (_, { modifier })=>modifier ? [
|
|
222
|
-
`:merge(.peer\\/${modifier})`,
|
|
222
|
+
`:merge(.peer\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
223
223
|
" ~ &"
|
|
224
224
|
] : [
|
|
225
225
|
`:merge(.peer)`,
|
|
@@ -231,7 +231,25 @@ let variantPlugins = {
|
|
|
231
231
|
let result = (0, _dataTypes.normalize)(typeof value === "function" ? value(extra) : value);
|
|
232
232
|
if (!result.includes("&")) result = "&" + result;
|
|
233
233
|
let [a, b] = fn("", extra);
|
|
234
|
-
|
|
234
|
+
let start = null;
|
|
235
|
+
let end = null;
|
|
236
|
+
let quotes = 0;
|
|
237
|
+
for(let i = 0; i < result.length; ++i){
|
|
238
|
+
let c = result[i];
|
|
239
|
+
if (c === "&") {
|
|
240
|
+
start = i;
|
|
241
|
+
} else if (c === "'" || c === '"') {
|
|
242
|
+
quotes += 1;
|
|
243
|
+
} else if (start !== null && c === " " && !quotes) {
|
|
244
|
+
end = i;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (start !== null && end === null) {
|
|
248
|
+
end = result.length;
|
|
249
|
+
}
|
|
250
|
+
// Basically this but can handle quotes:
|
|
251
|
+
// result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
|
|
252
|
+
return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end);
|
|
235
253
|
}, {
|
|
236
254
|
values: Object.fromEntries(pseudoVariants)
|
|
237
255
|
});
|
|
@@ -277,15 +295,15 @@ let variantPlugins = {
|
|
|
277
295
|
addVariant("print", "@media print");
|
|
278
296
|
},
|
|
279
297
|
screenVariants: ({ theme , addVariant , matchVariant })=>{
|
|
280
|
-
var
|
|
281
|
-
let rawScreens = (
|
|
298
|
+
var _theme;
|
|
299
|
+
let rawScreens = (_theme = theme("screens")) !== null && _theme !== void 0 ? _theme : {};
|
|
282
300
|
let areSimpleScreens = Object.values(rawScreens).every((v)=>typeof v === "string");
|
|
283
301
|
let screens = (0, _normalizeScreens.normalizeScreens)(theme("screens"));
|
|
284
302
|
/** @type {Set<string>} */ let unitCache = new Set([]);
|
|
285
303
|
/** @param {string} value */ function units(value) {
|
|
286
|
-
var
|
|
287
|
-
var
|
|
288
|
-
return (
|
|
304
|
+
var _value_match;
|
|
305
|
+
var _value_match_;
|
|
306
|
+
return (_value_match_ = (_value_match = value.match(/(\D+)$/)) === null || _value_match === void 0 ? void 0 : _value_match[1]) !== null && _value_match_ !== void 0 ? _value_match_ : "(none)";
|
|
289
307
|
}
|
|
290
308
|
/** @param {string} value */ function recordUnits(value) {
|
|
291
309
|
if (value !== undefined) {
|
|
@@ -384,7 +402,7 @@ let variantPlugins = {
|
|
|
384
402
|
});
|
|
385
403
|
},
|
|
386
404
|
supportsVariants: ({ matchVariant , theme })=>{
|
|
387
|
-
var
|
|
405
|
+
var _theme;
|
|
388
406
|
matchVariant("supports", (value = "")=>{
|
|
389
407
|
let check = (0, _dataTypes.normalize)(value);
|
|
390
408
|
let isRaw = /^\w*\s*\(/.test(check);
|
|
@@ -402,35 +420,35 @@ let variantPlugins = {
|
|
|
402
420
|
}
|
|
403
421
|
return `@supports ${check}`;
|
|
404
422
|
}, {
|
|
405
|
-
values: (
|
|
423
|
+
values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
|
|
406
424
|
});
|
|
407
425
|
},
|
|
408
426
|
ariaVariants: ({ matchVariant , theme })=>{
|
|
409
|
-
var
|
|
427
|
+
var _theme;
|
|
410
428
|
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
|
|
411
|
-
values: (
|
|
429
|
+
values: (_theme = theme("aria")) !== null && _theme !== void 0 ? _theme : {}
|
|
412
430
|
});
|
|
413
|
-
var
|
|
431
|
+
var _theme1;
|
|
414
432
|
matchVariant("group-aria", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[aria-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
415
|
-
values: (
|
|
433
|
+
values: (_theme1 = theme("aria")) !== null && _theme1 !== void 0 ? _theme1 : {}
|
|
416
434
|
});
|
|
417
|
-
var
|
|
435
|
+
var _theme2;
|
|
418
436
|
matchVariant("peer-aria", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[aria-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[aria-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
419
|
-
values: (
|
|
437
|
+
values: (_theme2 = theme("aria")) !== null && _theme2 !== void 0 ? _theme2 : {}
|
|
420
438
|
});
|
|
421
439
|
},
|
|
422
440
|
dataVariants: ({ matchVariant , theme })=>{
|
|
423
|
-
var
|
|
441
|
+
var _theme;
|
|
424
442
|
matchVariant("data", (value)=>`&[data-${(0, _dataTypes.normalize)(value)}]`, {
|
|
425
|
-
values: (
|
|
443
|
+
values: (_theme = theme("data")) !== null && _theme !== void 0 ? _theme : {}
|
|
426
444
|
});
|
|
427
|
-
var
|
|
445
|
+
var _theme1;
|
|
428
446
|
matchVariant("group-data", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] &` : `:merge(.group)[data-${(0, _dataTypes.normalize)(value)}] &`, {
|
|
429
|
-
values: (
|
|
447
|
+
values: (_theme1 = theme("data")) !== null && _theme1 !== void 0 ? _theme1 : {}
|
|
430
448
|
});
|
|
431
|
-
var
|
|
449
|
+
var _theme2;
|
|
432
450
|
matchVariant("peer-data", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier})[data-${(0, _dataTypes.normalize)(value)}] ~ &` : `:merge(.peer)[data-${(0, _dataTypes.normalize)(value)}] ~ &`, {
|
|
433
|
-
values: (
|
|
451
|
+
values: (_theme2 = theme("data")) !== null && _theme2 !== void 0 ? _theme2 : {}
|
|
434
452
|
});
|
|
435
453
|
},
|
|
436
454
|
orientationVariants: ({ addVariant })=>{
|
|
@@ -1223,8 +1241,8 @@ let corePlugins = {
|
|
|
1223
1241
|
},
|
|
1224
1242
|
animation: ({ matchUtilities , theme , config })=>{
|
|
1225
1243
|
let prefixName = (name)=>`${config("prefix")}${(0, _escapeClassName.default)(name)}`;
|
|
1226
|
-
var
|
|
1227
|
-
let keyframes = Object.fromEntries(Object.entries((
|
|
1244
|
+
var _theme;
|
|
1245
|
+
let keyframes = Object.fromEntries(Object.entries((_theme = theme("keyframes")) !== null && _theme !== void 0 ? _theme : {}).map(([key, value])=>{
|
|
1228
1246
|
return [
|
|
1229
1247
|
key,
|
|
1230
1248
|
{
|
|
@@ -3441,15 +3459,15 @@ let corePlugins = {
|
|
|
3441
3459
|
},
|
|
3442
3460
|
ringWidth: ({ matchUtilities , addDefaults , addUtilities , theme , config })=>{
|
|
3443
3461
|
let ringColorDefault = (()=>{
|
|
3444
|
-
var
|
|
3462
|
+
var _theme, _theme1;
|
|
3445
3463
|
if ((0, _featureFlags.flagEnabled)(config(), "respectDefaultRingColorOpacity")) {
|
|
3446
3464
|
return theme("ringColor.DEFAULT");
|
|
3447
3465
|
}
|
|
3448
3466
|
let ringOpacityDefault = theme("ringOpacity.DEFAULT", "0.5");
|
|
3449
|
-
if (!((
|
|
3467
|
+
if (!((_theme = theme("ringColor")) === null || _theme === void 0 ? void 0 : _theme.DEFAULT)) {
|
|
3450
3468
|
return `rgb(147 197 253 / ${ringOpacityDefault})`;
|
|
3451
3469
|
}
|
|
3452
|
-
return (0, _withAlphaVariable.withAlphaValue)((
|
|
3470
|
+
return (0, _withAlphaVariable.withAlphaValue)((_theme1 = theme("ringColor")) === null || _theme1 === void 0 ? void 0 : _theme1.DEFAULT, ringOpacityDefault, `rgb(147 197 253 / ${ringOpacityDefault})`);
|
|
3453
3471
|
})();
|
|
3454
3472
|
addDefaults("ring-width", {
|
|
3455
3473
|
"--tw-ring-inset": " ",
|
package/lib/featureFlags.js
CHANGED
|
@@ -38,14 +38,14 @@ let featureFlags = {
|
|
|
38
38
|
};
|
|
39
39
|
function flagEnabled(config, flag) {
|
|
40
40
|
if (featureFlags.future.includes(flag)) {
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
return config.future === "all" || ((
|
|
41
|
+
var _config_future;
|
|
42
|
+
var _config_future_flag, _ref;
|
|
43
|
+
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);
|
|
44
44
|
}
|
|
45
45
|
if (featureFlags.experimental.includes(flag)) {
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
return config.experimental === "all" || ((
|
|
46
|
+
var _config_experimental;
|
|
47
|
+
var _config_experimental_flag, _ref1;
|
|
48
|
+
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);
|
|
49
49
|
}
|
|
50
50
|
return false;
|
|
51
51
|
}
|
|
@@ -53,8 +53,8 @@ function experimentalFlagsEnabled(config) {
|
|
|
53
53
|
if (config.experimental === "all") {
|
|
54
54
|
return featureFlags.experimental;
|
|
55
55
|
}
|
|
56
|
-
var
|
|
57
|
-
return Object.keys((
|
|
56
|
+
var _config_experimental;
|
|
57
|
+
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]);
|
|
58
58
|
}
|
|
59
59
|
function issueFlagNotices(config) {
|
|
60
60
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
package/lib/index.js
CHANGED
|
@@ -1,48 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
|
|
7
|
-
const _sharedState = require("./lib/sharedState");
|
|
8
|
-
const _findAtConfigPath = require("./lib/findAtConfigPath");
|
|
9
|
-
function _interopRequireDefault(obj) {
|
|
10
|
-
return obj && obj.__esModule ? obj : {
|
|
11
|
-
default: obj
|
|
12
|
-
};
|
|
2
|
+
if (process.env.OXIDE) {
|
|
3
|
+
module.exports = require("./oxide/postcss-plugin");
|
|
4
|
+
} else {
|
|
5
|
+
module.exports = require("./plugin");
|
|
13
6
|
}
|
|
14
|
-
module.exports = function tailwindcss(configOrPath) {
|
|
15
|
-
return {
|
|
16
|
-
postcssPlugin: "tailwindcss",
|
|
17
|
-
plugins: [
|
|
18
|
-
_sharedState.env.DEBUG && function(root) {
|
|
19
|
-
console.log("\n");
|
|
20
|
-
console.time("JIT TOTAL");
|
|
21
|
-
return root;
|
|
22
|
-
},
|
|
23
|
-
function(root, result) {
|
|
24
|
-
var ref;
|
|
25
|
-
// Use the path for the `@config` directive if it exists, otherwise use the
|
|
26
|
-
// path for the file being processed
|
|
27
|
-
configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
|
|
28
|
-
let context = (0, _setupTrackingContext.default)(configOrPath);
|
|
29
|
-
if (root.type === "document") {
|
|
30
|
-
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
31
|
-
for (const root1 of roots){
|
|
32
|
-
if (root1.type === "root") {
|
|
33
|
-
(0, _processTailwindFeatures.default)(context)(root1, result);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
(0, _processTailwindFeatures.default)(context)(root, result);
|
|
39
|
-
},
|
|
40
|
-
_sharedState.env.DEBUG && function(root) {
|
|
41
|
-
console.timeEnd("JIT TOTAL");
|
|
42
|
-
console.log("\n");
|
|
43
|
-
return root;
|
|
44
|
-
}
|
|
45
|
-
].filter(Boolean)
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
module.exports.postcss = true;
|
|
@@ -29,10 +29,10 @@ function collapseAdjacentRules() {
|
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
let properties = comparisonMap[node.type];
|
|
32
|
-
var
|
|
32
|
+
var _node_property, _currentRule_property;
|
|
33
33
|
if (node.type === "atrule" && node.name === "font-face") {
|
|
34
34
|
currentRule = node;
|
|
35
|
-
} else if (properties.every((property)=>((
|
|
35
|
+
} 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, " "))) {
|
|
36
36
|
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
37
37
|
if (node.nodes) {
|
|
38
38
|
currentRule.append(node.nodes);
|
|
@@ -76,8 +76,8 @@ let UNITLESS_NUMBER = Symbol("unitless-number");
|
|
|
76
76
|
function resolveUnit(input) {
|
|
77
77
|
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
|
78
78
|
if (result) {
|
|
79
|
-
var
|
|
80
|
-
return (
|
|
79
|
+
var _result_;
|
|
80
|
+
return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
|
|
81
81
|
}
|
|
82
82
|
return null;
|
|
83
83
|
}
|
package/lib/lib/content.js
CHANGED
|
@@ -135,43 +135,43 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
135
135
|
content: raw,
|
|
136
136
|
extension
|
|
137
137
|
}));
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
|
|
139
|
+
for (let changedFile of changedFiles){
|
|
140
140
|
let extension = _path.default.extname(changedFile).slice(1);
|
|
141
141
|
changedContent.push({
|
|
142
|
-
|
|
142
|
+
file: changedFile,
|
|
143
143
|
extension
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
|
-
return
|
|
146
|
+
return [
|
|
147
|
+
changedContent,
|
|
148
|
+
mTimesToCommit
|
|
149
|
+
];
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
149
152
|
*
|
|
150
153
|
* @param {ContentPath[]} candidateFiles
|
|
151
154
|
* @param {Map<string, number>} fileModifiedMap
|
|
152
|
-
* @returns {Set<string>}
|
|
155
|
+
* @returns {[Set<string>, Map<string, number>]}
|
|
153
156
|
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
154
157
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
158
|
+
let mTimesToCommit = new Map();
|
|
155
159
|
let changedFiles = new Set();
|
|
156
160
|
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
157
161
|
let files = _fastGlob.default.sync(paths, {
|
|
158
162
|
absolute: true
|
|
159
163
|
});
|
|
160
164
|
for (let file of files){
|
|
161
|
-
let prevModified = fileModifiedMap.
|
|
165
|
+
let prevModified = fileModifiedMap.get(file) || -Infinity;
|
|
162
166
|
let modified = _fs.default.statSync(file).mtimeMs;
|
|
163
|
-
|
|
164
|
-
// earier in the process and we want to make sure we don't miss any changes that happen
|
|
165
|
-
// when a context dependency is also a content dependency
|
|
166
|
-
// Ideally, we'd do all this tracking at one time but that is a larger refactor
|
|
167
|
-
// than we want to commit to right now, so this is a decent compromise.
|
|
168
|
-
// This should be sufficient because file modification times will be off by at least
|
|
169
|
-
// 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
|
|
170
|
-
if (modified >= prevModified) {
|
|
167
|
+
if (modified > prevModified) {
|
|
171
168
|
changedFiles.add(file);
|
|
172
|
-
|
|
169
|
+
mTimesToCommit.set(file, modified);
|
|
173
170
|
}
|
|
174
171
|
}
|
|
175
172
|
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
|
|
176
|
-
return
|
|
173
|
+
return [
|
|
174
|
+
changedFiles,
|
|
175
|
+
mTimesToCommit
|
|
176
|
+
];
|
|
177
177
|
}
|
|
@@ -54,10 +54,10 @@ function defaultExtractor(context) {
|
|
|
54
54
|
*/ return (content)=>{
|
|
55
55
|
/** @type {(string|string)[]} */ let results = [];
|
|
56
56
|
for (let pattern of patterns){
|
|
57
|
-
var
|
|
57
|
+
var _content_match;
|
|
58
58
|
results = [
|
|
59
59
|
...results,
|
|
60
|
-
...(
|
|
60
|
+
...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
|
|
61
61
|
];
|
|
62
62
|
}
|
|
63
63
|
return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
|
|
@@ -71,8 +71,13 @@ function* buildRegExps(context) {
|
|
|
71
71
|
_regex.escape(context.tailwindConfig.prefix)
|
|
72
72
|
])) : "";
|
|
73
73
|
let utility = _regex.any([
|
|
74
|
-
// Arbitrary properties
|
|
75
|
-
/\[[^\s:'"`]+:[^\s]+\]/,
|
|
74
|
+
// Arbitrary properties (without square brackets)
|
|
75
|
+
/\[[^\s:'"`]+:[^\s\[\]]+\]/,
|
|
76
|
+
// Arbitrary properties with balanced square brackets
|
|
77
|
+
// This is a targeted fix to continue to allow theme()
|
|
78
|
+
// with square brackets to work in arbitrary properties
|
|
79
|
+
// while fixing a problem with the regex matching too much
|
|
80
|
+
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+?\][^\s]+?\]/,
|
|
76
81
|
// Utilities
|
|
77
82
|
_regex.pattern([
|
|
78
83
|
// Utility Name / Group Name
|
|
@@ -216,7 +221,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
216
221
|
// This means that there was an extra closing `]`
|
|
217
222
|
// We'll clip to just before it
|
|
218
223
|
if (depth < 0) {
|
|
219
|
-
return input.substring(0, match.index);
|
|
224
|
+
return input.substring(0, match.index - 1);
|
|
220
225
|
}
|
|
221
226
|
// We've finished balancing the brackets but there still may be characters that can be included
|
|
222
227
|
// For example in the class `text-[#336699]/[.35]`
|
package/lib/lib/detectNesting.js
CHANGED
|
@@ -6,12 +6,18 @@ Object.defineProperty(exports, "default", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>_default
|
|
8
8
|
});
|
|
9
|
+
function isRoot(node) {
|
|
10
|
+
return node.type === "root";
|
|
11
|
+
}
|
|
12
|
+
function isAtLayer(node) {
|
|
13
|
+
return node.type === "atrule" && node.name === "layer";
|
|
14
|
+
}
|
|
9
15
|
function _default(_context) {
|
|
10
16
|
return (root, result)=>{
|
|
11
17
|
let found = false;
|
|
12
18
|
root.walkAtRules("tailwind", (node)=>{
|
|
13
19
|
if (found) return false;
|
|
14
|
-
if (node.parent && node.parent
|
|
20
|
+
if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
|
|
15
21
|
found = true;
|
|
16
22
|
node.warn(result, [
|
|
17
23
|
"Nested @tailwind rules were detected, but are not supported.",
|
|
@@ -177,8 +177,8 @@ let nodeTypePropertyMap = {
|
|
|
177
177
|
alpha
|
|
178
178
|
});
|
|
179
179
|
});
|
|
180
|
-
var
|
|
181
|
-
return (
|
|
180
|
+
var _results_find;
|
|
181
|
+
return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
|
|
182
182
|
}
|
|
183
183
|
function _default(context) {
|
|
184
184
|
let config = context.tailwindConfig;
|
|
@@ -186,9 +186,9 @@ function _default(context) {
|
|
|
186
186
|
theme: (node, path, ...defaultValue)=>{
|
|
187
187
|
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
188
188
|
if (!isValid) {
|
|
189
|
-
var
|
|
189
|
+
var _parentNode_raws_tailwind;
|
|
190
190
|
let parentNode = node.parent;
|
|
191
|
-
let candidate = (
|
|
191
|
+
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;
|
|
192
192
|
if (parentNode && candidate !== undefined) {
|
|
193
193
|
// Remove this utility from any caches
|
|
194
194
|
context.markInvalidUtilityNode(parentNode);
|
|
@@ -139,8 +139,8 @@ function* pathToRoot(node) {
|
|
|
139
139
|
root.walkRules((rule)=>{
|
|
140
140
|
// Ignore rules generated by Tailwind
|
|
141
141
|
for (let node of pathToRoot(rule)){
|
|
142
|
-
var
|
|
143
|
-
if (((
|
|
142
|
+
var _node_raws_tailwind;
|
|
143
|
+
if (((_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.layer) !== undefined) {
|
|
144
144
|
return;
|
|
145
145
|
}
|
|
146
146
|
}
|