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
package/lib/css/preflight.css
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
3. Use a more readable tab size.
|
|
24
24
|
4. Use the user's configured `sans` font-family by default.
|
|
25
25
|
5. Use the user's configured `sans` font-feature-settings by default.
|
|
26
|
+
6. Use the user's configured `sans` font-variation-settings by default.
|
|
26
27
|
*/
|
|
27
28
|
|
|
28
29
|
html {
|
|
@@ -32,6 +33,7 @@ html {
|
|
|
32
33
|
tab-size: 4; /* 3 */
|
|
33
34
|
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
34
35
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
36
|
+
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
/*
|
package/lib/featureFlags.js
CHANGED
|
@@ -9,20 +9,32 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
flagEnabled: ()
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
flagEnabled: function() {
|
|
13
|
+
return flagEnabled;
|
|
14
|
+
},
|
|
15
|
+
issueFlagNotices: function() {
|
|
16
|
+
return issueFlagNotices;
|
|
17
|
+
},
|
|
18
|
+
default: function() {
|
|
19
|
+
return _default;
|
|
20
|
+
}
|
|
15
21
|
});
|
|
16
|
-
const _picocolors = /*#__PURE__*/
|
|
17
|
-
const _log = /*#__PURE__*/
|
|
18
|
-
function
|
|
22
|
+
const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
|
|
23
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("./util/log"));
|
|
24
|
+
function _interop_require_default(obj) {
|
|
19
25
|
return obj && obj.__esModule ? obj : {
|
|
20
26
|
default: obj
|
|
21
27
|
};
|
|
22
28
|
}
|
|
23
29
|
let defaults = {
|
|
24
30
|
optimizeUniversalDefaults: false,
|
|
25
|
-
generalizedModifiers: true
|
|
31
|
+
generalizedModifiers: true,
|
|
32
|
+
get disableColorOpacityUtilitiesByDefault () {
|
|
33
|
+
return false;
|
|
34
|
+
},
|
|
35
|
+
get relativeContentPathsByDefault () {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
26
38
|
};
|
|
27
39
|
let featureFlags = {
|
|
28
40
|
future: [
|
|
@@ -38,14 +50,14 @@ let featureFlags = {
|
|
|
38
50
|
};
|
|
39
51
|
function flagEnabled(config, flag) {
|
|
40
52
|
if (featureFlags.future.includes(flag)) {
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
return config.future === "all" || ((
|
|
53
|
+
var _config_future;
|
|
54
|
+
var _config_future_flag, _ref;
|
|
55
|
+
return config.future === "all" || ((_ref = (_config_future_flag = config === null || config === void 0 ? void 0 : (_config_future = config.future) === null || _config_future === void 0 ? void 0 : _config_future[flag]) !== null && _config_future_flag !== void 0 ? _config_future_flag : defaults[flag]) !== null && _ref !== void 0 ? _ref : false);
|
|
44
56
|
}
|
|
45
57
|
if (featureFlags.experimental.includes(flag)) {
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
return config.experimental === "all" || ((
|
|
58
|
+
var _config_experimental;
|
|
59
|
+
var _config_experimental_flag, _ref1;
|
|
60
|
+
return config.experimental === "all" || ((_ref1 = (_config_experimental_flag = config === null || config === void 0 ? void 0 : (_config_experimental = config.experimental) === null || _config_experimental === void 0 ? void 0 : _config_experimental[flag]) !== null && _config_experimental_flag !== void 0 ? _config_experimental_flag : defaults[flag]) !== null && _ref1 !== void 0 ? _ref1 : false);
|
|
49
61
|
}
|
|
50
62
|
return false;
|
|
51
63
|
}
|
|
@@ -53,8 +65,8 @@ function experimentalFlagsEnabled(config) {
|
|
|
53
65
|
if (config.experimental === "all") {
|
|
54
66
|
return featureFlags.experimental;
|
|
55
67
|
}
|
|
56
|
-
var
|
|
57
|
-
return Object.keys((
|
|
68
|
+
var _config_experimental;
|
|
69
|
+
return Object.keys((_config_experimental = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config_experimental !== void 0 ? _config_experimental : {}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
58
70
|
}
|
|
59
71
|
function issueFlagNotices(config) {
|
|
60
72
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
package/lib/index.js
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
const _setupTrackingContext = /*#__PURE__*/ _interopRequireDefault(require("./lib/setupTrackingContext"));
|
|
6
|
-
const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
|
|
7
|
-
const _sharedState = require("./lib/sharedState");
|
|
8
|
-
const _findAtConfigPath = require("./lib/findAtConfigPath");
|
|
9
|
-
function _interopRequireDefault(obj) {
|
|
10
|
-
return obj && obj.__esModule ? obj : {
|
|
11
|
-
default: obj
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
module.exports = function tailwindcss(configOrPath) {
|
|
15
|
-
return {
|
|
16
|
-
postcssPlugin: "tailwindcss",
|
|
17
|
-
plugins: [
|
|
18
|
-
_sharedState.env.DEBUG && function(root) {
|
|
19
|
-
console.log("\n");
|
|
20
|
-
console.time("JIT TOTAL");
|
|
21
|
-
return root;
|
|
22
|
-
},
|
|
23
|
-
function(root, result) {
|
|
24
|
-
var ref;
|
|
25
|
-
// Use the path for the `@config` directive if it exists, otherwise use the
|
|
26
|
-
// path for the file being processed
|
|
27
|
-
configOrPath = (ref = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && ref !== void 0 ? ref : configOrPath;
|
|
28
|
-
let context = (0, _setupTrackingContext.default)(configOrPath);
|
|
29
|
-
if (root.type === "document") {
|
|
30
|
-
let roots = root.nodes.filter((node)=>node.type === "root");
|
|
31
|
-
for (const root1 of roots){
|
|
32
|
-
if (root1.type === "root") {
|
|
33
|
-
(0, _processTailwindFeatures.default)(context)(root1, result);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
(0, _processTailwindFeatures.default)(context)(root, result);
|
|
39
|
-
},
|
|
40
|
-
_sharedState.env.DEBUG && function(root) {
|
|
41
|
-
console.timeEnd("JIT TOTAL");
|
|
42
|
-
console.log("\n");
|
|
43
|
-
return root;
|
|
44
|
-
}
|
|
45
|
-
].filter(Boolean)
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
module.exports.postcss = true;
|
|
2
|
+
module.exports = require("./plugin");
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "hasContentChanged", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return hasContentChanged;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _crypto = /*#__PURE__*/
|
|
10
|
-
const _sharedState = /*#__PURE__*/
|
|
11
|
-
function
|
|
11
|
+
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
12
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
12
14
|
return obj && obj.__esModule ? obj : {
|
|
13
15
|
default: obj
|
|
14
16
|
};
|
|
@@ -21,7 +23,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
21
23
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
24
|
})(nodeInterop);
|
|
23
25
|
}
|
|
24
|
-
function
|
|
26
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
25
27
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
28
|
return obj;
|
|
27
29
|
}
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return collapseAdjacentRules;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
let comparisonMap = {
|
|
10
12
|
atrule: [
|
|
@@ -29,10 +31,10 @@ function collapseAdjacentRules() {
|
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
31
33
|
let properties = comparisonMap[node.type];
|
|
32
|
-
var
|
|
34
|
+
var _node_property, _currentRule_property;
|
|
33
35
|
if (node.type === "atrule" && node.name === "font-face") {
|
|
34
36
|
currentRule = node;
|
|
35
|
-
} else if (properties.every((property)=>((
|
|
37
|
+
} else if (properties.every((property)=>((_node_property = node[property]) !== null && _node_property !== void 0 ? _node_property : "").replace(/\s+/g, " ") === ((_currentRule_property = currentRule[property]) !== null && _currentRule_property !== void 0 ? _currentRule_property : "").replace(/\s+/g, " "))) {
|
|
36
38
|
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
37
39
|
if (node.nodes) {
|
|
38
40
|
currentRule.append(node.nodes);
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return collapseDuplicateDeclarations;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
function collapseDuplicateDeclarations() {
|
|
10
12
|
return (root)=>{
|
|
@@ -51,21 +53,21 @@ function collapseDuplicateDeclarations() {
|
|
|
51
53
|
// with the same unit but the last one in the list.
|
|
52
54
|
for (let declarations of byProperty.values()){
|
|
53
55
|
let byUnit = new Map();
|
|
54
|
-
for (let
|
|
55
|
-
let unit = resolveUnit(
|
|
56
|
+
for (let decl of declarations){
|
|
57
|
+
let unit = resolveUnit(decl.value);
|
|
56
58
|
if (unit === null) {
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
59
61
|
if (!byUnit.has(unit)) {
|
|
60
62
|
byUnit.set(unit, new Set());
|
|
61
63
|
}
|
|
62
|
-
byUnit.get(unit).add(
|
|
64
|
+
byUnit.get(unit).add(decl);
|
|
63
65
|
}
|
|
64
|
-
for (let
|
|
66
|
+
for (let declarations of byUnit.values()){
|
|
65
67
|
// Get all but the last one
|
|
66
|
-
let removableDeclarations = Array.from(
|
|
67
|
-
for (let
|
|
68
|
-
|
|
68
|
+
let removableDeclarations = Array.from(declarations).slice(0, -1);
|
|
69
|
+
for (let decl of removableDeclarations){
|
|
70
|
+
decl.remove();
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
}
|
|
@@ -76,8 +78,8 @@ let UNITLESS_NUMBER = Symbol("unitless-number");
|
|
|
76
78
|
function resolveUnit(input) {
|
|
77
79
|
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
|
78
80
|
if (result) {
|
|
79
|
-
var
|
|
80
|
-
return (
|
|
81
|
+
var _result_;
|
|
82
|
+
return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
|
|
81
83
|
}
|
|
82
84
|
return null;
|
|
83
85
|
}
|
package/lib/lib/content.js
CHANGED
|
@@ -10,17 +10,21 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
parseCandidateFiles: ()
|
|
14
|
-
|
|
13
|
+
parseCandidateFiles: function() {
|
|
14
|
+
return parseCandidateFiles;
|
|
15
|
+
},
|
|
16
|
+
resolvedChangedContent: function() {
|
|
17
|
+
return resolvedChangedContent;
|
|
18
|
+
}
|
|
15
19
|
});
|
|
16
|
-
const _fs = /*#__PURE__*/
|
|
17
|
-
const _path = /*#__PURE__*/
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
|
21
|
+
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
|
22
|
+
const _isglob = /*#__PURE__*/ _interop_require_default(require("is-glob"));
|
|
23
|
+
const _fastglob = /*#__PURE__*/ _interop_require_default(require("fast-glob"));
|
|
24
|
+
const _normalizepath = /*#__PURE__*/ _interop_require_default(require("normalize-path"));
|
|
21
25
|
const _parseGlob = require("../util/parseGlob");
|
|
22
26
|
const _sharedState = require("./sharedState");
|
|
23
|
-
function
|
|
27
|
+
function _interop_require_default(obj) {
|
|
24
28
|
return obj && obj.__esModule ? obj : {
|
|
25
29
|
default: obj
|
|
26
30
|
};
|
|
@@ -29,9 +33,9 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
29
33
|
let files = tailwindConfig.content.files;
|
|
30
34
|
// Normalize the file globs
|
|
31
35
|
files = files.filter((filePath)=>typeof filePath === "string");
|
|
32
|
-
files = files.map(
|
|
36
|
+
files = files.map(_normalizepath.default);
|
|
33
37
|
// Split into included and excluded globs
|
|
34
|
-
let tasks =
|
|
38
|
+
let tasks = _fastglob.default.generateTasks(files);
|
|
35
39
|
/** @type {ContentPath[]} */ let included = [];
|
|
36
40
|
/** @type {ContentPath[]} */ let excluded = [];
|
|
37
41
|
for (const task of tasks){
|
|
@@ -63,7 +67,7 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
63
67
|
pattern: filePath,
|
|
64
68
|
glob: null
|
|
65
69
|
};
|
|
66
|
-
if ((0,
|
|
70
|
+
if ((0, _isglob.default)(filePath)) {
|
|
67
71
|
Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
|
|
68
72
|
}
|
|
69
73
|
return contentPath;
|
|
@@ -77,10 +81,10 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
77
81
|
// Afaik, this technically shouldn't be needed but there's probably
|
|
78
82
|
// some internal, direct path matching with a normalized path in
|
|
79
83
|
// a package which can't handle mixed directory separators
|
|
80
|
-
let base = (0,
|
|
84
|
+
let base = (0, _normalizepath.default)(contentPath.base);
|
|
81
85
|
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
|
82
86
|
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
|
83
|
-
base =
|
|
87
|
+
base = _fastglob.default.escapePath(base);
|
|
84
88
|
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
|
|
85
89
|
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
|
|
86
90
|
return contentPath;
|
|
@@ -135,43 +139,43 @@ function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
|
135
139
|
content: raw,
|
|
136
140
|
extension
|
|
137
141
|
}));
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
|
|
143
|
+
for (let changedFile of changedFiles){
|
|
140
144
|
let extension = _path.default.extname(changedFile).slice(1);
|
|
141
145
|
changedContent.push({
|
|
142
|
-
|
|
146
|
+
file: changedFile,
|
|
143
147
|
extension
|
|
144
148
|
});
|
|
145
149
|
}
|
|
146
|
-
return
|
|
150
|
+
return [
|
|
151
|
+
changedContent,
|
|
152
|
+
mTimesToCommit
|
|
153
|
+
];
|
|
147
154
|
}
|
|
148
155
|
/**
|
|
149
156
|
*
|
|
150
157
|
* @param {ContentPath[]} candidateFiles
|
|
151
158
|
* @param {Map<string, number>} fileModifiedMap
|
|
152
|
-
* @returns {Set<string>}
|
|
159
|
+
* @returns {[Set<string>, Map<string, number>]}
|
|
153
160
|
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
154
161
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
162
|
+
let mTimesToCommit = new Map();
|
|
155
163
|
let changedFiles = new Set();
|
|
156
164
|
_sharedState.env.DEBUG && console.time("Finding changed files");
|
|
157
|
-
let files =
|
|
165
|
+
let files = _fastglob.default.sync(paths, {
|
|
158
166
|
absolute: true
|
|
159
167
|
});
|
|
160
168
|
for (let file of files){
|
|
161
|
-
let prevModified = fileModifiedMap.
|
|
169
|
+
let prevModified = fileModifiedMap.get(file) || -Infinity;
|
|
162
170
|
let modified = _fs.default.statSync(file).mtimeMs;
|
|
163
|
-
|
|
164
|
-
// earier in the process and we want to make sure we don't miss any changes that happen
|
|
165
|
-
// when a context dependency is also a content dependency
|
|
166
|
-
// Ideally, we'd do all this tracking at one time but that is a larger refactor
|
|
167
|
-
// than we want to commit to right now, so this is a decent compromise.
|
|
168
|
-
// This should be sufficient because file modification times will be off by at least
|
|
169
|
-
// 1ms (the precision of fstat in Node) in most cases if they exist and were changed.
|
|
170
|
-
if (modified >= prevModified) {
|
|
171
|
+
if (modified > prevModified) {
|
|
171
172
|
changedFiles.add(file);
|
|
172
|
-
|
|
173
|
+
mTimesToCommit.set(file, modified);
|
|
173
174
|
}
|
|
174
175
|
}
|
|
175
176
|
_sharedState.env.DEBUG && console.timeEnd("Finding changed files");
|
|
176
|
-
return
|
|
177
|
+
return [
|
|
178
|
+
changedFiles,
|
|
179
|
+
mTimesToCommit
|
|
180
|
+
];
|
|
177
181
|
}
|
|
@@ -4,10 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "defaultExtractor", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return defaultExtractor;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
11
|
const _featureFlags = require("../featureFlags");
|
|
10
|
-
const _regex = /*#__PURE__*/
|
|
12
|
+
const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
|
|
11
13
|
function _getRequireWildcardCache(nodeInterop) {
|
|
12
14
|
if (typeof WeakMap !== "function") return null;
|
|
13
15
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -16,7 +18,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
16
18
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
17
19
|
})(nodeInterop);
|
|
18
20
|
}
|
|
19
|
-
function
|
|
21
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
20
22
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
21
23
|
return obj;
|
|
22
24
|
}
|
|
@@ -54,10 +56,10 @@ function defaultExtractor(context) {
|
|
|
54
56
|
*/ return (content)=>{
|
|
55
57
|
/** @type {(string|string)[]} */ let results = [];
|
|
56
58
|
for (let pattern of patterns){
|
|
57
|
-
var
|
|
59
|
+
var _content_match;
|
|
58
60
|
results = [
|
|
59
61
|
...results,
|
|
60
|
-
...(
|
|
62
|
+
...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
|
|
61
63
|
];
|
|
62
64
|
}
|
|
63
65
|
return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
|
|
@@ -71,8 +73,13 @@ function* buildRegExps(context) {
|
|
|
71
73
|
_regex.escape(context.tailwindConfig.prefix)
|
|
72
74
|
])) : "";
|
|
73
75
|
let utility = _regex.any([
|
|
74
|
-
// Arbitrary properties
|
|
75
|
-
/\[[^\s:'"`]+:[^\s]+\]/,
|
|
76
|
+
// Arbitrary properties (without square brackets)
|
|
77
|
+
/\[[^\s:'"`]+:[^\s\[\]]+\]/,
|
|
78
|
+
// Arbitrary properties with balanced square brackets
|
|
79
|
+
// This is a targeted fix to continue to allow theme()
|
|
80
|
+
// with square brackets to work in arbitrary properties
|
|
81
|
+
// while fixing a problem with the regex matching too much
|
|
82
|
+
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
|
|
76
83
|
// Utilities
|
|
77
84
|
_regex.pattern([
|
|
78
85
|
// Utility Name / Group Name
|
|
@@ -216,7 +223,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
216
223
|
// This means that there was an extra closing `]`
|
|
217
224
|
// We'll clip to just before it
|
|
218
225
|
if (depth < 0) {
|
|
219
|
-
return input.substring(0, match.index);
|
|
226
|
+
return input.substring(0, match.index - 1);
|
|
220
227
|
}
|
|
221
228
|
// We've finished balancing the brackets but there still may be characters that can be included
|
|
222
229
|
// For example in the class `text-[#336699]/[.35]`
|
package/lib/lib/detectNesting.js
CHANGED
|
@@ -4,14 +4,22 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
11
|
+
function isRoot(node) {
|
|
12
|
+
return node.type === "root";
|
|
13
|
+
}
|
|
14
|
+
function isAtLayer(node) {
|
|
15
|
+
return node.type === "atrule" && node.name === "layer";
|
|
16
|
+
}
|
|
9
17
|
function _default(_context) {
|
|
10
18
|
return (root, result)=>{
|
|
11
19
|
let found = false;
|
|
12
20
|
root.walkAtRules("tailwind", (node)=>{
|
|
13
21
|
if (found) return false;
|
|
14
|
-
if (node.parent && node.parent
|
|
22
|
+
if (node.parent && !(isRoot(node.parent) || isAtLayer(node.parent))) {
|
|
15
23
|
found = true;
|
|
16
24
|
node.warn(result, [
|
|
17
25
|
"Nested @tailwind rules were detected, but are not supported.",
|
|
@@ -4,19 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
});
|
|
5
5
|
Object.defineProperty(exports, "default", {
|
|
6
6
|
enumerable: true,
|
|
7
|
-
get: ()
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
8
10
|
});
|
|
9
|
-
const _dlv = /*#__PURE__*/
|
|
10
|
-
const _didyoumean = /*#__PURE__*/
|
|
11
|
-
const _transformThemeValue = /*#__PURE__*/
|
|
12
|
-
const
|
|
11
|
+
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
|
|
12
|
+
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
|
|
13
|
+
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
|
|
14
|
+
const _postcssvalueparser = /*#__PURE__*/ _interop_require_default(require("postcss-value-parser"));
|
|
13
15
|
const _normalizeScreens = require("../util/normalizeScreens");
|
|
14
|
-
const _buildMediaQuery = /*#__PURE__*/
|
|
16
|
+
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
|
|
15
17
|
const _toPath = require("../util/toPath");
|
|
16
18
|
const _withAlphaVariable = require("../util/withAlphaVariable");
|
|
17
19
|
const _pluginUtils = require("../util/pluginUtils");
|
|
18
|
-
const _log = /*#__PURE__*/
|
|
19
|
-
function
|
|
20
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
|
|
21
|
+
function _interop_require_default(obj) {
|
|
20
22
|
return obj && obj.__esModule ? obj : {
|
|
21
23
|
default: obj
|
|
22
24
|
};
|
|
@@ -86,22 +88,22 @@ function validatePath(config, path, defaultValue, themeOpts = {}) {
|
|
|
86
88
|
};
|
|
87
89
|
}
|
|
88
90
|
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
|
|
89
|
-
let
|
|
91
|
+
let error = `'${pathString}' was found but does not resolve to a string.`;
|
|
90
92
|
if (isObject(value)) {
|
|
91
|
-
let
|
|
93
|
+
let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
|
|
92
94
|
...pathSegments,
|
|
93
95
|
key
|
|
94
96
|
]).isValid);
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
+
if (validKeys.length) {
|
|
98
|
+
error += ` Did you mean something like '${pathToString([
|
|
97
99
|
...pathSegments,
|
|
98
|
-
|
|
100
|
+
validKeys[0]
|
|
99
101
|
])}'?`;
|
|
100
102
|
}
|
|
101
103
|
}
|
|
102
104
|
return {
|
|
103
105
|
isValid: false,
|
|
104
|
-
error
|
|
106
|
+
error
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
109
|
const [themeSection] = pathSegments;
|
|
@@ -119,7 +121,7 @@ function extractArgs(node, vNodes, functions) {
|
|
|
119
121
|
if (vNode.type === "div" && vNode.value === ",") {
|
|
120
122
|
args.push("");
|
|
121
123
|
} else {
|
|
122
|
-
args[args.length - 1] +=
|
|
124
|
+
args[args.length - 1] += _postcssvalueparser.default.stringify(vNode);
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
return args;
|
|
@@ -133,7 +135,7 @@ function resolveVNode(node, vNode, functions) {
|
|
|
133
135
|
return vNode;
|
|
134
136
|
}
|
|
135
137
|
function resolveFunctions(node, input, functions) {
|
|
136
|
-
return (0,
|
|
138
|
+
return (0, _postcssvalueparser.default)(input).walk((vNode)=>{
|
|
137
139
|
resolveVNode(node, vNode, functions);
|
|
138
140
|
}).toString();
|
|
139
141
|
}
|
|
@@ -177,8 +179,8 @@ let nodeTypePropertyMap = {
|
|
|
177
179
|
alpha
|
|
178
180
|
});
|
|
179
181
|
});
|
|
180
|
-
var
|
|
181
|
-
return (
|
|
182
|
+
var _results_find;
|
|
183
|
+
return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
|
|
182
184
|
}
|
|
183
185
|
function _default(context) {
|
|
184
186
|
let config = context.tailwindConfig;
|
|
@@ -186,9 +188,9 @@ function _default(context) {
|
|
|
186
188
|
theme: (node, path, ...defaultValue)=>{
|
|
187
189
|
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
|
|
188
190
|
if (!isValid) {
|
|
189
|
-
var
|
|
191
|
+
var _parentNode_raws_tailwind;
|
|
190
192
|
let parentNode = node.parent;
|
|
191
|
-
let candidate = (
|
|
193
|
+
let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
|
|
192
194
|
if (parentNode && candidate !== undefined) {
|
|
193
195
|
// Remove this utility from any caches
|
|
194
196
|
context.markInvalidUtilityNode(parentNode);
|