tailwindcss 0.0.0-insiders.ea10bb9 → 0.0.0-insiders.ea4e1cd
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/deps.js +17 -9
- package/lib/cli/build/index.js +20 -10
- package/lib/cli/build/plugin.js +86 -70
- package/lib/cli/build/utils.js +18 -8
- package/lib/cli/build/watching.js +16 -12
- package/lib/cli/help/index.js +6 -4
- package/lib/cli/index.js +222 -10
- package/lib/cli/init/index.js +29 -12
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +4 -226
- package/lib/corePluginList.js +7 -1
- package/lib/corePlugins.js +348 -75
- package/lib/css/preflight.css +2 -0
- package/lib/featureFlags.js +27 -15
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +7 -5
- package/lib/lib/collapseAdjacentRules.js +5 -3
- package/lib/lib/collapseDuplicateDeclarations.js +12 -10
- package/lib/lib/content.js +34 -30
- package/lib/lib/defaultExtractor.js +15 -8
- package/lib/lib/detectNesting.js +10 -2
- package/lib/lib/evaluateTailwindFunctions.js +22 -20
- package/lib/lib/expandApplyAtRules.js +43 -35
- package/lib/lib/expandTailwindAtRules.js +46 -19
- package/lib/lib/findAtConfigPath.js +9 -7
- package/lib/lib/generateRules.js +157 -92
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +5 -3
- package/lib/lib/offsets.js +93 -4
- package/lib/lib/partitionApplyAtRules.js +3 -1
- package/lib/lib/regex.js +21 -7
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +28 -24
- package/lib/lib/setupContextUtils.js +190 -131
- package/lib/lib/setupTrackingContext.js +49 -26
- package/lib/lib/sharedState.js +37 -10
- package/lib/lib/substituteScreenAtRules.js +5 -3
- package/lib/oxide/cli/build/deps.js +89 -0
- package/lib/oxide/cli/build/index.js +53 -0
- package/lib/oxide/cli/build/plugin.js +375 -0
- package/lib/oxide/cli/build/utils.js +87 -0
- package/lib/oxide/cli/build/watching.js +179 -0
- package/lib/oxide/cli/help/index.js +72 -0
- package/lib/oxide/cli/index.js +214 -0
- package/lib/oxide/cli/init/index.js +52 -0
- package/lib/oxide/cli.js +5 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +98 -0
- package/lib/postcss-plugins/nesting/index.js +3 -1
- package/lib/postcss-plugins/nesting/plugin.js +10 -8
- package/lib/processTailwindFeatures.js +14 -12
- package/lib/public/colors.js +49 -25
- package/lib/public/create-plugin.js +5 -3
- package/lib/public/default-config.js +6 -4
- package/lib/public/default-theme.js +6 -4
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +6 -4
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +3 -1
- package/lib/util/buildMediaQuery.js +3 -1
- package/lib/util/cloneDeep.js +3 -1
- package/lib/util/cloneNodes.js +5 -3
- package/lib/util/color.js +30 -12
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +3 -1
- package/lib/util/createPlugin.js +3 -1
- package/lib/util/createUtilityPlugin.js +7 -5
- package/lib/util/dataTypes.js +74 -17
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +3 -1
- package/lib/util/flattenColorPalette.js +3 -1
- package/lib/util/formatVariantSelector.js +138 -160
- package/lib/util/getAllConfigs.js +8 -6
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +3 -1
- package/lib/util/isPlainObject.js +3 -1
- package/lib/util/isSyntacticallyValidPropertyValue.js +3 -1
- package/lib/util/log.js +8 -4
- package/lib/util/nameClass.js +12 -6
- package/lib/util/negateValue.js +4 -2
- package/lib/util/normalizeConfig.js +28 -27
- package/lib/util/normalizeScreens.js +12 -4
- package/lib/util/parseAnimationValue.js +3 -1
- package/lib/util/parseBoxShadowValue.js +6 -2
- package/lib/util/parseDependency.js +3 -1
- package/lib/util/parseGlob.js +6 -4
- package/lib/util/parseObjectStyles.js +9 -7
- package/lib/util/pluginUtils.js +54 -54
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +229 -0
- package/lib/util/removeAlphaVariables.js +3 -1
- package/lib/util/resolveConfig.js +17 -15
- package/lib/util/resolveConfigPath.js +26 -10
- package/lib/util/responsive.js +6 -4
- package/lib/util/splitAtTopLevelOnly.js +10 -2
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +3 -1
- package/lib/util/toPath.js +3 -1
- package/lib/util/transformThemeValue.js +6 -4
- package/lib/util/validateConfig.js +16 -3
- package/lib/util/validateFormalSyntax.js +3 -1
- package/lib/util/withAlphaVariable.js +6 -2
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +45 -37
- package/peers/index.js +63324 -46417
- package/resolveConfig.d.ts +11 -2
- package/scripts/swap-engines.js +40 -0
- package/src/cli/build/index.js +13 -9
- package/src/cli/build/plugin.js +42 -32
- package/src/cli/build/watching.js +4 -2
- package/src/cli/index.js +216 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +4 -220
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +207 -32
- package/src/css/preflight.css +2 -0
- package/src/featureFlags.js +6 -0
- package/src/index.js +1 -47
- package/src/lib/content.js +12 -17
- package/src/lib/defaultExtractor.js +9 -3
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/expandApplyAtRules.js +8 -1
- package/src/lib/expandTailwindAtRules.js +36 -7
- package/src/lib/generateRules.js +124 -42
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +31 -0
- package/src/lib/offsets.js +104 -1
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +103 -54
- package/src/lib/setupTrackingContext.js +36 -11
- package/src/lib/sharedState.js +15 -4
- 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 +442 -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 +204 -0
- package/src/oxide/cli/init/index.ts +59 -0
- package/src/oxide/cli.ts +1 -0
- package/src/oxide/postcss-plugin.ts +1 -0
- package/src/plugin.js +107 -0
- package/src/public/colors.js +22 -0
- package/src/public/default-config.js +1 -1
- package/src/public/default-theme.js +2 -2
- package/src/public/load-config.js +2 -0
- package/src/util/applyImportantSelector.js +27 -0
- package/src/util/color.js +18 -3
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +33 -4
- package/src/util/formatVariantSelector.js +160 -163
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +2 -1
- package/src/util/pluginUtils.js +16 -31
- package/src/util/prefixSelector.js +28 -10
- package/src/util/pseudoElements.js +170 -0
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +13 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +183 -146
- package/stubs/{simpleConfig.stub.js → config.simple.js} +0 -1
- package/stubs/postcss.config.js +6 -0
- package/stubs/tailwind.config.cjs +2 -0
- package/stubs/tailwind.config.js +2 -0
- package/stubs/tailwind.config.ts +3 -0
- package/types/config.d.ts +15 -9
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +108 -79
- package/CHANGELOG.md +0 -2336
- package/lib/cli/shared.js +0 -12
- package/lib/constants.js +0 -44
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/shared.js +0 -5
- package/src/constants.js +0 -17
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
|
@@ -9,36 +9,46 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
isValidVariantFormatString: ()
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
isValidVariantFormatString: function() {
|
|
13
|
+
return isValidVariantFormatString;
|
|
14
|
+
},
|
|
15
|
+
parseVariant: function() {
|
|
16
|
+
return parseVariant;
|
|
17
|
+
},
|
|
18
|
+
getFileModifiedMap: function() {
|
|
19
|
+
return getFileModifiedMap;
|
|
20
|
+
},
|
|
21
|
+
createContext: function() {
|
|
22
|
+
return createContext;
|
|
23
|
+
},
|
|
24
|
+
getContext: function() {
|
|
25
|
+
return getContext;
|
|
26
|
+
}
|
|
17
27
|
});
|
|
18
|
-
const _fs = /*#__PURE__*/
|
|
19
|
-
const _url = /*#__PURE__*/
|
|
20
|
-
const _postcss = /*#__PURE__*/
|
|
21
|
-
const _dlv = /*#__PURE__*/
|
|
22
|
-
const
|
|
23
|
-
const _transformThemeValue = /*#__PURE__*/
|
|
24
|
-
const _parseObjectStyles = /*#__PURE__*/
|
|
25
|
-
const _prefixSelector = /*#__PURE__*/
|
|
26
|
-
const _isPlainObject = /*#__PURE__*/
|
|
27
|
-
const _escapeClassName = /*#__PURE__*/
|
|
28
|
-
const _nameClass = /*#__PURE__*/
|
|
28
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
29
|
+
const _url = /*#__PURE__*/ _interop_require_default(require("url"));
|
|
30
|
+
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
|
31
|
+
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
32
|
+
const _postcssselectorparser = /*#__PURE__*/ _interop_require_default(require("postcss-selector-parser"));
|
|
33
|
+
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
34
|
+
const _parseObjectStyles = /*#__PURE__*/ _interop_require_default(require("../util/parseObjectStyles"));
|
|
35
|
+
const _prefixSelector = /*#__PURE__*/ _interop_require_default(require("../util/prefixSelector"));
|
|
36
|
+
const _isPlainObject = /*#__PURE__*/ _interop_require_default(require("../util/isPlainObject"));
|
|
37
|
+
const _escapeClassName = /*#__PURE__*/ _interop_require_default(require("../util/escapeClassName"));
|
|
38
|
+
const _nameClass = /*#__PURE__*/ _interop_require_wildcard(require("../util/nameClass"));
|
|
29
39
|
const _pluginUtils = require("../util/pluginUtils");
|
|
30
40
|
const _corePlugins = require("../corePlugins");
|
|
31
|
-
const _sharedState = /*#__PURE__*/
|
|
41
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
32
42
|
const _toPath = require("../util/toPath");
|
|
33
|
-
const _log = /*#__PURE__*/
|
|
34
|
-
const _negateValue = /*#__PURE__*/
|
|
35
|
-
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/
|
|
43
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
44
|
+
const _negateValue = /*#__PURE__*/ _interop_require_default(require("../util/negateValue"));
|
|
45
|
+
const _isSyntacticallyValidPropertyValue = /*#__PURE__*/ _interop_require_default(require("../util/isSyntacticallyValidPropertyValue"));
|
|
36
46
|
const _generateRules = require("./generateRules");
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
47
|
+
const _cacheInvalidation = require("./cacheInvalidation.js");
|
|
48
|
+
const _offsets = require("./offsets.js");
|
|
49
|
+
const _featureFlags = require("../featureFlags.js");
|
|
40
50
|
const _formatVariantSelector = require("../util/formatVariantSelector");
|
|
41
|
-
function
|
|
51
|
+
function _interop_require_default(obj) {
|
|
42
52
|
return obj && obj.__esModule ? obj : {
|
|
43
53
|
default: obj
|
|
44
54
|
};
|
|
@@ -51,7 +61,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
51
61
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
52
62
|
})(nodeInterop);
|
|
53
63
|
}
|
|
54
|
-
function
|
|
64
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
55
65
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
56
66
|
return obj;
|
|
57
67
|
}
|
|
@@ -113,27 +123,41 @@ function normalizeOptionTypes({ type ="any" , ...options }) {
|
|
|
113
123
|
};
|
|
114
124
|
}
|
|
115
125
|
function parseVariantFormatString(input) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
/** @type {string[]} */ let parts = [];
|
|
127
|
+
// When parsing whitespace around special characters are insignificant
|
|
128
|
+
// However, _inside_ of a variant they could be
|
|
129
|
+
// Because the selector could look like this
|
|
130
|
+
// @media { &[data-name="foo bar"] }
|
|
131
|
+
// This is why we do not skip whitespace
|
|
132
|
+
let current = "";
|
|
133
|
+
let depth = 0;
|
|
134
|
+
for(let idx = 0; idx < input.length; idx++){
|
|
135
|
+
let char = input[idx];
|
|
136
|
+
if (char === "\\") {
|
|
137
|
+
// Escaped characters are not special
|
|
138
|
+
current += "\\" + input[++idx];
|
|
139
|
+
} else if (char === "{") {
|
|
140
|
+
// Nested rule: start
|
|
141
|
+
++depth;
|
|
142
|
+
parts.push(current.trim());
|
|
143
|
+
current = "";
|
|
129
144
|
} else if (char === "}") {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
;
|
|
145
|
+
// Nested rule: end
|
|
146
|
+
if (--depth < 0) {
|
|
147
|
+
throw new Error(`Your { and } are unbalanced.`);
|
|
133
148
|
}
|
|
149
|
+
parts.push(current.trim());
|
|
150
|
+
current = "";
|
|
151
|
+
} else {
|
|
152
|
+
// Normal character
|
|
153
|
+
current += char;
|
|
134
154
|
}
|
|
135
155
|
}
|
|
136
|
-
|
|
156
|
+
if (current.length > 0) {
|
|
157
|
+
parts.push(current.trim());
|
|
158
|
+
}
|
|
159
|
+
parts = parts.filter((part)=>part !== "");
|
|
160
|
+
return parts;
|
|
137
161
|
}
|
|
138
162
|
function insertInto(list, value, { before =[] } = {}) {
|
|
139
163
|
before = [].concat(before);
|
|
@@ -161,7 +185,7 @@ function parseStyles(styles) {
|
|
|
161
185
|
});
|
|
162
186
|
}
|
|
163
187
|
function getClasses(selector, mutate) {
|
|
164
|
-
let parser = (0,
|
|
188
|
+
let parser = (0, _postcssselectorparser.default)((selectors)=>{
|
|
165
189
|
let allClasses = [];
|
|
166
190
|
if (mutate) {
|
|
167
191
|
mutate(selectors);
|
|
@@ -281,26 +305,20 @@ function parseVariant(variant) {
|
|
|
281
305
|
return context.tailwindConfig.prefix + identifier;
|
|
282
306
|
}
|
|
283
307
|
function resolveThemeValue(path, defaultValue, opts = {}) {
|
|
284
|
-
|
|
285
|
-
|
|
308
|
+
let parts = (0, _toPath.toPath)(path);
|
|
309
|
+
let value = getConfigValue([
|
|
286
310
|
"theme",
|
|
287
|
-
|
|
288
|
-
...subPaths
|
|
311
|
+
...parts
|
|
289
312
|
], defaultValue);
|
|
290
|
-
return (0, _transformThemeValue.default)(
|
|
313
|
+
return (0, _transformThemeValue.default)(parts[0])(value, opts);
|
|
291
314
|
}
|
|
292
|
-
const theme = Object.assign((path, defaultValue = undefined)=>resolveThemeValue(path, defaultValue), {
|
|
293
|
-
withAlpha: (path, opacityValue)=>resolveThemeValue(path, undefined, {
|
|
294
|
-
opacityValue
|
|
295
|
-
})
|
|
296
|
-
});
|
|
297
315
|
let variantIdentifier = 0;
|
|
298
316
|
let api = {
|
|
299
317
|
postcss: _postcss.default,
|
|
300
318
|
prefix: applyConfiguredPrefix,
|
|
301
319
|
e: _escapeClassName.default,
|
|
302
320
|
config: getConfigValue,
|
|
303
|
-
theme,
|
|
321
|
+
theme: resolveThemeValue,
|
|
304
322
|
corePlugins: (path)=>{
|
|
305
323
|
if (Array.isArray(tailwindConfig.corePlugins)) {
|
|
306
324
|
return tailwindConfig.corePlugins.includes(path);
|
|
@@ -443,7 +461,7 @@ function parseVariant(variant) {
|
|
|
443
461
|
return utilityModifier;
|
|
444
462
|
}
|
|
445
463
|
};
|
|
446
|
-
let modifiersEnabled = (0,
|
|
464
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
447
465
|
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
448
466
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
449
467
|
}));
|
|
@@ -509,7 +527,7 @@ function parseVariant(variant) {
|
|
|
509
527
|
return utilityModifier;
|
|
510
528
|
}
|
|
511
529
|
};
|
|
512
|
-
let modifiersEnabled = (0,
|
|
530
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
513
531
|
let ruleSets = [].concat(modifiersEnabled ? rule(value, extras) : rule(value)).filter(Boolean).map((declaration)=>({
|
|
514
532
|
[(0, _nameClass.default)(identifier, modifier)]: declaration
|
|
515
533
|
}));
|
|
@@ -565,14 +583,14 @@ function parseVariant(variant) {
|
|
|
565
583
|
context.variantOptions.set(variantName, options);
|
|
566
584
|
},
|
|
567
585
|
matchVariant (variant, variantFn, options) {
|
|
568
|
-
var
|
|
586
|
+
var _options_id;
|
|
569
587
|
// A unique identifier that "groups" these variants together.
|
|
570
588
|
// This is for internal use only which is why it is not present in the types
|
|
571
|
-
let id = (
|
|
589
|
+
let id = (_options_id = options === null || options === void 0 ? void 0 : options.id) !== null && _options_id !== void 0 ? _options_id : ++variantIdentifier;
|
|
572
590
|
let isSpecial = variant === "@";
|
|
573
|
-
let modifiersEnabled = (0,
|
|
574
|
-
var
|
|
575
|
-
for (let [key, value] of Object.entries((
|
|
591
|
+
let modifiersEnabled = (0, _featureFlags.flagEnabled)(tailwindConfig, "generalizedModifiers");
|
|
592
|
+
var _options_values;
|
|
593
|
+
for (let [key, value] of Object.entries((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {})){
|
|
576
594
|
if (key === "DEFAULT") continue;
|
|
577
595
|
api.addVariant(isSpecial ? `${variant}${key}` : `${variant}-${key}`, ({ args , container })=>{
|
|
578
596
|
return variantFn(value, modifiersEnabled ? {
|
|
@@ -589,15 +607,15 @@ function parseVariant(variant) {
|
|
|
589
607
|
variantInfo: VARIANT_INFO.Base
|
|
590
608
|
});
|
|
591
609
|
}
|
|
592
|
-
var
|
|
593
|
-
let hasDefault = "DEFAULT" in ((
|
|
610
|
+
var _options_values1;
|
|
611
|
+
let hasDefault = "DEFAULT" in ((_options_values1 = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {});
|
|
594
612
|
api.addVariant(variant, ({ args , container })=>{
|
|
595
613
|
if ((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE && !hasDefault) {
|
|
596
614
|
return null;
|
|
597
615
|
}
|
|
598
616
|
var // (JetBrains) plugins.
|
|
599
|
-
|
|
600
|
-
return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (
|
|
617
|
+
_args_value;
|
|
618
|
+
return variantFn((args === null || args === void 0 ? void 0 : args.value) === _sharedState.NONE ? options.values.DEFAULT : (_args_value = args === null || args === void 0 ? void 0 : args.value) !== null && _args_value !== void 0 ? _args_value : typeof args === "string" ? args : "", modifiersEnabled ? {
|
|
601
619
|
modifier: args === null || args === void 0 ? void 0 : args.modifier,
|
|
602
620
|
container
|
|
603
621
|
} : {
|
|
@@ -622,24 +640,28 @@ function getFileModifiedMap(context) {
|
|
|
622
640
|
}
|
|
623
641
|
function trackModified(files, fileModifiedMap) {
|
|
624
642
|
let changed = false;
|
|
643
|
+
let mtimesToCommit = new Map();
|
|
625
644
|
for (let file of files){
|
|
626
|
-
var
|
|
645
|
+
var _fs_statSync;
|
|
627
646
|
if (!file) continue;
|
|
628
647
|
let parsed = _url.default.parse(file);
|
|
629
648
|
let pathname = parsed.hash ? parsed.href.replace(parsed.hash, "") : parsed.href;
|
|
630
649
|
pathname = parsed.search ? pathname.replace(parsed.search, "") : pathname;
|
|
631
|
-
let newModified = (
|
|
650
|
+
let newModified = (_fs_statSync = _fs.default.statSync(decodeURIComponent(pathname), {
|
|
632
651
|
throwIfNoEntry: false
|
|
633
|
-
})) === null ||
|
|
652
|
+
})) === null || _fs_statSync === void 0 ? void 0 : _fs_statSync.mtimeMs;
|
|
634
653
|
if (!newModified) {
|
|
635
654
|
continue;
|
|
636
655
|
}
|
|
637
656
|
if (!fileModifiedMap.has(file) || newModified > fileModifiedMap.get(file)) {
|
|
638
657
|
changed = true;
|
|
639
658
|
}
|
|
640
|
-
|
|
659
|
+
mtimesToCommit.set(file, newModified);
|
|
641
660
|
}
|
|
642
|
-
return
|
|
661
|
+
return [
|
|
662
|
+
changed,
|
|
663
|
+
mtimesToCommit
|
|
664
|
+
];
|
|
643
665
|
}
|
|
644
666
|
function extractVariantAtRules(node) {
|
|
645
667
|
node.walkAtRules((atRule)=>{
|
|
@@ -677,9 +699,9 @@ function collectLayerPlugins(root) {
|
|
|
677
699
|
}
|
|
678
700
|
layerRule.remove();
|
|
679
701
|
} else if (layerRule.params === "components") {
|
|
680
|
-
for (let
|
|
702
|
+
for (let node of layerRule.nodes){
|
|
681
703
|
layerPlugins.push(function({ addComponents }) {
|
|
682
|
-
addComponents(
|
|
704
|
+
addComponents(node, {
|
|
683
705
|
respectPrefix: false,
|
|
684
706
|
preserveSource: true
|
|
685
707
|
});
|
|
@@ -687,9 +709,9 @@ function collectLayerPlugins(root) {
|
|
|
687
709
|
}
|
|
688
710
|
layerRule.remove();
|
|
689
711
|
} else if (layerRule.params === "utilities") {
|
|
690
|
-
for (let
|
|
712
|
+
for (let node of layerRule.nodes){
|
|
691
713
|
layerPlugins.push(function({ addUtilities }) {
|
|
692
|
-
addUtilities(
|
|
714
|
+
addUtilities(node, {
|
|
693
715
|
respectPrefix: false,
|
|
694
716
|
preserveSource: true
|
|
695
717
|
});
|
|
@@ -747,7 +769,7 @@ function registerPlugins(plugins, context) {
|
|
|
747
769
|
let variantList = [];
|
|
748
770
|
let variantMap = new Map();
|
|
749
771
|
context.variantMap = variantMap;
|
|
750
|
-
let offsets = new
|
|
772
|
+
let offsets = new _offsets.Offsets();
|
|
751
773
|
context.offsets = offsets;
|
|
752
774
|
let classList = new Set();
|
|
753
775
|
let pluginApi = buildPluginApi(context.tailwindConfig, context, {
|
|
@@ -774,8 +796,8 @@ function registerPlugins(plugins, context) {
|
|
|
774
796
|
variantFunction
|
|
775
797
|
]));
|
|
776
798
|
}
|
|
777
|
-
var
|
|
778
|
-
let safelist = ((
|
|
799
|
+
var _context_tailwindConfig_safelist;
|
|
800
|
+
let safelist = ((_context_tailwindConfig_safelist = context.tailwindConfig.safelist) !== null && _context_tailwindConfig_safelist !== void 0 ? _context_tailwindConfig_safelist : []).filter(Boolean);
|
|
779
801
|
if (safelist.length > 0) {
|
|
780
802
|
let checks = [];
|
|
781
803
|
for (let value of safelist){
|
|
@@ -803,8 +825,8 @@ function registerPlugins(plugins, context) {
|
|
|
803
825
|
for (let util of classList){
|
|
804
826
|
let utils = Array.isArray(util) ? (()=>{
|
|
805
827
|
let [utilName, options] = util;
|
|
806
|
-
var
|
|
807
|
-
let values = Object.keys((
|
|
828
|
+
var _options_values;
|
|
829
|
+
let values = Object.keys((_options_values = options === null || options === void 0 ? void 0 : options.values) !== null && _options_values !== void 0 ? _options_values : {});
|
|
808
830
|
let classes = values.map((value)=>(0, _nameClass.formatClass)(utilName, value));
|
|
809
831
|
if (options === null || options === void 0 ? void 0 : options.supportsNegativeValues) {
|
|
810
832
|
// This is the normal negated version
|
|
@@ -838,7 +860,7 @@ function registerPlugins(plugins, context) {
|
|
|
838
860
|
})() : [
|
|
839
861
|
util
|
|
840
862
|
];
|
|
841
|
-
for (let
|
|
863
|
+
for (let util of utils){
|
|
842
864
|
for (let { pattern , variants =[] } of checks){
|
|
843
865
|
// RegExp with the /g flag are stateful, so let's reset the last
|
|
844
866
|
// index pointer to reset the state.
|
|
@@ -846,15 +868,15 @@ function registerPlugins(plugins, context) {
|
|
|
846
868
|
if (!patternMatchingCount.has(pattern)) {
|
|
847
869
|
patternMatchingCount.set(pattern, 0);
|
|
848
870
|
}
|
|
849
|
-
if (!pattern.test(
|
|
871
|
+
if (!pattern.test(util)) continue;
|
|
850
872
|
patternMatchingCount.set(pattern, patternMatchingCount.get(pattern) + 1);
|
|
851
873
|
context.changedContent.push({
|
|
852
|
-
content:
|
|
874
|
+
content: util,
|
|
853
875
|
extension: "html"
|
|
854
876
|
});
|
|
855
877
|
for (let variant of variants){
|
|
856
878
|
context.changedContent.push({
|
|
857
|
-
content: variant + context.tailwindConfig.separator +
|
|
879
|
+
content: variant + context.tailwindConfig.separator + util,
|
|
858
880
|
extension: "html"
|
|
859
881
|
});
|
|
860
882
|
}
|
|
@@ -871,8 +893,8 @@ function registerPlugins(plugins, context) {
|
|
|
871
893
|
}
|
|
872
894
|
}
|
|
873
895
|
}
|
|
874
|
-
var
|
|
875
|
-
let darkClassName = (
|
|
896
|
+
var _context_tailwindConfig_darkMode, _concat_;
|
|
897
|
+
let darkClassName = (_concat_ = [].concat((_context_tailwindConfig_darkMode = context.tailwindConfig.darkMode) !== null && _context_tailwindConfig_darkMode !== void 0 ? _context_tailwindConfig_darkMode : "media")[1]) !== null && _concat_ !== void 0 ? _concat_ : "dark";
|
|
876
898
|
// A list of utilities that are used by certain Tailwind CSS utilities but
|
|
877
899
|
// that don't exist on their own. This will result in them "not existing" and
|
|
878
900
|
// sorting could be weird since you still require them in order to make the
|
|
@@ -883,22 +905,30 @@ function registerPlugins(plugins, context) {
|
|
|
883
905
|
prefix(context, "peer")
|
|
884
906
|
];
|
|
885
907
|
context.getClassOrder = function getClassOrder(classes) {
|
|
908
|
+
// Sort classes so they're ordered in a deterministic manner
|
|
909
|
+
let sorted = [
|
|
910
|
+
...classes
|
|
911
|
+
].sort((a, z)=>{
|
|
912
|
+
if (a === z) return 0;
|
|
913
|
+
if (a < z) return -1;
|
|
914
|
+
return 1;
|
|
915
|
+
});
|
|
886
916
|
// Non-util classes won't be generated, so we default them to null
|
|
887
|
-
let sortedClassNames = new Map(
|
|
917
|
+
let sortedClassNames = new Map(sorted.map((className)=>[
|
|
888
918
|
className,
|
|
889
919
|
null
|
|
890
920
|
]));
|
|
891
921
|
// Sort all classes in order
|
|
892
922
|
// Non-tailwind classes won't be generated and will be left as `null`
|
|
893
|
-
let rules = (0, _generateRules.generateRules)(new Set(
|
|
923
|
+
let rules = (0, _generateRules.generateRules)(new Set(sorted), context);
|
|
894
924
|
rules = context.offsets.sort(rules);
|
|
895
925
|
let idx = BigInt(parasiteUtilities.length);
|
|
896
926
|
for (const [, rule] of rules){
|
|
897
927
|
sortedClassNames.set(rule.raws.tailwind.candidate, idx++);
|
|
898
928
|
}
|
|
899
929
|
return classes.map((className)=>{
|
|
900
|
-
var
|
|
901
|
-
let order = (
|
|
930
|
+
var _sortedClassNames_get;
|
|
931
|
+
let order = (_sortedClassNames_get = sortedClassNames.get(className)) !== null && _sortedClassNames_get !== void 0 ? _sortedClassNames_get : null;
|
|
902
932
|
let parasiteIndex = parasiteUtilities.indexOf(className);
|
|
903
933
|
if (order === null && parasiteIndex !== -1) {
|
|
904
934
|
// This will make sure that it is at the very beginning of the
|
|
@@ -914,21 +944,40 @@ function registerPlugins(plugins, context) {
|
|
|
914
944
|
};
|
|
915
945
|
// Generate a list of strings for autocompletion purposes, e.g.
|
|
916
946
|
// ['uppercase', 'lowercase', ...]
|
|
917
|
-
context.getClassList = function getClassList() {
|
|
947
|
+
context.getClassList = function getClassList(options = {}) {
|
|
918
948
|
let output = [];
|
|
919
949
|
for (let util of classList){
|
|
920
950
|
if (Array.isArray(util)) {
|
|
921
|
-
|
|
951
|
+
var _utilOptions_types;
|
|
952
|
+
let [utilName, utilOptions] = util;
|
|
922
953
|
let negativeClasses = [];
|
|
923
|
-
var
|
|
924
|
-
|
|
954
|
+
var _utilOptions_modifiers;
|
|
955
|
+
let modifiers = Object.keys((_utilOptions_modifiers = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.modifiers) !== null && _utilOptions_modifiers !== void 0 ? _utilOptions_modifiers : {});
|
|
956
|
+
if (utilOptions === null || utilOptions === void 0 ? void 0 : (_utilOptions_types = utilOptions.types) === null || _utilOptions_types === void 0 ? void 0 : _utilOptions_types.some(({ type })=>type === "color")) {
|
|
957
|
+
var _context_tailwindConfig_theme_opacity;
|
|
958
|
+
modifiers.push(...Object.keys((_context_tailwindConfig_theme_opacity = context.tailwindConfig.theme.opacity) !== null && _context_tailwindConfig_theme_opacity !== void 0 ? _context_tailwindConfig_theme_opacity : {}));
|
|
959
|
+
}
|
|
960
|
+
let metadata = {
|
|
961
|
+
modifiers
|
|
962
|
+
};
|
|
963
|
+
let includeMetadata = options.includeMetadata && modifiers.length > 0;
|
|
964
|
+
var _utilOptions_values;
|
|
965
|
+
for (let [key, value] of Object.entries((_utilOptions_values = utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.values) !== null && _utilOptions_values !== void 0 ? _utilOptions_values : {})){
|
|
925
966
|
// Ignore undefined and null values
|
|
926
967
|
if (value == null) {
|
|
927
968
|
continue;
|
|
928
969
|
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
970
|
+
let cls = (0, _nameClass.formatClass)(utilName, key);
|
|
971
|
+
output.push(includeMetadata ? [
|
|
972
|
+
cls,
|
|
973
|
+
metadata
|
|
974
|
+
] : cls);
|
|
975
|
+
if ((utilOptions === null || utilOptions === void 0 ? void 0 : utilOptions.supportsNegativeValues) && (0, _negateValue.default)(value)) {
|
|
976
|
+
let cls = (0, _nameClass.formatClass)(utilName, `-${key}`);
|
|
977
|
+
negativeClasses.push(includeMetadata ? [
|
|
978
|
+
cls,
|
|
979
|
+
metadata
|
|
980
|
+
] : cls);
|
|
932
981
|
}
|
|
933
982
|
}
|
|
934
983
|
output.push(...negativeClasses);
|
|
@@ -943,11 +992,11 @@ function registerPlugins(plugins, context) {
|
|
|
943
992
|
let result = [];
|
|
944
993
|
for (let [name, options] of context.variantOptions.entries()){
|
|
945
994
|
if (options.variantInfo === VARIANT_INFO.Base) continue;
|
|
946
|
-
var
|
|
995
|
+
var _options_values;
|
|
947
996
|
result.push({
|
|
948
997
|
name,
|
|
949
998
|
isArbitrary: options.type === Symbol.for("MATCH_VARIANT"),
|
|
950
|
-
values: Object.keys((
|
|
999
|
+
values: Object.keys((_options_values = options.values) !== null && _options_values !== void 0 ? _options_values : {}),
|
|
951
1000
|
hasDash: name !== "@",
|
|
952
1001
|
selectors ({ modifier , value } = {}) {
|
|
953
1002
|
let candidate = "__TAILWIND_PLACEHOLDER__";
|
|
@@ -960,17 +1009,17 @@ function registerPlugins(plugins, context) {
|
|
|
960
1009
|
]
|
|
961
1010
|
});
|
|
962
1011
|
let before = container.toString();
|
|
963
|
-
var
|
|
964
|
-
let fns = ((
|
|
1012
|
+
var _context_variantMap_get;
|
|
1013
|
+
let fns = ((_context_variantMap_get = context.variantMap.get(name)) !== null && _context_variantMap_get !== void 0 ? _context_variantMap_get : []).flatMap(([_, fn])=>fn);
|
|
965
1014
|
let formatStrings = [];
|
|
966
1015
|
for (let fn of fns){
|
|
967
|
-
var
|
|
1016
|
+
var _options_values;
|
|
968
1017
|
let localFormatStrings = [];
|
|
969
|
-
var
|
|
1018
|
+
var _options_values_value;
|
|
970
1019
|
let api = {
|
|
971
1020
|
args: {
|
|
972
1021
|
modifier,
|
|
973
|
-
value: (
|
|
1022
|
+
value: (_options_values_value = (_options_values = options.values) === null || _options_values === void 0 ? void 0 : _options_values[value]) !== null && _options_values_value !== void 0 ? _options_values_value : value
|
|
974
1023
|
},
|
|
975
1024
|
separator: context.tailwindConfig.separator,
|
|
976
1025
|
modifySelectors (modifierFunction) {
|
|
@@ -1021,7 +1070,7 @@ function registerPlugins(plugins, context) {
|
|
|
1021
1070
|
// as well. E.g.: `${variant}${separator}${className}`.
|
|
1022
1071
|
// However, plugin authors probably also prepend or append certain
|
|
1023
1072
|
// classes, pseudos, ids, ...
|
|
1024
|
-
let rebuiltBase = (0,
|
|
1073
|
+
let rebuiltBase = (0, _postcssselectorparser.default)((selectors)=>{
|
|
1025
1074
|
selectors.walkClasses((classNode)=>{
|
|
1026
1075
|
classNode.value = `${name}${context.tailwindConfig.separator}${classNode.value}`;
|
|
1027
1076
|
});
|
|
@@ -1044,15 +1093,23 @@ function registerPlugins(plugins, context) {
|
|
|
1044
1093
|
manualFormatStrings.push(`@${atrule.name} (${atrule.params}) { & }`);
|
|
1045
1094
|
});
|
|
1046
1095
|
}
|
|
1047
|
-
var
|
|
1048
|
-
let
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1096
|
+
var _options_values1;
|
|
1097
|
+
let isArbitraryVariant = !(value in ((_options_values1 = options.values) !== null && _options_values1 !== void 0 ? _options_values1 : {}));
|
|
1098
|
+
formatStrings = formatStrings.map((format)=>format.map((str)=>({
|
|
1099
|
+
format: str,
|
|
1100
|
+
isArbitraryVariant
|
|
1101
|
+
})));
|
|
1102
|
+
manualFormatStrings = manualFormatStrings.map((format)=>({
|
|
1103
|
+
format,
|
|
1104
|
+
isArbitraryVariant
|
|
1105
|
+
}));
|
|
1106
|
+
let opts = {
|
|
1107
|
+
candidate,
|
|
1108
|
+
context
|
|
1109
|
+
};
|
|
1110
|
+
let result = formatStrings.map((formats)=>(0, _formatVariantSelector.finalizeSelector)(`.${candidate}`, (0, _formatVariantSelector.formatVariantSelector)(formats, opts), opts).replace(`.${candidate}`, "&").replace("{ & }", "").trim());
|
|
1054
1111
|
if (manualFormatStrings.length > 0) {
|
|
1055
|
-
result.push((0, _formatVariantSelector.formatVariantSelector)("&"
|
|
1112
|
+
result.push((0, _formatVariantSelector.formatVariantSelector)(manualFormatStrings, opts).toString().replace(`.${candidate}`, "&"));
|
|
1056
1113
|
}
|
|
1057
1114
|
return result;
|
|
1058
1115
|
}
|
|
@@ -1098,7 +1155,7 @@ function registerPlugins(plugins, context) {
|
|
|
1098
1155
|
markInvalidUtilityCandidate(context, candidate);
|
|
1099
1156
|
}
|
|
1100
1157
|
function createContext(tailwindConfig, changedContent = [], root = _postcss.default.root()) {
|
|
1101
|
-
var
|
|
1158
|
+
var _tailwindConfig_blocklist;
|
|
1102
1159
|
let context = {
|
|
1103
1160
|
disposables: [],
|
|
1104
1161
|
ruleCache: new Set(),
|
|
@@ -1106,7 +1163,7 @@ function createContext(tailwindConfig, changedContent = [], root = _postcss.defa
|
|
|
1106
1163
|
classCache: new Map(),
|
|
1107
1164
|
applyClassCache: new Map(),
|
|
1108
1165
|
// Seed the not class cache with the blocklist (which is only strings)
|
|
1109
|
-
notClassCache: new Set((
|
|
1166
|
+
notClassCache: new Set((_tailwindConfig_blocklist = tailwindConfig.blocklist) !== null && _tailwindConfig_blocklist !== void 0 ? _tailwindConfig_blocklist : []),
|
|
1110
1167
|
postCssNodeCache: new Map(),
|
|
1111
1168
|
candidateRuleMap: new Map(),
|
|
1112
1169
|
tailwindConfig,
|
|
@@ -1137,17 +1194,18 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1137
1194
|
contextMap.set(sourcePath, context);
|
|
1138
1195
|
existingContext = context;
|
|
1139
1196
|
}
|
|
1140
|
-
let cssDidChange = (0,
|
|
1197
|
+
let cssDidChange = (0, _cacheInvalidation.hasContentChanged)(sourcePath, root);
|
|
1141
1198
|
// If there's already a context in the cache and we don't need to
|
|
1142
1199
|
// reset the context, return the cached context.
|
|
1143
1200
|
if (existingContext) {
|
|
1144
|
-
let contextDependenciesChanged = trackModified([
|
|
1201
|
+
let [contextDependenciesChanged, mtimesToCommit] = trackModified([
|
|
1145
1202
|
...contextDependencies
|
|
1146
1203
|
], getFileModifiedMap(existingContext));
|
|
1147
1204
|
if (!contextDependenciesChanged && !cssDidChange) {
|
|
1148
1205
|
return [
|
|
1149
1206
|
existingContext,
|
|
1150
|
-
false
|
|
1207
|
+
false,
|
|
1208
|
+
mtimesToCommit
|
|
1151
1209
|
];
|
|
1152
1210
|
}
|
|
1153
1211
|
}
|
|
@@ -1162,9 +1220,9 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1162
1220
|
contextSourcesMap.get(oldContext).delete(sourcePath);
|
|
1163
1221
|
if (contextSourcesMap.get(oldContext).size === 0) {
|
|
1164
1222
|
contextSourcesMap.delete(oldContext);
|
|
1165
|
-
for (let [
|
|
1166
|
-
if (
|
|
1167
|
-
configContextMap.delete(
|
|
1223
|
+
for (let [tailwindConfigHash, context] of configContextMap){
|
|
1224
|
+
if (context === oldContext) {
|
|
1225
|
+
configContextMap.delete(tailwindConfigHash);
|
|
1168
1226
|
}
|
|
1169
1227
|
}
|
|
1170
1228
|
for (let disposable of oldContext.disposables.splice(0)){
|
|
@@ -1174,23 +1232,24 @@ function getContext(root, result, tailwindConfig, userConfigPath, tailwindConfig
|
|
|
1174
1232
|
}
|
|
1175
1233
|
}
|
|
1176
1234
|
_sharedState.env.DEBUG && console.log("Setting up new context...");
|
|
1177
|
-
let
|
|
1178
|
-
Object.assign(
|
|
1235
|
+
let context = createContext(tailwindConfig, [], root);
|
|
1236
|
+
Object.assign(context, {
|
|
1179
1237
|
userConfigPath
|
|
1180
1238
|
});
|
|
1181
|
-
trackModified([
|
|
1239
|
+
let [, mtimesToCommit] = trackModified([
|
|
1182
1240
|
...contextDependencies
|
|
1183
|
-
], getFileModifiedMap(
|
|
1241
|
+
], getFileModifiedMap(context));
|
|
1184
1242
|
// ---
|
|
1185
1243
|
// Update all context tracking state
|
|
1186
|
-
configContextMap.set(tailwindConfigHash,
|
|
1187
|
-
contextMap.set(sourcePath,
|
|
1188
|
-
if (!contextSourcesMap.has(
|
|
1189
|
-
contextSourcesMap.set(
|
|
1244
|
+
configContextMap.set(tailwindConfigHash, context);
|
|
1245
|
+
contextMap.set(sourcePath, context);
|
|
1246
|
+
if (!contextSourcesMap.has(context)) {
|
|
1247
|
+
contextSourcesMap.set(context, new Set());
|
|
1190
1248
|
}
|
|
1191
|
-
contextSourcesMap.get(
|
|
1249
|
+
contextSourcesMap.get(context).add(sourcePath);
|
|
1192
1250
|
return [
|
|
1193
|
-
|
|
1194
|
-
true
|
|
1251
|
+
context,
|
|
1252
|
+
true,
|
|
1253
|
+
mtimesToCommit
|
|
1195
1254
|
];
|
|
1196
1255
|
}
|