tailwindcss 0.0.0-insiders.fc623da → 0.0.0-insiders.fc6c27d
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 +79 -2
- package/README.md +8 -4
- package/lib/cli.js +49 -12
- package/lib/css/preflight.css +1 -2
- package/lib/index.js +1 -3
- package/lib/lib/collapseDuplicateDeclarations.js +52 -1
- package/lib/lib/defaultExtractor.js +42 -0
- package/lib/lib/evaluateTailwindFunctions.js +1 -1
- package/lib/lib/expandApplyAtRules.js +87 -15
- package/lib/lib/expandTailwindAtRules.js +32 -37
- package/lib/lib/generateRules.js +4 -1
- package/lib/lib/normalizeTailwindDirectives.js +8 -1
- package/lib/lib/setupContextUtils.js +7 -1
- package/lib/lib/setupTrackingContext.js +11 -10
- package/lib/lib/sharedState.js +33 -4
- package/lib/processTailwindFeatures.js +2 -1
- package/lib/util/color.js +23 -8
- package/lib/util/resolveConfig.js +9 -1
- package/lib/util/toPath.js +6 -1
- package/package.json +12 -13
- package/peers/index.js +681 -693
- package/src/cli.js +57 -12
- package/src/css/preflight.css +1 -2
- package/src/index.js +1 -7
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/defaultExtractor.js +48 -0
- package/src/lib/evaluateTailwindFunctions.js +1 -1
- package/src/lib/expandApplyAtRules.js +90 -19
- package/src/lib/expandTailwindAtRules.js +29 -32
- package/src/lib/generateRules.js +5 -1
- package/src/lib/normalizeTailwindDirectives.js +6 -1
- package/src/lib/setupContextUtils.js +8 -1
- package/src/lib/setupTrackingContext.js +11 -10
- package/src/lib/sharedState.js +40 -4
- package/src/processTailwindFeatures.js +2 -1
- package/src/util/color.js +20 -7
- package/src/util/resolveConfig.js +11 -1
- package/src/util/toPath.js +23 -1
- package/stubs/defaultConfig.stub.js +2 -2
- package/lib/lib/setupWatchingContext.js +0 -288
- package/src/lib/setupWatchingContext.js +0 -311
|
@@ -12,7 +12,11 @@ function _interopRequireDefault(obj) {
|
|
|
12
12
|
function normalizeTailwindDirectives(root) {
|
|
13
13
|
let tailwindDirectives = new Set();
|
|
14
14
|
let layerDirectives = new Set();
|
|
15
|
+
let applyDirectives = new Set();
|
|
15
16
|
root.walkAtRules((atRule)=>{
|
|
17
|
+
if (atRule.name === 'apply') {
|
|
18
|
+
applyDirectives.add(atRule);
|
|
19
|
+
}
|
|
16
20
|
if (atRule.name === 'import') {
|
|
17
21
|
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
|
|
18
22
|
atRule.name = 'tailwind';
|
|
@@ -72,5 +76,8 @@ function normalizeTailwindDirectives(root) {
|
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
75
|
-
return
|
|
79
|
+
return {
|
|
80
|
+
tailwindDirectives,
|
|
81
|
+
applyDirectives
|
|
82
|
+
};
|
|
76
83
|
}
|
|
@@ -463,11 +463,17 @@ function getFileModifiedMap(context) {
|
|
|
463
463
|
function trackModified(files, fileModifiedMap) {
|
|
464
464
|
let changed = false;
|
|
465
465
|
for (let file of files){
|
|
466
|
+
var ref;
|
|
466
467
|
if (!file) continue;
|
|
467
468
|
let parsed = _url.default.parse(file);
|
|
468
469
|
let pathname = parsed.hash ? parsed.href.replace(parsed.hash, '') : parsed.href;
|
|
469
470
|
pathname = parsed.search ? pathname.replace(parsed.search, '') : pathname;
|
|
470
|
-
let newModified = _fs.default.statSync(decodeURIComponent(pathname)
|
|
471
|
+
let newModified = (ref = _fs.default.statSync(decodeURIComponent(pathname), {
|
|
472
|
+
throwIfNoEntry: false
|
|
473
|
+
})) === null || ref === void 0 ? void 0 : ref.mtimeMs;
|
|
474
|
+
if (!newModified) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
471
477
|
if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
|
|
472
478
|
changed = true;
|
|
473
479
|
}
|
|
@@ -119,16 +119,17 @@ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
|
119
119
|
return changedFiles;
|
|
120
120
|
}
|
|
121
121
|
function setupTrackingContext(configOrPath) {
|
|
122
|
-
return ({ tailwindDirectives , registerDependency })=>{
|
|
122
|
+
return ({ tailwindDirectives , registerDependency , applyDirectives })=>{
|
|
123
123
|
return (root, result)=>{
|
|
124
124
|
let [tailwindConfig, userConfigPath, tailwindConfigHash, configDependencies] = getTailwindConfig(configOrPath);
|
|
125
125
|
let contextDependencies = new Set(configDependencies);
|
|
126
|
-
// If there are no @tailwind rules, we don't consider this CSS
|
|
127
|
-
// to be dependencies of the context. Can reuse
|
|
128
|
-
// We may want to think about `@layer`
|
|
129
|
-
//
|
|
130
|
-
// in
|
|
131
|
-
|
|
126
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS
|
|
127
|
+
// file or its dependencies to be dependencies of the context. Can reuse
|
|
128
|
+
// the context even if they change. We may want to think about `@layer`
|
|
129
|
+
// being part of this trigger too, but it's tough because it's impossible
|
|
130
|
+
// for a layer in one file to end up in the actual @tailwind rule in
|
|
131
|
+
// another file since independent sources are effectively isolated.
|
|
132
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
132
133
|
// Add current css file as a context dependencies.
|
|
133
134
|
contextDependencies.add(result.opts.from);
|
|
134
135
|
// Add all css @import dependencies as context dependencies.
|
|
@@ -140,12 +141,12 @@ function setupTrackingContext(configOrPath) {
|
|
|
140
141
|
}
|
|
141
142
|
let [context] = (0, _setupContextUtils).getContext(root, result, tailwindConfig, userConfigPath, tailwindConfigHash, contextDependencies);
|
|
142
143
|
let candidateFiles = getCandidateFiles(context, tailwindConfig);
|
|
143
|
-
// If there are no @tailwind rules, we don't consider this CSS file or it's
|
|
144
|
-
// to be dependencies of the context. Can reuse the context even if they change.
|
|
144
|
+
// If there are no @tailwind or @apply rules, we don't consider this CSS file or it's
|
|
145
|
+
// dependencies to be dependencies of the context. Can reuse the context even if they change.
|
|
145
146
|
// We may want to think about `@layer` being part of this trigger too, but it's tough
|
|
146
147
|
// because it's impossible for a layer in one file to end up in the actual @tailwind rule
|
|
147
148
|
// in another file since independent sources are effectively isolated.
|
|
148
|
-
if (tailwindDirectives.size > 0) {
|
|
149
|
+
if (tailwindDirectives.size > 0 || applyDirectives.size > 0) {
|
|
149
150
|
let fileModifiedMap = (0, _setupContextUtils).getFileModifiedMap(context);
|
|
150
151
|
// Add template paths as postcss dependencies.
|
|
151
152
|
for (let fileOrGlob of candidateFiles){
|
package/lib/lib/sharedState.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
+
exports.resolveDebug = resolveDebug;
|
|
5
6
|
exports.contextSourcesMap = exports.configContextMap = exports.contextMap = exports.env = void 0;
|
|
6
7
|
const env = {
|
|
7
|
-
TAILWIND_MODE: process.env.TAILWIND_MODE,
|
|
8
8
|
NODE_ENV: process.env.NODE_ENV,
|
|
9
|
-
DEBUG: process.env.DEBUG
|
|
10
|
-
TAILWIND_DISABLE_TOUCH: process.env.TAILWIND_DISABLE_TOUCH !== undefined,
|
|
11
|
-
TAILWIND_TOUCH_DIR: process.env.TAILWIND_TOUCH_DIR
|
|
9
|
+
DEBUG: resolveDebug(process.env.DEBUG)
|
|
12
10
|
};
|
|
13
11
|
exports.env = env;
|
|
14
12
|
const contextMap = new Map();
|
|
@@ -17,3 +15,34 @@ const configContextMap = new Map();
|
|
|
17
15
|
exports.configContextMap = configContextMap;
|
|
18
16
|
const contextSourcesMap = new Map();
|
|
19
17
|
exports.contextSourcesMap = contextSourcesMap;
|
|
18
|
+
function resolveDebug(debug) {
|
|
19
|
+
if (debug === undefined) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// Environment variables are strings, so convert to boolean
|
|
23
|
+
if (debug === 'true' || debug === '1') {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (debug === 'false' || debug === '0') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Keep the debug convention into account:
|
|
30
|
+
// DEBUG=* -> This enables all debug modes
|
|
31
|
+
// DEBUG=projectA,projectB,projectC -> This enables debug for projectA, projectB and projectC
|
|
32
|
+
// DEBUG=projectA:* -> This enables all debug modes for projectA (if you have sub-types)
|
|
33
|
+
// DEBUG=projectA,-projectB -> This enables debug for projectA and explicitly disables it for projectB
|
|
34
|
+
if (debug === '*') {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
let debuggers = debug.split(',').map((d)=>d.split(':')[0]
|
|
38
|
+
);
|
|
39
|
+
// Ignoring tailwindcss
|
|
40
|
+
if (debuggers.includes('-tailwindcss')) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
// Including tailwindcss
|
|
44
|
+
if (debuggers.includes('tailwindcss')) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
@@ -21,9 +21,10 @@ function _interopRequireDefault(obj) {
|
|
|
21
21
|
}
|
|
22
22
|
function processTailwindFeatures(setupContext) {
|
|
23
23
|
return function(root, result) {
|
|
24
|
-
let tailwindDirectives = (0, _normalizeTailwindDirectives).default(root);
|
|
24
|
+
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives).default(root);
|
|
25
25
|
let context = setupContext({
|
|
26
26
|
tailwindDirectives,
|
|
27
|
+
applyDirectives,
|
|
27
28
|
registerDependency (dependency) {
|
|
28
29
|
result.messages.push({
|
|
29
30
|
plugin: 'tailwindcss',
|
package/lib/util/color.js
CHANGED
|
@@ -15,7 +15,8 @@ let SHORT_HEX = /^#([a-f\d])([a-f\d])([a-f\d])([a-f\d])?$/i;
|
|
|
15
15
|
let VALUE = `(?:\\d+|\\d*\\.\\d+)%?`;
|
|
16
16
|
let SEP = `(?:\\s*,\\s*|\\s+)`;
|
|
17
17
|
let ALPHA_SEP = `\\s*[,/]\\s*`;
|
|
18
|
-
let
|
|
18
|
+
let RGB = new RegExp(`^rgba?\\(\\s*(${VALUE})${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
|
|
19
|
+
let HSL = new RegExp(`^hsla?\\(\\s*((?:${VALUE})(?:deg|rad|grad|turn)?)${SEP}(${VALUE})${SEP}(${VALUE})(?:${ALPHA_SEP}(${VALUE}))?\\s*\\)$`);
|
|
19
20
|
function parseColor(value) {
|
|
20
21
|
if (typeof value !== 'string') {
|
|
21
22
|
return null;
|
|
@@ -62,18 +63,32 @@ function parseColor(value) {
|
|
|
62
63
|
alpha: hex[4] ? (parseInt(hex[4], 16) / 255).toString() : undefined
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
|
-
let
|
|
66
|
-
if (
|
|
66
|
+
let rgbMatch = value.match(RGB);
|
|
67
|
+
if (rgbMatch !== null) {
|
|
67
68
|
var ref, ref1;
|
|
68
69
|
return {
|
|
69
|
-
mode:
|
|
70
|
+
mode: 'rgb',
|
|
71
|
+
color: [
|
|
72
|
+
rgbMatch[1],
|
|
73
|
+
rgbMatch[2],
|
|
74
|
+
rgbMatch[3]
|
|
75
|
+
].map((v)=>v.toString()
|
|
76
|
+
),
|
|
77
|
+
alpha: (ref = rgbMatch[4]) === null || ref === void 0 ? void 0 : (ref1 = ref.toString) === null || ref1 === void 0 ? void 0 : ref1.call(ref)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
let hslMatch = value.match(HSL);
|
|
81
|
+
if (hslMatch !== null) {
|
|
82
|
+
var ref2, ref3;
|
|
83
|
+
return {
|
|
84
|
+
mode: 'hsl',
|
|
70
85
|
color: [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
hslMatch[1],
|
|
87
|
+
hslMatch[2],
|
|
88
|
+
hslMatch[3]
|
|
74
89
|
].map((v)=>v.toString()
|
|
75
90
|
),
|
|
76
|
-
alpha: (
|
|
91
|
+
alpha: (ref2 = hslMatch[4]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.toString) === null || ref3 === void 0 ? void 0 : ref3.call(ref2)
|
|
77
92
|
};
|
|
78
93
|
}
|
|
79
94
|
return null;
|
|
@@ -11,6 +11,8 @@ var _colors = _interopRequireDefault(require("../public/colors"));
|
|
|
11
11
|
var _defaults = require("./defaults");
|
|
12
12
|
var _toPath = require("./toPath");
|
|
13
13
|
var _normalizeConfig = require("./normalizeConfig");
|
|
14
|
+
var _isPlainObject = _interopRequireDefault(require("./isPlainObject"));
|
|
15
|
+
var _cloneDeep = require("./cloneDeep");
|
|
14
16
|
function _interopRequireDefault(obj) {
|
|
15
17
|
return obj && obj.__esModule ? obj : {
|
|
16
18
|
default: obj
|
|
@@ -143,7 +145,13 @@ function resolveFunctionKeys(object) {
|
|
|
143
145
|
val = val[path[index++]];
|
|
144
146
|
val = isFunction(val) ? val(resolvePath, configUtils) : val;
|
|
145
147
|
}
|
|
146
|
-
|
|
148
|
+
if (val === undefined) {
|
|
149
|
+
return defaultValue;
|
|
150
|
+
}
|
|
151
|
+
if ((0, _isPlainObject).default(val)) {
|
|
152
|
+
return (0, _cloneDeep).cloneDeep(val);
|
|
153
|
+
}
|
|
154
|
+
return val;
|
|
147
155
|
};
|
|
148
156
|
resolvePath.theme = resolvePath;
|
|
149
157
|
for(let key1 in configUtils){
|
package/lib/util/toPath.js
CHANGED
|
@@ -5,5 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
exports.toPath = toPath;
|
|
6
6
|
function toPath(path) {
|
|
7
7
|
if (Array.isArray(path)) return path;
|
|
8
|
-
|
|
8
|
+
let openBrackets = path.split('[').length - 1;
|
|
9
|
+
let closedBrackets = path.split(']').length - 1;
|
|
10
|
+
if (openBrackets !== closedBrackets) {
|
|
11
|
+
throw new Error(`Path is invalid. Has unbalanced brackets: ${path}`);
|
|
12
|
+
}
|
|
13
|
+
return path.split(/\.(?![^\[]*\])|[\[\]]/g).filter(Boolean);
|
|
9
14
|
}
|
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.fc6c27d",
|
|
4
4
|
"description": "A utility-first CSS framework for rapidly building custom user interfaces.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prepublishOnly": "npm install --force && npm run swcify",
|
|
26
26
|
"style": "eslint .",
|
|
27
27
|
"pretest": "npm run generate:plugin-list",
|
|
28
|
-
"test": "
|
|
28
|
+
"test": "jest",
|
|
29
29
|
"test:integrations": "npm run test --prefix ./integrations",
|
|
30
30
|
"install:integrations": "node scripts/install-integrations.js",
|
|
31
31
|
"posttest": "npm run style",
|
|
@@ -43,22 +43,22 @@
|
|
|
43
43
|
"*.js"
|
|
44
44
|
],
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@swc/cli": "^0.1.
|
|
46
|
+
"@swc/cli": "^0.1.55",
|
|
47
47
|
"@swc/core": "^1.2.118",
|
|
48
|
-
"@swc/jest": "^0.2.
|
|
48
|
+
"@swc/jest": "^0.2.15",
|
|
49
49
|
"@swc/register": "^0.1.7",
|
|
50
|
-
"autoprefixer": "^10.4.
|
|
50
|
+
"autoprefixer": "^10.4.1",
|
|
51
51
|
"cross-env": "^7.0.3",
|
|
52
|
-
"cssnano": "^5.0.
|
|
52
|
+
"cssnano": "^5.0.14",
|
|
53
53
|
"esbuild": "^0.14.2",
|
|
54
54
|
"eslint": "^8.4.1",
|
|
55
55
|
"eslint-config-prettier": "^8.3.0",
|
|
56
56
|
"eslint-plugin-prettier": "^4.0.0",
|
|
57
|
-
"jest": "^27.4.
|
|
57
|
+
"jest": "^27.4.5",
|
|
58
58
|
"jest-diff": "^27.4.2",
|
|
59
|
-
"postcss": "^8.4.
|
|
59
|
+
"postcss": "^8.4.5",
|
|
60
60
|
"postcss-cli": "^8.3.1",
|
|
61
|
-
"prettier": "^2.5.
|
|
61
|
+
"prettier": "^2.5.1",
|
|
62
62
|
"rimraf": "^3.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
@@ -79,14 +79,13 @@
|
|
|
79
79
|
"is-glob": "^4.0.3",
|
|
80
80
|
"normalize-path": "^3.0.0",
|
|
81
81
|
"object-hash": "^2.2.0",
|
|
82
|
-
"postcss-js": "^
|
|
82
|
+
"postcss-js": "^4.0.0",
|
|
83
83
|
"postcss-load-config": "^3.1.0",
|
|
84
84
|
"postcss-nested": "5.0.6",
|
|
85
|
-
"postcss-selector-parser": "^6.0.
|
|
85
|
+
"postcss-selector-parser": "^6.0.7",
|
|
86
86
|
"postcss-value-parser": "^4.2.0",
|
|
87
87
|
"quick-lru": "^5.1.1",
|
|
88
|
-
"resolve": "^1.20.0"
|
|
89
|
-
"tmp": "^0.2.1"
|
|
88
|
+
"resolve": "^1.20.0"
|
|
90
89
|
},
|
|
91
90
|
"browserslist": [
|
|
92
91
|
"> 1%",
|