tailwindcss 0.0.0-insiders.7aa2d4d → 0.0.0-insiders.7b6ac54
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/CHANGELOG.md +98 -2
- package/README.md +6 -3
- package/defaultTheme.d.ts +2 -1
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +116 -112
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +232 -215
- package/lib/css/preflight.css +5 -0
- package/lib/featureFlags.js +16 -8
- package/lib/index.js +9 -6
- package/lib/lib/cacheInvalidation.js +18 -15
- package/lib/lib/collapseAdjacentRules.js +14 -11
- package/lib/lib/collapseDuplicateDeclarations.js +11 -8
- package/lib/lib/defaultExtractor.js +86 -58
- package/lib/lib/detectNesting.js +4 -1
- package/lib/lib/evaluateTailwindFunctions.js +81 -43
- package/lib/lib/expandApplyAtRules.js +104 -62
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +99 -79
- package/lib/lib/getModuleDependencies.js +21 -18
- package/lib/lib/normalizeTailwindDirectives.js +10 -7
- package/lib/lib/partitionApplyAtRules.js +14 -11
- package/lib/lib/regex.js +15 -7
- package/lib/lib/resolveDefaultsAtRules.js +94 -73
- package/lib/lib/setupContextUtils.js +118 -99
- package/lib/lib/setupTrackingContext.js +85 -76
- package/lib/lib/sharedState.js +15 -8
- package/lib/lib/substituteScreenAtRules.js +8 -5
- package/lib/postcss-plugins/nesting/index.js +7 -5
- package/lib/postcss-plugins/nesting/plugin.js +7 -4
- package/lib/processTailwindFeatures.js +34 -31
- package/lib/public/colors.js +6 -4
- package/lib/public/create-plugin.js +6 -4
- package/lib/public/default-config.js +7 -5
- package/lib/public/default-theme.js +7 -5
- package/lib/public/resolve-config.js +13 -10
- package/lib/util/bigSign.js +4 -1
- package/lib/util/buildMediaQuery.js +5 -2
- package/lib/util/cloneDeep.js +4 -1
- package/lib/util/cloneNodes.js +9 -2
- package/lib/util/color.js +11 -3
- package/lib/util/configurePlugins.js +4 -1
- package/lib/util/createPlugin.js +5 -3
- package/lib/util/createUtilityPlugin.js +13 -10
- package/lib/util/dataTypes.js +30 -24
- package/lib/util/defaults.js +4 -1
- package/lib/util/escapeClassName.js +12 -9
- package/lib/util/escapeCommas.js +4 -1
- package/lib/util/flattenColorPalette.js +5 -3
- package/lib/util/formatVariantSelector.js +23 -15
- package/lib/util/getAllConfigs.js +26 -12
- package/lib/util/hashConfig.js +10 -7
- package/lib/util/isKeyframeRule.js +4 -1
- package/lib/util/isPlainObject.js +4 -1
- package/lib/util/isValidArbitraryValue.js +33 -24
- package/lib/util/log.js +12 -5
- package/lib/util/nameClass.js +16 -8
- package/lib/util/negateValue.js +4 -1
- package/lib/util/normalizeConfig.js +26 -23
- package/lib/util/normalizeScreens.js +17 -2
- package/lib/util/parseAnimationValue.js +42 -39
- package/lib/util/parseBoxShadowValue.js +12 -4
- package/lib/util/parseDependency.js +35 -32
- package/lib/util/parseObjectStyles.js +14 -11
- package/lib/util/pluginUtils.js +28 -20
- package/lib/util/prefixSelector.js +6 -3
- package/lib/util/removeAlphaVariables.js +29 -0
- package/lib/util/resolveConfig.js +56 -53
- package/lib/util/resolveConfigPath.js +20 -17
- package/lib/util/responsive.js +12 -9
- package/lib/util/splitAtTopLevelOnly.js +16 -13
- package/lib/util/tap.js +4 -1
- package/lib/util/toColorValue.js +4 -1
- package/lib/util/toPath.js +18 -2
- package/lib/util/transformThemeValue.js +10 -7
- package/lib/util/validateConfig.js +5 -2
- package/lib/util/withAlphaVariable.js +30 -22
- package/package.json +16 -16
- package/peers/index.js +3804 -2153
- package/resolveConfig.d.ts +3 -0
- package/scripts/generate-types.js +53 -0
- package/scripts/type-utils.js +27 -0
- package/src/cli.js +43 -37
- package/src/corePlugins.js +44 -21
- package/src/css/preflight.css +5 -0
- package/src/featureFlags.js +5 -1
- package/src/lib/defaultExtractor.js +50 -34
- package/src/lib/evaluateTailwindFunctions.js +51 -17
- package/src/lib/expandApplyAtRules.js +71 -18
- package/src/lib/generateRules.js +25 -11
- package/src/lib/resolveDefaultsAtRules.js +53 -36
- package/src/lib/setupContextUtils.js +20 -4
- package/src/lib/setupTrackingContext.js +1 -1
- package/src/util/cloneNodes.js +5 -1
- package/src/util/dataTypes.js +3 -5
- package/src/util/formatVariantSelector.js +3 -1
- package/src/util/getAllConfigs.js +14 -2
- package/src/util/removeAlphaVariables.js +24 -0
- package/src/util/resolveConfig.js +1 -1
- package/types/config.d.ts +8 -6
- package/types/generated/default-theme.d.ts +331 -0
- package/types/index.d.ts +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,9 +7,97 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Add support for configuring default `font-feature-settings` for a font family ([#9039](https://github.com/tailwindlabs/tailwindcss/pull/9039))
|
|
13
|
+
- Add a standalone CLI build for 32-bit Linux on ARM (`node16-linux-armv7`) ([#9084](https://github.com/tailwindlabs/tailwindcss/pull/9084))
|
|
14
|
+
- Add future flag to disable color opacity utility plugins ([#9088](https://github.com/tailwindlabs/tailwindcss/pull/9088))
|
|
15
|
+
- Add negative value support for `outline-offset` ([#9136](https://github.com/tailwindlabs/tailwindcss/pull/9136))
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Use absolute paths when resolving changed files for resilience against working directory changes ([#9032](https://github.com/tailwindlabs/tailwindcss/pull/9032))
|
|
20
|
+
- Fix ring color utility generation when using `respectDefaultRingColorOpacity` ([#9070](https://github.com/tailwindlabs/tailwindcss/pull/9070))
|
|
21
|
+
- Sort tags before classes when `@applying` a selector with joined classes ([#9107](https://github.com/tailwindlabs/tailwindcss/pull/9107))
|
|
22
|
+
- Remove invalid `outline-hidden` utility ([#9147](https://github.com/tailwindlabs/tailwindcss/pull/9147))
|
|
23
|
+
- Honor the `hidden` attribute on elements in preflight ([#9174](https://github.com/tailwindlabs/tailwindcss/pull/9174))
|
|
24
|
+
|
|
25
|
+
## [3.1.8] - 2022-08-05
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- Don’t prefix classes within reused arbitrary variants ([#8992](https://github.com/tailwindlabs/tailwindcss/pull/8992))
|
|
30
|
+
- Fix usage of alpha values inside single-named colors that are functions ([#9008](https://github.com/tailwindlabs/tailwindcss/pull/9008))
|
|
31
|
+
- Fix `@apply` of user utilities when negative and non-negative versions both exist ([#9027](https://github.com/tailwindlabs/tailwindcss/pull/9027))
|
|
32
|
+
|
|
33
|
+
## [3.1.7] - 2022-07-29
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Don't rewrite source maps for `@layer` rules ([#8971](https://github.com/tailwindlabs/tailwindcss/pull/8971))
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- Added types for `resolveConfig` ([#8924](https://github.com/tailwindlabs/tailwindcss/pull/8924))
|
|
42
|
+
|
|
43
|
+
## [3.1.6] - 2022-07-11
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- Fix usage on Node 12.x ([b4e637e](https://github.com/tailwindlabs/tailwindcss/commit/b4e637e2e096a9d6f2210efba9541f6fd4f28e56))
|
|
48
|
+
- Handle theme keys with slashes when using `theme()` in CSS ([#8831](https://github.com/tailwindlabs/tailwindcss/pull/8831))
|
|
49
|
+
|
|
50
|
+
## [3.1.5] - 2022-07-07
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
|
|
54
|
+
- Support configuring a default `font-weight` for each font size utility ([#8763](https://github.com/tailwindlabs/tailwindcss/pull/8763))
|
|
55
|
+
- Add support for alpha values in safe list ([#8774](https://github.com/tailwindlabs/tailwindcss/pull/8774))
|
|
56
|
+
|
|
57
|
+
### Fixed
|
|
58
|
+
|
|
59
|
+
- Improve types to support fallback values in the CSS-in-JS syntax used in plugin APIs ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))
|
|
60
|
+
- Support including `tailwindcss` and `autoprefixer` in `postcss.config.js` in standalone CLI ([#8769](https://github.com/tailwindlabs/tailwindcss/pull/8769))
|
|
61
|
+
- Fix using special-characters as prefixes ([#8772](https://github.com/tailwindlabs/tailwindcss/pull/8772))
|
|
62
|
+
- Don’t prefix classes used within arbitrary variants ([#8773](https://github.com/tailwindlabs/tailwindcss/pull/8773))
|
|
63
|
+
- Add more explicit types for the default theme ([#8780](https://github.com/tailwindlabs/tailwindcss/pull/8780))
|
|
64
|
+
|
|
65
|
+
## [3.1.4] - 2022-06-21
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- Provide default to `<alpha-value>` when using `theme()` ([#8652](https://github.com/tailwindlabs/tailwindcss/pull/8652))
|
|
70
|
+
- Detect arbitrary variants with quotes ([#8687](https://github.com/tailwindlabs/tailwindcss/pull/8687))
|
|
71
|
+
- Don’t add spaces around raw `/` that are preceded by numbers ([#8688](https://github.com/tailwindlabs/tailwindcss/pull/8688))
|
|
72
|
+
|
|
73
|
+
## [3.1.3] - 2022-06-14
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- Fix extraction of multi-word utilities with arbitrary values and quotes ([#8604](https://github.com/tailwindlabs/tailwindcss/pull/8604))
|
|
78
|
+
- Fix casing of import of `corePluginList` type definition ([#8587](https://github.com/tailwindlabs/tailwindcss/pull/8587))
|
|
79
|
+
- Ignore PostCSS nodes returned by `addVariant` ([#8608](https://github.com/tailwindlabs/tailwindcss/pull/8608))
|
|
80
|
+
- Fix missing spaces around arithmetic operators ([#8615](https://github.com/tailwindlabs/tailwindcss/pull/8615))
|
|
81
|
+
- Detect alpha value in CSS `theme()` function when using quotes ([#8625](https://github.com/tailwindlabs/tailwindcss/pull/8625))
|
|
82
|
+
- Fix "Maximum call stack size exceeded" bug ([#8636](https://github.com/tailwindlabs/tailwindcss/pull/8636))
|
|
83
|
+
- Allow functions returning parallel variants to mutate the container ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
|
|
84
|
+
- Remove text opacity CSS variables from `::marker` ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
|
|
85
|
+
|
|
86
|
+
## [3.1.2] - 2022-06-10
|
|
87
|
+
|
|
88
|
+
### Fixed
|
|
89
|
+
|
|
90
|
+
- Ensure `\` is a valid arbitrary variant token ([#8576](https://github.com/tailwindlabs/tailwindcss/pull/8576))
|
|
91
|
+
- Enable `postcss-import` in the CLI by default in watch mode ([#8574](https://github.com/tailwindlabs/tailwindcss/pull/8574), [#8580](https://github.com/tailwindlabs/tailwindcss/pull/8580))
|
|
92
|
+
|
|
93
|
+
## [3.1.1] - 2022-06-09
|
|
94
|
+
|
|
10
95
|
### Fixed
|
|
11
96
|
|
|
12
97
|
- Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))
|
|
98
|
+
- Split `::backdrop` into separate defaults group ([#8567](https://github.com/tailwindlabs/tailwindcss/pull/8567))
|
|
99
|
+
- Fix postcss plugin type ([#8564](https://github.com/tailwindlabs/tailwindcss/pull/8564))
|
|
100
|
+
- Fix class detection in markdown code fences and slim templates ([#8569](https://github.com/tailwindlabs/tailwindcss/pull/8569))
|
|
13
101
|
|
|
14
102
|
## [3.1.0] - 2022-06-08
|
|
15
103
|
|
|
@@ -1588,7 +1676,7 @@ No release notes
|
|
|
1588
1676
|
|
|
1589
1677
|
- Make it possible to disable all core plugins using `corePlugins: false`
|
|
1590
1678
|
- Make it possible to configure a single list of variants that applies to all utility plugins
|
|
1591
|
-
- Make it possible to
|
|
1679
|
+
- Make it possible to safelist which core plugins should be enabled
|
|
1592
1680
|
|
|
1593
1681
|
### Fixed
|
|
1594
1682
|
|
|
@@ -1954,7 +2042,15 @@ No release notes
|
|
|
1954
2042
|
|
|
1955
2043
|
- Everything!
|
|
1956
2044
|
|
|
1957
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.
|
|
2045
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...HEAD
|
|
2046
|
+
[3.1.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.7...v3.1.8
|
|
2047
|
+
[3.1.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.6...v3.1.7
|
|
2048
|
+
[3.1.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.5...v3.1.6
|
|
2049
|
+
[3.1.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.4...v3.1.5
|
|
2050
|
+
[3.1.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...v3.1.4
|
|
2051
|
+
[3.1.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...v3.1.3
|
|
2052
|
+
[3.1.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...v3.1.2
|
|
2053
|
+
[3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
|
|
1958
2054
|
[3.1.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...v3.1.0
|
|
1959
2055
|
[3.0.24]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...v3.0.24
|
|
1960
2056
|
[3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<p>
|
|
1
|
+
<p align="center">
|
|
2
2
|
<a href="https://tailwindcss.com/#gh-light-mode-only" target="_blank">
|
|
3
3
|
<img src="./.github/logo-light.svg" alt="Tailwind CSS" width="350" height="70">
|
|
4
4
|
</a>
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
</a>
|
|
8
8
|
</p>
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
<p align="center">
|
|
11
|
+
A utility-first CSS framework for rapidly building custom user interfaces.
|
|
12
|
+
</p>
|
|
13
|
+
|
|
11
14
|
|
|
12
|
-
<p>
|
|
15
|
+
<p align="center">
|
|
13
16
|
<a href="https://github.com/tailwindlabs/tailwindcss/actions"><img src="https://img.shields.io/github/workflow/status/tailwindlabs/tailwindcss/Node.js%20CI" alt="Build Status"></a>
|
|
14
17
|
<a href="https://www.npmjs.com/package/tailwindcss"><img src="https://img.shields.io/npm/dt/tailwindcss.svg" alt="Total Downloads"></a>
|
|
15
18
|
<a href="https://github.com/tailwindcss/tailwindcss/releases"><img src="https://img.shields.io/npm/v/tailwindcss.svg" alt="Latest Release"></a>
|
package/defaultTheme.d.ts
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
+
lazyPostcss: ()=>lazyPostcss,
|
|
13
|
+
lazyPostcssImport: ()=>lazyPostcssImport,
|
|
14
|
+
lazyAutoprefixer: ()=>lazyAutoprefixer,
|
|
15
|
+
lazyCssnano: ()=>lazyCssnano
|
|
16
|
+
});
|
|
9
17
|
function lazyPostcss() {
|
|
10
18
|
return require("postcss");
|
|
11
19
|
}
|
package/lib/cli.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
= _interopRequireDefault(require("postcss-load-config
|
|
12
|
-
|
|
13
|
-
= _interopRequireDefault(require("postcss-load-config/src/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
const _indexJs = require("../peers/index.js");
|
|
7
|
+
const _chokidar = /*#__PURE__*/ _interopRequireDefault(require("chokidar"));
|
|
8
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
9
|
+
const _arg = /*#__PURE__*/ _interopRequireDefault(require("arg"));
|
|
10
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
11
|
+
const _postcssLoadConfig = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config"));
|
|
12
|
+
const _lilconfig = require("lilconfig");
|
|
13
|
+
const _plugins = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config/src/plugins" // Little bit scary, looking at private/internal API
|
|
14
|
+
));
|
|
15
|
+
const _options = /*#__PURE__*/ _interopRequireDefault(require("postcss-load-config/src/options" // Little bit scary, looking at private/internal API
|
|
16
|
+
));
|
|
17
|
+
const _processTailwindFeatures = /*#__PURE__*/ _interopRequireDefault(require("./processTailwindFeatures"));
|
|
18
|
+
const _resolveConfig = /*#__PURE__*/ _interopRequireDefault(require("../resolveConfig"));
|
|
19
|
+
const _fastGlob = /*#__PURE__*/ _interopRequireDefault(require("fast-glob"));
|
|
20
|
+
const _getModuleDependencies = /*#__PURE__*/ _interopRequireDefault(require("./lib/getModuleDependencies"));
|
|
21
|
+
const _log = /*#__PURE__*/ _interopRequireDefault(require("./util/log"));
|
|
22
|
+
const _packageJson = /*#__PURE__*/ _interopRequireDefault(require("../package.json"));
|
|
23
|
+
const _normalizePath = /*#__PURE__*/ _interopRequireDefault(require("normalize-path"));
|
|
24
|
+
const _validateConfigJs = require("./util/validateConfig.js");
|
|
22
25
|
function _interopRequireDefault(obj) {
|
|
23
26
|
return obj && obj.__esModule ? obj : {
|
|
24
27
|
default: obj
|
|
@@ -76,7 +79,7 @@ function drainStdin() {
|
|
|
76
79
|
process.stdin.on("error", (err)=>reject(err));
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
|
-
function help({ message , usage , commands
|
|
82
|
+
function help({ message , usage , commands , options }) {
|
|
80
83
|
let indent = 2;
|
|
81
84
|
// Render header
|
|
82
85
|
console.log();
|
|
@@ -97,11 +100,11 @@ function help({ message , usage , commands: commands1 , options }) {
|
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
// Render commands
|
|
100
|
-
if (
|
|
103
|
+
if (commands && commands.length > 0) {
|
|
101
104
|
console.log();
|
|
102
105
|
console.log("Commands:");
|
|
103
|
-
for (let
|
|
104
|
-
console.log(" ".repeat(indent),
|
|
106
|
+
for (let command of commands){
|
|
107
|
+
console.log(" ".repeat(indent), command);
|
|
105
108
|
}
|
|
106
109
|
}
|
|
107
110
|
// Render options
|
|
@@ -121,12 +124,12 @@ function help({ message , usage , commands: commands1 , options }) {
|
|
|
121
124
|
}
|
|
122
125
|
console.log();
|
|
123
126
|
console.log("Options:");
|
|
124
|
-
for (let { flags
|
|
127
|
+
for (let { flags , description , deprecated } of Object.values(groupedOptions)){
|
|
125
128
|
if (deprecated) continue;
|
|
126
|
-
if (
|
|
127
|
-
console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ),
|
|
129
|
+
if (flags.length === 1) {
|
|
130
|
+
console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(", ").padEnd(20, " "), description);
|
|
128
131
|
} else {
|
|
129
|
-
console.log(" ".repeat(indent),
|
|
132
|
+
console.log(" ".repeat(indent), flags.slice().reverse().join(", ").padEnd(24, " "), description);
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
}
|
|
@@ -150,7 +153,7 @@ function loadPostcss() {
|
|
|
150
153
|
try {
|
|
151
154
|
return require("postcss");
|
|
152
155
|
} catch {}
|
|
153
|
-
return (0, _indexJs
|
|
156
|
+
return (0, _indexJs.lazyPostcss)();
|
|
154
157
|
}
|
|
155
158
|
let commands = {
|
|
156
159
|
init: {
|
|
@@ -233,7 +236,7 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
|
|
|
233
236
|
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
|
234
237
|
"tailwindcss init [--full] [--postcss] [options...]",
|
|
235
238
|
],
|
|
236
|
-
commands: Object.keys(commands).filter((
|
|
239
|
+
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
237
240
|
options: {
|
|
238
241
|
...commands.build.args,
|
|
239
242
|
...sharedFlags
|
|
@@ -253,7 +256,7 @@ if (commands[command] === undefined) {
|
|
|
253
256
|
usage: [
|
|
254
257
|
"tailwindcss <command> [options]"
|
|
255
258
|
],
|
|
256
|
-
commands: Object.keys(commands).filter((
|
|
259
|
+
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
|
257
260
|
options: sharedFlags
|
|
258
261
|
});
|
|
259
262
|
process.exit(1);
|
|
@@ -263,7 +266,7 @@ if (commands[command] === undefined) {
|
|
|
263
266
|
let { args: flags , run } = commands[command];
|
|
264
267
|
let args = (()=>{
|
|
265
268
|
try {
|
|
266
|
-
let result = (0, _arg
|
|
269
|
+
let result = (0, _arg.default)(Object.fromEntries(Object.entries({
|
|
267
270
|
...flags,
|
|
268
271
|
...sharedFlags
|
|
269
272
|
}).filter(([_key, value])=>{
|
|
@@ -287,16 +290,16 @@ let args = (()=>{
|
|
|
287
290
|
handler = flags[handler];
|
|
288
291
|
}
|
|
289
292
|
if (!handler) continue;
|
|
290
|
-
let
|
|
293
|
+
let args = [];
|
|
291
294
|
let offset = i + 1;
|
|
292
295
|
// Parse args for current flag
|
|
293
296
|
while(result["_"][offset] && !result["_"][offset].startsWith("-")){
|
|
294
|
-
|
|
297
|
+
args.push(result["_"][offset++]);
|
|
295
298
|
}
|
|
296
299
|
// Cleanup manually parsed flags + args
|
|
297
|
-
result["_"].splice(i, 1 +
|
|
300
|
+
result["_"].splice(i, 1 + args.length);
|
|
298
301
|
// Set the resolved value in the `result` object
|
|
299
|
-
result[flagName] = handler.type(
|
|
302
|
+
result[flagName] = handler.type(args.length === 0 ? undefined : args.length === 1 ? args[0] : args, flagName);
|
|
300
303
|
}
|
|
301
304
|
// Ensure that the `command` is always the first argument in the `args`.
|
|
302
305
|
// This is important so that we don't have to check if a default command
|
|
@@ -354,8 +357,8 @@ function init() {
|
|
|
354
357
|
if (_fs.default.existsSync(postcssConfigLocation)) {
|
|
355
358
|
messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
|
|
356
359
|
} else {
|
|
357
|
-
let
|
|
358
|
-
_fs.default.writeFileSync(postcssConfigLocation,
|
|
360
|
+
let stubFile1 = _fs.default.readFileSync(_path.default.resolve(__dirname, "../stubs/defaultPostCssConfig.stub.js"), "utf8");
|
|
361
|
+
_fs.default.writeFileSync(postcssConfigLocation, stubFile1, "utf8");
|
|
359
362
|
messages.push(`Created PostCSS config file: ${_path.default.basename(postcssConfigLocation)}`);
|
|
360
363
|
}
|
|
361
364
|
}
|
|
@@ -392,10 +395,10 @@ async function build() {
|
|
|
392
395
|
let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
|
|
393
396
|
async function loadPostCssPlugins() {
|
|
394
397
|
let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
|
|
395
|
-
let
|
|
398
|
+
let config = customPostCssPath ? await (async ()=>{
|
|
396
399
|
let file = _path.default.resolve(customPostCssPath);
|
|
397
400
|
// Implementation, see: https://unpkg.com/browse/postcss-load-config@3.1.0/src/index.js
|
|
398
|
-
let { config ={} } = await (0, _lilconfig
|
|
401
|
+
let { config ={} } = await (0, _lilconfig.lilconfig)("postcss").load(file);
|
|
399
402
|
if (typeof config === "function") {
|
|
400
403
|
config = config();
|
|
401
404
|
} else {
|
|
@@ -406,11 +409,11 @@ async function build() {
|
|
|
406
409
|
}
|
|
407
410
|
return {
|
|
408
411
|
file,
|
|
409
|
-
plugins: (0, _plugins
|
|
410
|
-
options: (0, _options
|
|
412
|
+
plugins: (0, _plugins.default)(config, file),
|
|
413
|
+
options: (0, _options.default)(config, file)
|
|
411
414
|
};
|
|
412
|
-
})() : await (0, _postcssLoadConfig
|
|
413
|
-
let configPlugins =
|
|
415
|
+
})() : await (0, _postcssLoadConfig.default)();
|
|
416
|
+
let configPlugins = config.plugins;
|
|
414
417
|
let configPluginTailwindIdx = configPlugins.findIndex((plugin)=>{
|
|
415
418
|
if (typeof plugin === "function" && plugin.name === "tailwindcss") {
|
|
416
419
|
return true;
|
|
@@ -425,7 +428,44 @@ async function build() {
|
|
|
425
428
|
return [
|
|
426
429
|
beforePlugins,
|
|
427
430
|
afterPlugins,
|
|
428
|
-
|
|
431
|
+
config.options
|
|
432
|
+
];
|
|
433
|
+
}
|
|
434
|
+
function loadBuiltinPostcssPlugins() {
|
|
435
|
+
let postcss = loadPostcss();
|
|
436
|
+
let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
|
|
437
|
+
return [
|
|
438
|
+
[
|
|
439
|
+
(root)=>{
|
|
440
|
+
root.walkAtRules("import", (rule)=>{
|
|
441
|
+
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
|
442
|
+
rule.after(postcss.comment({
|
|
443
|
+
text: IMPORT_COMMENT + rule.params
|
|
444
|
+
}));
|
|
445
|
+
rule.remove();
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
(()=>{
|
|
450
|
+
try {
|
|
451
|
+
return require("postcss-import");
|
|
452
|
+
} catch {}
|
|
453
|
+
return (0, _indexJs.lazyPostcssImport)();
|
|
454
|
+
})(),
|
|
455
|
+
(root)=>{
|
|
456
|
+
root.walkComments((rule)=>{
|
|
457
|
+
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
458
|
+
rule.after(postcss.atRule({
|
|
459
|
+
name: "import",
|
|
460
|
+
params: rule.text.replace(IMPORT_COMMENT, "")
|
|
461
|
+
}));
|
|
462
|
+
rule.remove();
|
|
463
|
+
}
|
|
464
|
+
});
|
|
465
|
+
},
|
|
466
|
+
],
|
|
467
|
+
[],
|
|
468
|
+
{},
|
|
429
469
|
];
|
|
430
470
|
}
|
|
431
471
|
function resolveConfig() {
|
|
@@ -441,18 +481,18 @@ async function build() {
|
|
|
441
481
|
}
|
|
442
482
|
if (args["--content"]) {
|
|
443
483
|
let files = args["--content"].split(/(?<!{[^}]+),/);
|
|
444
|
-
let resolvedConfig = (0, _resolveConfig
|
|
484
|
+
let resolvedConfig = (0, _resolveConfig.default)(config, {
|
|
445
485
|
content: {
|
|
446
486
|
files
|
|
447
487
|
}
|
|
448
488
|
});
|
|
449
489
|
resolvedConfig.content.files = files;
|
|
450
|
-
resolvedConfig = (0, _validateConfigJs
|
|
490
|
+
resolvedConfig = (0, _validateConfigJs.validateConfig)(resolvedConfig);
|
|
451
491
|
return resolvedConfig;
|
|
452
492
|
}
|
|
453
|
-
let
|
|
454
|
-
|
|
455
|
-
return
|
|
493
|
+
let resolvedConfig1 = (0, _resolveConfig.default)(config);
|
|
494
|
+
resolvedConfig1 = (0, _validateConfigJs.validateConfig)(resolvedConfig1);
|
|
495
|
+
return resolvedConfig1;
|
|
456
496
|
}
|
|
457
497
|
function extractFileGlobs(config) {
|
|
458
498
|
return config.content.files.filter((file)=>{
|
|
@@ -460,7 +500,7 @@ async function build() {
|
|
|
460
500
|
// like an object it's probably a raw content object. But this object
|
|
461
501
|
// is not watchable, so let's remove it.
|
|
462
502
|
return typeof file === "string";
|
|
463
|
-
}).map((glob)=>(0, _normalizePath
|
|
503
|
+
}).map((glob)=>(0, _normalizePath.default)(glob));
|
|
464
504
|
}
|
|
465
505
|
function extractRawContent(config) {
|
|
466
506
|
return config.content.files.filter((file)=>{
|
|
@@ -494,7 +534,7 @@ async function build() {
|
|
|
494
534
|
return {
|
|
495
535
|
postcssPlugin: "tailwindcss",
|
|
496
536
|
Once (root, { result }) {
|
|
497
|
-
(0, _processTailwindFeatures
|
|
537
|
+
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
498
538
|
return ()=>{
|
|
499
539
|
return createContext(config, changedContent);
|
|
500
540
|
};
|
|
@@ -503,40 +543,7 @@ async function build() {
|
|
|
503
543
|
};
|
|
504
544
|
};
|
|
505
545
|
tailwindPlugin.postcss = true;
|
|
506
|
-
let
|
|
507
|
-
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : [
|
|
508
|
-
[
|
|
509
|
-
(root)=>{
|
|
510
|
-
root.walkAtRules("import", (rule)=>{
|
|
511
|
-
if (rule.params.slice(1).startsWith("tailwindcss/")) {
|
|
512
|
-
rule.after(postcss.comment({
|
|
513
|
-
text: IMPORT_COMMENT + rule.params
|
|
514
|
-
}));
|
|
515
|
-
rule.remove();
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
},
|
|
519
|
-
(()=>{
|
|
520
|
-
try {
|
|
521
|
-
return require("postcss-import");
|
|
522
|
-
} catch {}
|
|
523
|
-
return (0, _indexJs).lazyPostcssImport();
|
|
524
|
-
})(),
|
|
525
|
-
(root)=>{
|
|
526
|
-
root.walkComments((rule)=>{
|
|
527
|
-
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
528
|
-
rule.after(postcss.atRule({
|
|
529
|
-
name: "import",
|
|
530
|
-
params: rule.text.replace(IMPORT_COMMENT, "")
|
|
531
|
-
}));
|
|
532
|
-
rule.remove();
|
|
533
|
-
}
|
|
534
|
-
});
|
|
535
|
-
},
|
|
536
|
-
],
|
|
537
|
-
[],
|
|
538
|
-
{},
|
|
539
|
-
];
|
|
546
|
+
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
|
|
540
547
|
let plugins = [
|
|
541
548
|
...beforePlugins,
|
|
542
549
|
tailwindPlugin,
|
|
@@ -547,7 +554,7 @@ async function build() {
|
|
|
547
554
|
try {
|
|
548
555
|
return require("autoprefixer");
|
|
549
556
|
} catch {}
|
|
550
|
-
return (0, _indexJs
|
|
557
|
+
return (0, _indexJs.lazyAutoprefixer)();
|
|
551
558
|
})(),
|
|
552
559
|
args["--minify"] && (()=>{
|
|
553
560
|
let options = {
|
|
@@ -562,7 +569,7 @@ async function build() {
|
|
|
562
569
|
try {
|
|
563
570
|
return require("cssnano");
|
|
564
571
|
} catch {}
|
|
565
|
-
return (0, _indexJs
|
|
572
|
+
return (0, _indexJs.lazyCssnano)()(options);
|
|
566
573
|
})(),
|
|
567
574
|
].filter(Boolean);
|
|
568
575
|
let postcss = loadPostcss();
|
|
@@ -589,7 +596,7 @@ async function build() {
|
|
|
589
596
|
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
590
597
|
});
|
|
591
598
|
}
|
|
592
|
-
let
|
|
599
|
+
let css = await (()=>{
|
|
593
600
|
// Piping in data, let's drain the stdin
|
|
594
601
|
if (input === "-") {
|
|
595
602
|
return drainStdin();
|
|
@@ -601,7 +608,7 @@ async function build() {
|
|
|
601
608
|
// No input file provided, fallback to default atrules
|
|
602
609
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
603
610
|
})();
|
|
604
|
-
return processCSS(
|
|
611
|
+
return processCSS(css);
|
|
605
612
|
}
|
|
606
613
|
let context = null;
|
|
607
614
|
async function startWatcher() {
|
|
@@ -611,11 +618,11 @@ async function build() {
|
|
|
611
618
|
let watcher = null;
|
|
612
619
|
function refreshConfig() {
|
|
613
620
|
env.DEBUG && console.time("Module dependencies");
|
|
614
|
-
for (let
|
|
615
|
-
delete require.cache[require.resolve(
|
|
621
|
+
for (let file of configDependencies){
|
|
622
|
+
delete require.cache[require.resolve(file)];
|
|
616
623
|
}
|
|
617
624
|
if (configPath) {
|
|
618
|
-
configDependencies = (0, _getModuleDependencies
|
|
625
|
+
configDependencies = (0, _getModuleDependencies.default)(configPath).map(({ file })=>file);
|
|
619
626
|
for (let dependency of configDependencies){
|
|
620
627
|
contextDependencies.add(dependency);
|
|
621
628
|
}
|
|
@@ -623,10 +630,7 @@ async function build() {
|
|
|
623
630
|
env.DEBUG && console.timeEnd("Module dependencies");
|
|
624
631
|
return resolveConfig();
|
|
625
632
|
}
|
|
626
|
-
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() :
|
|
627
|
-
[],
|
|
628
|
-
[]
|
|
629
|
-
];
|
|
633
|
+
let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
|
|
630
634
|
let plugins = [
|
|
631
635
|
...beforePlugins,
|
|
632
636
|
"__TAILWIND_PLUGIN_POSITION__",
|
|
@@ -637,7 +641,7 @@ async function build() {
|
|
|
637
641
|
try {
|
|
638
642
|
return require("autoprefixer");
|
|
639
643
|
} catch {}
|
|
640
|
-
return (0, _indexJs
|
|
644
|
+
return (0, _indexJs.lazyAutoprefixer)();
|
|
641
645
|
})(),
|
|
642
646
|
args["--minify"] && (()=>{
|
|
643
647
|
let options = {
|
|
@@ -652,7 +656,7 @@ async function build() {
|
|
|
652
656
|
try {
|
|
653
657
|
return require("cssnano");
|
|
654
658
|
} catch {}
|
|
655
|
-
return (0, _indexJs
|
|
659
|
+
return (0, _indexJs.lazyCssnano)()(options);
|
|
656
660
|
})(),
|
|
657
661
|
].filter(Boolean);
|
|
658
662
|
async function rebuild(config) {
|
|
@@ -662,7 +666,7 @@ async function build() {
|
|
|
662
666
|
postcssPlugin: "tailwindcss",
|
|
663
667
|
Once (root, { result }) {
|
|
664
668
|
env.DEBUG && console.time("Compiling CSS");
|
|
665
|
-
(0, _processTailwindFeatures
|
|
669
|
+
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
666
670
|
console.error();
|
|
667
671
|
console.error("Rebuilding...");
|
|
668
672
|
return ()=>{
|
|
@@ -720,7 +724,7 @@ async function build() {
|
|
|
720
724
|
}
|
|
721
725
|
});
|
|
722
726
|
}
|
|
723
|
-
let
|
|
727
|
+
let css = await (()=>{
|
|
724
728
|
// Piping in data, let's drain the stdin
|
|
725
729
|
if (input === "-") {
|
|
726
730
|
return drainStdin();
|
|
@@ -732,17 +736,17 @@ async function build() {
|
|
|
732
736
|
// No input file provided, fallback to default atrules
|
|
733
737
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
734
738
|
})();
|
|
735
|
-
let
|
|
739
|
+
let result = await processCSS(css);
|
|
736
740
|
env.DEBUG && console.timeEnd("Finished in");
|
|
737
|
-
return
|
|
741
|
+
return result;
|
|
738
742
|
}
|
|
739
|
-
let
|
|
743
|
+
let config = refreshConfig(configPath);
|
|
740
744
|
if (input) {
|
|
741
745
|
contextDependencies.add(_path.default.resolve(input));
|
|
742
746
|
}
|
|
743
747
|
watcher = _chokidar.default.watch([
|
|
744
748
|
...contextDependencies,
|
|
745
|
-
...extractFileGlobs(
|
|
749
|
+
...extractFileGlobs(config)
|
|
746
750
|
], {
|
|
747
751
|
usePolling: shouldPoll,
|
|
748
752
|
interval: shouldPoll ? pollInterval : undefined,
|
|
@@ -757,16 +761,16 @@ async function build() {
|
|
|
757
761
|
if (contextDependencies.has(file)) {
|
|
758
762
|
env.DEBUG && console.time("Resolve config");
|
|
759
763
|
context = null;
|
|
760
|
-
|
|
764
|
+
config = refreshConfig(configPath);
|
|
761
765
|
env.DEBUG && console.timeEnd("Resolve config");
|
|
762
766
|
env.DEBUG && console.time("Watch new files");
|
|
763
|
-
let globs = extractFileGlobs(
|
|
767
|
+
let globs = extractFileGlobs(config);
|
|
764
768
|
watcher.add(configDependencies);
|
|
765
769
|
watcher.add(globs);
|
|
766
770
|
env.DEBUG && console.timeEnd("Watch new files");
|
|
767
771
|
chain = chain.then(async ()=>{
|
|
768
|
-
changedContent.push(...getChangedContent(
|
|
769
|
-
await rebuild(
|
|
772
|
+
changedContent.push(...getChangedContent(config));
|
|
773
|
+
await rebuild(config);
|
|
770
774
|
});
|
|
771
775
|
} else {
|
|
772
776
|
chain = chain.then(async ()=>{
|
|
@@ -774,7 +778,7 @@ async function build() {
|
|
|
774
778
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
775
779
|
extension: _path.default.extname(file).slice(1)
|
|
776
780
|
});
|
|
777
|
-
await rebuild(
|
|
781
|
+
await rebuild(config);
|
|
778
782
|
});
|
|
779
783
|
}
|
|
780
784
|
});
|
|
@@ -784,12 +788,12 @@ async function build() {
|
|
|
784
788
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
785
789
|
extension: _path.default.extname(file).slice(1)
|
|
786
790
|
});
|
|
787
|
-
await rebuild(
|
|
791
|
+
await rebuild(config);
|
|
788
792
|
});
|
|
789
793
|
});
|
|
790
794
|
chain = chain.then(()=>{
|
|
791
|
-
changedContent.push(...getChangedContent(
|
|
792
|
-
return rebuild(
|
|
795
|
+
changedContent.push(...getChangedContent(config));
|
|
796
|
+
return rebuild(config);
|
|
793
797
|
});
|
|
794
798
|
}
|
|
795
799
|
if (shouldWatch) {
|