tailwindcss 0.0.0-insiders.e4a37ce → 0.0.0-insiders.e572dc6
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 -1
- package/index.css +5 -0
- package/lib/cli/build/index.js +3 -0
- package/lib/cli/build/plugin.js +54 -51
- package/lib/cli/index.js +1 -0
- package/lib/cli.js +1 -5
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +28 -4
- package/lib/css/preflight.css +7 -1
- package/lib/featureFlags.js +7 -9
- package/lib/lib/content.js +27 -1
- package/lib/lib/evaluateTailwindFunctions.js +5 -3
- package/lib/lib/expandTailwindAtRules.js +53 -13
- package/lib/lib/generateRules.js +4 -7
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/normalizeTailwindDirectives.js +0 -15
- package/lib/lib/setupContextUtils.js +6 -16
- package/lib/lib/setupTrackingContext.js +2 -1
- package/lib/lib/sharedState.js +2 -10
- package/lib/plugin.js +37 -19
- package/lib/util/dataTypes.js +14 -6
- package/lib/util/log.js +17 -0
- package/lib/util/normalizeConfig.js +21 -9
- package/lib/util/pluginUtils.js +1 -3
- package/lib/util/validateConfig.js +11 -0
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/package.json +24 -31
- package/src/cli/build/index.js +4 -0
- package/src/cli/build/plugin.js +57 -44
- package/src/cli/index.js +1 -0
- package/src/cli.js +1 -5
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +32 -4
- package/src/css/preflight.css +7 -1
- package/src/featureFlags.js +6 -8
- package/src/lib/content.js +33 -1
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandTailwindAtRules.js +58 -26
- package/src/lib/generateRules.js +4 -8
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/setupContextUtils.js +6 -15
- package/src/lib/setupTrackingContext.js +1 -3
- package/src/lib/sharedState.js +0 -4
- package/src/plugin.js +70 -53
- package/src/util/dataTypes.js +17 -6
- package/src/util/log.js +24 -0
- package/src/util/normalizeConfig.js +22 -10
- package/src/util/pluginUtils.js +0 -4
- package/src/util/validateConfig.js +10 -0
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/config.full.js +14 -1
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +0 -1
- package/stubs/postcss.config.js +0 -1
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +2 -1
- package/lib/cli/build/deps.js +0 -62
- package/lib/cli-peer-dependencies.js +0 -36
- package/lib/oxide/cli/build/deps.js +0 -89
- package/lib/oxide/cli/build/index.js +0 -53
- package/lib/oxide/cli/build/plugin.js +0 -375
- package/lib/oxide/cli/build/utils.js +0 -87
- package/lib/oxide/cli/build/watching.js +0 -179
- package/lib/oxide/cli/help/index.js +0 -72
- package/lib/oxide/cli/index.js +0 -214
- package/lib/oxide/cli/init/index.js +0 -52
- package/lib/oxide/cli.js +0 -5
- package/lib/oxide/postcss-plugin.js +0 -2
- package/peers/index.js +0 -96419
- package/scripts/swap-engines.js +0 -40
- package/src/cli/build/deps.js +0 -56
- package/src/cli-peer-dependencies.js +0 -15
- package/src/oxide/cli/build/deps.ts +0 -91
- package/src/oxide/cli/build/index.ts +0 -47
- package/src/oxide/cli/build/plugin.ts +0 -442
- package/src/oxide/cli/build/utils.ts +0 -74
- package/src/oxide/cli/build/watching.ts +0 -225
- package/src/oxide/cli/help/index.ts +0 -69
- package/src/oxide/cli/index.ts +0 -204
- package/src/oxide/cli/init/index.ts +0 -59
- package/src/oxide/cli.ts +0 -1
- package/src/oxide/postcss-plugin.ts +0 -1
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
<p align="center">
|
|
17
|
-
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci
|
|
17
|
+
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/actions/workflow/status/tailwindlabs/tailwindcss/ci.yml?branch=master" alt="Build Status"></a>
|
|
18
18
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
19
19
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
|
20
20
|
<a href="https://github.com/tailwindcss/tailwindcss/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/tailwindcss.svg" alt="License"></a>
|
package/index.css
ADDED
package/lib/cli/build/index.js
CHANGED
|
@@ -34,6 +34,9 @@ async function build(args) {
|
|
|
34
34
|
console.error(`Specified config file ${args["--config"]} does not exist.`);
|
|
35
35
|
process.exit(9);
|
|
36
36
|
}
|
|
37
|
+
if (args["--no-autoprefixer"]) {
|
|
38
|
+
console.error("[deprecation] The --no-autoprefixer flag is deprecated and has no effect.");
|
|
39
|
+
}
|
|
37
40
|
// TODO: Reference the @config path here if exists
|
|
38
41
|
let configPath = args["--config"] ? args["--config"] : (0, _resolveConfigPath.resolveDefaultConfigPath)();
|
|
39
42
|
let processor = await (0, _plugin.createProcessor)(args, configPath);
|
package/lib/cli/build/plugin.js
CHANGED
|
@@ -9,16 +9,19 @@ Object.defineProperty(exports, "createProcessor", {
|
|
|
9
9
|
return createProcessor;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../package.json"));
|
|
12
13
|
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
13
14
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
15
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
14
16
|
const _postcssloadconfig = /*#__PURE__*/ _interop_require_default(require("postcss-load-config"));
|
|
17
|
+
const _browserslist = /*#__PURE__*/ _interop_require_default(require("browserslist"));
|
|
18
|
+
const _lightningcss = /*#__PURE__*/ _interop_require_default(require("lightningcss"));
|
|
15
19
|
const _lilconfig = require("lilconfig");
|
|
16
20
|
const _plugins = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/plugins" // Little bit scary, looking at private/internal API
|
|
17
21
|
));
|
|
18
22
|
const _options = /*#__PURE__*/ _interop_require_default(require("postcss-load-config/src/options" // Little bit scary, looking at private/internal API
|
|
19
23
|
));
|
|
20
24
|
const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("../../processTailwindFeatures"));
|
|
21
|
-
const _deps = require("./deps");
|
|
22
25
|
const _utils = require("./utils");
|
|
23
26
|
const _sharedState = require("../../lib/sharedState");
|
|
24
27
|
const _resolveConfig = /*#__PURE__*/ _interop_require_default(require("../../../resolveConfig.js"));
|
|
@@ -29,11 +32,42 @@ const _findAtConfigPath = require("../../lib/findAtConfigPath.js");
|
|
|
29
32
|
const _log = /*#__PURE__*/ _interop_require_default(require("../../util/log"));
|
|
30
33
|
const _loadconfig = require("../../lib/load-config");
|
|
31
34
|
const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("../../lib/getModuleDependencies"));
|
|
35
|
+
const _validateConfig = require("../../util/validateConfig");
|
|
36
|
+
const _handleImportAtRules = require("../../lib/handleImportAtRules");
|
|
37
|
+
const _featureFlags = require("../../featureFlags");
|
|
32
38
|
function _interop_require_default(obj) {
|
|
33
39
|
return obj && obj.__esModule ? obj : {
|
|
34
40
|
default: obj
|
|
35
41
|
};
|
|
36
42
|
}
|
|
43
|
+
async function lightningcss(result, { map =true , minify =true } = {}) {
|
|
44
|
+
try {
|
|
45
|
+
let transformed = _lightningcss.default.transform({
|
|
46
|
+
filename: result.opts.from || "input.css",
|
|
47
|
+
code: Buffer.from(result.css, "utf-8"),
|
|
48
|
+
minify,
|
|
49
|
+
sourceMap: result.map === undefined ? map : !!result.map,
|
|
50
|
+
inputSourceMap: result.map ? result.map.toString() : undefined,
|
|
51
|
+
targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(_packagejson.default.browserslist)),
|
|
52
|
+
drafts: {
|
|
53
|
+
nesting: true
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return Object.assign(result, {
|
|
57
|
+
css: transformed.code.toString("utf8"),
|
|
58
|
+
map: result.map ? Object.assign(result.map, {
|
|
59
|
+
toString () {
|
|
60
|
+
var _transformed_map;
|
|
61
|
+
return (_transformed_map = transformed.map) === null || _transformed_map === void 0 ? void 0 : _transformed_map.toString();
|
|
62
|
+
}
|
|
63
|
+
}) : result.map
|
|
64
|
+
});
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error("Unable to use Lightning CSS. Using raw version instead.");
|
|
67
|
+
console.error(err);
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
37
71
|
/**
|
|
38
72
|
*
|
|
39
73
|
* @param {string} [customPostCssPath ]
|
|
@@ -76,43 +110,11 @@ function _interop_require_default(obj) {
|
|
|
76
110
|
config.options
|
|
77
111
|
];
|
|
78
112
|
}
|
|
79
|
-
function loadBuiltinPostcssPlugins() {
|
|
80
|
-
let postcss = (0, _deps.loadPostcss)();
|
|
81
|
-
let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
|
|
82
|
-
return [
|
|
83
|
-
[
|
|
84
|
-
(root)=>{
|
|
85
|
-
root.walkAtRules("import", (rule)=>{
|
|
86
|
-
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
|
87
|
-
rule.after(postcss.comment({
|
|
88
|
-
text: IMPORT_COMMENT + rule.params
|
|
89
|
-
}));
|
|
90
|
-
rule.remove();
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
(0, _deps.loadPostcssImport)(),
|
|
95
|
-
(root)=>{
|
|
96
|
-
root.walkComments((rule)=>{
|
|
97
|
-
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
98
|
-
rule.after(postcss.atRule({
|
|
99
|
-
name: "import",
|
|
100
|
-
params: rule.text.replace(IMPORT_COMMENT, "")
|
|
101
|
-
}));
|
|
102
|
-
rule.remove();
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
[],
|
|
108
|
-
{}
|
|
109
|
-
];
|
|
110
|
-
}
|
|
111
113
|
let state = {
|
|
112
114
|
/** @type {any} */ context: null,
|
|
113
115
|
/** @type {ReturnType<typeof createWatcher> | null} */ watcher: null,
|
|
114
116
|
/** @type {{content: string, extension: string}[]} */ changedContent: [],
|
|
115
|
-
/** @type {
|
|
117
|
+
/** @type {{config: import('../../../types').Config, dependencies: Set<string>, dispose: Function } | null} */ configBag: null,
|
|
116
118
|
contextDependencies: new Set(),
|
|
117
119
|
/** @type {import('../../lib/content.js').ContentPath[]} */ contentPaths: [],
|
|
118
120
|
refreshContentPaths () {
|
|
@@ -143,12 +145,7 @@ let state = {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
};
|
|
146
|
-
|
|
147
|
-
this.configBag.config = (0, _resolveConfig.default)(this.configBag.config, {
|
|
148
|
-
content: {
|
|
149
|
-
files: []
|
|
150
|
-
}
|
|
151
|
-
});
|
|
148
|
+
this.configBag.config = (0, _validateConfig.validateConfig)((0, _resolveConfig.default)(this.configBag.config));
|
|
152
149
|
// Override content files if `--content` has been passed explicitly
|
|
153
150
|
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
154
151
|
this.configBag.config.content.files = content;
|
|
@@ -167,7 +164,7 @@ let state = {
|
|
|
167
164
|
// TODO: When we make the postcss plugin async-capable this can become async
|
|
168
165
|
let files = _fastglob.default.sync(this.contentPatterns.all);
|
|
169
166
|
for (let file of files){
|
|
170
|
-
if (
|
|
167
|
+
if ((0, _featureFlags.flagEnabled)(this.config, "oxideParser")) {
|
|
171
168
|
content.push({
|
|
172
169
|
file,
|
|
173
170
|
extension: _path.default.extname(file).slice(1)
|
|
@@ -225,12 +222,16 @@ let state = {
|
|
|
225
222
|
};
|
|
226
223
|
async function createProcessor(args, cliConfigPath) {
|
|
227
224
|
var _args_content;
|
|
228
|
-
let postcss = (0, _deps.loadPostcss)();
|
|
229
225
|
let input = args["--input"];
|
|
230
226
|
let output = args["--output"];
|
|
231
227
|
let includePostCss = args["--postcss"];
|
|
232
228
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
233
|
-
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) :
|
|
229
|
+
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : [
|
|
230
|
+
[],
|
|
231
|
+
[],
|
|
232
|
+
{}
|
|
233
|
+
];
|
|
234
|
+
beforePlugins.unshift(...(0, _handleImportAtRules.handleImportAtRules)());
|
|
234
235
|
if (args["--purge"]) {
|
|
235
236
|
_log.default.warn("purge-flag-deprecated", [
|
|
236
237
|
"The `--purge` flag has been deprecated.",
|
|
@@ -269,12 +270,10 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
269
270
|
...beforePlugins,
|
|
270
271
|
tailwindPlugin,
|
|
271
272
|
!args["--minify"] && _utils.formatNodes,
|
|
272
|
-
...afterPlugins
|
|
273
|
-
!args["--no-autoprefixer"] && (0, _deps.loadAutoprefixer)(),
|
|
274
|
-
args["--minify"] && (0, _deps.loadCssNano)()
|
|
273
|
+
...afterPlugins
|
|
275
274
|
].filter(Boolean);
|
|
276
275
|
/** @type {import('postcss').Processor} */ // @ts-ignore
|
|
277
|
-
let processor =
|
|
276
|
+
let processor = (0, _postcss.default)(plugins);
|
|
278
277
|
async function readInput() {
|
|
279
278
|
// Piping in data, let's drain the stdin
|
|
280
279
|
if (input === "-") {
|
|
@@ -289,10 +288,14 @@ async function createProcessor(args, cliConfigPath) {
|
|
|
289
288
|
}
|
|
290
289
|
async function build() {
|
|
291
290
|
let start = process.hrtime.bigint();
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
291
|
+
let options = {
|
|
292
|
+
...postcssOptions,
|
|
293
|
+
from: input,
|
|
294
|
+
to: output
|
|
295
|
+
};
|
|
296
|
+
return readInput().then((css)=>processor.process(css, options)).then((result)=>lightningcss(result, {
|
|
297
|
+
...options,
|
|
298
|
+
minify: !!args["--minify"]
|
|
296
299
|
})).then((result)=>{
|
|
297
300
|
if (!state.watcher) {
|
|
298
301
|
return result;
|
package/lib/cli/index.js
CHANGED
package/lib/cli.js
CHANGED
package/lib/corePluginList.js
CHANGED
package/lib/corePlugins.js
CHANGED
|
@@ -415,6 +415,17 @@ let variantPlugins = {
|
|
|
415
415
|
values: (_theme = theme("supports")) !== null && _theme !== void 0 ? _theme : {}
|
|
416
416
|
});
|
|
417
417
|
},
|
|
418
|
+
hasVariants: ({ matchVariant })=>{
|
|
419
|
+
matchVariant("has", (value)=>`&:has(${(0, _dataTypes.normalize)(value)})`, {
|
|
420
|
+
values: {}
|
|
421
|
+
});
|
|
422
|
+
matchVariant("group-has", (value, { modifier })=>modifier ? `:merge(.group\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) &` : `:merge(.group):has(${(0, _dataTypes.normalize)(value)}) &`, {
|
|
423
|
+
values: {}
|
|
424
|
+
});
|
|
425
|
+
matchVariant("peer-has", (value, { modifier })=>modifier ? `:merge(.peer\\/${modifier}):has(${(0, _dataTypes.normalize)(value)}) ~ &` : `:merge(.peer):has(${(0, _dataTypes.normalize)(value)}) ~ &`, {
|
|
426
|
+
values: {}
|
|
427
|
+
});
|
|
428
|
+
},
|
|
418
429
|
ariaVariants: ({ matchVariant , theme })=>{
|
|
419
430
|
var _theme;
|
|
420
431
|
matchVariant("aria", (value)=>`&[aria-${(0, _dataTypes.normalize)(value)}]`, {
|
|
@@ -1935,11 +1946,11 @@ let corePlugins = {
|
|
|
1935
1946
|
]
|
|
1936
1947
|
]
|
|
1937
1948
|
]),
|
|
1938
|
-
space: ({ matchUtilities , addUtilities , theme })=>{
|
|
1949
|
+
space: ({ matchUtilities , addUtilities , theme , config })=>{
|
|
1939
1950
|
matchUtilities({
|
|
1940
1951
|
"space-x": (value)=>{
|
|
1941
1952
|
value = value === "0" ? "0px" : value;
|
|
1942
|
-
if (
|
|
1953
|
+
if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
|
|
1943
1954
|
return {
|
|
1944
1955
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1945
1956
|
"--tw-space-x-reverse": "0",
|
|
@@ -1979,11 +1990,11 @@ let corePlugins = {
|
|
|
1979
1990
|
}
|
|
1980
1991
|
});
|
|
1981
1992
|
},
|
|
1982
|
-
divideWidth: ({ matchUtilities , addUtilities , theme })=>{
|
|
1993
|
+
divideWidth: ({ matchUtilities , addUtilities , theme , config })=>{
|
|
1983
1994
|
matchUtilities({
|
|
1984
1995
|
"divide-x": (value)=>{
|
|
1985
1996
|
value = value === "0" ? "0px" : value;
|
|
1986
|
-
if (
|
|
1997
|
+
if ((0, _featureFlags.flagEnabled)(config(), "logicalSiblingUtilities")) {
|
|
1987
1998
|
return {
|
|
1988
1999
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1989
2000
|
"@defaults border-width": {},
|
|
@@ -2293,6 +2304,19 @@ let corePlugins = {
|
|
|
2293
2304
|
}
|
|
2294
2305
|
});
|
|
2295
2306
|
},
|
|
2307
|
+
textWrap: ({ addUtilities })=>{
|
|
2308
|
+
addUtilities({
|
|
2309
|
+
".text-wrap": {
|
|
2310
|
+
"text-wrap": "wrap"
|
|
2311
|
+
},
|
|
2312
|
+
".text-nowrap": {
|
|
2313
|
+
"text-wrap": "nowrap"
|
|
2314
|
+
},
|
|
2315
|
+
".text-balance": {
|
|
2316
|
+
"text-wrap": "balance"
|
|
2317
|
+
}
|
|
2318
|
+
});
|
|
2319
|
+
},
|
|
2296
2320
|
wordBreak: ({ addUtilities })=>{
|
|
2297
2321
|
addUtilities({
|
|
2298
2322
|
".break-normal": {
|
package/lib/css/preflight.css
CHANGED
|
@@ -163,6 +163,8 @@ optgroup,
|
|
|
163
163
|
select,
|
|
164
164
|
textarea {
|
|
165
165
|
font-family: inherit; /* 1 */
|
|
166
|
+
font-feature-settings: inherit; /* 1 */
|
|
167
|
+
font-variation-settings: inherit; /* 1 */
|
|
166
168
|
font-size: 100%; /* 1 */
|
|
167
169
|
font-weight: inherit; /* 1 */
|
|
168
170
|
line-height: inherit; /* 1 */
|
|
@@ -264,7 +266,7 @@ summary {
|
|
|
264
266
|
}
|
|
265
267
|
|
|
266
268
|
/*
|
|
267
|
-
Removes the default spacing
|
|
269
|
+
Removes the default spacing for appropriate elements.
|
|
268
270
|
*/
|
|
269
271
|
|
|
270
272
|
blockquote,
|
|
@@ -300,6 +302,10 @@ menu {
|
|
|
300
302
|
padding: 0;
|
|
301
303
|
}
|
|
302
304
|
|
|
305
|
+
dialog {
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
303
309
|
/*
|
|
304
310
|
Prevent resizing textareas horizontally by default.
|
|
305
311
|
*/
|
package/lib/featureFlags.js
CHANGED
|
@@ -28,24 +28,22 @@ function _interop_require_default(obj) {
|
|
|
28
28
|
}
|
|
29
29
|
let defaults = {
|
|
30
30
|
optimizeUniversalDefaults: false,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
get relativeContentPathsByDefault () {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
31
|
+
disableColorOpacityUtilitiesByDefault: false,
|
|
32
|
+
relativeContentPathsByDefault: false,
|
|
33
|
+
oxideParser: false,
|
|
34
|
+
logicalSiblingUtilities: false
|
|
38
35
|
};
|
|
39
36
|
let featureFlags = {
|
|
40
37
|
future: [
|
|
41
38
|
"hoverOnlyWhenSupported",
|
|
42
39
|
"respectDefaultRingColorOpacity",
|
|
43
40
|
"disableColorOpacityUtilitiesByDefault",
|
|
44
|
-
"relativeContentPathsByDefault"
|
|
41
|
+
"relativeContentPathsByDefault",
|
|
42
|
+
"logicalSiblingUtilities"
|
|
45
43
|
],
|
|
46
44
|
experimental: [
|
|
47
45
|
"optimizeUniversalDefaults",
|
|
48
|
-
"
|
|
46
|
+
"oxideParser"
|
|
49
47
|
]
|
|
50
48
|
};
|
|
51
49
|
function flagEnabled(config, flag) {
|
package/lib/lib/content.js
CHANGED
|
@@ -24,13 +24,39 @@ const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
|
24
24
|
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
25
25
|
const _parseGlob = require("../util/parseGlob");
|
|
26
26
|
const _sharedState = require("./sharedState");
|
|
27
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
27
28
|
function _interop_require_default(obj) {
|
|
28
29
|
return obj && obj.__esModule ? obj : {
|
|
29
30
|
default: obj
|
|
30
31
|
};
|
|
31
32
|
}
|
|
33
|
+
/** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ /*
|
|
34
|
+
* @param {import('tailwindcss').Config} tailwindConfig
|
|
35
|
+
* @param {{skip:string[]}} options
|
|
36
|
+
* @returns {ContentPath[]}
|
|
37
|
+
*/ function resolveContentFiles(tailwindConfig, { skip =[] } = {}) {
|
|
38
|
+
if (Array.isArray(tailwindConfig.content.files) && tailwindConfig.content.files.includes("auto")) {
|
|
39
|
+
let idx = tailwindConfig.content.files.indexOf("auto");
|
|
40
|
+
if (idx !== -1) {
|
|
41
|
+
_sharedState.env.DEBUG && console.time("Calculating resolve content paths");
|
|
42
|
+
let resolved = (0, _oxide.resolveContentPaths)({
|
|
43
|
+
base: process.cwd()
|
|
44
|
+
});
|
|
45
|
+
_sharedState.env.DEBUG && console.timeEnd("Calculating resolve content paths");
|
|
46
|
+
tailwindConfig.content.files.splice(idx, 1, ...resolved);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (skip.length > 0) {
|
|
50
|
+
tailwindConfig.content.files = tailwindConfig.content.files.filter((filePath)=>!skip.includes(filePath));
|
|
51
|
+
}
|
|
52
|
+
return tailwindConfig.content.files;
|
|
53
|
+
}
|
|
32
54
|
function parseCandidateFiles(context, tailwindConfig) {
|
|
33
|
-
let files = tailwindConfig
|
|
55
|
+
let files = resolveContentFiles(tailwindConfig, {
|
|
56
|
+
skip: [
|
|
57
|
+
context.userConfigPath
|
|
58
|
+
]
|
|
59
|
+
});
|
|
34
60
|
// Normalize the file globs
|
|
35
61
|
files = files.filter((filePath)=>typeof filePath === "string");
|
|
36
62
|
files = files.map(_normalizepath.default);
|
|
@@ -11,7 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
12
12
|
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
|
|
13
13
|
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
14
|
-
const
|
|
14
|
+
const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
|
|
15
15
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
16
16
|
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
17
17
|
const _toPath = require("../util/toPath");
|
|
@@ -121,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
|
|
|
121
121
|
if (vNode.type === "div" && vNode.value === ",") {
|
|
122
122
|
args.push("");
|
|
123
123
|
} else {
|
|
124
|
-
args[args.length - 1] +=
|
|
124
|
+
args[args.length - 1] += _index.default.stringify(vNode);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
return args;
|
|
@@ -135,7 +135,9 @@ function resolveVNode(node, vNode, functions) {
|
|
|
135
135
|
return vNode;
|
|
136
136
|
}
|
|
137
137
|
function resolveFunctions(node, input, functions) {
|
|
138
|
-
|
|
138
|
+
let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
|
|
139
|
+
if (!hasAnyFn) return input;
|
|
140
|
+
return (0, _index.default)(input).walk((vNode)=>{
|
|
139
141
|
resolveVNode(node, vNode, functions);
|
|
140
142
|
}).toString();
|
|
141
143
|
}
|
|
@@ -10,11 +10,13 @@ Object.defineProperty(exports, "default", {
|
|
|
10
10
|
});
|
|
11
11
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
12
12
|
const _quicklru = /*#__PURE__*/ _interop_require_default(require("@alloc/quick-lru"));
|
|
13
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
13
14
|
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
14
15
|
const _generateRules = require("./generateRules");
|
|
15
16
|
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
16
17
|
const _cloneNodes = /*#__PURE__*/ _interop_require_default(require("../util/cloneNodes"));
|
|
17
18
|
const _defaultExtractor = require("./defaultExtractor");
|
|
19
|
+
const _featureFlags = require("../featureFlags");
|
|
18
20
|
function _interop_require_default(obj) {
|
|
19
21
|
return obj && obj.__esModule ? obj : {
|
|
20
22
|
default: obj
|
|
@@ -69,7 +71,12 @@ const builtInTransformers = {
|
|
|
69
71
|
};
|
|
70
72
|
function getExtractor(context, fileExtension) {
|
|
71
73
|
let extractors = context.tailwindConfig.content.extract;
|
|
72
|
-
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] ||
|
|
74
|
+
return extractors[fileExtension] || extractors.DEFAULT || builtInExtractors[fileExtension] || // Because we call `DEFAULT(context)`, the returning function is always a new function without a
|
|
75
|
+
// stable identity. Marking it with `DEFAULT_EXTRACTOR` allows us to check if it is the default
|
|
76
|
+
// extractor without relying on the function identity.
|
|
77
|
+
Object.assign(builtInExtractors.DEFAULT(context), {
|
|
78
|
+
DEFAULT_EXTRACTOR: true
|
|
79
|
+
});
|
|
73
80
|
}
|
|
74
81
|
function getTransformer(tailwindConfig, fileExtension) {
|
|
75
82
|
let transformers = tailwindConfig.content.transform;
|
|
@@ -154,16 +161,35 @@ function expandTailwindAtRules(context) {
|
|
|
154
161
|
]);
|
|
155
162
|
let seen = new Set();
|
|
156
163
|
env.DEBUG && console.time("Reading changed files");
|
|
157
|
-
if (
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
164
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, "oxideParser")) {
|
|
165
|
+
let rustParserContent = [];
|
|
166
|
+
let regexParserContent = [];
|
|
167
|
+
for (let item of context.changedContent){
|
|
168
|
+
let transformer = getTransformer(context.tailwindConfig, item.extension);
|
|
169
|
+
let extractor = getExtractor(context, item.extension);
|
|
170
|
+
if (transformer === builtInTransformers.DEFAULT && (extractor === null || extractor === void 0 ? void 0 : extractor.DEFAULT_EXTRACTOR) === true) {
|
|
171
|
+
rustParserContent.push(item);
|
|
172
|
+
} else {
|
|
173
|
+
regexParserContent.push([
|
|
174
|
+
item,
|
|
175
|
+
{
|
|
176
|
+
transformer,
|
|
177
|
+
extractor
|
|
178
|
+
}
|
|
179
|
+
]);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (rustParserContent.length > 0) {
|
|
183
|
+
for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
|
|
184
|
+
candidates.add(candidate);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (regexParserContent.length > 0) {
|
|
188
|
+
for (let [{ file , content }, { transformer , extractor }] of regexParserContent){
|
|
189
|
+
content = file ? _fs.default.readFileSync(file, "utf8") : content;
|
|
190
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
191
|
+
}
|
|
161
192
|
}
|
|
162
|
-
// for (let { file, content, extension } of context.changedContent) {
|
|
163
|
-
// let transformer = getTransformer(context.tailwindConfig, extension)
|
|
164
|
-
// let extractor = getExtractor(context, extension)
|
|
165
|
-
// getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
|
|
166
|
-
// }
|
|
167
193
|
} else {
|
|
168
194
|
for (let { file , content , extension } of context.changedContent){
|
|
169
195
|
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
@@ -178,7 +204,10 @@ function expandTailwindAtRules(context) {
|
|
|
178
204
|
let classCacheCount = context.classCache.size;
|
|
179
205
|
env.DEBUG && console.time("Generate rules");
|
|
180
206
|
env.DEBUG && console.time("Sorting candidates");
|
|
181
|
-
|
|
207
|
+
// TODO: only sort if we are not using the oxide parser (flagEnabled(context.tailwindConfig,
|
|
208
|
+
// 'oxideParser')) AND if we got all the candidates form the oxideParser alone. This will not
|
|
209
|
+
// be the case currently if you have custom transformers / extractors.
|
|
210
|
+
let sortedCandidates = new Set([
|
|
182
211
|
...candidates
|
|
183
212
|
].sort((a, z)=>{
|
|
184
213
|
if (a === z) return 0;
|
|
@@ -242,9 +271,20 @@ function expandTailwindAtRules(context) {
|
|
|
242
271
|
}));
|
|
243
272
|
layerNodes.variants.remove();
|
|
244
273
|
} else if (variantNodes.length > 0) {
|
|
245
|
-
|
|
274
|
+
let cloned = (0, _cloneNodes.default)(variantNodes, undefined, {
|
|
246
275
|
layer: "variants"
|
|
247
|
-
})
|
|
276
|
+
});
|
|
277
|
+
cloned.forEach((node)=>{
|
|
278
|
+
var _node_raws_tailwind;
|
|
279
|
+
var _node_raws_tailwind_parentLayer;
|
|
280
|
+
let parentLayer = (_node_raws_tailwind_parentLayer = (_node_raws_tailwind = node.raws.tailwind) === null || _node_raws_tailwind === void 0 ? void 0 : _node_raws_tailwind.parentLayer) !== null && _node_raws_tailwind_parentLayer !== void 0 ? _node_raws_tailwind_parentLayer : null;
|
|
281
|
+
node.walk((n)=>{
|
|
282
|
+
if (!n.source) {
|
|
283
|
+
n.source = layerNodes[parentLayer].source;
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
root.append(cloned);
|
|
248
288
|
}
|
|
249
289
|
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
250
290
|
const hasUtilityVariants = variantNodes.some((node)=>{
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -215,9 +215,6 @@ function applyVariant(variant, matches, context) {
|
|
|
215
215
|
if (modifiers.length && !context.variantMap.has(variant)) {
|
|
216
216
|
variant = baseVariant;
|
|
217
217
|
args.modifier = modifiers[0];
|
|
218
|
-
if (!(0, _featureFlags.flagEnabled)(context.tailwindConfig, "generalizedModifiers")) {
|
|
219
|
-
return [];
|
|
220
|
-
}
|
|
221
218
|
}
|
|
222
219
|
}
|
|
223
220
|
// Retrieve "arbitrary value"
|
|
@@ -231,12 +228,12 @@ function applyVariant(variant, matches, context) {
|
|
|
231
228
|
// group[:hover] (`-` is missing)
|
|
232
229
|
let match = /(.)(-?)\[(.*)\]/g.exec(variant);
|
|
233
230
|
if (match) {
|
|
234
|
-
let [, char,
|
|
231
|
+
let [, char, separator, value] = match;
|
|
235
232
|
// @-[200px] case
|
|
236
|
-
if (char === "@" &&
|
|
233
|
+
if (char === "@" && separator === "-") return [];
|
|
237
234
|
// group[:hover] case
|
|
238
|
-
if (char !== "@" &&
|
|
239
|
-
variant = variant.replace(`${
|
|
235
|
+
if (char !== "@" && separator === "") return [];
|
|
236
|
+
variant = variant.replace(`${separator}[${value}]`, "");
|
|
240
237
|
args.value = value;
|
|
241
238
|
}
|
|
242
239
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "handleImportAtRules", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return handleImportAtRules;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
12
|
+
const _postcssimport = /*#__PURE__*/ _interop_require_default(require("postcss-import"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
const TAILWIND = Symbol();
|
|
19
|
+
function handleImportAtRules() {
|
|
20
|
+
let RESTORE_ATRULE_COMMENT = "__TAILWIND_RESTORE__";
|
|
21
|
+
let atRulesToRestore = [
|
|
22
|
+
"tailwind",
|
|
23
|
+
"config"
|
|
24
|
+
];
|
|
25
|
+
return [
|
|
26
|
+
(root)=>{
|
|
27
|
+
root.walkAtRules((rule)=>{
|
|
28
|
+
if (!atRulesToRestore.includes(rule.name)) return rule;
|
|
29
|
+
rule.after(_postcss.default.comment({
|
|
30
|
+
text: RESTORE_ATRULE_COMMENT,
|
|
31
|
+
raws: {
|
|
32
|
+
[TAILWIND]: {
|
|
33
|
+
rule
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
rule.remove();
|
|
38
|
+
});
|
|
39
|
+
},
|
|
40
|
+
(0, _postcssimport.default)(),
|
|
41
|
+
(root)=>{
|
|
42
|
+
root.walkComments((rule)=>{
|
|
43
|
+
if (rule.text === RESTORE_ATRULE_COMMENT) {
|
|
44
|
+
rule.after(rule.raws[TAILWIND].rule);
|
|
45
|
+
rule.remove();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
];
|
|
50
|
+
}
|
|
@@ -22,21 +22,6 @@ function normalizeTailwindDirectives(root) {
|
|
|
22
22
|
if (atRule.name === "apply") {
|
|
23
23
|
applyDirectives.add(atRule);
|
|
24
24
|
}
|
|
25
|
-
if (atRule.name === "import") {
|
|
26
|
-
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
|
|
27
|
-
atRule.name = "tailwind";
|
|
28
|
-
atRule.params = "base";
|
|
29
|
-
} else if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
|
|
30
|
-
atRule.name = "tailwind";
|
|
31
|
-
atRule.params = "components";
|
|
32
|
-
} else if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
|
|
33
|
-
atRule.name = "tailwind";
|
|
34
|
-
atRule.params = "utilities";
|
|
35
|
-
} else if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'" || atRule.params === '"tailwindcss/variants"' || atRule.params === "'tailwindcss/variants'") {
|
|
36
|
-
atRule.name = "tailwind";
|
|
37
|
-
atRule.params = "variants";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
25
|
if (atRule.name === "tailwind") {
|
|
41
26
|
if (atRule.params === "screens") {
|
|
42
27
|
atRule.params = "variants";
|