tailwindcss 0.0.0-insiders.73272fa → 0.0.0-insiders.7385373
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/lib/cli/build/plugin.js +9 -11
- package/lib/cli/build/utils.js +7 -7
- package/lib/cli/build/watching.js +1 -1
- package/lib/cli/index.js +2 -2
- package/lib/corePluginList.js +3 -1
- package/lib/corePlugins.js +47 -5
- package/lib/css/preflight.css +11 -4
- package/lib/featureFlags.js +8 -9
- package/lib/lib/cacheInvalidation.js +3 -1
- package/lib/lib/collapseAdjacentRules.js +4 -2
- package/lib/lib/defaultExtractor.js +35 -10
- package/lib/lib/evaluateTailwindFunctions.js +2 -2
- package/lib/lib/expandApplyAtRules.js +6 -0
- package/lib/lib/expandTailwindAtRules.js +34 -33
- package/lib/lib/generateRules.js +30 -11
- package/lib/lib/load-config.js +14 -3
- package/lib/lib/regex.js +12 -12
- package/lib/lib/resolveDefaultsAtRules.js +3 -3
- package/lib/lib/setupContextUtils.js +61 -63
- package/lib/lib/setupTrackingContext.js +1 -2
- package/lib/lib/sharedState.js +12 -12
- package/lib/plugin.js +4 -2
- package/lib/postcss-plugins/nesting/plugin.js +2 -2
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +4 -4
- package/lib/util/dataTypes.js +82 -33
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/formatVariantSelector.js +12 -7
- package/lib/util/getAllConfigs.js +1 -2
- package/lib/util/isPlainObject.js +1 -1
- package/lib/util/log.js +3 -3
- package/lib/util/normalizeConfig.js +15 -18
- package/lib/util/normalizeScreens.js +4 -4
- package/lib/util/parseBoxShadowValue.js +3 -3
- package/lib/util/pluginUtils.js +24 -11
- package/lib/util/resolveConfig.js +44 -41
- package/lib/util/withAlphaVariable.js +3 -3
- package/nesting/index.d.ts +4 -0
- package/package.json +17 -16
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/src/cli/build/plugin.js +5 -8
- package/src/cli/build/watching.js +1 -1
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +18 -0
- package/src/css/preflight.css +11 -4
- package/src/lib/defaultExtractor.js +29 -6
- package/src/lib/expandApplyAtRules.js +7 -0
- package/src/lib/expandTailwindAtRules.js +39 -32
- package/src/lib/generateRules.js +20 -4
- package/src/lib/load-config.ts +8 -0
- package/src/lib/setupContextUtils.js +33 -30
- package/src/plugin.js +1 -1
- package/src/util/cloneNodes.js +35 -14
- package/src/util/color.js +1 -1
- package/src/util/dataTypes.js +63 -11
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/pluginUtils.js +16 -0
- package/src/util/resolveConfig.js +42 -24
- package/stubs/config.full.js +67 -7
- package/types/config.d.ts +6 -3
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +28 -9
- package/types/index.d.ts +7 -3
package/lib/cli/build/plugin.js
CHANGED
|
@@ -61,7 +61,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
61
|
if (cache && cache.has(obj)) {
|
|
62
62
|
return cache.get(obj);
|
|
63
63
|
}
|
|
64
|
-
var newObj = {
|
|
64
|
+
var newObj = {
|
|
65
|
+
__proto__: null
|
|
66
|
+
};
|
|
65
67
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
68
|
for(var key in obj){
|
|
67
69
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -96,14 +98,11 @@ async function lightningcss(result, { map = true, minify = true } = {}) {
|
|
|
96
98
|
sourceMap: result.map === undefined ? map : !!result.map,
|
|
97
99
|
inputSourceMap: result.map ? result.map.toString() : undefined,
|
|
98
100
|
targets: _lightningcss.default.browserslistToTargets((0, _browserslist.default)(browsersListConfig)),
|
|
99
|
-
drafts: {
|
|
100
|
-
nesting: true
|
|
101
|
-
},
|
|
102
101
|
include: _lightningcss.Features.Nesting,
|
|
103
102
|
exclude: _lightningcss.Features.LogicalProperties
|
|
104
103
|
});
|
|
105
104
|
return Object.assign(result, {
|
|
106
|
-
css: transformed.code.toString(
|
|
105
|
+
css: transformed.code.toString(),
|
|
107
106
|
map: result.map ? Object.assign(result.map, {
|
|
108
107
|
toString () {
|
|
109
108
|
var _transformed_map;
|
|
@@ -180,7 +179,6 @@ let state = {
|
|
|
180
179
|
};
|
|
181
180
|
},
|
|
182
181
|
loadConfig (configPath, content) {
|
|
183
|
-
var _content;
|
|
184
182
|
if (this.watcher && configPath) {
|
|
185
183
|
this.refreshConfigDependencies();
|
|
186
184
|
}
|
|
@@ -197,7 +195,7 @@ let state = {
|
|
|
197
195
|
};
|
|
198
196
|
this.configBag.config = (0, _validateConfig.validateConfig)((0, _resolveConfig.default)(this.configBag.config));
|
|
199
197
|
// Override content files if `--content` has been passed explicitly
|
|
200
|
-
if ((
|
|
198
|
+
if ((content === null || content === void 0 ? void 0 : content.length) > 0) {
|
|
201
199
|
this.configBag.config.content.files = content;
|
|
202
200
|
}
|
|
203
201
|
return this.configBag.config;
|
|
@@ -239,14 +237,14 @@ let state = {
|
|
|
239
237
|
return content;
|
|
240
238
|
},
|
|
241
239
|
getContext ({ createContext, cliConfigPath, root, result, content }) {
|
|
242
|
-
if (this.context) {
|
|
243
|
-
this.context.changedContent = this.changedContent.splice(0);
|
|
244
|
-
return this.context;
|
|
245
|
-
}
|
|
246
240
|
_sharedState.env.DEBUG && console.time('Searching for config');
|
|
247
241
|
var _findAtConfigPath1;
|
|
248
242
|
let configPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : cliConfigPath;
|
|
249
243
|
_sharedState.env.DEBUG && console.timeEnd('Searching for config');
|
|
244
|
+
if (this.context) {
|
|
245
|
+
this.context.changedContent = this.changedContent.splice(0);
|
|
246
|
+
return this.context;
|
|
247
|
+
}
|
|
250
248
|
_sharedState.env.DEBUG && console.time('Loading config');
|
|
251
249
|
let config = this.loadConfig(configPath, content);
|
|
252
250
|
_sharedState.env.DEBUG && console.timeEnd('Loading config');
|
package/lib/cli/build/utils.js
CHANGED
|
@@ -10,20 +10,20 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
|
|
14
|
-
return
|
|
13
|
+
drainStdin: function() {
|
|
14
|
+
return drainStdin;
|
|
15
15
|
},
|
|
16
16
|
formatNodes: function() {
|
|
17
17
|
return formatNodes;
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
return
|
|
21
|
-
},
|
|
22
|
-
drainStdin: function() {
|
|
23
|
-
return drainStdin;
|
|
19
|
+
indentRecursive: function() {
|
|
20
|
+
return indentRecursive;
|
|
24
21
|
},
|
|
25
22
|
outputFile: function() {
|
|
26
23
|
return outputFile;
|
|
24
|
+
},
|
|
25
|
+
readFileWithRetries: function() {
|
|
26
|
+
return readFileWithRetries;
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
29
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
@@ -126,7 +126,7 @@ function createWatcher(args, { state, rebuild }) {
|
|
|
126
126
|
// This is very likely a chokidar bug but it's one we need to work around
|
|
127
127
|
// We treat this as a change event and rebuild the CSS
|
|
128
128
|
watcher.on('raw', (evt, filePath, meta)=>{
|
|
129
|
-
if (evt !== 'rename') {
|
|
129
|
+
if (evt !== 'rename' || filePath === null) {
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
let watchedPath = meta.watchedPath;
|
package/lib/cli/index.js
CHANGED
|
@@ -151,8 +151,8 @@ let args = (()=>{
|
|
|
151
151
|
...flags,
|
|
152
152
|
...sharedFlags
|
|
153
153
|
}).filter(([_key, value])=>{
|
|
154
|
-
var _value_type
|
|
155
|
-
return !(
|
|
154
|
+
var _value_type;
|
|
155
|
+
return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
|
|
156
156
|
}).map(([key, value])=>[
|
|
157
157
|
key,
|
|
158
158
|
typeof value === 'object' ? value.type : value
|
package/lib/corePluginList.js
CHANGED
|
@@ -32,6 +32,7 @@ const _default = [
|
|
|
32
32
|
"lineClamp",
|
|
33
33
|
"display",
|
|
34
34
|
"aspectRatio",
|
|
35
|
+
"size",
|
|
35
36
|
"height",
|
|
36
37
|
"maxHeight",
|
|
37
38
|
"minHeight",
|
|
@@ -184,5 +185,6 @@ const _default = [
|
|
|
184
185
|
"transitionDuration",
|
|
185
186
|
"transitionTimingFunction",
|
|
186
187
|
"willChange",
|
|
187
|
-
"content"
|
|
188
|
+
"content",
|
|
189
|
+
"forcedColorAdjust"
|
|
188
190
|
];
|
package/lib/corePlugins.js
CHANGED
|
@@ -9,11 +9,11 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
variantPlugins: function() {
|
|
13
|
-
return variantPlugins;
|
|
14
|
-
},
|
|
15
12
|
corePlugins: function() {
|
|
16
13
|
return corePlugins;
|
|
14
|
+
},
|
|
15
|
+
variantPlugins: function() {
|
|
16
|
+
return variantPlugins;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
@@ -61,7 +61,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
61
61
|
if (cache && cache.has(obj)) {
|
|
62
62
|
return cache.get(obj);
|
|
63
63
|
}
|
|
64
|
-
var newObj = {
|
|
64
|
+
var newObj = {
|
|
65
|
+
__proto__: null
|
|
66
|
+
};
|
|
65
67
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
66
68
|
for(var key in obj){
|
|
67
69
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -464,6 +466,9 @@ let variantPlugins = {
|
|
|
464
466
|
prefersContrastVariants: ({ addVariant })=>{
|
|
465
467
|
addVariant('contrast-more', '@media (prefers-contrast: more)');
|
|
466
468
|
addVariant('contrast-less', '@media (prefers-contrast: less)');
|
|
469
|
+
},
|
|
470
|
+
forcedColorsVariants: ({ addVariant })=>{
|
|
471
|
+
addVariant('forced-colors', '@media (forced-colors: active)');
|
|
467
472
|
}
|
|
468
473
|
};
|
|
469
474
|
let cssTransformValue = [
|
|
@@ -779,6 +784,12 @@ let corePlugins = {
|
|
|
779
784
|
]),
|
|
780
785
|
float: ({ addUtilities })=>{
|
|
781
786
|
addUtilities({
|
|
787
|
+
'.float-start': {
|
|
788
|
+
float: 'inline-start'
|
|
789
|
+
},
|
|
790
|
+
'.float-end': {
|
|
791
|
+
float: 'inline-end'
|
|
792
|
+
},
|
|
782
793
|
'.float-right': {
|
|
783
794
|
float: 'right'
|
|
784
795
|
},
|
|
@@ -792,6 +803,12 @@ let corePlugins = {
|
|
|
792
803
|
},
|
|
793
804
|
clear: ({ addUtilities })=>{
|
|
794
805
|
addUtilities({
|
|
806
|
+
'.clear-start': {
|
|
807
|
+
clear: 'inline-start'
|
|
808
|
+
},
|
|
809
|
+
'.clear-end': {
|
|
810
|
+
clear: 'inline-end'
|
|
811
|
+
},
|
|
795
812
|
'.clear-left': {
|
|
796
813
|
clear: 'left'
|
|
797
814
|
},
|
|
@@ -975,6 +992,15 @@ let corePlugins = {
|
|
|
975
992
|
]
|
|
976
993
|
]
|
|
977
994
|
]),
|
|
995
|
+
size: (0, _createUtilityPlugin.default)('size', [
|
|
996
|
+
[
|
|
997
|
+
'size',
|
|
998
|
+
[
|
|
999
|
+
'width',
|
|
1000
|
+
'height'
|
|
1001
|
+
]
|
|
1002
|
+
]
|
|
1003
|
+
]),
|
|
978
1004
|
height: (0, _createUtilityPlugin.default)('height', [
|
|
979
1005
|
[
|
|
980
1006
|
'h',
|
|
@@ -1618,6 +1644,9 @@ let corePlugins = {
|
|
|
1618
1644
|
addUtilities({
|
|
1619
1645
|
'.appearance-none': {
|
|
1620
1646
|
appearance: 'none'
|
|
1647
|
+
},
|
|
1648
|
+
'.appearance-auto': {
|
|
1649
|
+
appearance: 'auto'
|
|
1621
1650
|
}
|
|
1622
1651
|
});
|
|
1623
1652
|
},
|
|
@@ -2312,6 +2341,9 @@ let corePlugins = {
|
|
|
2312
2341
|
},
|
|
2313
2342
|
'.text-balance': {
|
|
2314
2343
|
'text-wrap': 'balance'
|
|
2344
|
+
},
|
|
2345
|
+
'.text-pretty': {
|
|
2346
|
+
'text-wrap': 'pretty'
|
|
2315
2347
|
}
|
|
2316
2348
|
});
|
|
2317
2349
|
},
|
|
@@ -4191,5 +4223,15 @@ let corePlugins = {
|
|
|
4191
4223
|
]
|
|
4192
4224
|
]
|
|
4193
4225
|
]
|
|
4194
|
-
])
|
|
4226
|
+
]),
|
|
4227
|
+
forcedColorAdjust: ({ addUtilities })=>{
|
|
4228
|
+
addUtilities({
|
|
4229
|
+
'.forced-color-adjust-auto': {
|
|
4230
|
+
'forced-color-adjust': 'auto'
|
|
4231
|
+
},
|
|
4232
|
+
'.forced-color-adjust-none': {
|
|
4233
|
+
'forced-color-adjust': 'none'
|
|
4234
|
+
}
|
|
4235
|
+
});
|
|
4236
|
+
}
|
|
4195
4237
|
};
|
package/lib/css/preflight.css
CHANGED
|
@@ -24,9 +24,11 @@
|
|
|
24
24
|
4. Use the user's configured `sans` font-family by default.
|
|
25
25
|
5. Use the user's configured `sans` font-feature-settings by default.
|
|
26
26
|
6. Use the user's configured `sans` font-variation-settings by default.
|
|
27
|
+
7. Disable tap highlights on iOS.
|
|
27
28
|
*/
|
|
28
29
|
|
|
29
|
-
html
|
|
30
|
+
html,
|
|
31
|
+
:host {
|
|
30
32
|
line-height: 1.5; /* 1 */
|
|
31
33
|
-webkit-text-size-adjust: 100%; /* 2 */
|
|
32
34
|
-moz-tab-size: 4; /* 3 */
|
|
@@ -34,6 +36,7 @@ html {
|
|
|
34
36
|
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
35
37
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
36
38
|
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
39
|
+
-webkit-tap-highlight-color: transparent; /* 7 */
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
/*
|
|
@@ -99,8 +102,10 @@ strong {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
/*
|
|
102
|
-
1. Use the user's configured `mono` font
|
|
103
|
-
2.
|
|
105
|
+
1. Use the user's configured `mono` font-family by default.
|
|
106
|
+
2. Use the user's configured `mono` font-feature-settings by default.
|
|
107
|
+
3. Use the user's configured `mono` font-variation-settings by default.
|
|
108
|
+
4. Correct the odd `em` font sizing in all browsers.
|
|
104
109
|
*/
|
|
105
110
|
|
|
106
111
|
code,
|
|
@@ -108,7 +113,9 @@ kbd,
|
|
|
108
113
|
samp,
|
|
109
114
|
pre {
|
|
110
115
|
font-family: theme('fontFamily.mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace); /* 1 */
|
|
111
|
-
font-
|
|
116
|
+
font-feature-settings: theme('fontFamily.mono[1].fontFeatureSettings', normal); /* 2 */
|
|
117
|
+
font-variation-settings: theme('fontFamily.mono[1].fontVariationSettings', normal); /* 3 */
|
|
118
|
+
font-size: 1em; /* 4 */
|
|
112
119
|
}
|
|
113
120
|
|
|
114
121
|
/*
|
package/lib/featureFlags.js
CHANGED
|
@@ -9,6 +9,9 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
+
default: function() {
|
|
13
|
+
return _default;
|
|
14
|
+
},
|
|
12
15
|
featureFlags: function() {
|
|
13
16
|
return featureFlags;
|
|
14
17
|
},
|
|
@@ -17,9 +20,6 @@ _export(exports, {
|
|
|
17
20
|
},
|
|
18
21
|
issueFlagNotices: function() {
|
|
19
22
|
return issueFlagNotices;
|
|
20
|
-
},
|
|
21
|
-
default: function() {
|
|
22
|
-
return _default;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
|
|
@@ -51,24 +51,23 @@ let featureFlags = {
|
|
|
51
51
|
};
|
|
52
52
|
function flagEnabled(config, flag) {
|
|
53
53
|
if (featureFlags.future.includes(flag)) {
|
|
54
|
-
var _config_future
|
|
54
|
+
var _config_future;
|
|
55
55
|
var _config_future_flag, _ref;
|
|
56
|
-
return config.future === 'all' || ((_ref = (_config_future_flag =
|
|
56
|
+
return config.future === 'all' || ((_ref = (_config_future_flag = config === null || config === void 0 ? void 0 : (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
|
|
57
57
|
}
|
|
58
58
|
if (featureFlags.experimental.includes(flag)) {
|
|
59
|
-
var _config_experimental
|
|
59
|
+
var _config_experimental;
|
|
60
60
|
var _config_experimental_flag, _ref1;
|
|
61
|
-
return config.experimental === 'all' || ((_ref1 = (_config_experimental_flag =
|
|
61
|
+
return config.experimental === 'all' || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
|
|
62
62
|
}
|
|
63
63
|
return false;
|
|
64
64
|
}
|
|
65
65
|
function experimentalFlagsEnabled(config) {
|
|
66
|
-
var _config;
|
|
67
66
|
if (config.experimental === 'all') {
|
|
68
67
|
return featureFlags.experimental;
|
|
69
68
|
}
|
|
70
69
|
var _config_experimental;
|
|
71
|
-
return Object.keys((_config_experimental =
|
|
70
|
+
return Object.keys((_config_experimental = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
72
71
|
}
|
|
73
72
|
function issueFlagNotices(config) {
|
|
74
73
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
@@ -36,7 +36,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
36
36
|
if (cache && cache.has(obj)) {
|
|
37
37
|
return cache.get(obj);
|
|
38
38
|
}
|
|
39
|
-
var newObj = {
|
|
39
|
+
var newObj = {
|
|
40
|
+
__proto__: null
|
|
41
|
+
};
|
|
40
42
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
43
|
for(var key in obj){
|
|
42
44
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -31,10 +31,12 @@ function collapseAdjacentRules() {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
let properties = comparisonMap[node.type];
|
|
34
|
-
var _node_property, _currentRule_property;
|
|
35
34
|
if (node.type === 'atrule' && node.name === 'font-face') {
|
|
36
35
|
currentRule = node;
|
|
37
|
-
} else if (properties.every((property)=>
|
|
36
|
+
} else if (properties.every((property)=>{
|
|
37
|
+
var _node_property, _currentRule_property;
|
|
38
|
+
return ((_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, ' ');
|
|
39
|
+
})) {
|
|
38
40
|
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
39
41
|
if (node.nodes) {
|
|
40
42
|
currentRule.append(node.nodes);
|
|
@@ -30,7 +30,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
30
30
|
if (cache && cache.has(obj)) {
|
|
31
31
|
return cache.get(obj);
|
|
32
32
|
}
|
|
33
|
-
var newObj = {
|
|
33
|
+
var newObj = {
|
|
34
|
+
__proto__: null
|
|
35
|
+
};
|
|
34
36
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
35
37
|
for(var key in obj){
|
|
36
38
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -56,12 +58,11 @@ function defaultExtractor(context) {
|
|
|
56
58
|
/** @type {(string|string)[]} */ let results = [];
|
|
57
59
|
for (let pattern of patterns){
|
|
58
60
|
var _content_match;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
];
|
|
61
|
+
for (let result of (_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []){
|
|
62
|
+
results.push(clipAtBalancedParens(result));
|
|
63
|
+
}
|
|
63
64
|
}
|
|
64
|
-
return results
|
|
65
|
+
return results;
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
68
|
function* buildRegExps(context) {
|
|
@@ -77,16 +78,25 @@ function* buildRegExps(context) {
|
|
|
77
78
|
// This is a targeted fix to continue to allow theme()
|
|
78
79
|
// with square brackets to work in arbitrary properties
|
|
79
80
|
// while fixing a problem with the regex matching too much
|
|
80
|
-
/\[[^\s:'"
|
|
81
|
+
/\[[^\s:'"`\]]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
|
|
81
82
|
// Utilities
|
|
82
83
|
_regex.pattern([
|
|
83
84
|
// Utility Name / Group Name
|
|
84
|
-
|
|
85
|
+
_regex.any([
|
|
86
|
+
/-?(?:\w+)/,
|
|
87
|
+
// This is here to make sure @container supports everything that other utilities do
|
|
88
|
+
/@(?:\w+)/
|
|
89
|
+
]),
|
|
85
90
|
// Normal/Arbitrary values
|
|
86
91
|
_regex.optional(_regex.any([
|
|
87
92
|
_regex.pattern([
|
|
88
93
|
// Arbitrary values
|
|
89
|
-
|
|
94
|
+
_regex.any([
|
|
95
|
+
/-(?:\w+-)*\['[^\s]+'\]/,
|
|
96
|
+
/-(?:\w+-)*\["[^\s]+"\]/,
|
|
97
|
+
/-(?:\w+-)*\[`[^\s]+`\]/,
|
|
98
|
+
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s:\[\]]+\]/
|
|
99
|
+
]),
|
|
90
100
|
// Not immediately followed by an `{[(`
|
|
91
101
|
/(?![{([]])/,
|
|
92
102
|
// optionally followed by an opacity modifier
|
|
@@ -94,7 +104,12 @@ function* buildRegExps(context) {
|
|
|
94
104
|
]),
|
|
95
105
|
_regex.pattern([
|
|
96
106
|
// Arbitrary values
|
|
97
|
-
|
|
107
|
+
_regex.any([
|
|
108
|
+
/-(?:\w+-)*\['[^\s]+'\]/,
|
|
109
|
+
/-(?:\w+-)*\["[^\s]+"\]/,
|
|
110
|
+
/-(?:\w+-)*\[`[^\s]+`\]/,
|
|
111
|
+
/-(?:\w+-)*\[(?:[^\s\[\]]+\[[^\s\[\]]+\])*[^\s\[\]]+\]/
|
|
112
|
+
]),
|
|
98
113
|
// Not immediately followed by an `{[(`
|
|
99
114
|
/(?![{([]])/,
|
|
100
115
|
// optionally followed by an opacity modifier
|
|
@@ -113,6 +128,11 @@ function* buildRegExps(context) {
|
|
|
113
128
|
/@\[[^\s"'`]+\](\/[^\s"'`]+)?/,
|
|
114
129
|
separator
|
|
115
130
|
]),
|
|
131
|
+
// With variant modifier (e.g.: group-[..]/modifier)
|
|
132
|
+
_regex.pattern([
|
|
133
|
+
/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]\/\w+/,
|
|
134
|
+
separator
|
|
135
|
+
]),
|
|
116
136
|
_regex.pattern([
|
|
117
137
|
/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
|
|
118
138
|
separator
|
|
@@ -124,6 +144,11 @@ function* buildRegExps(context) {
|
|
|
124
144
|
]),
|
|
125
145
|
// With quotes allowed
|
|
126
146
|
_regex.any([
|
|
147
|
+
// With variant modifier (e.g.: group-[..]/modifier)
|
|
148
|
+
_regex.pattern([
|
|
149
|
+
/([^\s"'`\[\\]+-)?\[[^\s`]+\]\/\w+/,
|
|
150
|
+
separator
|
|
151
|
+
]),
|
|
127
152
|
_regex.pattern([
|
|
128
153
|
/([^\s"'`\[\\]+-)?\[[^\s`]+\]/,
|
|
129
154
|
separator
|
|
@@ -190,9 +190,9 @@ function _default(context) {
|
|
|
190
190
|
theme: (node, path, ...defaultValue)=>{
|
|
191
191
|
let { isValid, value, error, alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
192
192
|
if (!isValid) {
|
|
193
|
-
var _parentNode_raws_tailwind
|
|
193
|
+
var _parentNode_raws_tailwind;
|
|
194
194
|
let parentNode = node.parent;
|
|
195
|
-
let candidate =
|
|
195
|
+
let candidate = parentNode === null || parentNode === void 0 ? void 0 : (_parentNode_raws_tailwind = parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
|
|
196
196
|
if (parentNode && candidate !== undefined) {
|
|
197
197
|
// Remove this utility from any caches
|
|
198
198
|
context.markInvalidUtilityNode(parentNode);
|
|
@@ -482,6 +482,12 @@ function processApply(root, context, localCache) {
|
|
|
482
482
|
// We do *not* want to do this for user CSS that happens to be structured the same
|
|
483
483
|
let isGenerated = parent.raws.tailwind !== undefined;
|
|
484
484
|
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
|
485
|
+
// If the selector becomes empty after replacing the important selector
|
|
486
|
+
// This means that it's the same as the parent selector and we don't want to replace it
|
|
487
|
+
// Otherwise we'll crash
|
|
488
|
+
if (parentSelector === '') {
|
|
489
|
+
parentSelector = parent.selector;
|
|
490
|
+
}
|
|
485
491
|
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
|
|
486
492
|
// And then re-add it if it was removed
|
|
487
493
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
@@ -43,7 +43,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
43
43
|
if (cache && cache.has(obj)) {
|
|
44
44
|
return cache.get(obj);
|
|
45
45
|
}
|
|
46
|
-
var newObj = {
|
|
46
|
+
var newObj = {
|
|
47
|
+
__proto__: null
|
|
48
|
+
};
|
|
47
49
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
48
50
|
for(var key in obj){
|
|
49
51
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -161,40 +163,36 @@ function expandTailwindAtRules(context) {
|
|
|
161
163
|
]);
|
|
162
164
|
let seen = new Set();
|
|
163
165
|
env.DEBUG && console.time('Reading changed files');
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
]);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
if (rustParserContent.length > 0) {
|
|
184
|
-
for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
|
|
185
|
-
candidates.add(candidate);
|
|
186
|
-
}
|
|
166
|
+
/** @type {[item: {file?: string, content?: string}, meta: {transformer: any, extractor: any}][]} */ let regexParserContent = [];
|
|
167
|
+
/** @type {{file?: string, content?: string}[]} */ let rustParserContent = [];
|
|
168
|
+
for (let item of context.changedContent){
|
|
169
|
+
let transformer = getTransformer(context.tailwindConfig, item.extension);
|
|
170
|
+
let extractor = getExtractor(context, item.extension);
|
|
171
|
+
if ((0, _featureFlags.flagEnabled)(context.tailwindConfig, 'oxideParser') && transformer === builtInTransformers.DEFAULT && (extractor === null || extractor === void 0 ? void 0 : extractor.DEFAULT_EXTRACTOR) === true) {
|
|
172
|
+
rustParserContent.push(item);
|
|
173
|
+
} else {
|
|
174
|
+
regexParserContent.push([
|
|
175
|
+
item,
|
|
176
|
+
{
|
|
177
|
+
transformer,
|
|
178
|
+
extractor
|
|
179
|
+
}
|
|
180
|
+
]);
|
|
187
181
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
}
|
|
183
|
+
// Read files using our newer, faster parser when:
|
|
184
|
+
// - Oxide is enabled; AND
|
|
185
|
+
// - The file is using default transfomers and extractors
|
|
186
|
+
if (rustParserContent.length > 0) {
|
|
187
|
+
for (let candidate of (0, _oxide.parseCandidateStrings)(rustParserContent, _oxide.IO.Parallel | _oxide.Parsing.Parallel)){
|
|
188
|
+
candidates.add(candidate);
|
|
193
189
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
190
|
+
}
|
|
191
|
+
// Otherwise, read any files in node and parse with regexes
|
|
192
|
+
const BATCH_SIZE = 500;
|
|
193
|
+
for(let i = 0; i < regexParserContent.length; i += BATCH_SIZE){
|
|
194
|
+
let batch = regexParserContent.slice(i, i + BATCH_SIZE);
|
|
195
|
+
await Promise.all(batch.map(async ([{ file, content }, { transformer, extractor }])=>{
|
|
198
196
|
content = file ? await _fs.default.promises.readFile(file, 'utf8') : content;
|
|
199
197
|
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
200
198
|
}));
|
|
@@ -287,6 +285,9 @@ function expandTailwindAtRules(context) {
|
|
|
287
285
|
});
|
|
288
286
|
root.append(cloned);
|
|
289
287
|
}
|
|
288
|
+
var _root_source_end;
|
|
289
|
+
// TODO: Why is the root node having no source location for `end` possible?
|
|
290
|
+
root.source.end = (_root_source_end = root.source.end) !== null && _root_source_end !== void 0 ? _root_source_end : root.source.start;
|
|
290
291
|
// If we've got a utility layer and no utilities are generated there's likely something wrong
|
|
291
292
|
const hasUtilityVariants = variantNodes.some((node)=>{
|
|
292
293
|
var _node_raws_tailwind;
|