tailwindcss 0.0.0-insiders.d33b650 → 0.0.0-insiders.d3f2221
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/index.css +5 -0
- package/lib/cli/build/index.js +32 -19
- package/lib/cli/build/plugin.js +228 -148
- package/lib/cli/build/utils.js +31 -21
- package/lib/cli/build/watching.js +99 -30
- package/lib/cli/help/index.js +17 -15
- package/lib/cli/index.js +223 -10
- package/lib/cli/init/index.js +31 -14
- package/lib/cli.js +1 -227
- package/lib/corePluginList.js +8 -1
- package/lib/corePlugins.js +2128 -1823
- package/lib/css/preflight.css +17 -4
- package/lib/featureFlags.js +39 -25
- package/lib/index.js +1 -47
- package/lib/lib/cacheInvalidation.js +10 -8
- package/lib/lib/collapseAdjacentRules.js +10 -8
- package/lib/lib/collapseDuplicateDeclarations.js +13 -11
- package/lib/lib/content.js +65 -28
- package/lib/lib/defaultExtractor.js +24 -32
- package/lib/lib/detectNesting.js +18 -10
- package/lib/lib/evaluateTailwindFunctions.js +45 -41
- package/lib/lib/expandApplyAtRules.js +60 -52
- package/lib/lib/expandTailwindAtRules.js +115 -47
- package/lib/lib/findAtConfigPath.js +14 -12
- package/lib/lib/generateRules.js +206 -146
- package/lib/lib/getModuleDependencies.js +85 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +26 -39
- package/lib/lib/offsets.js +136 -47
- package/lib/lib/partitionApplyAtRules.js +5 -3
- package/lib/lib/regex.js +26 -12
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +53 -49
- package/lib/lib/setupContextUtils.js +337 -250
- package/lib/lib/setupTrackingContext.js +54 -29
- package/lib/lib/sharedState.js +36 -17
- package/lib/lib/substituteScreenAtRules.js +9 -7
- package/lib/plugin.js +164 -0
- package/lib/postcss-plugins/nesting/index.js +5 -3
- package/lib/postcss-plugins/nesting/plugin.js +19 -17
- package/lib/processTailwindFeatures.js +19 -17
- package/lib/public/colors.js +269 -245
- 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 +5 -3
- package/lib/util/cloneDeep.js +4 -2
- package/lib/util/cloneNodes.js +6 -4
- package/lib/util/color.js +46 -28
- 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 +9 -7
- package/lib/util/dataTypes.js +215 -96
- package/lib/util/defaults.js +9 -7
- package/lib/util/escapeClassName.js +10 -8
- package/lib/util/escapeCommas.js +4 -2
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +149 -169
- package/lib/util/getAllConfigs.js +12 -9
- package/lib/util/hashConfig.js +6 -4
- package/lib/util/isKeyframeRule.js +4 -2
- package/lib/util/isPlainObject.js +4 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +14 -12
- package/lib/util/log.js +31 -10
- package/lib/util/nameClass.js +16 -10
- package/lib/util/negateValue.js +12 -10
- package/lib/util/normalizeConfig.js +123 -77
- package/lib/util/normalizeScreens.js +30 -22
- package/lib/util/parseAnimationValue.js +41 -39
- package/lib/util/parseBoxShadowValue.js +24 -20
- package/lib/util/parseDependency.js +7 -5
- package/lib/util/parseGlob.js +10 -8
- package/lib/util/parseObjectStyles.js +10 -8
- package/lib/util/pluginUtils.js +92 -96
- package/lib/util/prefixSelector.js +27 -11
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +4 -2
- package/lib/util/resolveConfig.js +28 -24
- package/lib/util/resolveConfigPath.js +28 -12
- package/lib/util/responsive.js +7 -5
- package/lib/util/splitAtTopLevelOnly.js +12 -4
- package/lib/util/tap.js +3 -1
- package/lib/util/toColorValue.js +4 -2
- package/lib/util/toPath.js +5 -3
- package/lib/util/transformThemeValue.js +30 -28
- package/lib/util/validateConfig.js +31 -7
- package/lib/util/validateFormalSyntax.js +8 -6
- package/lib/util/withAlphaVariable.js +11 -7
- package/lib/value-parser/LICENSE +22 -0
- package/lib/value-parser/README.md +3 -0
- package/lib/value-parser/index.d.js +2 -0
- package/lib/value-parser/index.js +22 -0
- package/lib/value-parser/parse.js +259 -0
- package/lib/value-parser/stringify.js +38 -0
- package/lib/value-parser/unit.js +86 -0
- package/lib/value-parser/walk.js +16 -0
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/package.json +49 -50
- package/resolveConfig.d.ts +11 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/index.js +17 -9
- package/src/cli/build/plugin.js +129 -77
- package/src/cli/build/watching.js +108 -13
- package/src/cli/index.js +217 -3
- package/src/cli/init/index.js +37 -8
- package/src/cli.js +1 -221
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +259 -46
- package/src/css/preflight.css +17 -4
- package/src/featureFlags.js +7 -7
- package/src/index.js +1 -47
- package/src/lib/content.js +44 -10
- package/src/lib/defaultExtractor.js +10 -14
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +4 -1
- package/src/lib/expandApplyAtRules.js +10 -3
- package/src/lib/expandTailwindAtRules.js +78 -13
- package/src/lib/generateRules.js +140 -65
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/handleImportAtRules.js +34 -0
- package/src/lib/load-config.ts +31 -0
- package/src/lib/normalizeTailwindDirectives.js +0 -27
- package/src/lib/offsets.js +105 -2
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/setupContextUtils.js +145 -80
- package/src/lib/setupTrackingContext.js +37 -14
- package/src/lib/sharedState.js +11 -4
- package/src/plugin.js +133 -0
- package/src/processTailwindFeatures.js +3 -2
- 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 +19 -4
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +97 -9
- package/src/util/formatVariantSelector.js +163 -165
- package/src/util/getAllConfigs.js +2 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +24 -0
- package/src/util/negateValue.js +1 -1
- package/src/util/normalizeConfig.js +57 -11
- package/src/util/pluginUtils.js +38 -54
- package/src/util/prefixSelector.js +29 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/resolveConfig.js +0 -2
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +8 -1
- package/src/util/validateConfig.js +23 -0
- package/src/value-parser/LICENSE +22 -0
- package/src/value-parser/README.md +3 -0
- package/src/value-parser/index.d.ts +177 -0
- package/src/value-parser/index.js +28 -0
- package/src/value-parser/parse.js +303 -0
- package/src/value-parser/stringify.js +41 -0
- package/src/value-parser/unit.js +118 -0
- package/src/value-parser/walk.js +18 -0
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +203 -172
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -2
- package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -1
- package/stubs/postcss.config.js +5 -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 +20 -13
- package/types/generated/colors.d.ts +22 -0
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +116 -80
- package/CHANGELOG.md +0 -2300
- package/lib/cli/build/deps.js +0 -54
- package/lib/cli/shared.js +0 -12
- package/lib/cli-peer-dependencies.js +0 -28
- package/lib/constants.js +0 -44
- package/peers/index.js +0 -79459
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli/build/deps.js +0 -56
- package/src/cli/shared.js +0 -5
- package/src/cli-peer-dependencies.js +0 -15
- package/src/constants.js +0 -17
package/lib/css/preflight.css
CHANGED
|
@@ -23,15 +23,18 @@
|
|
|
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
|
-
html
|
|
29
|
+
html,
|
|
30
|
+
:host {
|
|
29
31
|
line-height: 1.5; /* 1 */
|
|
30
32
|
-webkit-text-size-adjust: 100%; /* 2 */
|
|
31
33
|
-moz-tab-size: 4; /* 3 */
|
|
32
34
|
tab-size: 4; /* 3 */
|
|
33
|
-
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui,
|
|
35
|
+
font-family: theme('fontFamily.sans', ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"); /* 4 */
|
|
34
36
|
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
37
|
+
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
35
38
|
}
|
|
36
39
|
|
|
37
40
|
/*
|
|
@@ -161,6 +164,8 @@ optgroup,
|
|
|
161
164
|
select,
|
|
162
165
|
textarea {
|
|
163
166
|
font-family: inherit; /* 1 */
|
|
167
|
+
font-feature-settings: inherit; /* 1 */
|
|
168
|
+
font-variation-settings: inherit; /* 1 */
|
|
164
169
|
font-size: 100%; /* 1 */
|
|
165
170
|
font-weight: inherit; /* 1 */
|
|
166
171
|
line-height: inherit; /* 1 */
|
|
@@ -262,7 +267,7 @@ summary {
|
|
|
262
267
|
}
|
|
263
268
|
|
|
264
269
|
/*
|
|
265
|
-
Removes the default spacing
|
|
270
|
+
Removes the default spacing for appropriate elements.
|
|
266
271
|
*/
|
|
267
272
|
|
|
268
273
|
blockquote,
|
|
@@ -298,6 +303,10 @@ menu {
|
|
|
298
303
|
padding: 0;
|
|
299
304
|
}
|
|
300
305
|
|
|
306
|
+
dialog {
|
|
307
|
+
padding: 0;
|
|
308
|
+
}
|
|
309
|
+
|
|
301
310
|
/*
|
|
302
311
|
Prevent resizing textareas horizontally by default.
|
|
303
312
|
*/
|
|
@@ -329,6 +338,7 @@ button,
|
|
|
329
338
|
/*
|
|
330
339
|
Make sure disabled buttons don't get the pointer cursor.
|
|
331
340
|
*/
|
|
341
|
+
|
|
332
342
|
:disabled {
|
|
333
343
|
cursor: default;
|
|
334
344
|
}
|
|
@@ -361,7 +371,10 @@ video {
|
|
|
361
371
|
height: auto;
|
|
362
372
|
}
|
|
363
373
|
|
|
364
|
-
/*
|
|
374
|
+
/*
|
|
375
|
+
Make elements with the HTML hidden attribute stay hidden by default.
|
|
376
|
+
*/
|
|
377
|
+
|
|
365
378
|
[hidden] {
|
|
366
379
|
display: none;
|
|
367
380
|
}
|
package/lib/featureFlags.js
CHANGED
|
@@ -9,62 +9,76 @@ function _export(target, all) {
|
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
featureFlags: function() {
|
|
13
|
+
return featureFlags;
|
|
14
|
+
},
|
|
15
|
+
flagEnabled: function() {
|
|
16
|
+
return flagEnabled;
|
|
17
|
+
},
|
|
18
|
+
issueFlagNotices: function() {
|
|
19
|
+
return issueFlagNotices;
|
|
20
|
+
},
|
|
21
|
+
default: function() {
|
|
22
|
+
return _default;
|
|
23
|
+
}
|
|
15
24
|
});
|
|
16
|
-
const _picocolors = /*#__PURE__*/
|
|
17
|
-
const _log = /*#__PURE__*/
|
|
18
|
-
function
|
|
25
|
+
const _picocolors = /*#__PURE__*/ _interop_require_default(require("picocolors"));
|
|
26
|
+
const _log = /*#__PURE__*/ _interop_require_default(require("./util/log"));
|
|
27
|
+
function _interop_require_default(obj) {
|
|
19
28
|
return obj && obj.__esModule ? obj : {
|
|
20
29
|
default: obj
|
|
21
30
|
};
|
|
22
31
|
}
|
|
23
32
|
let defaults = {
|
|
24
33
|
optimizeUniversalDefaults: false,
|
|
25
|
-
|
|
34
|
+
disableColorOpacityUtilitiesByDefault: false,
|
|
35
|
+
relativeContentPathsByDefault: false,
|
|
36
|
+
oxideParser: true,
|
|
37
|
+
logicalSiblingUtilities: false
|
|
26
38
|
};
|
|
27
39
|
let featureFlags = {
|
|
28
40
|
future: [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
'hoverOnlyWhenSupported',
|
|
42
|
+
'respectDefaultRingColorOpacity',
|
|
43
|
+
'disableColorOpacityUtilitiesByDefault',
|
|
44
|
+
'relativeContentPathsByDefault',
|
|
45
|
+
'logicalSiblingUtilities'
|
|
33
46
|
],
|
|
34
47
|
experimental: [
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
'optimizeUniversalDefaults',
|
|
49
|
+
'oxideParser'
|
|
37
50
|
]
|
|
38
51
|
};
|
|
39
52
|
function flagEnabled(config, flag) {
|
|
40
53
|
if (featureFlags.future.includes(flag)) {
|
|
41
|
-
var
|
|
42
|
-
var
|
|
43
|
-
return config.future ===
|
|
54
|
+
var _config_future, _config;
|
|
55
|
+
var _config_future_flag, _ref;
|
|
56
|
+
return config.future === 'all' || ((_ref = (_config_future_flag = (_config = 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
57
|
}
|
|
45
58
|
if (featureFlags.experimental.includes(flag)) {
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
return config.experimental ===
|
|
59
|
+
var _config_experimental, _config1;
|
|
60
|
+
var _config_experimental_flag, _ref1;
|
|
61
|
+
return config.experimental === 'all' || ((_ref1 = (_config_experimental_flag = (_config1 = config) === null || _config1 === void 0 ? void 0 : (_config_experimental = _config1.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
62
|
}
|
|
50
63
|
return false;
|
|
51
64
|
}
|
|
52
65
|
function experimentalFlagsEnabled(config) {
|
|
53
|
-
|
|
66
|
+
var _config;
|
|
67
|
+
if (config.experimental === 'all') {
|
|
54
68
|
return featureFlags.experimental;
|
|
55
69
|
}
|
|
56
|
-
var
|
|
57
|
-
return Object.keys((
|
|
70
|
+
var _config_experimental;
|
|
71
|
+
return Object.keys((_config_experimental = (_config = 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
72
|
}
|
|
59
73
|
function issueFlagNotices(config) {
|
|
60
74
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
61
75
|
return;
|
|
62
76
|
}
|
|
63
77
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
64
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(
|
|
65
|
-
_log.default.warn(
|
|
78
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(', ');
|
|
79
|
+
_log.default.warn('experimental-flags-enabled', [
|
|
66
80
|
`You have enabled experimental features: ${changes}`,
|
|
67
|
-
|
|
81
|
+
'Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time.'
|
|
68
82
|
]);
|
|
69
83
|
}
|
|
70
84
|
}
|
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
|
}
|
|
@@ -70,16 +72,16 @@ function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
70
72
|
* @param {string} str
|
|
71
73
|
*/ function getHash(str) {
|
|
72
74
|
try {
|
|
73
|
-
return _crypto.default.createHash(
|
|
75
|
+
return _crypto.default.createHash('md5').update(str, 'utf-8').digest('binary');
|
|
74
76
|
} catch (err) {
|
|
75
|
-
return
|
|
77
|
+
return '';
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
function hasContentChanged(sourcePath, root) {
|
|
79
81
|
let css = root.toString();
|
|
80
82
|
// We only care about files with @tailwind directives
|
|
81
83
|
// Other files use an existing context
|
|
82
|
-
if (!css.includes(
|
|
84
|
+
if (!css.includes('@tailwind')) {
|
|
83
85
|
return false;
|
|
84
86
|
}
|
|
85
87
|
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
|
|
@@ -4,15 +4,17 @@ 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: [
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
'name',
|
|
14
|
+
'params'
|
|
13
15
|
],
|
|
14
16
|
rule: [
|
|
15
|
-
|
|
17
|
+
'selector'
|
|
16
18
|
]
|
|
17
19
|
};
|
|
18
20
|
let types = new Set(Object.keys(comparisonMap));
|
|
@@ -29,10 +31,10 @@ function collapseAdjacentRules() {
|
|
|
29
31
|
return;
|
|
30
32
|
}
|
|
31
33
|
let properties = comparisonMap[node.type];
|
|
32
|
-
var
|
|
33
|
-
if (node.type ===
|
|
34
|
+
var _node_property, _currentRule_property;
|
|
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);
|
|
@@ -48,7 +50,7 @@ function collapseAdjacentRules() {
|
|
|
48
50
|
// explicitly does not handle rule nesting on its own as
|
|
49
51
|
// the user is expected to use a nesting plugin
|
|
50
52
|
root.each((node)=>{
|
|
51
|
-
if (node.type ===
|
|
53
|
+
if (node.type === 'atrule') {
|
|
52
54
|
collapseRulesIn(node);
|
|
53
55
|
}
|
|
54
56
|
});
|
|
@@ -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,33 +53,33 @@ 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
|
}
|
|
72
74
|
});
|
|
73
75
|
};
|
|
74
76
|
}
|
|
75
|
-
let UNITLESS_NUMBER = Symbol(
|
|
77
|
+
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,28 +10,58 @@ 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
|
-
|
|
27
|
+
const _oxide = require("@tailwindcss/oxide");
|
|
28
|
+
function _interop_require_default(obj) {
|
|
24
29
|
return obj && obj.__esModule ? obj : {
|
|
25
30
|
default: obj
|
|
26
31
|
};
|
|
27
32
|
}
|
|
33
|
+
/** @typedef {import('../../types/config.js').RawFile} RawFile */ /** @typedef {import('../../types/config.js').FilePath} FilePath */ /*
|
|
34
|
+
* @param {import('tailwindcss').Config} tailwindConfig
|
|
35
|
+
* @param {{skip:string[]}} options
|
|
36
|
+
* @returns {ContentPath[]}
|
|
37
|
+
*/ function resolveContentFiles(tailwindConfig, { skip = [] } = {}) {
|
|
38
|
+
if (Array.isArray(tailwindConfig.content.files) && tailwindConfig.content.files.includes('auto')) {
|
|
39
|
+
let idx = tailwindConfig.content.files.indexOf('auto');
|
|
40
|
+
if (idx !== -1) {
|
|
41
|
+
_sharedState.env.DEBUG && console.time('Calculating resolve content paths');
|
|
42
|
+
let resolved = (0, _oxide.resolveContentPaths)({
|
|
43
|
+
base: process.cwd()
|
|
44
|
+
});
|
|
45
|
+
_sharedState.env.DEBUG && console.timeEnd('Calculating resolve content paths');
|
|
46
|
+
tailwindConfig.content.files.splice(idx, 1, ...resolved);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (skip.length > 0) {
|
|
50
|
+
tailwindConfig.content.files = tailwindConfig.content.files.filter((filePath)=>!skip.includes(filePath));
|
|
51
|
+
}
|
|
52
|
+
return tailwindConfig.content.files;
|
|
53
|
+
}
|
|
28
54
|
function parseCandidateFiles(context, tailwindConfig) {
|
|
29
|
-
let files = tailwindConfig
|
|
55
|
+
let files = resolveContentFiles(tailwindConfig, {
|
|
56
|
+
skip: [
|
|
57
|
+
context.userConfigPath
|
|
58
|
+
]
|
|
59
|
+
});
|
|
30
60
|
// Normalize the file globs
|
|
31
|
-
files = files.filter((filePath)=>typeof filePath ===
|
|
32
|
-
files = files.map(
|
|
61
|
+
files = files.filter((filePath)=>typeof filePath === 'string');
|
|
62
|
+
files = files.map(_normalizepath.default);
|
|
33
63
|
// Split into included and excluded globs
|
|
34
|
-
let tasks =
|
|
64
|
+
let tasks = _fastglob.default.generateTasks(files);
|
|
35
65
|
/** @type {ContentPath[]} */ let included = [];
|
|
36
66
|
/** @type {ContentPath[]} */ let excluded = [];
|
|
37
67
|
for (const task of tasks){
|
|
@@ -63,7 +93,7 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
63
93
|
pattern: filePath,
|
|
64
94
|
glob: null
|
|
65
95
|
};
|
|
66
|
-
if ((0,
|
|
96
|
+
if ((0, _isglob.default)(filePath)) {
|
|
67
97
|
Object.assign(contentPath, (0, _parseGlob.parseGlob)(filePath));
|
|
68
98
|
}
|
|
69
99
|
return contentPath;
|
|
@@ -77,10 +107,10 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
77
107
|
// Afaik, this technically shouldn't be needed but there's probably
|
|
78
108
|
// some internal, direct path matching with a normalized path in
|
|
79
109
|
// a package which can't handle mixed directory separators
|
|
80
|
-
let base = (0,
|
|
110
|
+
let base = (0, _normalizepath.default)(contentPath.base);
|
|
81
111
|
// If the user's file path contains any special characters (like parens) for instance fast-glob
|
|
82
112
|
// is like "OOOH SHINY" and treats them as such. So we have to escape the base path to fix this
|
|
83
|
-
base =
|
|
113
|
+
base = _fastglob.default.escapePath(base);
|
|
84
114
|
contentPath.pattern = contentPath.glob ? `${base}/${contentPath.glob}` : base;
|
|
85
115
|
contentPath.pattern = contentPath.ignore ? `!${contentPath.pattern}` : contentPath.pattern;
|
|
86
116
|
return contentPath;
|
|
@@ -125,46 +155,53 @@ function parseCandidateFiles(context, tailwindConfig) {
|
|
|
125
155
|
base: resolvedPath
|
|
126
156
|
});
|
|
127
157
|
}
|
|
128
|
-
} catch
|
|
158
|
+
} catch (e) {
|
|
129
159
|
// TODO: log this?
|
|
130
160
|
}
|
|
131
161
|
return paths;
|
|
132
162
|
}
|
|
133
163
|
function resolvedChangedContent(context, candidateFiles, fileModifiedMap) {
|
|
134
|
-
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw ===
|
|
164
|
+
let changedContent = context.tailwindConfig.content.files.filter((item)=>typeof item.raw === 'string').map(({ raw, extension = 'html' })=>({
|
|
135
165
|
content: raw,
|
|
136
166
|
extension
|
|
137
167
|
}));
|
|
138
|
-
|
|
139
|
-
|
|
168
|
+
let [changedFiles, mTimesToCommit] = resolveChangedFiles(candidateFiles, fileModifiedMap);
|
|
169
|
+
for (let changedFile of changedFiles){
|
|
140
170
|
let extension = _path.default.extname(changedFile).slice(1);
|
|
141
171
|
changedContent.push({
|
|
142
|
-
|
|
172
|
+
file: changedFile,
|
|
143
173
|
extension
|
|
144
174
|
});
|
|
145
175
|
}
|
|
146
|
-
return
|
|
176
|
+
return [
|
|
177
|
+
changedContent,
|
|
178
|
+
mTimesToCommit
|
|
179
|
+
];
|
|
147
180
|
}
|
|
148
181
|
/**
|
|
149
182
|
*
|
|
150
183
|
* @param {ContentPath[]} candidateFiles
|
|
151
184
|
* @param {Map<string, number>} fileModifiedMap
|
|
152
|
-
* @returns {Set<string>}
|
|
185
|
+
* @returns {[Set<string>, Map<string, number>]}
|
|
153
186
|
*/ function resolveChangedFiles(candidateFiles, fileModifiedMap) {
|
|
154
187
|
let paths = candidateFiles.map((contentPath)=>contentPath.pattern);
|
|
188
|
+
let mTimesToCommit = new Map();
|
|
155
189
|
let changedFiles = new Set();
|
|
156
|
-
_sharedState.env.DEBUG && console.time(
|
|
157
|
-
let files =
|
|
190
|
+
_sharedState.env.DEBUG && console.time('Finding changed files');
|
|
191
|
+
let files = _fastglob.default.sync(paths, {
|
|
158
192
|
absolute: true
|
|
159
193
|
});
|
|
160
194
|
for (let file of files){
|
|
161
|
-
let prevModified = fileModifiedMap.
|
|
195
|
+
let prevModified = fileModifiedMap.get(file) || -Infinity;
|
|
162
196
|
let modified = _fs.default.statSync(file).mtimeMs;
|
|
163
197
|
if (modified > prevModified) {
|
|
164
198
|
changedFiles.add(file);
|
|
165
|
-
|
|
199
|
+
mTimesToCommit.set(file, modified);
|
|
166
200
|
}
|
|
167
201
|
}
|
|
168
|
-
_sharedState.env.DEBUG && console.timeEnd(
|
|
169
|
-
return
|
|
202
|
+
_sharedState.env.DEBUG && console.timeEnd('Finding changed files');
|
|
203
|
+
return [
|
|
204
|
+
changedFiles,
|
|
205
|
+
mTimesToCommit
|
|
206
|
+
];
|
|
170
207
|
}
|
|
@@ -4,10 +4,11 @@ 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
|
-
const
|
|
10
|
-
const _regex = /*#__PURE__*/ _interopRequireWildcard(require("./regex"));
|
|
11
|
+
const _regex = /*#__PURE__*/ _interop_require_wildcard(require("./regex"));
|
|
11
12
|
function _getRequireWildcardCache(nodeInterop) {
|
|
12
13
|
if (typeof WeakMap !== "function") return null;
|
|
13
14
|
var cacheBabelInterop = new WeakMap();
|
|
@@ -16,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
16
17
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
17
18
|
})(nodeInterop);
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
20
21
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
21
22
|
return obj;
|
|
22
23
|
}
|
|
@@ -54,10 +55,10 @@ function defaultExtractor(context) {
|
|
|
54
55
|
*/ return (content)=>{
|
|
55
56
|
/** @type {(string|string)[]} */ let results = [];
|
|
56
57
|
for (let pattern of patterns){
|
|
57
|
-
var
|
|
58
|
+
var _content_match;
|
|
58
59
|
results = [
|
|
59
60
|
...results,
|
|
60
|
-
...(
|
|
61
|
+
...(_content_match = content.match(pattern)) !== null && _content_match !== void 0 ? _content_match : []
|
|
61
62
|
];
|
|
62
63
|
}
|
|
63
64
|
return results.filter((v)=>v !== undefined).map(clipAtBalancedParens);
|
|
@@ -65,14 +66,18 @@ function defaultExtractor(context) {
|
|
|
65
66
|
}
|
|
66
67
|
function* buildRegExps(context) {
|
|
67
68
|
let separator = context.tailwindConfig.separator;
|
|
68
|
-
let
|
|
69
|
-
let prefix = context.tailwindConfig.prefix !== "" ? _regex.optional(_regex.pattern([
|
|
69
|
+
let prefix = context.tailwindConfig.prefix !== '' ? _regex.optional(_regex.pattern([
|
|
70
70
|
/-?/,
|
|
71
71
|
_regex.escape(context.tailwindConfig.prefix)
|
|
72
|
-
])) :
|
|
72
|
+
])) : '';
|
|
73
73
|
let utility = _regex.any([
|
|
74
|
-
// Arbitrary properties
|
|
75
|
-
/\[[^\s:'"`]+:[^\s]+\]/,
|
|
74
|
+
// Arbitrary properties (without square brackets)
|
|
75
|
+
/\[[^\s:'"`]+:[^\s\[\]]+\]/,
|
|
76
|
+
// Arbitrary properties with balanced square brackets
|
|
77
|
+
// This is a targeted fix to continue to allow theme()
|
|
78
|
+
// with square brackets to work in arbitrary properties
|
|
79
|
+
// while fixing a problem with the regex matching too much
|
|
80
|
+
/\[[^\s:'"`]+:[^\s]+?\[[^\s]+\][^\s]+?\]/,
|
|
76
81
|
// Utilities
|
|
77
82
|
_regex.pattern([
|
|
78
83
|
// Utility Name / Group Name
|
|
@@ -132,26 +137,13 @@ function* buildRegExps(context) {
|
|
|
132
137
|
for (const variantPattern of variantPatterns){
|
|
133
138
|
yield _regex.pattern([
|
|
134
139
|
// Variants
|
|
135
|
-
|
|
140
|
+
'((?=((',
|
|
136
141
|
variantPattern,
|
|
137
|
-
|
|
142
|
+
')+))\\2)?',
|
|
138
143
|
// Important (optional)
|
|
139
144
|
/!?/,
|
|
140
145
|
prefix,
|
|
141
|
-
|
|
142
|
-
// Or any of those things but grouped separated by commas
|
|
143
|
-
_regex.pattern([
|
|
144
|
-
/\(/,
|
|
145
|
-
utility,
|
|
146
|
-
_regex.zeroOrMore([
|
|
147
|
-
/,/,
|
|
148
|
-
utility
|
|
149
|
-
]),
|
|
150
|
-
/\)/
|
|
151
|
-
]),
|
|
152
|
-
// Arbitrary properties, constrained utilities, arbitrary values, etc…
|
|
153
|
-
utility
|
|
154
|
-
]) : utility
|
|
146
|
+
utility
|
|
155
147
|
]);
|
|
156
148
|
}
|
|
157
149
|
// 5. Inner matches
|
|
@@ -176,7 +168,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
176
168
|
* @param {string} input
|
|
177
169
|
*/ function clipAtBalancedParens(input) {
|
|
178
170
|
// We are care about this for arbitrary values
|
|
179
|
-
if (!input.includes(
|
|
171
|
+
if (!input.includes('-[')) {
|
|
180
172
|
return input;
|
|
181
173
|
}
|
|
182
174
|
let depth = 0;
|
|
@@ -200,15 +192,15 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
200
192
|
let inStringType = openStringTypes[openStringTypes.length - 1];
|
|
201
193
|
if (char === inStringType) {
|
|
202
194
|
openStringTypes.pop();
|
|
203
|
-
} else if (char === "'" || char === '"' || char ===
|
|
195
|
+
} else if (char === "'" || char === '"' || char === '`') {
|
|
204
196
|
openStringTypes.push(char);
|
|
205
197
|
}
|
|
206
198
|
if (inStringType) {
|
|
207
199
|
continue;
|
|
208
|
-
} else if (char ===
|
|
200
|
+
} else if (char === '[') {
|
|
209
201
|
depth++;
|
|
210
202
|
continue;
|
|
211
|
-
} else if (char ===
|
|
203
|
+
} else if (char === ']') {
|
|
212
204
|
depth--;
|
|
213
205
|
continue;
|
|
214
206
|
}
|
|
@@ -216,7 +208,7 @@ let ALLOWED_CLASS_CHARACTERS = /[^"'`\s<>\]]+/;
|
|
|
216
208
|
// This means that there was an extra closing `]`
|
|
217
209
|
// We'll clip to just before it
|
|
218
210
|
if (depth < 0) {
|
|
219
|
-
return input.substring(0, match.index);
|
|
211
|
+
return input.substring(0, match.index - 1);
|
|
220
212
|
}
|
|
221
213
|
// We've finished balancing the brackets but there still may be characters that can be included
|
|
222
214
|
// For example in the class `text-[#336699]/[.35]`
|