tailwindcss 0.0.0-oxide-insiders.5b078d9 → 0.0.0-oxide-insiders.019fddb
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/init/index.js +2 -2
- package/lib/corePlugins.js +3 -3
- package/lib/lib/collapseDuplicateDeclarations.js +7 -7
- package/lib/lib/evaluateTailwindFunctions.js +6 -6
- package/lib/lib/expandApplyAtRules.js +25 -25
- package/lib/lib/expandTailwindAtRules.js +2 -2
- package/lib/lib/generateRules.js +13 -13
- package/lib/lib/resolveDefaultsAtRules.js +12 -12
- package/lib/lib/setupContextUtils.js +22 -22
- package/lib/lib/setupTrackingContext.js +8 -8
- package/lib/plugin.js +3 -3
- package/lib/util/defaults.js +3 -3
- package/lib/util/normalizeConfig.js +2 -2
- package/package.json +5 -5
- package/peers/index.js +2654 -438
package/lib/cli/init/index.js
CHANGED
|
@@ -32,8 +32,8 @@ function init(args, configs) {
|
|
|
32
32
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
33
33
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
34
34
|
} else {
|
|
35
|
-
let
|
|
36
|
-
_fs.default.writeFileSync(postcssConfigLocation,
|
|
35
|
+
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, "../../../stubs/defaultPostCssConfig.stub.js"), "utf8");
|
|
36
|
+
_fs.default.writeFileSync(postcssConfigLocation, stubFile, "utf8");
|
|
37
37
|
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
|
|
38
38
|
}
|
|
39
39
|
}
|
package/lib/corePlugins.js
CHANGED
|
@@ -372,11 +372,11 @@ let variantPlugins = {
|
|
|
372
372
|
});
|
|
373
373
|
// screens and min-* are sorted together when they can be
|
|
374
374
|
let id = "min-screens";
|
|
375
|
-
for (let
|
|
376
|
-
addVariant(
|
|
375
|
+
for (let screen of screens){
|
|
376
|
+
addVariant(screen.name, `@media ${(0, _buildMediaQuery.default)(screen)}`, {
|
|
377
377
|
id,
|
|
378
378
|
sort: areSimpleScreens && screensUseConsistentUnits ? minSort : undefined,
|
|
379
|
-
value:
|
|
379
|
+
value: screen
|
|
380
380
|
});
|
|
381
381
|
}
|
|
382
382
|
matchVariant("min", buildScreenVariant("min"), {
|
|
@@ -51,21 +51,21 @@ function collapseDuplicateDeclarations() {
|
|
|
51
51
|
// with the same unit but the last one in the list.
|
|
52
52
|
for (let declarations of byProperty.values()){
|
|
53
53
|
let byUnit = new Map();
|
|
54
|
-
for (let
|
|
55
|
-
let unit = resolveUnit(
|
|
54
|
+
for (let decl of declarations){
|
|
55
|
+
let unit = resolveUnit(decl.value);
|
|
56
56
|
if (unit === null) {
|
|
57
57
|
continue;
|
|
58
58
|
}
|
|
59
59
|
if (!byUnit.has(unit)) {
|
|
60
60
|
byUnit.set(unit, new Set());
|
|
61
61
|
}
|
|
62
|
-
byUnit.get(unit).add(
|
|
62
|
+
byUnit.get(unit).add(decl);
|
|
63
63
|
}
|
|
64
|
-
for (let
|
|
64
|
+
for (let declarations of byUnit.values()){
|
|
65
65
|
// Get all but the last one
|
|
66
|
-
let removableDeclarations = Array.from(
|
|
67
|
-
for (let
|
|
68
|
-
|
|
66
|
+
let removableDeclarations = Array.from(declarations).slice(0, -1);
|
|
67
|
+
for (let decl of removableDeclarations){
|
|
68
|
+
decl.remove();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
|
@@ -86,22 +86,22 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
|
|
89
|
-
let
|
|
89
|
+
let error = `'${pathString}' was found but does not resolve to a string.`;
|
|
90
90
|
if (isObject(value)) {
|
|
91
|
-
let
|
|
91
|
+
let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
|
|
92
92
|
...pathSegments,
|
|
93
93
|
key
|
|
94
94
|
]).isValid);
|
|
95
|
-
if (
|
|
96
|
-
|
|
95
|
+
if (validKeys.length) {
|
|
96
|
+
error += ` Did you mean something like '${pathToString([
|
|
97
97
|
...pathSegments,
|
|
98
|
-
|
|
98
|
+
validKeys[0]
|
|
99
99
|
])}'?`;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
return {
|
|
103
103
|
isValid: false,
|
|
104
|
-
error
|
|
104
|
+
error
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
107
|
const [themeSection] = pathSegments;
|
|
@@ -309,11 +309,11 @@ function processApply(root, context, localCache) {
|
|
|
309
309
|
// Sort tag names before class names (but only sort each group (separated by a combinator)
|
|
310
310
|
// separately and not in total)
|
|
311
311
|
// This happens when replacing `.bar` in `.foo.bar` with a tag like `section`
|
|
312
|
-
for (let
|
|
312
|
+
for (let sel of replaced){
|
|
313
313
|
let groups = [
|
|
314
314
|
[]
|
|
315
315
|
];
|
|
316
|
-
for (let node of
|
|
316
|
+
for (let node of sel.nodes){
|
|
317
317
|
if (node.type === "combinator") {
|
|
318
318
|
groups.push(node);
|
|
319
319
|
groups.push([]);
|
|
@@ -322,7 +322,7 @@ function processApply(root, context, localCache) {
|
|
|
322
322
|
last.push(node);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
-
|
|
325
|
+
sel.nodes = [];
|
|
326
326
|
for (let group of groups){
|
|
327
327
|
if (Array.isArray(group)) {
|
|
328
328
|
group.sort((a, b)=>{
|
|
@@ -338,7 +338,7 @@ function processApply(root, context, localCache) {
|
|
|
338
338
|
return 0;
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
|
|
341
|
+
sel.nodes = sel.nodes.concat(group);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
sel.replaceWith(...replaced);
|
|
@@ -356,15 +356,15 @@ function processApply(root, context, localCache) {
|
|
|
356
356
|
candidates,
|
|
357
357
|
apply.source
|
|
358
358
|
]);
|
|
359
|
-
let [
|
|
359
|
+
let [applyCandidates, important] = extractApplyCandidates(apply.params);
|
|
360
360
|
if (apply.parent.type === "atrule") {
|
|
361
361
|
if (apply.parent.name === "screen") {
|
|
362
362
|
let screenType = apply.parent.params;
|
|
363
|
-
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${
|
|
363
|
+
throw apply.error(`@apply is not supported within nested at-rules like @screen. We suggest you write this as @apply ${applyCandidates.map((c)=>`${screenType}:${c}`).join(" ")} instead.`);
|
|
364
364
|
}
|
|
365
365
|
throw apply.error(`@apply is not supported within nested at-rules like @${apply.parent.name}. You can fix this by un-nesting @${apply.parent.name}.`);
|
|
366
366
|
}
|
|
367
|
-
for (let applyCandidate of
|
|
367
|
+
for (let applyCandidate of applyCandidates){
|
|
368
368
|
if ([
|
|
369
369
|
prefix(context, "group"),
|
|
370
370
|
prefix(context, "peer")
|
|
@@ -383,16 +383,16 @@ function processApply(root, context, localCache) {
|
|
|
383
383
|
]);
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
for (let [parent, [
|
|
386
|
+
for (let [parent, [candidates, atApplySource]] of perParentApplies){
|
|
387
387
|
let siblings = [];
|
|
388
|
-
for (let [
|
|
388
|
+
for (let [applyCandidate, important, rules] of candidates){
|
|
389
389
|
let potentialApplyCandidates = [
|
|
390
|
-
|
|
390
|
+
applyCandidate,
|
|
391
391
|
...extractBaseCandidates([
|
|
392
|
-
|
|
392
|
+
applyCandidate
|
|
393
393
|
], context.tailwindConfig.separator)
|
|
394
394
|
];
|
|
395
|
-
for (let [meta, node] of
|
|
395
|
+
for (let [meta, node] of rules){
|
|
396
396
|
let parentClasses = extractClasses(parent);
|
|
397
397
|
let nodeClasses = extractClasses(node);
|
|
398
398
|
// When we encounter a rule like `.dark .a, .b { … }` we only want to be left with `[.dark, .a]` if the base applyCandidate is `.a` or with `[.b]` if the base applyCandidate is `.b`
|
|
@@ -423,20 +423,20 @@ function processApply(root, context, localCache) {
|
|
|
423
423
|
nodeClasses = nodeClasses.concat(extractBaseCandidates(nodeClasses, context.tailwindConfig.separator));
|
|
424
424
|
let intersects = parentClasses.some((selector)=>nodeClasses.includes(selector));
|
|
425
425
|
if (intersects) {
|
|
426
|
-
throw node.error(`You cannot \`@apply\` the \`${
|
|
426
|
+
throw node.error(`You cannot \`@apply\` the \`${applyCandidate}\` utility here because it creates a circular dependency.`);
|
|
427
427
|
}
|
|
428
|
-
let
|
|
428
|
+
let root = _postcss.default.root({
|
|
429
429
|
nodes: [
|
|
430
430
|
node.clone()
|
|
431
431
|
]
|
|
432
432
|
});
|
|
433
433
|
// Make sure every node in the entire tree points back at the @apply rule that generated it
|
|
434
|
-
|
|
434
|
+
root.walk((node)=>{
|
|
435
435
|
node.source = atApplySource;
|
|
436
436
|
});
|
|
437
437
|
let canRewriteSelector = node.type !== "atrule" || node.type === "atrule" && node.name !== "keyframes";
|
|
438
438
|
if (canRewriteSelector) {
|
|
439
|
-
|
|
439
|
+
root.walkRules((rule)=>{
|
|
440
440
|
// Let's imagine you have the following structure:
|
|
441
441
|
//
|
|
442
442
|
// .foo {
|
|
@@ -468,7 +468,7 @@ function processApply(root, context, localCache) {
|
|
|
468
468
|
// would have replaced this with something that didn't exist and
|
|
469
469
|
// therefore it removed the selector altogether. In this specific
|
|
470
470
|
// case it would result in `{}` instead of `.something-unrelated {}`
|
|
471
|
-
if (!extractClasses(rule).some((candidate)=>candidate ===
|
|
471
|
+
if (!extractClasses(rule).some((candidate)=>candidate === applyCandidate)) {
|
|
472
472
|
rule.remove();
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
@@ -478,25 +478,25 @@ function processApply(root, context, localCache) {
|
|
|
478
478
|
// We do *not* want to do this for user CSS that happens to be structured the same
|
|
479
479
|
let isGenerated = parent.raws.tailwind !== undefined;
|
|
480
480
|
let parentSelector = isGenerated && importantSelector && parent.selector.indexOf(importantSelector) === 0 ? parent.selector.slice(importantSelector.length) : parent.selector;
|
|
481
|
-
rule.selector = replaceSelector(parentSelector, rule.selector,
|
|
481
|
+
rule.selector = replaceSelector(parentSelector, rule.selector, applyCandidate);
|
|
482
482
|
// And then re-add it if it was removed
|
|
483
483
|
if (importantSelector && parentSelector !== parent.selector) {
|
|
484
484
|
rule.selector = `${importantSelector} ${rule.selector}`;
|
|
485
485
|
}
|
|
486
486
|
rule.walkDecls((d)=>{
|
|
487
|
-
d.important = meta.important ||
|
|
487
|
+
d.important = meta.important || important;
|
|
488
488
|
});
|
|
489
489
|
});
|
|
490
490
|
}
|
|
491
491
|
// It could be that the node we were inserted was removed because the class didn't match
|
|
492
492
|
// If that was the *only* rule in the parent, then we have nothing add so we skip it
|
|
493
|
-
if (!
|
|
493
|
+
if (!root.nodes[0]) {
|
|
494
494
|
continue;
|
|
495
495
|
}
|
|
496
496
|
// Insert it
|
|
497
497
|
siblings.push([
|
|
498
498
|
meta.sort,
|
|
499
|
-
|
|
499
|
+
root.nodes[0]
|
|
500
500
|
]);
|
|
501
501
|
}
|
|
502
502
|
}
|
|
@@ -505,13 +505,13 @@ function processApply(root, context, localCache) {
|
|
|
505
505
|
// `parent` refers to the node at `.abc` in: .abc { @apply mt-2 }
|
|
506
506
|
parent.after(nodes);
|
|
507
507
|
}
|
|
508
|
-
for (let
|
|
508
|
+
for (let apply of applies){
|
|
509
509
|
// If there are left-over declarations, just remove the @apply
|
|
510
|
-
if (
|
|
511
|
-
|
|
510
|
+
if (apply.parent.nodes.length > 1) {
|
|
511
|
+
apply.remove();
|
|
512
512
|
} else {
|
|
513
513
|
// The node is empty, drop the full node
|
|
514
|
-
|
|
514
|
+
apply.parent.remove();
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
517
|
// Do it again, in case we have other `@apply` rules
|
|
@@ -97,8 +97,8 @@ function getClassCandidates(content, extractor, candidates, seen) {
|
|
|
97
97
|
} else {
|
|
98
98
|
let extractorMatches = extractor(line).filter((s)=>s !== "!*");
|
|
99
99
|
let lineMatchesSet = new Set(extractorMatches);
|
|
100
|
-
for (let
|
|
101
|
-
candidates.add(
|
|
100
|
+
for (let match of lineMatchesSet){
|
|
101
|
+
candidates.add(match);
|
|
102
102
|
}
|
|
103
103
|
extractorCache.get(extractor).set(line, lineMatchesSet);
|
|
104
104
|
}
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -216,9 +216,9 @@ function applyVariant(variant, matches, context) {
|
|
|
216
216
|
// But we don't want:
|
|
217
217
|
// @-[200px] (`-` is incorrect)
|
|
218
218
|
// group[:hover] (`-` is missing)
|
|
219
|
-
let
|
|
220
|
-
if (
|
|
221
|
-
let [, char, seperator, value] =
|
|
219
|
+
let match = /(.)(-?)\[(.*)\]/g.exec(variant);
|
|
220
|
+
if (match) {
|
|
221
|
+
let [, char, seperator, value] = match;
|
|
222
222
|
// @-[200px] case
|
|
223
223
|
if (char === "@" && seperator === "-") return [];
|
|
224
224
|
// group[:hover] case
|
|
@@ -310,14 +310,14 @@ function applyVariant(variant, matches, context) {
|
|
|
310
310
|
// It can happen that a list of format strings is returned from within the function. In that
|
|
311
311
|
// case, we have to process them as well. We can use the existing `variantSort`.
|
|
312
312
|
if (Array.isArray(ruleWithVariant)) {
|
|
313
|
-
for (let [idx,
|
|
313
|
+
for (let [idx, variantFunction] of ruleWithVariant.entries()){
|
|
314
314
|
// This is a little bit scary since we are pushing to an array of items that we are
|
|
315
315
|
// currently looping over. However, you can also think of it like a processing queue
|
|
316
316
|
// where you keep handling jobs until everything is done and each job can queue more
|
|
317
317
|
// jobs if needed.
|
|
318
318
|
variantFunctionTuples.push([
|
|
319
319
|
context.offsets.applyParallelOffset(variantSort, idx),
|
|
320
|
-
|
|
320
|
+
variantFunction,
|
|
321
321
|
// If the clone has been modified we have to pass that back
|
|
322
322
|
// though so each rule can use the modified container
|
|
323
323
|
clone.clone()
|
|
@@ -607,18 +607,18 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
} else if (modifier === "DEFAULT" || modifier === "-DEFAULT") {
|
|
610
|
-
let
|
|
611
|
-
let [
|
|
612
|
-
for (let
|
|
610
|
+
let ruleSet = plugin;
|
|
611
|
+
let [rules, options] = parseRules(ruleSet, context.postCssNodeCache);
|
|
612
|
+
for (let rule of rules){
|
|
613
613
|
matchesPerPlugin.push([
|
|
614
614
|
{
|
|
615
615
|
...sort,
|
|
616
616
|
options: {
|
|
617
617
|
...sort.options,
|
|
618
|
-
...
|
|
618
|
+
...options
|
|
619
619
|
}
|
|
620
620
|
},
|
|
621
|
-
|
|
621
|
+
rule
|
|
622
622
|
]);
|
|
623
623
|
}
|
|
624
624
|
}
|
|
@@ -694,11 +694,11 @@ function* resolveMatches(candidate, context, original = candidate) {
|
|
|
694
694
|
}
|
|
695
695
|
let messages = [];
|
|
696
696
|
for (let [idx, group] of typesPerPlugin.entries()){
|
|
697
|
-
for (let
|
|
698
|
-
let
|
|
697
|
+
for (let type of group){
|
|
698
|
+
let rules = matches[idx].map(([, rule])=>rule).flat().map((rule)=>rule.toString().split("\n").slice(1, -1) // Remove selector and closing '}'
|
|
699
699
|
.map((line)=>line.trim()).map((x)=>` ${x}`) // Re-indent
|
|
700
700
|
.join("\n")).join("\n\n");
|
|
701
|
-
messages.push(` Use \`${candidate.replace("[", `[${
|
|
701
|
+
messages.push(` Use \`${candidate.replace("[", `[${type}:`)}\` for \`${rules.trim()}\``);
|
|
702
702
|
break;
|
|
703
703
|
}
|
|
704
704
|
}
|
|
@@ -119,12 +119,12 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
119
119
|
universal.remove();
|
|
120
120
|
continue;
|
|
121
121
|
}
|
|
122
|
-
for (let [,
|
|
122
|
+
for (let [, selectors] of selectorGroups){
|
|
123
123
|
let universalRule = _postcss.default.rule({
|
|
124
124
|
source: universal.source
|
|
125
125
|
});
|
|
126
126
|
universalRule.selectors = [
|
|
127
|
-
...
|
|
127
|
+
...selectors
|
|
128
128
|
];
|
|
129
129
|
universalRule.append(universal.nodes.map((node)=>node.clone()));
|
|
130
130
|
universal.before(universalRule);
|
|
@@ -133,29 +133,29 @@ function resolveDefaultsAtRules({ tailwindConfig }) {
|
|
|
133
133
|
universal.remove();
|
|
134
134
|
}
|
|
135
135
|
} else if (universals.size) {
|
|
136
|
-
let
|
|
136
|
+
let universalRule = _postcss.default.rule({
|
|
137
137
|
selectors: [
|
|
138
138
|
"*",
|
|
139
139
|
"::before",
|
|
140
140
|
"::after"
|
|
141
141
|
]
|
|
142
142
|
});
|
|
143
|
-
for (let
|
|
144
|
-
|
|
145
|
-
if (!
|
|
146
|
-
|
|
143
|
+
for (let universal of universals){
|
|
144
|
+
universalRule.append(universal.nodes);
|
|
145
|
+
if (!universalRule.parent) {
|
|
146
|
+
universal.before(universalRule);
|
|
147
147
|
}
|
|
148
|
-
if (!
|
|
149
|
-
|
|
148
|
+
if (!universalRule.source) {
|
|
149
|
+
universalRule.source = universal.source;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
universal.remove();
|
|
152
152
|
}
|
|
153
|
-
let backdropRule =
|
|
153
|
+
let backdropRule = universalRule.clone({
|
|
154
154
|
selectors: [
|
|
155
155
|
"::backdrop"
|
|
156
156
|
]
|
|
157
157
|
});
|
|
158
|
-
|
|
158
|
+
universalRule.after(backdropRule);
|
|
159
159
|
}
|
|
160
160
|
};
|
|
161
161
|
}
|
|
@@ -689,9 +689,9 @@ function collectLayerPlugins(root) {
|
|
|
689
689
|
}
|
|
690
690
|
layerRule.remove();
|
|
691
691
|
} else if (layerRule.params === "components") {
|
|
692
|
-
for (let
|
|
692
|
+
for (let node of layerRule.nodes){
|
|
693
693
|
layerPlugins.push(function({ addComponents }) {
|
|
694
|
-
addComponents(
|
|
694
|
+
addComponents(node, {
|
|
695
695
|
respectPrefix: false,
|
|
696
696
|
preserveSource: true
|
|
697
697
|
});
|
|
@@ -699,9 +699,9 @@ function collectLayerPlugins(root) {
|
|
|
699
699
|
}
|
|
700
700
|
layerRule.remove();
|
|
701
701
|
} else if (layerRule.params === "utilities") {
|
|
702
|
-
for (let
|
|
702
|
+
for (let node of layerRule.nodes){
|
|
703
703
|
layerPlugins.push(function({ addUtilities }) {
|
|
704
|
-
addUtilities(
|
|
704
|
+
addUtilities(node, {
|
|
705
705
|
respectPrefix: false,
|
|
706
706
|
preserveSource: true
|
|
707
707
|
});
|
|
@@ -850,7 +850,7 @@ function registerPlugins(plugins, context) {
|
|
|
850
850
|
})() : [
|
|
851
851
|
util
|
|
852
852
|
];
|
|
853
|
-
for (let
|
|
853
|
+
for (let util of utils){
|
|
854
854
|
for (let { pattern , variants =[] } of checks){
|
|
855
855
|
// RegExp with the /g flag are stateful, so let's reset the last
|
|
856
856
|
// index pointer to reset the state.
|
|
@@ -858,15 +858,15 @@ function registerPlugins(plugins, context) {
|
|
|
858
858
|
if (!patternMatchingCount.has(pattern)) {
|
|
859
859
|
patternMatchingCount.set(pattern, 0);
|
|
860
860
|
}
|
|
861
|
-
if (!pattern.test(
|
|
861
|
+
if (!pattern.test(util)) continue;
|
|
862
862
|
patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
|
|
863
863
|
context.changedContent.push({
|
|
864
|
-
content:
|
|
864
|
+
content: util,
|
|
865
865
|
extension: "html"
|
|
866
866
|
});
|
|
867
867
|
for (let variant of variants){
|
|
868
868
|
context.changedContent.push({
|
|
869
|
-
content: variant + context.tailwindConfig.separator +
|
|
869
|
+
content: variant + context.tailwindConfig.separator + util,
|
|
870
870
|
extension: "html"
|
|
871
871
|
});
|
|
872
872
|
}
|
|
@@ -1183,9 +1183,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1183
1183
|
contextSourcesMap.get(oldContext).delete(sourcePath);
|
|
1184
1184
|
if (contextSourcesMap.get(oldContext).size === 0) {
|
|
1185
1185
|
contextSourcesMap.delete(oldContext);
|
|
1186
|
-
for (let [
|
|
1187
|
-
if (
|
|
1188
|
-
configContextMap.delete(
|
|
1186
|
+
for (let [tailwindConfigHash, context] of configContextMap){
|
|
1187
|
+
if (context === oldContext) {
|
|
1188
|
+
configContextMap.delete(tailwindConfigHash);
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
for (let disposable of oldContext.disposables.splice(0)){
|
|
@@ -1195,24 +1195,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
_sharedState.env.DEBUG && console.log("Setting up new context...");
|
|
1198
|
-
let
|
|
1199
|
-
Object.assign(
|
|
1198
|
+
let context = createContext(tailwindConfig, [], root);
|
|
1199
|
+
Object.assign(context, {
|
|
1200
1200
|
userConfigPath
|
|
1201
1201
|
});
|
|
1202
|
-
let [,
|
|
1202
|
+
let [, mtimesToCommit] = trackModified([
|
|
1203
1203
|
...contextDependencies
|
|
1204
|
-
], getFileModifiedMap(
|
|
1204
|
+
], getFileModifiedMap(context));
|
|
1205
1205
|
// ---
|
|
1206
1206
|
// Update all context tracking state
|
|
1207
|
-
configContextMap.set(tailwindConfigHash,
|
|
1208
|
-
contextMap.set(sourcePath,
|
|
1209
|
-
if (!contextSourcesMap.has(
|
|
1210
|
-
contextSourcesMap.set(
|
|
1207
|
+
configContextMap.set(tailwindConfigHash, context);
|
|
1208
|
+
contextMap.set(sourcePath, context);
|
|
1209
|
+
if (!contextSourcesMap.has(context)) {
|
|
1210
|
+
contextSourcesMap.set(context, new Set());
|
|
1211
1211
|
}
|
|
1212
|
-
contextSourcesMap.get(
|
|
1212
|
+
contextSourcesMap.get(context).add(sourcePath);
|
|
1213
1213
|
return [
|
|
1214
|
-
|
|
1214
|
+
context,
|
|
1215
1215
|
true,
|
|
1216
|
-
|
|
1216
|
+
mtimesToCommit
|
|
1217
1217
|
];
|
|
1218
1218
|
}
|
|
@@ -62,8 +62,8 @@ function getTailwindConfig(configOrPath) {
|
|
|
62
62
|
];
|
|
63
63
|
}
|
|
64
64
|
// It has changed (based on timestamps), or first run
|
|
65
|
-
for (let
|
|
66
|
-
delete require.cache[
|
|
65
|
+
for (let file of newDeps){
|
|
66
|
+
delete require.cache[file];
|
|
67
67
|
}
|
|
68
68
|
let newConfig = (0, _resolveConfig.default)(require(userConfigPath));
|
|
69
69
|
newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
|
|
@@ -82,12 +82,12 @@ function getTailwindConfig(configOrPath) {
|
|
|
82
82
|
];
|
|
83
83
|
}
|
|
84
84
|
// It's a plain object, not a path
|
|
85
|
-
let
|
|
86
|
-
|
|
85
|
+
let newConfig = (0, _resolveConfig.default)(configOrPath.config === undefined ? configOrPath : configOrPath.config);
|
|
86
|
+
newConfig = (0, _validateConfigJs.validateConfig)(newConfig);
|
|
87
87
|
return [
|
|
88
|
-
|
|
88
|
+
newConfig,
|
|
89
89
|
null,
|
|
90
|
-
(0, _hashConfig.default)(
|
|
90
|
+
(0, _hashConfig.default)(newConfig),
|
|
91
91
|
[]
|
|
92
92
|
];
|
|
93
93
|
}
|
|
@@ -154,8 +154,8 @@ function setupTrackingContext(configOrPath) {
|
|
|
154
154
|
// "commit" the new modified time for all context deps
|
|
155
155
|
// We do this here because we want content tracking to
|
|
156
156
|
// read the "old" mtime even when it's a context dependency.
|
|
157
|
-
for (let [
|
|
158
|
-
fileModifiedMap.set(
|
|
157
|
+
for (let [path, mtime] of mTimesToCommit.entries()){
|
|
158
|
+
fileModifiedMap.set(path, mtime);
|
|
159
159
|
}
|
|
160
160
|
return context;
|
|
161
161
|
};
|
package/lib/plugin.js
CHANGED
|
@@ -28,9 +28,9 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
28
28
|
let context = (0, _setupTrackingContext.default)(configOrPath);
|
|
29
29
|
if (root.type === "document") {
|
|
30
30
|
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
31
|
-
for (const
|
|
32
|
-
if (
|
|
33
|
-
(0, _processTailwindFeatures.default)(context)(
|
|
31
|
+
for (const root of roots){
|
|
32
|
+
if (root.type === "root") {
|
|
33
|
+
(0, _processTailwindFeatures.default)(context)(root, result);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return;
|
package/lib/util/defaults.js
CHANGED
|
@@ -14,10 +14,10 @@ function defaults(target, ...sources) {
|
|
|
14
14
|
target[k] = source[k];
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
for (let
|
|
17
|
+
for (let k of Object.getOwnPropertySymbols(source)){
|
|
18
18
|
var _target_hasOwnProperty1;
|
|
19
|
-
if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty1 = target.hasOwnProperty) === null || _target_hasOwnProperty1 === void 0 ? void 0 : _target_hasOwnProperty1.call(target,
|
|
20
|
-
target[
|
|
19
|
+
if (!(target === null || target === void 0 ? void 0 : (_target_hasOwnProperty1 = target.hasOwnProperty) === null || _target_hasOwnProperty1 === void 0 ? void 0 : _target_hasOwnProperty1.call(target, k))) {
|
|
20
|
+
target[k] = source[k];
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -128,8 +128,8 @@ function normalizeConfig(config) {
|
|
|
128
128
|
}
|
|
129
129
|
// `config.content.transform` is optional, and can be a Function or a Record<String, Function>
|
|
130
130
|
if (typeof config.content.transform === "object") {
|
|
131
|
-
for (let
|
|
132
|
-
if (typeof
|
|
131
|
+
for (let value of Object.values(config.content.transform)){
|
|
132
|
+
if (typeof value !== "function") {
|
|
133
133
|
return false;
|
|
134
134
|
}
|
|
135
135
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-oxide-insiders.
|
|
3
|
+
"version": "0.0.0-oxide-insiders.019fddb",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -48,19 +48,19 @@
|
|
|
48
48
|
],
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@swc/cli": "0.1.59",
|
|
51
|
-
"@swc/core": "1.3.
|
|
51
|
+
"@swc/core": "1.3.27",
|
|
52
52
|
"@swc/jest": "0.2.24",
|
|
53
53
|
"@swc/register": "0.1.10",
|
|
54
54
|
"autoprefixer": "^10.4.13",
|
|
55
55
|
"concurrently": "^7.5.0",
|
|
56
56
|
"cssnano": "^5.1.14",
|
|
57
|
-
"esbuild": "^0.
|
|
57
|
+
"esbuild": "^0.17.3",
|
|
58
58
|
"eslint": "^8.31.0",
|
|
59
59
|
"eslint-config-prettier": "^8.6.0",
|
|
60
60
|
"eslint-plugin-prettier": "^4.2.1",
|
|
61
61
|
"jest": "^28.1.3",
|
|
62
62
|
"jest-diff": "^28.1.3",
|
|
63
|
-
"prettier": "^2.8.
|
|
63
|
+
"prettier": "^2.8.3",
|
|
64
64
|
"rimraf": "^3.0.0",
|
|
65
65
|
"source-map-js": "^1.0.2",
|
|
66
66
|
"turbo": "^1.7.0"
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"postcss": "^8.0.9"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@tailwindcss/oxide": "0.0.0-oxide-insiders.
|
|
72
|
+
"@tailwindcss/oxide": "0.0.0-oxide-insiders.019fddb",
|
|
73
73
|
"arg": "^5.0.2",
|
|
74
74
|
"browserslist": "^4.21.4",
|
|
75
75
|
"chokidar": "^3.5.3",
|