tailwindcss 0.0.0-insiders.c834da4 → 0.0.0-insiders.c8bf2d4
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/lib/cli/build/plugin.js +30 -25
- package/lib/cli/index.js +231 -10
- package/lib/cli.js +4 -236
- package/lib/corePluginList.js +2 -0
- package/lib/corePlugins.js +216 -4
- package/lib/css/preflight.css +2 -0
- package/lib/featureFlags.js +5 -1
- package/lib/index.js +4 -46
- package/lib/lib/content.js +16 -16
- package/lib/lib/defaultExtractor.js +7 -2
- package/lib/lib/detectNesting.js +7 -1
- package/lib/lib/expandTailwindAtRules.js +30 -5
- package/lib/lib/generateRules.js +92 -56
- package/lib/lib/offsets.js +19 -0
- package/lib/lib/setupContextUtils.js +84 -37
- 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/util/color.js +16 -2
- package/lib/util/dataTypes.js +19 -1
- package/lib/util/formatVariantSelector.js +151 -103
- package/lib/util/negateValue.js +2 -2
- package/lib/util/pluginUtils.js +5 -24
- package/lib/util/prefixSelector.js +22 -8
- package/package.json +26 -15
- package/peers/index.js +108 -173
- package/scripts/swap-engines.js +40 -0
- package/src/cli/build/plugin.js +12 -7
- package/src/cli/index.js +234 -3
- package/src/cli.js +4 -231
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +117 -4
- package/src/css/preflight.css +2 -0
- package/src/featureFlags.js +4 -0
- package/src/index.js +4 -46
- package/src/lib/content.js +12 -17
- package/src/lib/defaultExtractor.js +8 -2
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/expandTailwindAtRules.js +35 -6
- package/src/lib/generateRules.js +106 -56
- package/src/lib/offsets.js +22 -0
- package/src/lib/setupContextUtils.js +90 -41
- 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 +18 -0
- package/src/util/formatVariantSelector.js +204 -122
- package/src/util/negateValue.js +1 -1
- package/src/util/pluginUtils.js +10 -29
- package/src/util/prefixSelector.js +28 -10
- package/stubs/defaultConfig.stub.js +3 -0
- package/types/config.d.ts +11 -1
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +5 -2
- package/CHANGELOG.md +0 -2352
- 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/corePlugins.js
CHANGED
|
@@ -15,6 +15,7 @@ _export(exports, {
|
|
|
15
15
|
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
16
16
|
const _path = /*#__PURE__*/ _interopRequireWildcard(require("path"));
|
|
17
17
|
const _postcss = /*#__PURE__*/ _interopRequireDefault(require("postcss"));
|
|
18
|
+
const _sharedState = require("./lib/sharedState");
|
|
18
19
|
const _createUtilityPlugin = /*#__PURE__*/ _interopRequireDefault(require("./util/createUtilityPlugin"));
|
|
19
20
|
const _buildMediaQuery = /*#__PURE__*/ _interopRequireDefault(require("./util/buildMediaQuery"));
|
|
20
21
|
const _escapeClassName = /*#__PURE__*/ _interopRequireDefault(require("./util/escapeClassName"));
|
|
@@ -212,14 +213,14 @@ let variantPlugins = {
|
|
|
212
213
|
}
|
|
213
214
|
let variants = {
|
|
214
215
|
group: (_, { modifier })=>modifier ? [
|
|
215
|
-
`:merge(.group\\/${modifier})`,
|
|
216
|
+
`:merge(.group\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
216
217
|
" &"
|
|
217
218
|
] : [
|
|
218
219
|
`:merge(.group)`,
|
|
219
220
|
" &"
|
|
220
221
|
],
|
|
221
222
|
peer: (_, { modifier })=>modifier ? [
|
|
222
|
-
`:merge(.peer\\/${modifier})`,
|
|
223
|
+
`:merge(.peer\\/${(0, _escapeClassName.default)(modifier)})`,
|
|
223
224
|
" ~ &"
|
|
224
225
|
] : [
|
|
225
226
|
`:merge(.peer)`,
|
|
@@ -231,7 +232,25 @@ let variantPlugins = {
|
|
|
231
232
|
let result = (0, _dataTypes.normalize)(typeof value === "function" ? value(extra) : value);
|
|
232
233
|
if (!result.includes("&")) result = "&" + result;
|
|
233
234
|
let [a, b] = fn("", extra);
|
|
234
|
-
|
|
235
|
+
let start = null;
|
|
236
|
+
let end = null;
|
|
237
|
+
let quotes = 0;
|
|
238
|
+
for(let i = 0; i < result.length; ++i){
|
|
239
|
+
let c = result[i];
|
|
240
|
+
if (c === "&") {
|
|
241
|
+
start = i;
|
|
242
|
+
} else if (c === "'" || c === '"') {
|
|
243
|
+
quotes += 1;
|
|
244
|
+
} else if (start !== null && c === " " && !quotes) {
|
|
245
|
+
end = i;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (start !== null && end === null) {
|
|
249
|
+
end = result.length;
|
|
250
|
+
}
|
|
251
|
+
// Basically this but can handle quotes:
|
|
252
|
+
// result.replace(/&(\S+)?/g, (_, pseudo = '') => a + pseudo + b)
|
|
253
|
+
return result.slice(0, start) + a + result.slice(start + 1, end) + b + result.slice(end);
|
|
235
254
|
}, {
|
|
236
255
|
values: Object.fromEntries(pseudoVariants)
|
|
237
256
|
});
|
|
@@ -650,6 +669,18 @@ let corePlugins = {
|
|
|
650
669
|
]
|
|
651
670
|
],
|
|
652
671
|
[
|
|
672
|
+
[
|
|
673
|
+
"start",
|
|
674
|
+
[
|
|
675
|
+
"inset-inline-start"
|
|
676
|
+
]
|
|
677
|
+
],
|
|
678
|
+
[
|
|
679
|
+
"end",
|
|
680
|
+
[
|
|
681
|
+
"inset-inline-end"
|
|
682
|
+
]
|
|
683
|
+
],
|
|
653
684
|
[
|
|
654
685
|
"top",
|
|
655
686
|
[
|
|
@@ -802,6 +833,18 @@ let corePlugins = {
|
|
|
802
833
|
]
|
|
803
834
|
],
|
|
804
835
|
[
|
|
836
|
+
[
|
|
837
|
+
"ms",
|
|
838
|
+
[
|
|
839
|
+
"margin-inline-start"
|
|
840
|
+
]
|
|
841
|
+
],
|
|
842
|
+
[
|
|
843
|
+
"me",
|
|
844
|
+
[
|
|
845
|
+
"margin-inline-end"
|
|
846
|
+
]
|
|
847
|
+
],
|
|
805
848
|
[
|
|
806
849
|
"mt",
|
|
807
850
|
[
|
|
@@ -1010,6 +1053,16 @@ let corePlugins = {
|
|
|
1010
1053
|
}
|
|
1011
1054
|
});
|
|
1012
1055
|
},
|
|
1056
|
+
captionSide: ({ addUtilities })=>{
|
|
1057
|
+
addUtilities({
|
|
1058
|
+
".caption-top": {
|
|
1059
|
+
"caption-side": "top"
|
|
1060
|
+
},
|
|
1061
|
+
".caption-bottom": {
|
|
1062
|
+
"caption-side": "bottom"
|
|
1063
|
+
}
|
|
1064
|
+
});
|
|
1065
|
+
},
|
|
1013
1066
|
borderCollapse: ({ addUtilities })=>{
|
|
1014
1067
|
addUtilities({
|
|
1015
1068
|
".border-collapse": {
|
|
@@ -1416,6 +1469,18 @@ let corePlugins = {
|
|
|
1416
1469
|
]
|
|
1417
1470
|
],
|
|
1418
1471
|
[
|
|
1472
|
+
[
|
|
1473
|
+
"scroll-ms",
|
|
1474
|
+
[
|
|
1475
|
+
"scroll-margin-inline-start"
|
|
1476
|
+
]
|
|
1477
|
+
],
|
|
1478
|
+
[
|
|
1479
|
+
"scroll-me",
|
|
1480
|
+
[
|
|
1481
|
+
"scroll-margin-inline-end"
|
|
1482
|
+
]
|
|
1483
|
+
],
|
|
1419
1484
|
[
|
|
1420
1485
|
"scroll-mt",
|
|
1421
1486
|
[
|
|
@@ -1468,6 +1533,18 @@ let corePlugins = {
|
|
|
1468
1533
|
]
|
|
1469
1534
|
],
|
|
1470
1535
|
[
|
|
1536
|
+
[
|
|
1537
|
+
"scroll-ps",
|
|
1538
|
+
[
|
|
1539
|
+
"scroll-padding-inline-start"
|
|
1540
|
+
]
|
|
1541
|
+
],
|
|
1542
|
+
[
|
|
1543
|
+
"scroll-pe",
|
|
1544
|
+
[
|
|
1545
|
+
"scroll-padding-inline-end"
|
|
1546
|
+
]
|
|
1547
|
+
],
|
|
1471
1548
|
[
|
|
1472
1549
|
"scroll-pt",
|
|
1473
1550
|
[
|
|
@@ -1772,6 +1849,9 @@ let corePlugins = {
|
|
|
1772
1849
|
},
|
|
1773
1850
|
justifyContent: ({ addUtilities })=>{
|
|
1774
1851
|
addUtilities({
|
|
1852
|
+
".justify-normal": {
|
|
1853
|
+
"justify-content": "normal"
|
|
1854
|
+
},
|
|
1775
1855
|
".justify-start": {
|
|
1776
1856
|
"justify-content": "flex-start"
|
|
1777
1857
|
},
|
|
@@ -1789,6 +1869,9 @@ let corePlugins = {
|
|
|
1789
1869
|
},
|
|
1790
1870
|
".justify-evenly": {
|
|
1791
1871
|
"justify-content": "space-evenly"
|
|
1872
|
+
},
|
|
1873
|
+
".justify-stretch": {
|
|
1874
|
+
"justify-content": "stretch"
|
|
1792
1875
|
}
|
|
1793
1876
|
});
|
|
1794
1877
|
},
|
|
@@ -1834,6 +1917,15 @@ let corePlugins = {
|
|
|
1834
1917
|
matchUtilities({
|
|
1835
1918
|
"space-x": (value)=>{
|
|
1836
1919
|
value = value === "0" ? "0px" : value;
|
|
1920
|
+
if (_sharedState.env.OXIDE) {
|
|
1921
|
+
return {
|
|
1922
|
+
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1923
|
+
"--tw-space-x-reverse": "0",
|
|
1924
|
+
"margin-inline-end": `calc(${value} * var(--tw-space-x-reverse))`,
|
|
1925
|
+
"margin-inline-start": `calc(${value} * calc(1 - var(--tw-space-x-reverse)))`
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
}
|
|
1837
1929
|
return {
|
|
1838
1930
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1839
1931
|
"--tw-space-x-reverse": "0",
|
|
@@ -1869,6 +1961,16 @@ let corePlugins = {
|
|
|
1869
1961
|
matchUtilities({
|
|
1870
1962
|
"divide-x": (value)=>{
|
|
1871
1963
|
value = value === "0" ? "0px" : value;
|
|
1964
|
+
if (_sharedState.env.OXIDE) {
|
|
1965
|
+
return {
|
|
1966
|
+
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1967
|
+
"@defaults border-width": {},
|
|
1968
|
+
"--tw-divide-x-reverse": "0",
|
|
1969
|
+
"border-inline-end-width": `calc(${value} * var(--tw-divide-x-reverse))`,
|
|
1970
|
+
"border-inline-start-width": `calc(${value} * calc(1 - var(--tw-divide-x-reverse)))`
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1872
1974
|
return {
|
|
1873
1975
|
"& > :not([hidden]) ~ :not([hidden])": {
|
|
1874
1976
|
"@defaults border-width": {},
|
|
@@ -2134,6 +2236,19 @@ let corePlugins = {
|
|
|
2134
2236
|
}
|
|
2135
2237
|
});
|
|
2136
2238
|
},
|
|
2239
|
+
hyphens: ({ addUtilities })=>{
|
|
2240
|
+
addUtilities({
|
|
2241
|
+
".hyphens-none": {
|
|
2242
|
+
hyphens: "none"
|
|
2243
|
+
},
|
|
2244
|
+
".hyphens-manual": {
|
|
2245
|
+
hyphens: "manual"
|
|
2246
|
+
},
|
|
2247
|
+
".hyphens-auto": {
|
|
2248
|
+
hyphens: "auto"
|
|
2249
|
+
}
|
|
2250
|
+
});
|
|
2251
|
+
},
|
|
2137
2252
|
whitespace: ({ addUtilities })=>{
|
|
2138
2253
|
addUtilities({
|
|
2139
2254
|
".whitespace-normal": {
|
|
@@ -2178,6 +2293,20 @@ let corePlugins = {
|
|
|
2178
2293
|
]
|
|
2179
2294
|
],
|
|
2180
2295
|
[
|
|
2296
|
+
[
|
|
2297
|
+
"rounded-s",
|
|
2298
|
+
[
|
|
2299
|
+
"border-start-start-radius",
|
|
2300
|
+
"border-end-start-radius"
|
|
2301
|
+
]
|
|
2302
|
+
],
|
|
2303
|
+
[
|
|
2304
|
+
"rounded-e",
|
|
2305
|
+
[
|
|
2306
|
+
"border-start-end-radius",
|
|
2307
|
+
"border-end-end-radius"
|
|
2308
|
+
]
|
|
2309
|
+
],
|
|
2181
2310
|
[
|
|
2182
2311
|
"rounded-t",
|
|
2183
2312
|
[
|
|
@@ -2208,6 +2337,30 @@ let corePlugins = {
|
|
|
2208
2337
|
]
|
|
2209
2338
|
],
|
|
2210
2339
|
[
|
|
2340
|
+
[
|
|
2341
|
+
"rounded-ss",
|
|
2342
|
+
[
|
|
2343
|
+
"border-start-start-radius"
|
|
2344
|
+
]
|
|
2345
|
+
],
|
|
2346
|
+
[
|
|
2347
|
+
"rounded-se",
|
|
2348
|
+
[
|
|
2349
|
+
"border-start-end-radius"
|
|
2350
|
+
]
|
|
2351
|
+
],
|
|
2352
|
+
[
|
|
2353
|
+
"rounded-ee",
|
|
2354
|
+
[
|
|
2355
|
+
"border-end-end-radius"
|
|
2356
|
+
]
|
|
2357
|
+
],
|
|
2358
|
+
[
|
|
2359
|
+
"rounded-es",
|
|
2360
|
+
[
|
|
2361
|
+
"border-end-start-radius"
|
|
2362
|
+
]
|
|
2363
|
+
],
|
|
2211
2364
|
[
|
|
2212
2365
|
"rounded-tl",
|
|
2213
2366
|
[
|
|
@@ -2270,6 +2423,26 @@ let corePlugins = {
|
|
|
2270
2423
|
]
|
|
2271
2424
|
],
|
|
2272
2425
|
[
|
|
2426
|
+
[
|
|
2427
|
+
"border-s",
|
|
2428
|
+
[
|
|
2429
|
+
[
|
|
2430
|
+
"@defaults border-width",
|
|
2431
|
+
{}
|
|
2432
|
+
],
|
|
2433
|
+
"border-inline-start-width"
|
|
2434
|
+
]
|
|
2435
|
+
],
|
|
2436
|
+
[
|
|
2437
|
+
"border-e",
|
|
2438
|
+
[
|
|
2439
|
+
[
|
|
2440
|
+
"@defaults border-width",
|
|
2441
|
+
{}
|
|
2442
|
+
],
|
|
2443
|
+
"border-inline-end-width"
|
|
2444
|
+
]
|
|
2445
|
+
],
|
|
2273
2446
|
[
|
|
2274
2447
|
"border-t",
|
|
2275
2448
|
[
|
|
@@ -2401,6 +2574,30 @@ let corePlugins = {
|
|
|
2401
2574
|
]
|
|
2402
2575
|
});
|
|
2403
2576
|
matchUtilities({
|
|
2577
|
+
"border-s": (value)=>{
|
|
2578
|
+
if (!corePlugins("borderOpacity")) {
|
|
2579
|
+
return {
|
|
2580
|
+
"border-inline-start-color": (0, _toColorValue.default)(value)
|
|
2581
|
+
};
|
|
2582
|
+
}
|
|
2583
|
+
return (0, _withAlphaVariable.default)({
|
|
2584
|
+
color: value,
|
|
2585
|
+
property: "border-inline-start-color",
|
|
2586
|
+
variable: "--tw-border-opacity"
|
|
2587
|
+
});
|
|
2588
|
+
},
|
|
2589
|
+
"border-e": (value)=>{
|
|
2590
|
+
if (!corePlugins("borderOpacity")) {
|
|
2591
|
+
return {
|
|
2592
|
+
"border-inline-end-color": (0, _toColorValue.default)(value)
|
|
2593
|
+
};
|
|
2594
|
+
}
|
|
2595
|
+
return (0, _withAlphaVariable.default)({
|
|
2596
|
+
color: value,
|
|
2597
|
+
property: "border-inline-end-color",
|
|
2598
|
+
variable: "--tw-border-opacity"
|
|
2599
|
+
});
|
|
2600
|
+
},
|
|
2404
2601
|
"border-t": (value)=>{
|
|
2405
2602
|
if (!corePlugins("borderOpacity")) {
|
|
2406
2603
|
return {
|
|
@@ -2756,6 +2953,18 @@ let corePlugins = {
|
|
|
2756
2953
|
]
|
|
2757
2954
|
],
|
|
2758
2955
|
[
|
|
2956
|
+
[
|
|
2957
|
+
"ps",
|
|
2958
|
+
[
|
|
2959
|
+
"padding-inline-start"
|
|
2960
|
+
]
|
|
2961
|
+
],
|
|
2962
|
+
[
|
|
2963
|
+
"pe",
|
|
2964
|
+
[
|
|
2965
|
+
"padding-inline-end"
|
|
2966
|
+
]
|
|
2967
|
+
],
|
|
2759
2968
|
[
|
|
2760
2969
|
"pt",
|
|
2761
2970
|
[
|
|
@@ -2853,11 +3062,14 @@ let corePlugins = {
|
|
|
2853
3062
|
let [families, options = {}] = Array.isArray(value) && (0, _isPlainObject.default)(value[1]) ? value : [
|
|
2854
3063
|
value
|
|
2855
3064
|
];
|
|
2856
|
-
let { fontFeatureSettings } = options;
|
|
3065
|
+
let { fontFeatureSettings , fontVariationSettings } = options;
|
|
2857
3066
|
return {
|
|
2858
3067
|
"font-family": Array.isArray(families) ? families.join(", ") : families,
|
|
2859
3068
|
...fontFeatureSettings === undefined ? {} : {
|
|
2860
3069
|
"font-feature-settings": fontFeatureSettings
|
|
3070
|
+
},
|
|
3071
|
+
...fontVariationSettings === undefined ? {} : {
|
|
3072
|
+
"font-variation-settings": fontVariationSettings
|
|
2861
3073
|
}
|
|
2862
3074
|
};
|
|
2863
3075
|
}
|
package/lib/css/preflight.css
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
3. Use a more readable tab size.
|
|
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
|
+
6. Use the user's configured `sans` font-variation-settings by default.
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
html {
|
|
@@ -32,6 +33,7 @@ html {
|
|
|
32
33
|
tab-size: 4; /* 3 */
|
|
33
34
|
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
34
35
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
36
|
+
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/*
|
package/lib/featureFlags.js
CHANGED
|
@@ -15,6 +15,7 @@ _export(exports, {
|
|
|
15
15
|
});
|
|
16
16
|
const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
|
|
17
17
|
const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
|
|
18
|
+
const _sharedState = require("./lib/sharedState");
|
|
18
19
|
function _interopRequireDefault(obj) {
|
|
19
20
|
return obj && obj.__esModule ? obj : {
|
|
20
21
|
default: obj
|
|
@@ -22,7 +23,10 @@ function _interopRequireDefault(obj) {
|
|
|
22
23
|
}
|
|
23
24
|
let defaults = {
|
|
24
25
|
optimizeUniversalDefaults: false,
|
|
25
|
-
generalizedModifiers: true
|
|
26
|
+
generalizedModifiers: true,
|
|
27
|
+
get disableColorOpacityUtilitiesByDefault () {
|
|
28
|
+
return _sharedState.env.OXIDE;
|
|
29
|
+
}
|
|
26
30
|
};
|
|
27
31
|
let featureFlags = {
|
|
28
32
|
future: [
|
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 _findAtConfigPath1;
|
|
25
|
-
// Use the path for the `@config` directive if it exists, otherwise use the
|
|
26
|
-
// path for the file being processed
|
|
27
|
-
configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : 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;
|
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
|
}
|
|
@@ -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
|
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.",
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "default", {
|
|
|
6
6
|
enumerable: true,
|
|
7
7
|
get: ()=>expandTailwindAtRules
|
|
8
8
|
});
|
|
9
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
9
10
|
const _quickLru = /*#__PURE__*/ _interopRequireDefault(require("quick-lru"));
|
|
10
11
|
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
|
11
12
|
const _generateRules = require("./generateRules");
|
|
@@ -142,24 +143,48 @@ function expandTailwindAtRules(context) {
|
|
|
142
143
|
if (Object.values(layerNodes).every((n)=>n === null)) {
|
|
143
144
|
return root;
|
|
144
145
|
}
|
|
146
|
+
var _context_candidates;
|
|
145
147
|
// ---
|
|
146
148
|
// Find potential rules in changed files
|
|
147
149
|
let candidates = new Set([
|
|
150
|
+
...(_context_candidates = context.candidates) !== null && _context_candidates !== void 0 ? _context_candidates : [],
|
|
148
151
|
_sharedState.NOT_ON_DEMAND
|
|
149
152
|
]);
|
|
150
153
|
let seen = new Set();
|
|
151
154
|
env.DEBUG && console.time("Reading changed files");
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
let
|
|
155
|
-
|
|
155
|
+
if (env.OXIDE) {
|
|
156
|
+
// TODO: Pass through or implement `extractor`
|
|
157
|
+
for (let candidate of require("@tailwindcss/oxide").parseCandidateStringsFromFiles(context.changedContent)){
|
|
158
|
+
candidates.add(candidate);
|
|
159
|
+
}
|
|
160
|
+
// for (let { file, content, extension } of context.changedContent) {
|
|
161
|
+
// let transformer = getTransformer(context.tailwindConfig, extension)
|
|
162
|
+
// let extractor = getExtractor(context, extension)
|
|
163
|
+
// getClassCandidatesOxide(file, transformer(content), extractor, candidates, seen)
|
|
164
|
+
// }
|
|
165
|
+
} else {
|
|
166
|
+
for (let { file , content , extension } of context.changedContent){
|
|
167
|
+
let transformer = getTransformer(context.tailwindConfig, extension);
|
|
168
|
+
let extractor = getExtractor(context, extension);
|
|
169
|
+
content = file ? _fs.default.readFileSync(file, "utf8") : content;
|
|
170
|
+
getClassCandidates(transformer(content), extractor, candidates, seen);
|
|
171
|
+
}
|
|
156
172
|
}
|
|
157
173
|
env.DEBUG && console.timeEnd("Reading changed files");
|
|
158
174
|
// ---
|
|
159
175
|
// Generate the actual CSS
|
|
160
176
|
let classCacheCount = context.classCache.size;
|
|
161
177
|
env.DEBUG && console.time("Generate rules");
|
|
162
|
-
|
|
178
|
+
env.DEBUG && console.time("Sorting candidates");
|
|
179
|
+
let sortedCandidates = env.OXIDE ? candidates : new Set([
|
|
180
|
+
...candidates
|
|
181
|
+
].sort((a, z)=>{
|
|
182
|
+
if (a === z) return 0;
|
|
183
|
+
if (a < z) return -1;
|
|
184
|
+
return 1;
|
|
185
|
+
}));
|
|
186
|
+
env.DEBUG && console.timeEnd("Sorting candidates");
|
|
187
|
+
(0, _generateRules.generateRules)(sortedCandidates, context);
|
|
163
188
|
env.DEBUG && console.timeEnd("Generate rules");
|
|
164
189
|
// We only ever add to the classCache, so if it didn't grow, there is nothing new.
|
|
165
190
|
env.DEBUG && console.time("Build stylesheet");
|