tailwindcss 0.0.0-insiders.7a24b3f → 0.0.0-insiders.7b4cc36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -1
- package/lib/cli.js +18 -6
- package/lib/corePluginList.js +1 -0
- package/lib/corePlugins.js +49 -5
- package/lib/index.js +12 -1
- package/lib/lib/cacheInvalidation.js +69 -0
- package/lib/lib/defaultExtractor.js +4 -4
- package/lib/lib/generateRules.js +58 -40
- package/lib/lib/setupContextUtils.js +3 -1
- package/lib/lib/sharedState.js +3 -1
- package/lib/util/resolveConfig.js +22 -0
- package/package.json +10 -10
- package/peers/index.js +176 -121
- package/src/cli.js +22 -10
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +50 -5
- package/src/index.js +15 -1
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/defaultExtractor.js +4 -4
- package/src/lib/generateRules.js +68 -46
- package/src/lib/setupContextUtils.js +4 -1
- package/src/lib/sharedState.js +1 -0
- package/src/util/resolveConfig.js +30 -0
- package/stubs/defaultConfig.stub.js +3 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,16 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
10
12
|
- Prevent nesting plugin from breaking other plugins ([#7563](https://github.com/tailwindlabs/tailwindcss/pull/7563))
|
|
11
13
|
- Recursively collapse adjacent rules ([#7565](https://github.com/tailwindlabs/tailwindcss/pull/7565))
|
|
12
|
-
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
13
14
|
- Preserve source maps for generated CSS ([#7588](https://github.com/tailwindlabs/tailwindcss/pull/7588))
|
|
14
15
|
- Split box shadows on top-level commas only ([#7479](https://github.com/tailwindlabs/tailwindcss/pull/7479))
|
|
15
16
|
- Use local user CSS cache for `@apply` ([#7524](https://github.com/tailwindlabs/tailwindcss/pull/7524))
|
|
17
|
+
- Invalidate context when main CSS changes ([#7626](https://github.com/tailwindlabs/tailwindcss/pull/7626))
|
|
18
|
+
- Only add `!` to selector class matching template candidate when using important modifier with mutli-class selectors ([#7664](https://github.com/tailwindlabs/tailwindcss/pull/7664))
|
|
19
|
+
- Correctly parse and prefix animation names with dots ([#7163](https://github.com/tailwindlabs/tailwindcss/pull/7163))
|
|
20
|
+
- Fix extraction from template literal/function with array ([#7481](https://github.com/tailwindlabs/tailwindcss/pull/7481))
|
|
21
|
+
- Don't output unparsable arbitrary values ([#7789](https://github.com/tailwindlabs/tailwindcss/pull/7789))
|
|
16
22
|
|
|
17
23
|
### Changed
|
|
18
24
|
|
|
19
25
|
- Replace `chalk` with `picocolors` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6039))
|
|
26
|
+
- Replace `cosmiconfig` with `lilconfig` ([#6039](https://github.com/tailwindlabs/tailwindcss/pull/6038))
|
|
27
|
+
- Update `cssnano` to avoid removing empty variables when minifying ([#7818](https://github.com/tailwindlabs/tailwindcss/pull/7818))
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
|
|
32
|
+
- Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
|
|
33
|
+
- Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
|
|
34
|
+
- Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
|
|
35
|
+
- Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
|
|
36
|
+
- Add `--poll` option to the CLI ([#7725](https://github.com/tailwindlabs/tailwindcss/pull/7725))
|
|
37
|
+
- Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
|
|
20
38
|
|
|
21
39
|
## [3.0.23] - 2022-02-16
|
|
22
40
|
|
package/lib/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ var _path = _interopRequireDefault(require("path"));
|
|
|
6
6
|
var _arg = _interopRequireDefault(require("arg"));
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
8
|
var _postcssLoadConfig = _interopRequireDefault(require("postcss-load-config"));
|
|
9
|
-
var
|
|
9
|
+
var _lilconfig = require("lilconfig");
|
|
10
10
|
var _plugins // Little bit scary, looking at private/internal API
|
|
11
11
|
= _interopRequireDefault(require("postcss-load-config/src/plugins"));
|
|
12
12
|
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
|
|
@@ -159,6 +159,10 @@ let commands = {
|
|
|
159
159
|
type: Boolean,
|
|
160
160
|
description: 'Watch for changes and rebuild as needed'
|
|
161
161
|
},
|
|
162
|
+
'--poll': {
|
|
163
|
+
type: Boolean,
|
|
164
|
+
description: 'Use polling instead of filesystem events when watching'
|
|
165
|
+
},
|
|
162
166
|
'--content': {
|
|
163
167
|
type: String,
|
|
164
168
|
description: 'Content paths to use for removing unused classes'
|
|
@@ -187,7 +191,8 @@ let commands = {
|
|
|
187
191
|
'-i': '--input',
|
|
188
192
|
'-o': '--output',
|
|
189
193
|
'-m': '--minify',
|
|
190
|
-
'-w': '--watch'
|
|
194
|
+
'-w': '--watch',
|
|
195
|
+
'-p': '--poll'
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
};
|
|
@@ -348,7 +353,12 @@ async function build() {
|
|
|
348
353
|
let input = args['--input'];
|
|
349
354
|
let output = args['--output'];
|
|
350
355
|
let shouldWatch = args['--watch'];
|
|
356
|
+
let shouldPoll = args['--poll'];
|
|
357
|
+
let shouldCoalesceWriteEvents = shouldPoll || process.platform === 'win32';
|
|
351
358
|
let includePostCss = args['--postcss'];
|
|
359
|
+
// Polling interval in milliseconds
|
|
360
|
+
// Used only when polling or coalescing add/change events on Windows
|
|
361
|
+
let pollInterval = 10;
|
|
352
362
|
// TODO: Deprecate this in future versions
|
|
353
363
|
if (!input && args['_'][1]) {
|
|
354
364
|
console.error('[deprecation] Running tailwindcss without -i, please provide an input file.');
|
|
@@ -368,8 +378,8 @@ async function build() {
|
|
|
368
378
|
let customPostCssPath = typeof args['--postcss'] === 'string' ? args['--postcss'] : undefined;
|
|
369
379
|
let { plugins: configPlugins } = customPostCssPath ? await (async ()=>{
|
|
370
380
|
let file = _path.default.resolve(customPostCssPath);
|
|
371
|
-
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.0
|
|
372
|
-
let { config ={} } = await (0,
|
|
381
|
+
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
|
382
|
+
let { config ={} } = await (0, _lilconfig).lilconfig('postcss').load(file);
|
|
373
383
|
if (typeof config === 'function') {
|
|
374
384
|
config = config();
|
|
375
385
|
} else {
|
|
@@ -684,10 +694,12 @@ async function build() {
|
|
|
684
694
|
...contextDependencies,
|
|
685
695
|
...extractFileGlobs(config1)
|
|
686
696
|
], {
|
|
697
|
+
usePolling: shouldPoll,
|
|
698
|
+
interval: shouldPoll ? pollInterval : undefined,
|
|
687
699
|
ignoreInitial: true,
|
|
688
|
-
awaitWriteFinish:
|
|
700
|
+
awaitWriteFinish: shouldCoalesceWriteEvents ? {
|
|
689
701
|
stabilityThreshold: 50,
|
|
690
|
-
pollInterval:
|
|
702
|
+
pollInterval: pollInterval
|
|
691
703
|
} : false
|
|
692
704
|
});
|
|
693
705
|
let chain = Promise.resolve();
|
package/lib/corePluginList.js
CHANGED
package/lib/corePlugins.js
CHANGED
|
@@ -8,6 +8,7 @@ var path = _interopRequireWildcard(require("path"));
|
|
|
8
8
|
var _postcss = _interopRequireDefault(require("postcss"));
|
|
9
9
|
var _createUtilityPlugin = _interopRequireDefault(require("./util/createUtilityPlugin"));
|
|
10
10
|
var _buildMediaQuery = _interopRequireDefault(require("./util/buildMediaQuery"));
|
|
11
|
+
var _escapeClassName = _interopRequireDefault(require("./util/escapeClassName"));
|
|
11
12
|
var _parseAnimationValue = _interopRequireDefault(require("./util/parseAnimationValue"));
|
|
12
13
|
var _flattenColorPalette = _interopRequireDefault(require("./util/flattenColorPalette"));
|
|
13
14
|
var _withAlphaVariable = _interopRequireWildcard(require("./util/withAlphaVariable"));
|
|
@@ -209,7 +210,7 @@ let variantPlugins = {
|
|
|
209
210
|
addVariant('motion-reduce', '@media (prefers-reduced-motion: reduce)');
|
|
210
211
|
},
|
|
211
212
|
darkVariants: ({ config , addVariant })=>{
|
|
212
|
-
let mode = config('darkMode', 'media');
|
|
213
|
+
let [mode, className = '.dark'] = [].concat(config('darkMode', 'media'));
|
|
213
214
|
if (mode === false) {
|
|
214
215
|
mode = 'media';
|
|
215
216
|
_log.default.warn('darkmode-false', [
|
|
@@ -219,7 +220,7 @@ let variantPlugins = {
|
|
|
219
220
|
]);
|
|
220
221
|
}
|
|
221
222
|
if (mode === 'class') {
|
|
222
|
-
addVariant('dark',
|
|
223
|
+
addVariant('dark', `${className} &`);
|
|
223
224
|
} else if (mode === 'media') {
|
|
224
225
|
addVariant('dark', '@media (prefers-color-scheme: dark)');
|
|
225
226
|
}
|
|
@@ -820,6 +821,38 @@ let corePlugins = {
|
|
|
820
821
|
}
|
|
821
822
|
});
|
|
822
823
|
},
|
|
824
|
+
borderSpacing: ({ addDefaults , matchUtilities , theme })=>{
|
|
825
|
+
addDefaults('border-spacing', {
|
|
826
|
+
'--tw-border-spacing-x': 0,
|
|
827
|
+
'--tw-border-spacing-y': 0
|
|
828
|
+
});
|
|
829
|
+
matchUtilities({
|
|
830
|
+
'border-spacing': (value)=>{
|
|
831
|
+
return {
|
|
832
|
+
'--tw-border-spacing-x': value,
|
|
833
|
+
'--tw-border-spacing-y': value,
|
|
834
|
+
'@defaults border-spacing': {},
|
|
835
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
836
|
+
};
|
|
837
|
+
},
|
|
838
|
+
'border-spacing-x': (value)=>{
|
|
839
|
+
return {
|
|
840
|
+
'--tw-border-spacing-x': value,
|
|
841
|
+
'@defaults border-spacing': {},
|
|
842
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
843
|
+
};
|
|
844
|
+
},
|
|
845
|
+
'border-spacing-y': (value)=>{
|
|
846
|
+
return {
|
|
847
|
+
'--tw-border-spacing-y': value,
|
|
848
|
+
'@defaults border-spacing': {},
|
|
849
|
+
'border-spacing': 'var(--tw-border-spacing-x) var(--tw-border-spacing-y)'
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
}, {
|
|
853
|
+
values: theme('borderSpacing')
|
|
854
|
+
});
|
|
855
|
+
},
|
|
823
856
|
transformOrigin: (0, _createUtilityPlugin).default('transformOrigin', [
|
|
824
857
|
[
|
|
825
858
|
'origin',
|
|
@@ -989,8 +1022,8 @@ let corePlugins = {
|
|
|
989
1022
|
}
|
|
990
1023
|
});
|
|
991
1024
|
},
|
|
992
|
-
animation: ({ matchUtilities , theme ,
|
|
993
|
-
let prefixName = (name)
|
|
1025
|
+
animation: ({ matchUtilities , theme , config })=>{
|
|
1026
|
+
let prefixName = (name)=>`${config('prefix')}${(0, _escapeClassName).default(name)}`
|
|
994
1027
|
;
|
|
995
1028
|
var ref;
|
|
996
1029
|
let keyframes = Object.fromEntries(Object.entries((ref = theme('keyframes')) !== null && ref !== void 0 ? ref : {}).map(([key, value])=>{
|
|
@@ -2531,6 +2564,12 @@ let corePlugins = {
|
|
|
2531
2564
|
},
|
|
2532
2565
|
'.text-justify': {
|
|
2533
2566
|
'text-align': 'justify'
|
|
2567
|
+
},
|
|
2568
|
+
'.text-start': {
|
|
2569
|
+
'text-align': 'start'
|
|
2570
|
+
},
|
|
2571
|
+
'.text-end': {
|
|
2572
|
+
'text-align': 'end'
|
|
2534
2573
|
}
|
|
2535
2574
|
});
|
|
2536
2575
|
},
|
|
@@ -3185,9 +3224,14 @@ let corePlugins = {
|
|
|
3185
3224
|
}
|
|
3186
3225
|
});
|
|
3187
3226
|
},
|
|
3188
|
-
ringColor: ({ matchUtilities , theme })=>{
|
|
3227
|
+
ringColor: ({ matchUtilities , theme , corePlugins: corePlugins6 })=>{
|
|
3189
3228
|
matchUtilities({
|
|
3190
3229
|
ring: (value)=>{
|
|
3230
|
+
if (!corePlugins6('ringOpacity')) {
|
|
3231
|
+
return {
|
|
3232
|
+
'--tw-ring-color': (0, _toColorValue).default(value)
|
|
3233
|
+
};
|
|
3234
|
+
}
|
|
3191
3235
|
return (0, _withAlphaVariable).default({
|
|
3192
3236
|
color: value,
|
|
3193
3237
|
property: '--tw-ring-color',
|
package/lib/index.js
CHANGED
|
@@ -17,7 +17,18 @@ module.exports = function tailwindcss(configOrPath) {
|
|
|
17
17
|
return root;
|
|
18
18
|
},
|
|
19
19
|
function(root, result) {
|
|
20
|
-
|
|
20
|
+
let context = (0, _setupTrackingContext).default(configOrPath);
|
|
21
|
+
if (root.type === 'document') {
|
|
22
|
+
let roots = root.nodes.filter((node)=>node.type === 'root'
|
|
23
|
+
);
|
|
24
|
+
for (const root1 of roots){
|
|
25
|
+
if (root1.type === 'root') {
|
|
26
|
+
(0, _processTailwindFeatures).default(context)(root1, result);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
(0, _processTailwindFeatures).default(context)(root, result);
|
|
21
32
|
},
|
|
22
33
|
_sharedState.env.DEBUG && function(root) {
|
|
23
34
|
console.timeEnd('JIT TOTAL');
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.hasContentChanged = hasContentChanged;
|
|
6
|
+
var _crypto = _interopRequireDefault(require("crypto"));
|
|
7
|
+
var sharedState = _interopRequireWildcard(require("./sharedState"));
|
|
8
|
+
function _interopRequireDefault(obj) {
|
|
9
|
+
return obj && obj.__esModule ? obj : {
|
|
10
|
+
default: obj
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function _interopRequireWildcard(obj) {
|
|
14
|
+
if (obj && obj.__esModule) {
|
|
15
|
+
return obj;
|
|
16
|
+
} else {
|
|
17
|
+
var newObj = {};
|
|
18
|
+
if (obj != null) {
|
|
19
|
+
for(var key in obj){
|
|
20
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
21
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
22
|
+
if (desc.get || desc.set) {
|
|
23
|
+
Object.defineProperty(newObj, key, desc);
|
|
24
|
+
} else {
|
|
25
|
+
newObj[key] = obj[key];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
newObj.default = obj;
|
|
31
|
+
return newObj;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Calculate the hash of a string.
|
|
36
|
+
*
|
|
37
|
+
* This doesn't need to be cryptographically secure or
|
|
38
|
+
* anything like that since it's used only to detect
|
|
39
|
+
* when the CSS changes to invalidate the context.
|
|
40
|
+
*
|
|
41
|
+
* This is wrapped in a try/catch because it's really dependent
|
|
42
|
+
* on how Node itself is build and the environment and OpenSSL
|
|
43
|
+
* version / build that is installed on the user's machine.
|
|
44
|
+
*
|
|
45
|
+
* Based on the environment this can just outright fail.
|
|
46
|
+
*
|
|
47
|
+
* See https://github.com/nodejs/node/issues/40455
|
|
48
|
+
*
|
|
49
|
+
* @param {string} str
|
|
50
|
+
*/ function getHash(str) {
|
|
51
|
+
try {
|
|
52
|
+
return _crypto.default.createHash('md5').update(str, 'utf-8').digest('binary');
|
|
53
|
+
} catch (err) {
|
|
54
|
+
return '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function hasContentChanged(sourcePath, root) {
|
|
58
|
+
let css = root.toString();
|
|
59
|
+
// We only care about files with @tailwind directives
|
|
60
|
+
// Other files use an existing context
|
|
61
|
+
if (!css.includes('@tailwind')) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
let existingHash = sharedState.sourceHashMap.get(sourcePath);
|
|
65
|
+
let rootHash = getHash(css);
|
|
66
|
+
let didChange = existingHash !== rootHash;
|
|
67
|
+
sharedState.sourceHashMap.set(sourcePath, rootHash);
|
|
68
|
+
return didChange;
|
|
69
|
+
}
|
|
@@ -7,16 +7,16 @@ const PATTERNS = [
|
|
|
7
7
|
/(?:\['([^'\s]+[^<>"'`\s:\\])')/.source,
|
|
8
8
|
/(?:\["([^"\s]+[^<>"'`\s:\\])")/.source,
|
|
9
9
|
/(?:\[`([^`\s]+[^<>"'`\s:\\])`)/.source,
|
|
10
|
-
/([
|
|
11
|
-
/([
|
|
10
|
+
/([^${(<>"'`\s]*\[\w*'[^"`\s]*'?\])/.source,
|
|
11
|
+
/([^${(<>"'`\s]*\[\w*"[^'`\s]*"?\])/.source,
|
|
12
12
|
/([^<>"'`\s]*\[\w*\('[^"'`\s]*'\)\])/.source,
|
|
13
13
|
/([^<>"'`\s]*\[\w*\("[^"'`\s]*"\)\])/.source,
|
|
14
14
|
/([^<>"'`\s]*\[\w*\('[^"`\s]*'\)\])/.source,
|
|
15
15
|
/([^<>"'`\s]*\[\w*\("[^'`\s]*"\)\])/.source,
|
|
16
16
|
/([^<>"'`\s]*\[[^<>"'`\s]*\('[^"`\s]*'\)+\])/.source,
|
|
17
17
|
/([^<>"'`\s]*\[[^<>"'`\s]*\("[^'`\s]*"\)+\])/.source,
|
|
18
|
-
/([
|
|
19
|
-
/([
|
|
18
|
+
/([^${(<>"'`\s]*\['[^"'`\s]*'\])/.source,
|
|
19
|
+
/([^${(<>"'`\s]*\["[^"'`\s]*"\])/.source,
|
|
20
20
|
/([^<>"'`\s]*\[[^<>"'`\s]*:[^\]\s]*\])/.source,
|
|
21
21
|
/([^<>"'`\s]*\[[^<>"'`\s]*:'[^"'`\s]*'\])/.source,
|
|
22
22
|
/([^<>"'`\s]*\[[^<>"'`\s]*:"[^"'`\s]*"\])/.source,
|
package/lib/lib/generateRules.js
CHANGED
|
@@ -108,7 +108,7 @@ function applyPrefix(matches, context) {
|
|
|
108
108
|
}
|
|
109
109
|
return matches;
|
|
110
110
|
}
|
|
111
|
-
function applyImportant(matches) {
|
|
111
|
+
function applyImportant(matches, classCandidate) {
|
|
112
112
|
if (matches.length === 0) {
|
|
113
113
|
return matches;
|
|
114
114
|
}
|
|
@@ -121,7 +121,10 @@ function applyImportant(matches) {
|
|
|
121
121
|
});
|
|
122
122
|
container.walkRules((r)=>{
|
|
123
123
|
r.selector = (0, _pluginUtils).updateAllClasses(r.selector, (className)=>{
|
|
124
|
-
|
|
124
|
+
if (className === classCandidate) {
|
|
125
|
+
return `!${className}`;
|
|
126
|
+
}
|
|
127
|
+
return className;
|
|
125
128
|
});
|
|
126
129
|
r.walkDecls((d)=>d.important = true
|
|
127
130
|
);
|
|
@@ -313,6 +316,16 @@ function isValidPropName(name) {
|
|
|
313
316
|
return false;
|
|
314
317
|
}
|
|
315
318
|
}
|
|
319
|
+
function isParsableNode(node) {
|
|
320
|
+
let isParsable = true;
|
|
321
|
+
node.walkDecls((decl)=>{
|
|
322
|
+
if (!isParsableCssValue(decl.name, decl.value)) {
|
|
323
|
+
isParsable = false;
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
});
|
|
327
|
+
return isParsable;
|
|
328
|
+
}
|
|
316
329
|
function isParsableCssValue(property, value) {
|
|
317
330
|
// We don't want to to treat [https://example.com] as a custom property
|
|
318
331
|
// Even though, according to the CSS grammar, it's a totally valid CSS declaration
|
|
@@ -479,54 +492,59 @@ function* resolveMatches(candidate, context) {
|
|
|
479
492
|
matches.push(matchesPerPlugin);
|
|
480
493
|
}
|
|
481
494
|
}
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
for (let
|
|
493
|
-
let
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
otherGroup.
|
|
498
|
-
|
|
495
|
+
if (isArbitraryValue(modifier)) {
|
|
496
|
+
// When generated arbitrary values are ambiguous, we can't know
|
|
497
|
+
// which to pick so don't generate any utilities for them
|
|
498
|
+
if (matches.length > 1) {
|
|
499
|
+
var ref1;
|
|
500
|
+
let typesPerPlugin = matches.map((match)=>new Set([
|
|
501
|
+
...(ref1 = typesByMatches.get(match)) !== null && ref1 !== void 0 ? ref1 : []
|
|
502
|
+
])
|
|
503
|
+
);
|
|
504
|
+
// Remove duplicates, so that we can detect proper unique types for each plugin.
|
|
505
|
+
for (let pluginTypes of typesPerPlugin){
|
|
506
|
+
for (let type of pluginTypes){
|
|
507
|
+
let removeFromOwnGroup = false;
|
|
508
|
+
for (let otherGroup of typesPerPlugin){
|
|
509
|
+
if (pluginTypes === otherGroup) continue;
|
|
510
|
+
if (otherGroup.has(type)) {
|
|
511
|
+
otherGroup.delete(type);
|
|
512
|
+
removeFromOwnGroup = true;
|
|
513
|
+
}
|
|
499
514
|
}
|
|
515
|
+
if (removeFromOwnGroup) pluginTypes.delete(type);
|
|
500
516
|
}
|
|
501
|
-
if (removeFromOwnGroup) pluginTypes.delete(type);
|
|
502
517
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
.join('\n')
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
518
|
+
let messages = [];
|
|
519
|
+
for (let [idx, group] of typesPerPlugin.entries()){
|
|
520
|
+
for (let type of group){
|
|
521
|
+
let rules = matches[idx].map(([, rule])=>rule
|
|
522
|
+
).flat().map((rule)=>rule.toString().split('\n').slice(1, -1) // Remove selector and closing '}'
|
|
523
|
+
.map((line)=>line.trim()
|
|
524
|
+
).map((x)=>` ${x}`
|
|
525
|
+
) // Re-indent
|
|
526
|
+
.join('\n')
|
|
527
|
+
).join('\n\n');
|
|
528
|
+
messages.push(` Use \`${candidate.replace('[', `[${type}:`)}\` for \`${rules.trim()}\``);
|
|
529
|
+
break;
|
|
530
|
+
}
|
|
516
531
|
}
|
|
532
|
+
_log.default.warn([
|
|
533
|
+
`The class \`${candidate}\` is ambiguous and matches multiple utilities.`,
|
|
534
|
+
...messages,
|
|
535
|
+
`If this is content and not a class, replace it with \`${candidate.replace('[', '[').replace(']', ']')}\` to silence this warning.`,
|
|
536
|
+
]);
|
|
537
|
+
continue;
|
|
517
538
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
`If this is content and not a class, replace it with \`${candidate.replace('[', '[').replace(']', ']')}\` to silence this warning.`,
|
|
522
|
-
]);
|
|
523
|
-
continue;
|
|
539
|
+
matches = matches.map((list)=>list.filter((match)=>isParsableNode(match[1])
|
|
540
|
+
)
|
|
541
|
+
);
|
|
524
542
|
}
|
|
525
543
|
matches = matches.flat();
|
|
526
544
|
matches = Array.from(recordCandidates(matches, classCandidate));
|
|
527
545
|
matches = applyPrefix(matches, context);
|
|
528
546
|
if (important) {
|
|
529
|
-
matches = applyImportant(matches,
|
|
547
|
+
matches = applyImportant(matches, classCandidate);
|
|
530
548
|
}
|
|
531
549
|
for (let variant of variants){
|
|
532
550
|
matches = applyVariant(variant, matches, context);
|
|
@@ -25,6 +25,7 @@ var _log = _interopRequireDefault(require("../util/log"));
|
|
|
25
25
|
var _negateValue = _interopRequireDefault(require("../util/negateValue"));
|
|
26
26
|
var _isValidArbitraryValue = _interopRequireDefault(require("../util/isValidArbitraryValue"));
|
|
27
27
|
var _generateRules = require("./generateRules");
|
|
28
|
+
var _cacheInvalidationJs = require("./cacheInvalidation.js");
|
|
28
29
|
function _interopRequireDefault(obj) {
|
|
29
30
|
return obj && obj.__esModule ? obj : {
|
|
30
31
|
default: obj
|
|
@@ -802,13 +803,14 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
802
803
|
contextMap.set(sourcePath, context);
|
|
803
804
|
existingContext = context;
|
|
804
805
|
}
|
|
806
|
+
let cssDidChange = (0, _cacheInvalidationJs).hasContentChanged(sourcePath, root);
|
|
805
807
|
// If there's already a context in the cache and we don't need to
|
|
806
808
|
// reset the context, return the cached context.
|
|
807
809
|
if (existingContext) {
|
|
808
810
|
let contextDependenciesChanged = trackModified([
|
|
809
811
|
...contextDependencies
|
|
810
812
|
], getFileModifiedMap(existingContext));
|
|
811
|
-
if (!contextDependenciesChanged) {
|
|
813
|
+
if (!contextDependenciesChanged && !cssDidChange) {
|
|
812
814
|
return [
|
|
813
815
|
existingContext,
|
|
814
816
|
false
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
exports.resolveDebug = resolveDebug;
|
|
6
|
-
exports.NOT_ON_DEMAND = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
6
|
+
exports.NOT_ON_DEMAND = exports.sourceHashMap = exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
7
7
|
const env = {
|
|
8
8
|
NODE_ENV: process.env.NODE_ENV,
|
|
9
9
|
DEBUG: resolveDebug(process.env.DEBUG)
|
|
@@ -15,6 +15,8 @@ const configContextMap = new Map();
|
|
|
15
15
|
exports.configContextMap = configContextMap;
|
|
16
16
|
const contextSourcesMap = new Map();
|
|
17
17
|
exports.contextSourcesMap = contextSourcesMap;
|
|
18
|
+
const sourceHashMap = new Map();
|
|
19
|
+
exports.sourceHashMap = sourceHashMap;
|
|
18
20
|
const NOT_ON_DEMAND = new String('*');
|
|
19
21
|
exports.NOT_ON_DEMAND = NOT_ON_DEMAND;
|
|
20
22
|
function resolveDebug(debug) {
|
|
@@ -62,6 +62,28 @@ const configUtils = {
|
|
|
62
62
|
[`screen-${key}`]: screens[key]
|
|
63
63
|
})
|
|
64
64
|
, {});
|
|
65
|
+
},
|
|
66
|
+
rgb (property) {
|
|
67
|
+
if (!property.startsWith('--')) {
|
|
68
|
+
throw new Error('The rgb() helper requires a custom property name to be passed as the first argument.');
|
|
69
|
+
}
|
|
70
|
+
return ({ opacityValue })=>{
|
|
71
|
+
if (opacityValue === undefined || opacityValue === 1) {
|
|
72
|
+
return `rgb(var(${property}) / 1.0)`;
|
|
73
|
+
}
|
|
74
|
+
return `rgb(var(${property}) / ${opacityValue})`;
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
hsl (property) {
|
|
78
|
+
if (!property.startsWith('--')) {
|
|
79
|
+
throw new Error('The hsl() helper requires a custom property name to be passed as the first argument.');
|
|
80
|
+
}
|
|
81
|
+
return ({ opacityValue })=>{
|
|
82
|
+
if (opacityValue === undefined || opacityValue === 1) {
|
|
83
|
+
return `hsl(var(${property}) / 1)`;
|
|
84
|
+
}
|
|
85
|
+
return `hsl(var(${property}) / ${opacityValue})`;
|
|
86
|
+
};
|
|
65
87
|
}
|
|
66
88
|
};
|
|
67
89
|
function value(valueToResolve, ...args) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tailwindcss",
|
|
3
|
-
"version": "0.0.0-insiders.
|
|
3
|
+
"version": "0.0.0-insiders.7b4cc36",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@swc/cli": "^0.1.55",
|
|
42
42
|
"@swc/core": "^1.2.127",
|
|
43
|
-
"@swc/jest": "^0.2.
|
|
43
|
+
"@swc/jest": "^0.2.20",
|
|
44
44
|
"@swc/register": "^0.1.10",
|
|
45
45
|
"autoprefixer": "^10.4.2",
|
|
46
|
-
"cssnano": "^5.
|
|
47
|
-
"esbuild": "^0.14.
|
|
48
|
-
"eslint": "^8.
|
|
49
|
-
"eslint-config-prettier": "^8.
|
|
46
|
+
"cssnano": "^5.1.3",
|
|
47
|
+
"esbuild": "^0.14.25",
|
|
48
|
+
"eslint": "^8.9.0",
|
|
49
|
+
"eslint-config-prettier": "^8.4.0",
|
|
50
50
|
"eslint-plugin-prettier": "^4.0.0",
|
|
51
51
|
"jest": "^27.5.1",
|
|
52
52
|
"jest-diff": "^27.5.1",
|
|
53
53
|
"prettier": "^2.5.1",
|
|
54
|
-
"prettier-plugin-tailwindcss": "^0.1.
|
|
54
|
+
"prettier-plugin-tailwindcss": "^0.1.8",
|
|
55
55
|
"rimraf": "^3.0.0",
|
|
56
56
|
"source-map-js": "^1.0.2"
|
|
57
57
|
},
|
|
@@ -63,17 +63,17 @@
|
|
|
63
63
|
"arg": "^5.0.1",
|
|
64
64
|
"chokidar": "^3.5.3",
|
|
65
65
|
"color-name": "^1.1.4",
|
|
66
|
-
"cosmiconfig": "^7.0.1",
|
|
67
66
|
"detective": "^5.2.0",
|
|
68
67
|
"didyoumean": "^1.2.2",
|
|
69
68
|
"dlv": "^1.1.3",
|
|
70
69
|
"fast-glob": "^3.2.11",
|
|
71
70
|
"glob-parent": "^6.0.2",
|
|
72
71
|
"is-glob": "^4.0.3",
|
|
72
|
+
"lilconfig": "^2.0.4",
|
|
73
73
|
"normalize-path": "^3.0.0",
|
|
74
|
-
"object-hash": "^
|
|
74
|
+
"object-hash": "^3.0.0",
|
|
75
75
|
"picocolors": "^1.0.0",
|
|
76
|
-
"postcss": "^8.4.
|
|
76
|
+
"postcss": "^8.4.7",
|
|
77
77
|
"postcss-js": "^4.0.0",
|
|
78
78
|
"postcss-load-config": "^3.1.3",
|
|
79
79
|
"postcss-nested": "5.0.6",
|