tailwindcss 0.0.0-insiders.eebf529 → 0.0.0-insiders.ef2ebb2
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/LICENSE +1 -2
- package/README.md +15 -7
- package/colors.d.ts +3 -0
- package/defaultConfig.d.ts +3 -0
- package/defaultTheme.d.ts +4 -0
- package/index.css +5 -0
- package/lib/cli/build/index.js +57 -0
- package/lib/cli/build/plugin.js +433 -0
- package/lib/cli/build/utils.js +88 -0
- package/lib/cli/build/watching.js +182 -0
- package/lib/cli/help/index.js +73 -0
- package/lib/cli/index.js +231 -0
- package/lib/cli/init/index.js +63 -0
- package/lib/cli.js +1 -704
- package/lib/corePluginList.js +13 -3
- package/lib/corePlugins.js +2399 -1867
- package/lib/css/preflight.css +17 -9
- package/lib/featureFlags.js +50 -26
- package/lib/index.js +1 -31
- package/lib/lib/cacheInvalidation.js +92 -0
- package/lib/lib/collapseAdjacentRules.js +30 -10
- package/lib/lib/collapseDuplicateDeclarations.js +60 -4
- package/lib/lib/content.js +207 -0
- package/lib/lib/defaultExtractor.js +243 -0
- package/lib/lib/detectNesting.js +21 -10
- package/lib/lib/evaluateTailwindFunctions.js +117 -50
- package/lib/lib/expandApplyAtRules.js +467 -161
- package/lib/lib/expandTailwindAtRules.js +200 -133
- package/lib/lib/findAtConfigPath.js +46 -0
- package/lib/lib/generateRules.js +550 -200
- package/lib/lib/getModuleDependencies.js +88 -37
- package/lib/lib/handleImportAtRules.js +50 -0
- package/lib/lib/load-config.js +42 -0
- package/lib/lib/normalizeTailwindDirectives.js +36 -38
- package/lib/lib/offsets.js +306 -0
- package/lib/lib/partitionApplyAtRules.js +58 -0
- package/lib/lib/regex.js +74 -0
- package/lib/lib/remap-bitfield.js +89 -0
- package/lib/lib/resolveDefaultsAtRules.js +98 -58
- package/lib/lib/setupContextUtils.js +767 -325
- package/lib/lib/setupTrackingContext.js +71 -75
- package/lib/lib/sharedState.js +70 -10
- package/lib/lib/substituteScreenAtRules.js +14 -10
- package/lib/plugin.js +166 -0
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +21 -0
- package/lib/postcss-plugins/nesting/plugin.js +89 -0
- package/lib/processTailwindFeatures.js +39 -26
- package/lib/public/colors.js +272 -246
- package/lib/public/create-plugin.js +9 -5
- package/lib/public/default-config.js +10 -6
- package/lib/public/default-theme.js +10 -6
- package/lib/public/load-config.js +12 -0
- package/lib/public/resolve-config.js +11 -6
- package/lib/util/applyImportantSelector.js +36 -0
- package/lib/util/bigSign.js +6 -1
- package/lib/util/buildMediaQuery.js +13 -6
- package/lib/util/cloneDeep.js +9 -6
- package/lib/util/cloneNodes.js +23 -3
- package/lib/util/color.js +70 -38
- package/lib/util/colorNames.js +752 -0
- package/lib/util/configurePlugins.js +7 -2
- package/lib/util/createPlugin.js +8 -6
- package/lib/util/createUtilityPlugin.js +16 -16
- package/lib/util/dataTypes.js +182 -111
- package/lib/util/defaults.js +14 -3
- package/lib/util/escapeClassName.js +13 -8
- package/lib/util/escapeCommas.js +7 -2
- package/lib/util/flattenColorPalette.js +11 -12
- package/lib/util/formatVariantSelector.js +228 -151
- package/lib/util/getAllConfigs.js +33 -12
- package/lib/util/hashConfig.js +9 -4
- package/lib/util/isKeyframeRule.js +7 -2
- package/lib/util/isPlainObject.js +7 -2
- package/lib/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +25 -15
- package/lib/util/log.js +44 -13
- package/lib/util/nameClass.js +27 -10
- package/lib/util/negateValue.js +25 -8
- package/lib/util/normalizeConfig.js +167 -67
- package/lib/util/normalizeScreens.js +128 -11
- package/lib/util/parseAnimationValue.js +44 -40
- package/lib/util/parseBoxShadowValue.js +34 -23
- package/lib/util/parseDependency.js +39 -55
- package/lib/util/parseGlob.js +36 -0
- package/lib/util/parseObjectStyles.js +15 -10
- package/lib/util/pluginUtils.js +157 -69
- package/lib/util/prefixSelector.js +30 -12
- package/lib/util/pseudoElements.js +209 -0
- package/lib/util/removeAlphaVariables.js +31 -0
- package/lib/util/resolveConfig.js +101 -79
- package/lib/util/resolveConfigPath.js +30 -12
- package/lib/util/responsive.js +11 -6
- package/lib/util/splitAtTopLevelOnly.js +51 -0
- package/lib/util/tap.js +6 -1
- package/lib/util/toColorValue.js +7 -3
- package/lib/util/toPath.js +26 -3
- package/lib/util/transformThemeValue.js +40 -30
- package/lib/util/validateConfig.js +48 -0
- package/lib/util/validateFormalSyntax.js +26 -0
- package/lib/util/withAlphaVariable.js +27 -15
- 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/nesting/index.js +2 -12
- package/package.json +63 -62
- package/plugin.d.ts +11 -0
- package/resolveConfig.d.ts +12 -0
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/index.js +53 -0
- package/src/cli/build/plugin.js +476 -0
- package/src/cli/build/utils.js +76 -0
- package/src/cli/build/watching.js +229 -0
- package/src/cli/help/index.js +70 -0
- package/src/cli/index.js +217 -0
- package/src/cli/init/index.js +79 -0
- package/src/cli.js +1 -766
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +800 -296
- package/src/css/preflight.css +17 -9
- package/src/featureFlags.js +20 -6
- package/src/index.js +1 -34
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +66 -1
- package/src/lib/content.js +240 -0
- package/src/lib/defaultExtractor.js +217 -0
- package/src/lib/detectNesting.js +9 -1
- package/src/lib/evaluateTailwindFunctions.js +83 -9
- package/src/lib/expandApplyAtRules.js +515 -153
- package/src/lib/expandTailwindAtRules.js +147 -86
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +541 -147
- 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 +5 -26
- package/src/lib/offsets.js +373 -0
- package/src/lib/partitionApplyAtRules.js +52 -0
- package/src/lib/regex.js +74 -0
- package/src/lib/remap-bitfield.js +82 -0
- package/src/lib/resolveDefaultsAtRules.js +59 -17
- package/src/lib/setupContextUtils.js +693 -176
- package/src/lib/setupTrackingContext.js +52 -65
- package/src/lib/sharedState.js +54 -7
- package/src/plugin.js +141 -0
- package/src/postcss-plugins/nesting/README.md +42 -0
- package/src/postcss-plugins/nesting/index.js +13 -0
- package/src/postcss-plugins/nesting/plugin.js +80 -0
- package/src/processTailwindFeatures.js +12 -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/buildMediaQuery.js +5 -3
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +44 -12
- package/src/util/colorNames.js +150 -0
- package/src/util/dataTypes.js +67 -23
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +264 -144
- package/src/util/getAllConfigs.js +21 -2
- package/src/util/{isValidArbitraryValue.js → isSyntacticallyValidPropertyValue.js} +1 -1
- package/src/util/log.js +35 -7
- package/src/util/nameClass.js +4 -0
- package/src/util/negateValue.js +11 -3
- package/src/util/normalizeConfig.js +86 -7
- package/src/util/normalizeScreens.js +99 -4
- package/src/util/parseBoxShadowValue.js +4 -3
- package/src/util/parseDependency.js +37 -42
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +118 -23
- package/src/util/prefixSelector.js +30 -10
- package/src/util/pseudoElements.js +167 -0
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +74 -26
- package/src/util/resolveConfigPath.js +12 -1
- package/src/util/splitAtTopLevelOnly.js +52 -0
- package/src/util/toPath.js +23 -1
- package/src/util/transformThemeValue.js +13 -3
- package/src/util/validateConfig.js +36 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +1 -1
- 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} +220 -167
- package/stubs/{simpleConfig.stub.js → config.simple.js} +1 -1
- 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 +369 -0
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +298 -0
- package/types/generated/corePluginList.d.ts +1 -0
- package/types/generated/default-theme.d.ts +372 -0
- package/types/index.d.ts +7 -0
- package/CHANGELOG.md +0 -1853
- package/lib/cli-peer-dependencies.js +0 -15
- package/lib/constants.js +0 -37
- package/lib/lib/setupWatchingContext.js +0 -288
- package/nesting/plugin.js +0 -41
- package/peers/index.js +0 -76107
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/cli-peer-dependencies.js +0 -9
- package/src/constants.js +0 -17
- package/src/lib/setupWatchingContext.js +0 -311
package/lib/css/preflight.css
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
box-sizing: border-box; /* 1 */
|
|
10
10
|
border-width: 0; /* 2 */
|
|
11
11
|
border-style: solid; /* 2 */
|
|
12
|
-
border-color: currentColor; /* 2 */
|
|
12
|
+
border-color: theme('borderColor.DEFAULT', currentColor); /* 2 */
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
::before,
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
23
23
|
3. Use a more readable tab size.
|
|
24
24
|
4. Use the user's configured `sans` font-family by default.
|
|
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.
|
|
25
27
|
*/
|
|
26
28
|
|
|
27
29
|
html {
|
|
@@ -30,6 +32,8 @@ html {
|
|
|
30
32
|
-moz-tab-size: 4; /* 3 */
|
|
31
33
|
tab-size: 4; /* 3 */
|
|
32
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 */
|
|
35
|
+
font-feature-settings: theme('fontFamily.sans[1].fontFeatureSettings', normal); /* 5 */
|
|
36
|
+
font-variation-settings: theme('fontFamily.sans[1].fontVariationSettings', normal); /* 6 */
|
|
33
37
|
}
|
|
34
38
|
|
|
35
39
|
/*
|
|
@@ -58,7 +62,7 @@ hr {
|
|
|
58
62
|
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
59
63
|
*/
|
|
60
64
|
|
|
61
|
-
abbr[title] {
|
|
65
|
+
abbr:where([title]) {
|
|
62
66
|
text-decoration: underline dotted;
|
|
63
67
|
}
|
|
64
68
|
|
|
@@ -144,7 +148,7 @@ sup {
|
|
|
144
148
|
table {
|
|
145
149
|
text-indent: 0; /* 1 */
|
|
146
150
|
border-color: inherit; /* 2 */
|
|
147
|
-
border-collapse: collapse;
|
|
151
|
+
border-collapse: collapse; /* 3 */
|
|
148
152
|
}
|
|
149
153
|
|
|
150
154
|
/*
|
|
@@ -159,7 +163,10 @@ optgroup,
|
|
|
159
163
|
select,
|
|
160
164
|
textarea {
|
|
161
165
|
font-family: inherit; /* 1 */
|
|
166
|
+
font-feature-settings: inherit; /* 1 */
|
|
167
|
+
font-variation-settings: inherit; /* 1 */
|
|
162
168
|
font-size: 100%; /* 1 */
|
|
169
|
+
font-weight: inherit; /* 1 */
|
|
163
170
|
line-height: inherit; /* 1 */
|
|
164
171
|
color: inherit; /* 1 */
|
|
165
172
|
margin: 0; /* 2 */
|
|
@@ -259,7 +266,7 @@ summary {
|
|
|
259
266
|
}
|
|
260
267
|
|
|
261
268
|
/*
|
|
262
|
-
Removes the default spacing
|
|
269
|
+
Removes the default spacing for appropriate elements.
|
|
263
270
|
*/
|
|
264
271
|
|
|
265
272
|
blockquote,
|
|
@@ -295,6 +302,10 @@ menu {
|
|
|
295
302
|
padding: 0;
|
|
296
303
|
}
|
|
297
304
|
|
|
305
|
+
dialog {
|
|
306
|
+
padding: 0;
|
|
307
|
+
}
|
|
308
|
+
|
|
298
309
|
/*
|
|
299
310
|
Prevent resizing textareas horizontally by default.
|
|
300
311
|
*/
|
|
@@ -310,7 +321,7 @@ textarea {
|
|
|
310
321
|
|
|
311
322
|
input::placeholder,
|
|
312
323
|
textarea::placeholder {
|
|
313
|
-
opacity: 1;
|
|
324
|
+
opacity: 1; /* 1 */
|
|
314
325
|
color: theme('colors.gray.400', #9ca3af); /* 2 */
|
|
315
326
|
}
|
|
316
327
|
|
|
@@ -358,10 +369,7 @@ video {
|
|
|
358
369
|
height: auto;
|
|
359
370
|
}
|
|
360
371
|
|
|
361
|
-
/*
|
|
362
|
-
Ensure the default browser behavior of the `hidden` attribute.
|
|
363
|
-
*/
|
|
364
|
-
|
|
372
|
+
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
365
373
|
[hidden] {
|
|
366
374
|
display: none;
|
|
367
375
|
}
|
package/lib/featureFlags.js
CHANGED
|
@@ -2,59 +2,83 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
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
|
+
}
|
|
24
|
+
});
|
|
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) {
|
|
11
28
|
return obj && obj.__esModule ? obj : {
|
|
12
29
|
default: obj
|
|
13
30
|
};
|
|
14
31
|
}
|
|
15
32
|
let defaults = {
|
|
16
|
-
optimizeUniversalDefaults:
|
|
33
|
+
optimizeUniversalDefaults: false,
|
|
34
|
+
disableColorOpacityUtilitiesByDefault: false,
|
|
35
|
+
relativeContentPathsByDefault: false,
|
|
36
|
+
oxideParser: true,
|
|
37
|
+
logicalSiblingUtilities: false
|
|
17
38
|
};
|
|
18
39
|
let featureFlags = {
|
|
19
|
-
future: [
|
|
40
|
+
future: [
|
|
41
|
+
"hoverOnlyWhenSupported",
|
|
42
|
+
"respectDefaultRingColorOpacity",
|
|
43
|
+
"disableColorOpacityUtilitiesByDefault",
|
|
44
|
+
"relativeContentPathsByDefault",
|
|
45
|
+
"logicalSiblingUtilities"
|
|
46
|
+
],
|
|
20
47
|
experimental: [
|
|
21
|
-
|
|
48
|
+
"optimizeUniversalDefaults",
|
|
49
|
+
"oxideParser"
|
|
22
50
|
]
|
|
23
51
|
};
|
|
24
52
|
function flagEnabled(config, flag) {
|
|
25
53
|
if (featureFlags.future.includes(flag)) {
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
return config.future ===
|
|
54
|
+
var _config_future;
|
|
55
|
+
var _config_future_flag, _ref;
|
|
56
|
+
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);
|
|
29
57
|
}
|
|
30
58
|
if (featureFlags.experimental.includes(flag)) {
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
return config.experimental ===
|
|
59
|
+
var _config_experimental;
|
|
60
|
+
var _config_experimental_flag, _ref1;
|
|
61
|
+
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);
|
|
34
62
|
}
|
|
35
63
|
return false;
|
|
36
64
|
}
|
|
37
65
|
function experimentalFlagsEnabled(config) {
|
|
38
|
-
if (config.experimental ===
|
|
66
|
+
if (config.experimental === "all") {
|
|
39
67
|
return featureFlags.experimental;
|
|
40
68
|
}
|
|
41
|
-
var
|
|
42
|
-
return Object.keys((
|
|
43
|
-
}).filter((flag)=>featureFlags.experimental.includes(flag) && config.experimental[flag]
|
|
44
|
-
);
|
|
69
|
+
var _config_experimental;
|
|
70
|
+
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]);
|
|
45
71
|
}
|
|
46
72
|
function issueFlagNotices(config) {
|
|
47
73
|
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
48
74
|
return;
|
|
49
75
|
}
|
|
50
76
|
if (experimentalFlagsEnabled(config).length > 0) {
|
|
51
|
-
let changes = experimentalFlagsEnabled(config).map((s)=>
|
|
52
|
-
|
|
53
|
-
_log.default.warn('experimental-flags-enabled', [
|
|
77
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
|
78
|
+
_log.default.warn("experimental-flags-enabled", [
|
|
54
79
|
`You have enabled experimental features: ${changes}`,
|
|
55
|
-
|
|
80
|
+
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
|
|
56
81
|
]);
|
|
57
82
|
}
|
|
58
83
|
}
|
|
59
|
-
|
|
60
|
-
exports.default = _default;
|
|
84
|
+
const _default = featureFlags;
|
package/lib/index.js
CHANGED
|
@@ -1,32 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var _setupWatchingContext = _interopRequireDefault(require("./lib/setupWatchingContext"));
|
|
4
|
-
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
|
|
5
|
-
var _sharedState = require("./lib/sharedState");
|
|
6
|
-
function _interopRequireDefault(obj) {
|
|
7
|
-
return obj && obj.__esModule ? obj : {
|
|
8
|
-
default: obj
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
module.exports = function tailwindcss(configOrPath) {
|
|
12
|
-
return {
|
|
13
|
-
postcssPlugin: 'tailwindcss',
|
|
14
|
-
plugins: [
|
|
15
|
-
_sharedState.env.DEBUG && function(root) {
|
|
16
|
-
console.log('\n');
|
|
17
|
-
console.time('JIT TOTAL');
|
|
18
|
-
return root;
|
|
19
|
-
},
|
|
20
|
-
function(root, result) {
|
|
21
|
-
let setupContext = _sharedState.env.TAILWIND_MODE === 'watch' ? (0, _setupWatchingContext).default(configOrPath) : (0, _setupTrackingContext).default(configOrPath);
|
|
22
|
-
(0, _processTailwindFeatures).default(setupContext)(root, result);
|
|
23
|
-
},
|
|
24
|
-
_sharedState.env.DEBUG && function(root) {
|
|
25
|
-
console.timeEnd('JIT TOTAL');
|
|
26
|
-
console.log('\n');
|
|
27
|
-
return root;
|
|
28
|
-
},
|
|
29
|
-
].filter(Boolean)
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
module.exports.postcss = true;
|
|
2
|
+
module.exports = require("./plugin");
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "hasContentChanged", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return hasContentChanged;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _crypto = /*#__PURE__*/ _interop_require_default(require("crypto"));
|
|
12
|
+
const _sharedState = /*#__PURE__*/ _interop_require_wildcard(require("./sharedState"));
|
|
13
|
+
function _interop_require_default(obj) {
|
|
14
|
+
return obj && obj.__esModule ? obj : {
|
|
15
|
+
default: obj
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
19
|
+
if (typeof WeakMap !== "function") return null;
|
|
20
|
+
var cacheBabelInterop = new WeakMap();
|
|
21
|
+
var cacheNodeInterop = new WeakMap();
|
|
22
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
23
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
24
|
+
})(nodeInterop);
|
|
25
|
+
}
|
|
26
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
27
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
28
|
+
return obj;
|
|
29
|
+
}
|
|
30
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
31
|
+
return {
|
|
32
|
+
default: obj
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
36
|
+
if (cache && cache.has(obj)) {
|
|
37
|
+
return cache.get(obj);
|
|
38
|
+
}
|
|
39
|
+
var newObj = {};
|
|
40
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
41
|
+
for(var key in obj){
|
|
42
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
43
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
44
|
+
if (desc && (desc.get || desc.set)) {
|
|
45
|
+
Object.defineProperty(newObj, key, desc);
|
|
46
|
+
} else {
|
|
47
|
+
newObj[key] = obj[key];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
newObj.default = obj;
|
|
52
|
+
if (cache) {
|
|
53
|
+
cache.set(obj, newObj);
|
|
54
|
+
}
|
|
55
|
+
return newObj;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Calculate the hash of a string.
|
|
59
|
+
*
|
|
60
|
+
* This doesn't need to be cryptographically secure or
|
|
61
|
+
* anything like that since it's used only to detect
|
|
62
|
+
* when the CSS changes to invalidate the context.
|
|
63
|
+
*
|
|
64
|
+
* This is wrapped in a try/catch because it's really dependent
|
|
65
|
+
* on how Node itself is build and the environment and OpenSSL
|
|
66
|
+
* version / build that is installed on the user's machine.
|
|
67
|
+
*
|
|
68
|
+
* Based on the environment this can just outright fail.
|
|
69
|
+
*
|
|
70
|
+
* See https://github.com/nodejs/node/issues/40455
|
|
71
|
+
*
|
|
72
|
+
* @param {string} str
|
|
73
|
+
*/ function getHash(str) {
|
|
74
|
+
try {
|
|
75
|
+
return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
|
|
76
|
+
} catch (err) {
|
|
77
|
+
return "";
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function hasContentChanged(sourcePath, root) {
|
|
81
|
+
let css = root.toString();
|
|
82
|
+
// We only care about files with @tailwind directives
|
|
83
|
+
// Other files use an existing context
|
|
84
|
+
if (!css.includes("@tailwind")) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
|
|
88
|
+
let rootHash = getHash(css);
|
|
89
|
+
let didChange = existingHash !== rootHash;
|
|
90
|
+
_sharedState.sourceHashMap.set(sourcePath, rootHash);
|
|
91
|
+
return didChange;
|
|
92
|
+
}
|
|
@@ -2,19 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return collapseAdjacentRules;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
6
11
|
let comparisonMap = {
|
|
7
12
|
atrule: [
|
|
8
|
-
|
|
9
|
-
|
|
13
|
+
"name",
|
|
14
|
+
"params"
|
|
10
15
|
],
|
|
11
16
|
rule: [
|
|
12
|
-
|
|
17
|
+
"selector"
|
|
13
18
|
]
|
|
14
19
|
};
|
|
15
20
|
let types = new Set(Object.keys(comparisonMap));
|
|
16
21
|
function collapseAdjacentRules() {
|
|
17
|
-
|
|
22
|
+
function collapseRulesIn(root) {
|
|
18
23
|
let currentRule = null;
|
|
19
24
|
root.each((node)=>{
|
|
20
25
|
if (!types.has(node.type)) {
|
|
@@ -26,16 +31,31 @@ function collapseAdjacentRules() {
|
|
|
26
31
|
return;
|
|
27
32
|
}
|
|
28
33
|
let properties = comparisonMap[node.type];
|
|
29
|
-
var
|
|
30
|
-
if (node.type ===
|
|
34
|
+
var _node_property, _currentRule_property;
|
|
35
|
+
if (node.type === "atrule" && node.name === "font-face") {
|
|
31
36
|
currentRule = node;
|
|
32
|
-
} else if (properties.every((property)=>((
|
|
33
|
-
|
|
34
|
-
|
|
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, " "))) {
|
|
38
|
+
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
39
|
+
if (node.nodes) {
|
|
40
|
+
currentRule.append(node.nodes);
|
|
41
|
+
}
|
|
35
42
|
node.remove();
|
|
36
43
|
} else {
|
|
37
44
|
currentRule = node;
|
|
38
45
|
}
|
|
39
46
|
});
|
|
47
|
+
// After we've collapsed adjacent rules & at-rules, we need to collapse
|
|
48
|
+
// adjacent rules & at-rules that are children of at-rules.
|
|
49
|
+
// We do not care about nesting rules because Tailwind CSS
|
|
50
|
+
// explicitly does not handle rule nesting on its own as
|
|
51
|
+
// the user is expected to use a nesting plugin
|
|
52
|
+
root.each((node)=>{
|
|
53
|
+
if (node.type === "atrule") {
|
|
54
|
+
collapseRulesIn(node);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return (root)=>{
|
|
59
|
+
collapseRulesIn(root);
|
|
40
60
|
};
|
|
41
61
|
}
|
|
@@ -2,12 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return collapseDuplicateDeclarations;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
6
11
|
function collapseDuplicateDeclarations() {
|
|
7
12
|
return (root)=>{
|
|
8
13
|
root.walkRules((node)=>{
|
|
9
14
|
let seen = new Map();
|
|
10
15
|
let droppable = new Set([]);
|
|
16
|
+
let byProperty = new Map();
|
|
11
17
|
node.walkDecls((decl)=>{
|
|
12
18
|
// This could happen if we have nested selectors. In that case the
|
|
13
19
|
// parent will loop over all its declarations but also the declarations
|
|
@@ -17,13 +23,63 @@ function collapseDuplicateDeclarations() {
|
|
|
17
23
|
return;
|
|
18
24
|
}
|
|
19
25
|
if (seen.has(decl.prop)) {
|
|
20
|
-
|
|
26
|
+
// Exact same value as what we have seen so far
|
|
27
|
+
if (seen.get(decl.prop).value === decl.value) {
|
|
28
|
+
// Keep the last one, drop the one we've seen so far
|
|
29
|
+
droppable.add(seen.get(decl.prop));
|
|
30
|
+
// Override the existing one with the new value. This is necessary
|
|
31
|
+
// so that if we happen to have more than one declaration with the
|
|
32
|
+
// same value, that we keep removing the previous one. Otherwise we
|
|
33
|
+
// will only remove the *first* one.
|
|
34
|
+
seen.set(decl.prop, decl);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// Not the same value, so we need to check if we can merge it so
|
|
38
|
+
// let's collect it first.
|
|
39
|
+
if (!byProperty.has(decl.prop)) {
|
|
40
|
+
byProperty.set(decl.prop, new Set());
|
|
41
|
+
}
|
|
42
|
+
byProperty.get(decl.prop).add(seen.get(decl.prop));
|
|
43
|
+
byProperty.get(decl.prop).add(decl);
|
|
21
44
|
}
|
|
22
45
|
seen.set(decl.prop, decl);
|
|
23
46
|
});
|
|
24
|
-
|
|
25
|
-
|
|
47
|
+
// Drop all the duplicate declarations with the exact same value we've
|
|
48
|
+
// already seen so far.
|
|
49
|
+
for (let decl of droppable){
|
|
50
|
+
decl.remove();
|
|
51
|
+
}
|
|
52
|
+
// Analyze the declarations based on its unit, drop all the declarations
|
|
53
|
+
// with the same unit but the last one in the list.
|
|
54
|
+
for (let declarations of byProperty.values()){
|
|
55
|
+
let byUnit = new Map();
|
|
56
|
+
for (let decl of declarations){
|
|
57
|
+
let unit = resolveUnit(decl.value);
|
|
58
|
+
if (unit === null) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (!byUnit.has(unit)) {
|
|
62
|
+
byUnit.set(unit, new Set());
|
|
63
|
+
}
|
|
64
|
+
byUnit.get(unit).add(decl);
|
|
65
|
+
}
|
|
66
|
+
for (let declarations of byUnit.values()){
|
|
67
|
+
// Get all but the last one
|
|
68
|
+
let removableDeclarations = Array.from(declarations).slice(0, -1);
|
|
69
|
+
for (let decl of removableDeclarations){
|
|
70
|
+
decl.remove();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
26
73
|
}
|
|
27
74
|
});
|
|
28
75
|
};
|
|
29
76
|
}
|
|
77
|
+
let UNITLESS_NUMBER = Symbol("unitless-number");
|
|
78
|
+
function resolveUnit(input) {
|
|
79
|
+
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
|
80
|
+
if (result) {
|
|
81
|
+
var _result_;
|
|
82
|
+
return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
|
|
83
|
+
}
|
|
84
|
+
return null;
|
|
85
|
+
}
|