tailwindcss 0.0.0-insiders.f4635e0 → 0.0.0-insiders.f4a2ccd
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/colors.js +2 -304
- package/defaultConfig.d.ts +3 -0
- package/defaultConfig.js +2 -4
- package/defaultTheme.d.ts +4 -0
- package/defaultTheme.js +2 -4
- package/lib/cli/build/deps.js +54 -0
- package/lib/cli/build/index.js +52 -0
- package/lib/cli/build/plugin.js +376 -0
- package/lib/cli/build/utils.js +78 -0
- package/lib/cli/build/watching.js +180 -0
- package/lib/cli/help/index.js +71 -0
- package/lib/cli/index.js +230 -0
- package/lib/cli/init/index.js +61 -0
- package/lib/cli-peer-dependencies.js +22 -14
- package/lib/cli.js +4 -762
- package/lib/corePluginList.js +182 -5
- package/lib/corePlugins.js +4109 -2952
- package/lib/css/preflight.css +24 -9
- package/lib/featureFlags.js +68 -50
- package/lib/index.js +5 -30
- package/lib/lib/cacheInvalidation.js +90 -0
- package/lib/lib/collapseAdjacentRules.js +52 -36
- package/lib/lib/collapseDuplicateDeclarations.js +83 -0
- package/lib/lib/content.js +177 -0
- package/lib/lib/defaultExtractor.js +241 -0
- package/lib/lib/detectNesting.js +39 -17
- package/lib/lib/evaluateTailwindFunctions.js +203 -161
- package/lib/lib/expandApplyAtRules.js +503 -221
- package/lib/lib/expandTailwindAtRules.js +255 -243
- package/lib/lib/findAtConfigPath.js +44 -0
- package/lib/lib/generateRules.js +831 -317
- package/lib/lib/getModuleDependencies.js +93 -49
- package/lib/lib/load-config.js +36 -0
- package/lib/lib/normalizeTailwindDirectives.js +79 -60
- package/lib/lib/offsets.js +304 -0
- package/lib/lib/partitionApplyAtRules.js +56 -0
- package/lib/lib/regex.js +60 -0
- package/lib/lib/remap-bitfield.js +87 -0
- package/lib/lib/resolveDefaultsAtRules.js +150 -94
- package/lib/lib/setupContextUtils.js +1197 -685
- package/lib/lib/setupTrackingContext.js +150 -177
- package/lib/lib/sharedState.js +70 -21
- package/lib/lib/substituteScreenAtRules.js +26 -28
- package/lib/oxide/cli/build/deps.js +81 -0
- package/lib/oxide/cli/build/index.js +51 -0
- package/lib/oxide/cli/build/plugin.js +373 -0
- package/lib/oxide/cli/build/utils.js +77 -0
- package/lib/oxide/cli/build/watching.js +177 -0
- package/lib/oxide/cli/help/index.js +70 -0
- package/lib/oxide/cli/index.js +214 -0
- package/lib/oxide/cli/init/index.js +50 -0
- package/lib/oxide/cli.js +5 -0
- package/lib/oxide/postcss-plugin.js +2 -0
- package/lib/plugin.js +98 -0
- package/{nesting → lib/postcss-plugins/nesting}/README.md +2 -2
- package/lib/postcss-plugins/nesting/index.js +19 -0
- package/lib/postcss-plugins/nesting/plugin.js +87 -0
- package/lib/processTailwindFeatures.js +58 -56
- package/lib/public/colors.js +353 -0
- package/lib/public/create-plugin.js +15 -0
- package/lib/public/default-config.js +16 -0
- package/lib/public/default-theme.js +16 -0
- package/lib/public/load-config.js +10 -0
- package/lib/public/resolve-config.js +22 -0
- package/lib/util/applyImportantSelector.js +22 -0
- package/lib/util/bigSign.js +7 -6
- package/lib/util/buildMediaQuery.js +21 -32
- package/lib/util/cloneDeep.js +16 -14
- package/lib/util/cloneNodes.js +29 -15
- package/lib/util/color.js +104 -66
- package/lib/util/configurePlugins.js +17 -15
- package/lib/util/createPlugin.js +23 -26
- package/lib/util/createUtilityPlugin.js +46 -46
- package/lib/util/dataTypes.js +266 -0
- package/lib/util/defaults.js +20 -15
- package/lib/util/escapeClassName.js +18 -17
- package/lib/util/escapeCommas.js +7 -6
- package/lib/util/flattenColorPalette.js +13 -12
- package/lib/util/formatVariantSelector.js +341 -0
- package/lib/util/getAllConfigs.js +44 -18
- package/lib/util/hashConfig.js +15 -12
- package/lib/util/isKeyframeRule.js +7 -6
- package/lib/util/isPlainObject.js +11 -11
- package/lib/util/isSyntacticallyValidPropertyValue.js +72 -0
- package/lib/util/log.js +52 -33
- package/lib/util/nameClass.js +35 -29
- package/lib/util/negateValue.js +31 -17
- package/lib/util/normalizeConfig.js +294 -0
- package/lib/util/normalizeScreens.js +170 -0
- package/lib/util/parseAnimationValue.js +85 -54
- package/lib/util/parseBoxShadowValue.js +84 -0
- package/lib/util/parseDependency.js +41 -70
- package/lib/util/parseGlob.js +34 -0
- package/lib/util/parseObjectStyles.js +30 -24
- package/lib/util/pluginUtils.js +234 -288
- package/lib/util/prefixSelector.js +33 -19
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +221 -256
- package/lib/util/resolveConfigPath.js +55 -48
- package/lib/util/responsive.js +18 -14
- package/lib/util/splitAtTopLevelOnly.js +49 -0
- package/lib/util/tap.js +8 -7
- package/lib/util/toColorValue.js +7 -6
- package/lib/util/toPath.js +27 -8
- package/lib/util/transformThemeValue.js +67 -28
- package/lib/util/validateConfig.js +24 -0
- package/lib/util/validateFormalSyntax.js +24 -0
- package/lib/util/withAlphaVariable.js +67 -57
- package/loadConfig.d.ts +4 -0
- package/loadConfig.js +2 -0
- package/nesting/index.js +2 -12
- package/package.json +69 -66
- package/peers/index.js +76328 -84169
- package/plugin.d.ts +11 -0
- package/plugin.js +1 -2
- package/resolveConfig.d.ts +12 -0
- package/resolveConfig.js +2 -7
- package/scripts/create-plugin-list.js +2 -2
- package/scripts/generate-types.js +105 -0
- package/scripts/release-channel.js +18 -0
- package/scripts/release-notes.js +21 -0
- package/scripts/swap-engines.js +40 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +49 -0
- package/src/cli/build/plugin.js +444 -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 +216 -0
- package/src/cli/init/index.js +79 -0
- package/src/cli-peer-dependencies.js +7 -1
- package/src/cli.js +4 -756
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +2526 -1956
- package/src/css/preflight.css +24 -9
- package/src/featureFlags.js +33 -10
- package/src/index.js +4 -33
- package/src/lib/cacheInvalidation.js +52 -0
- package/src/lib/collapseAdjacentRules.js +21 -2
- package/src/lib/collapseDuplicateDeclarations.js +93 -0
- package/src/lib/content.js +208 -0
- package/src/lib/defaultExtractor.js +217 -0
- package/src/lib/detectNesting.js +30 -3
- package/src/lib/evaluateTailwindFunctions.js +84 -10
- package/src/lib/expandApplyAtRules.js +509 -153
- package/src/lib/expandTailwindAtRules.js +125 -104
- package/src/lib/findAtConfigPath.js +48 -0
- package/src/lib/generateRules.js +678 -70
- package/src/lib/getModuleDependencies.js +70 -30
- package/src/lib/load-config.ts +27 -0
- package/src/lib/normalizeTailwindDirectives.js +10 -3
- 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 +105 -47
- package/src/lib/setupContextUtils.js +848 -247
- package/src/lib/setupTrackingContext.js +53 -64
- package/src/lib/sharedState.js +60 -6
- package/src/lib/substituteScreenAtRules.js +6 -3
- 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/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 +18 -3
- package/src/public/colors.js +322 -0
- package/src/public/create-plugin.js +2 -0
- package/src/public/default-config.js +4 -0
- package/src/public/default-theme.js +4 -0
- package/src/public/load-config.js +2 -0
- package/src/public/resolve-config.js +7 -0
- package/src/util/applyImportantSelector.js +19 -0
- package/src/util/buildMediaQuery.js +14 -16
- package/src/util/cloneNodes.js +19 -2
- package/src/util/color.js +43 -11
- package/src/util/createUtilityPlugin.js +2 -11
- package/src/util/dataTypes.js +281 -0
- package/src/util/defaults.js +6 -0
- package/src/util/formatVariantSelector.js +412 -0
- package/src/util/getAllConfigs.js +21 -2
- package/src/util/isSyntacticallyValidPropertyValue.js +61 -0
- package/src/util/log.js +23 -22
- package/src/util/nameClass.js +6 -2
- package/src/util/negateValue.js +15 -5
- package/src/util/normalizeConfig.js +318 -0
- package/src/util/normalizeScreens.js +140 -0
- package/src/util/parseAnimationValue.js +7 -1
- package/src/util/parseBoxShadowValue.js +72 -0
- package/src/util/parseDependency.js +37 -38
- package/src/util/parseGlob.js +24 -0
- package/src/util/pluginUtils.js +219 -219
- package/src/util/prefixSelector.js +30 -13
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +86 -91
- 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 +33 -8
- package/src/util/validateConfig.js +13 -0
- package/src/util/validateFormalSyntax.js +34 -0
- package/src/util/withAlphaVariable.js +14 -9
- package/stubs/.gitignore +1 -0
- package/stubs/.prettierrc.json +6 -0
- package/stubs/{defaultConfig.stub.js → config.full.js} +332 -249
- 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 +373 -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 +347 -0
- package/types/index.d.ts +7 -0
- package/CHANGELOG.md +0 -1742
- package/lib/constants.js +0 -37
- package/lib/lib/setupWatchingContext.js +0 -331
- package/nesting/plugin.js +0 -41
- package/scripts/install-integrations.js +0 -27
- package/scripts/rebuildFixtures.js +0 -68
- package/src/constants.js +0 -17
- package/src/lib/setupWatchingContext.js +0 -307
- /package/stubs/{defaultPostCssConfig.stub.js → postcss.config.cjs} +0 -0
package/lib/css/preflight.css
CHANGED
|
@@ -9,7 +9,12 @@
|
|
|
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
|
+
}
|
|
14
|
+
|
|
15
|
+
::before,
|
|
16
|
+
::after {
|
|
17
|
+
--tw-content: '';
|
|
13
18
|
}
|
|
14
19
|
|
|
15
20
|
/*
|
|
@@ -17,6 +22,8 @@
|
|
|
17
22
|
2. Prevent adjustments of font size after orientation changes in iOS.
|
|
18
23
|
3. Use a more readable tab size.
|
|
19
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.
|
|
20
27
|
*/
|
|
21
28
|
|
|
22
29
|
html {
|
|
@@ -25,6 +32,8 @@ html {
|
|
|
25
32
|
-moz-tab-size: 4; /* 3 */
|
|
26
33
|
tab-size: 4; /* 3 */
|
|
27
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 */
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
/*
|
|
@@ -53,7 +62,7 @@ hr {
|
|
|
53
62
|
Add the correct text decoration in Chrome, Edge, and Safari.
|
|
54
63
|
*/
|
|
55
64
|
|
|
56
|
-
abbr[title] {
|
|
65
|
+
abbr:where([title]) {
|
|
57
66
|
text-decoration: underline dotted;
|
|
58
67
|
}
|
|
59
68
|
|
|
@@ -139,7 +148,7 @@ sup {
|
|
|
139
148
|
table {
|
|
140
149
|
text-indent: 0; /* 1 */
|
|
141
150
|
border-color: inherit; /* 2 */
|
|
142
|
-
border-collapse: collapse;
|
|
151
|
+
border-collapse: collapse; /* 3 */
|
|
143
152
|
}
|
|
144
153
|
|
|
145
154
|
/*
|
|
@@ -155,6 +164,7 @@ select,
|
|
|
155
164
|
textarea {
|
|
156
165
|
font-family: inherit; /* 1 */
|
|
157
166
|
font-size: 100%; /* 1 */
|
|
167
|
+
font-weight: inherit; /* 1 */
|
|
158
168
|
line-height: inherit; /* 1 */
|
|
159
169
|
color: inherit; /* 1 */
|
|
160
170
|
margin: 0; /* 2 */
|
|
@@ -283,7 +293,8 @@ legend {
|
|
|
283
293
|
}
|
|
284
294
|
|
|
285
295
|
ol,
|
|
286
|
-
ul
|
|
296
|
+
ul,
|
|
297
|
+
menu {
|
|
287
298
|
list-style: none;
|
|
288
299
|
margin: 0;
|
|
289
300
|
padding: 0;
|
|
@@ -304,7 +315,7 @@ textarea {
|
|
|
304
315
|
|
|
305
316
|
input::placeholder,
|
|
306
317
|
textarea::placeholder {
|
|
307
|
-
opacity: 1;
|
|
318
|
+
opacity: 1; /* 1 */
|
|
308
319
|
color: theme('colors.gray.400', #9ca3af); /* 2 */
|
|
309
320
|
}
|
|
310
321
|
|
|
@@ -317,6 +328,13 @@ button,
|
|
|
317
328
|
cursor: pointer;
|
|
318
329
|
}
|
|
319
330
|
|
|
331
|
+
/*
|
|
332
|
+
Make sure disabled buttons don't get the pointer cursor.
|
|
333
|
+
*/
|
|
334
|
+
:disabled {
|
|
335
|
+
cursor: default;
|
|
336
|
+
}
|
|
337
|
+
|
|
320
338
|
/*
|
|
321
339
|
1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
|
|
322
340
|
2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
|
|
@@ -345,10 +363,7 @@ video {
|
|
|
345
363
|
height: auto;
|
|
346
364
|
}
|
|
347
365
|
|
|
348
|
-
/*
|
|
349
|
-
Ensure the default browser behavior of the `hidden` attribute.
|
|
350
|
-
*/
|
|
351
|
-
|
|
366
|
+
/* Make elements with the HTML hidden attribute stay hidden by default */
|
|
352
367
|
[hidden] {
|
|
353
368
|
display: none;
|
|
354
369
|
}
|
package/lib/featureFlags.js
CHANGED
|
@@ -1,60 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
5
4
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
+
flagEnabled: ()=>flagEnabled,
|
|
13
|
+
issueFlagNotices: ()=>issueFlagNotices,
|
|
14
|
+
default: ()=>_default
|
|
15
|
+
});
|
|
16
|
+
const _picocolors = /*#__PURE__*/ _interopRequireDefault(require("picocolors"));
|
|
17
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
|
|
18
|
+
const _sharedState = require("./lib/sharedState");
|
|
19
|
+
function _interopRequireDefault(obj) {
|
|
20
|
+
return obj && obj.__esModule ? obj : {
|
|
21
|
+
default: obj
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
let defaults = {
|
|
25
|
+
optimizeUniversalDefaults: false,
|
|
26
|
+
generalizedModifiers: true,
|
|
27
|
+
get disableColorOpacityUtilitiesByDefault () {
|
|
28
|
+
return _sharedState.env.OXIDE;
|
|
29
|
+
},
|
|
30
|
+
get relativeContentPathsByDefault () {
|
|
31
|
+
return _sharedState.env.OXIDE;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
let featureFlags = {
|
|
35
|
+
future: [
|
|
36
|
+
"hoverOnlyWhenSupported",
|
|
37
|
+
"respectDefaultRingColorOpacity",
|
|
38
|
+
"disableColorOpacityUtilitiesByDefault",
|
|
39
|
+
"relativeContentPathsByDefault"
|
|
40
|
+
],
|
|
41
|
+
experimental: [
|
|
42
|
+
"optimizeUniversalDefaults",
|
|
43
|
+
"generalizedModifiers"
|
|
44
|
+
]
|
|
19
45
|
};
|
|
20
|
-
|
|
21
46
|
function flagEnabled(config, flag) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return false;
|
|
47
|
+
if (featureFlags.future.includes(flag)) {
|
|
48
|
+
var _config_future;
|
|
49
|
+
var _config_future_flag, _ref;
|
|
50
|
+
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);
|
|
51
|
+
}
|
|
52
|
+
if (featureFlags.experimental.includes(flag)) {
|
|
53
|
+
var _config_experimental;
|
|
54
|
+
var _config_experimental_flag, _ref1;
|
|
55
|
+
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);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
35
58
|
}
|
|
36
|
-
|
|
37
59
|
function experimentalFlagsEnabled(config) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return Object.keys((_config$experimental2 = config === null || config === void 0 ? void 0 : config.experimental) !== null && _config$experimental2 !== void 0 ? _config$experimental2 : {}).filter(flag => featureFlags.experimental.includes(flag) && config.experimental[flag]);
|
|
60
|
+
if (config.experimental === "all") {
|
|
61
|
+
return featureFlags.experimental;
|
|
62
|
+
}
|
|
63
|
+
var _config_experimental;
|
|
64
|
+
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
65
|
}
|
|
46
|
-
|
|
47
66
|
function issueFlagNotices(config) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
if (process.env.JEST_WORKER_ID !== undefined) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (experimentalFlagsEnabled(config).length > 0) {
|
|
71
|
+
let changes = experimentalFlagsEnabled(config).map((s)=>_picocolors.default.yellow(s)).join(", ");
|
|
72
|
+
_log.default.warn("experimental-flags-enabled", [
|
|
73
|
+
`You have enabled experimental features: ${changes}`,
|
|
74
|
+
"Experimental features in Tailwind CSS are not covered by semver, may introduce breaking changes, and can change at any time."
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
57
77
|
}
|
|
58
|
-
|
|
59
|
-
var _default = featureFlags;
|
|
60
|
-
exports.default = _default;
|
|
78
|
+
const _default = featureFlags;
|
package/lib/index.js
CHANGED
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _processTailwindFeatures = _interopRequireDefault(require("./processTailwindFeatures"));
|
|
8
|
-
|
|
9
|
-
var _sharedState = require("./lib/sharedState");
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
module.exports = function tailwindcss(configOrPath) {
|
|
14
|
-
return {
|
|
15
|
-
postcssPlugin: 'tailwindcss',
|
|
16
|
-
plugins: [_sharedState.env.DEBUG && function (root) {
|
|
17
|
-
console.log('\n');
|
|
18
|
-
console.time('JIT TOTAL');
|
|
19
|
-
return root;
|
|
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
|
-
}, _sharedState.env.DEBUG && function (root) {
|
|
24
|
-
console.timeEnd('JIT TOTAL');
|
|
25
|
-
console.log('\n');
|
|
26
|
-
return root;
|
|
27
|
-
}].filter(Boolean)
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
module.exports.postcss = true;
|
|
2
|
+
if (process.env.OXIDE) {
|
|
3
|
+
module.exports = require("./oxide/postcss-plugin");
|
|
4
|
+
} else {
|
|
5
|
+
module.exports = require("./plugin");
|
|
6
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "hasContentChanged", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>hasContentChanged
|
|
8
|
+
});
|
|
9
|
+
const _crypto = /*#__PURE__*/ _interopRequireDefault(require("crypto"));
|
|
10
|
+
const _sharedState = /*#__PURE__*/ _interopRequireWildcard(require("./sharedState"));
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
17
|
+
if (typeof WeakMap !== "function") return null;
|
|
18
|
+
var cacheBabelInterop = new WeakMap();
|
|
19
|
+
var cacheNodeInterop = new WeakMap();
|
|
20
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
21
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
22
|
+
})(nodeInterop);
|
|
23
|
+
}
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) {
|
|
25
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
26
|
+
return obj;
|
|
27
|
+
}
|
|
28
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
29
|
+
return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
34
|
+
if (cache && cache.has(obj)) {
|
|
35
|
+
return cache.get(obj);
|
|
36
|
+
}
|
|
37
|
+
var newObj = {};
|
|
38
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
|
+
for(var key in obj){
|
|
40
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
41
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
42
|
+
if (desc && (desc.get || desc.set)) {
|
|
43
|
+
Object.defineProperty(newObj, key, desc);
|
|
44
|
+
} else {
|
|
45
|
+
newObj[key] = obj[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
newObj.default = obj;
|
|
50
|
+
if (cache) {
|
|
51
|
+
cache.set(obj, newObj);
|
|
52
|
+
}
|
|
53
|
+
return newObj;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Calculate the hash of a string.
|
|
57
|
+
*
|
|
58
|
+
* This doesn't need to be cryptographically secure or
|
|
59
|
+
* anything like that since it's used only to detect
|
|
60
|
+
* when the CSS changes to invalidate the context.
|
|
61
|
+
*
|
|
62
|
+
* This is wrapped in a try/catch because it's really dependent
|
|
63
|
+
* on how Node itself is build and the environment and OpenSSL
|
|
64
|
+
* version / build that is installed on the user's machine.
|
|
65
|
+
*
|
|
66
|
+
* Based on the environment this can just outright fail.
|
|
67
|
+
*
|
|
68
|
+
* See https://github.com/nodejs/node/issues/40455
|
|
69
|
+
*
|
|
70
|
+
* @param {string} str
|
|
71
|
+
*/ function getHash(str) {
|
|
72
|
+
try {
|
|
73
|
+
return _crypto.default.createHash("md5").update(str, "utf-8").digest("binary");
|
|
74
|
+
} catch (err) {
|
|
75
|
+
return "";
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function hasContentChanged(sourcePath, root) {
|
|
79
|
+
let css = root.toString();
|
|
80
|
+
// We only care about files with @tailwind directives
|
|
81
|
+
// Other files use an existing context
|
|
82
|
+
if (!css.includes("@tailwind")) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
let existingHash = _sharedState.sourceHashMap.get(sourcePath);
|
|
86
|
+
let rootHash = getHash(css);
|
|
87
|
+
let didChange = existingHash !== rootHash;
|
|
88
|
+
_sharedState.sourceHashMap.set(sourcePath, rootHash);
|
|
89
|
+
return didChange;
|
|
90
|
+
}
|
|
@@ -1,43 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
2
|
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>collapseAdjacentRules
|
|
5
8
|
});
|
|
6
|
-
exports.default = collapseAdjacentRules;
|
|
7
9
|
let comparisonMap = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
atrule: [
|
|
11
|
+
"name",
|
|
12
|
+
"params"
|
|
13
|
+
],
|
|
14
|
+
rule: [
|
|
15
|
+
"selector"
|
|
16
|
+
]
|
|
10
17
|
};
|
|
11
18
|
let types = new Set(Object.keys(comparisonMap));
|
|
12
|
-
|
|
13
19
|
function collapseAdjacentRules() {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
function collapseRulesIn(root) {
|
|
21
|
+
let currentRule = null;
|
|
22
|
+
root.each((node)=>{
|
|
23
|
+
if (!types.has(node.type)) {
|
|
24
|
+
currentRule = null;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (currentRule === null) {
|
|
28
|
+
currentRule = node;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let properties = comparisonMap[node.type];
|
|
32
|
+
var _node_property, _currentRule_property;
|
|
33
|
+
if (node.type === "atrule" && node.name === "font-face") {
|
|
34
|
+
currentRule = node;
|
|
35
|
+
} 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
|
+
// An AtRule may not have children (for example if we encounter duplicate @import url(…) rules)
|
|
37
|
+
if (node.nodes) {
|
|
38
|
+
currentRule.append(node.nodes);
|
|
39
|
+
}
|
|
40
|
+
node.remove();
|
|
41
|
+
} else {
|
|
42
|
+
currentRule = node;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
// After we've collapsed adjacent rules & at-rules, we need to collapse
|
|
46
|
+
// adjacent rules & at-rules that are children of at-rules.
|
|
47
|
+
// We do not care about nesting rules because Tailwind CSS
|
|
48
|
+
// explicitly does not handle rule nesting on its own as
|
|
49
|
+
// the user is expected to use a nesting plugin
|
|
50
|
+
root.each((node)=>{
|
|
51
|
+
if (node.type === "atrule") {
|
|
52
|
+
collapseRulesIn(node);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
return (root)=>{
|
|
57
|
+
collapseRulesIn(root);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>collapseDuplicateDeclarations
|
|
8
|
+
});
|
|
9
|
+
function collapseDuplicateDeclarations() {
|
|
10
|
+
return (root)=>{
|
|
11
|
+
root.walkRules((node)=>{
|
|
12
|
+
let seen = new Map();
|
|
13
|
+
let droppable = new Set([]);
|
|
14
|
+
let byProperty = new Map();
|
|
15
|
+
node.walkDecls((decl)=>{
|
|
16
|
+
// This could happen if we have nested selectors. In that case the
|
|
17
|
+
// parent will loop over all its declarations but also the declarations
|
|
18
|
+
// of nested rules. With this we ensure that we are shallowly checking
|
|
19
|
+
// declarations.
|
|
20
|
+
if (decl.parent !== node) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (seen.has(decl.prop)) {
|
|
24
|
+
// Exact same value as what we have seen so far
|
|
25
|
+
if (seen.get(decl.prop).value === decl.value) {
|
|
26
|
+
// Keep the last one, drop the one we've seen so far
|
|
27
|
+
droppable.add(seen.get(decl.prop));
|
|
28
|
+
// Override the existing one with the new value. This is necessary
|
|
29
|
+
// so that if we happen to have more than one declaration with the
|
|
30
|
+
// same value, that we keep removing the previous one. Otherwise we
|
|
31
|
+
// will only remove the *first* one.
|
|
32
|
+
seen.set(decl.prop, decl);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Not the same value, so we need to check if we can merge it so
|
|
36
|
+
// let's collect it first.
|
|
37
|
+
if (!byProperty.has(decl.prop)) {
|
|
38
|
+
byProperty.set(decl.prop, new Set());
|
|
39
|
+
}
|
|
40
|
+
byProperty.get(decl.prop).add(seen.get(decl.prop));
|
|
41
|
+
byProperty.get(decl.prop).add(decl);
|
|
42
|
+
}
|
|
43
|
+
seen.set(decl.prop, decl);
|
|
44
|
+
});
|
|
45
|
+
// Drop all the duplicate declarations with the exact same value we've
|
|
46
|
+
// already seen so far.
|
|
47
|
+
for (let decl of droppable){
|
|
48
|
+
decl.remove();
|
|
49
|
+
}
|
|
50
|
+
// Analyze the declarations based on its unit, drop all the declarations
|
|
51
|
+
// with the same unit but the last one in the list.
|
|
52
|
+
for (let declarations of byProperty.values()){
|
|
53
|
+
let byUnit = new Map();
|
|
54
|
+
for (let decl1 of declarations){
|
|
55
|
+
let unit = resolveUnit(decl1.value);
|
|
56
|
+
if (unit === null) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (!byUnit.has(unit)) {
|
|
60
|
+
byUnit.set(unit, new Set());
|
|
61
|
+
}
|
|
62
|
+
byUnit.get(unit).add(decl1);
|
|
63
|
+
}
|
|
64
|
+
for (let declarations1 of byUnit.values()){
|
|
65
|
+
// Get all but the last one
|
|
66
|
+
let removableDeclarations = Array.from(declarations1).slice(0, -1);
|
|
67
|
+
for (let decl2 of removableDeclarations){
|
|
68
|
+
decl2.remove();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
let UNITLESS_NUMBER = Symbol("unitless-number");
|
|
76
|
+
function resolveUnit(input) {
|
|
77
|
+
let result = /^-?\d*.?\d+([\w%]+)?$/g.exec(input);
|
|
78
|
+
if (result) {
|
|
79
|
+
var _result_;
|
|
80
|
+
return (_result_ = result[1]) !== null && _result_ !== void 0 ? _result_ : UNITLESS_NUMBER;
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|