tailwindcss 3.1.5 → 3.1.8
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 +36 -8
- package/README.md +6 -3
- package/lib/cli-peer-dependencies.js +12 -4
- package/lib/cli.js +78 -75
- package/lib/constants.js +19 -12
- package/lib/corePluginList.js +5 -3
- package/lib/corePlugins.js +194 -187
- package/lib/featureFlags.js +14 -7
- 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 +38 -35
- package/lib/lib/detectNesting.js +4 -1
- package/lib/lib/evaluateTailwindFunctions.js +75 -44
- package/lib/lib/expandApplyAtRules.js +50 -42
- package/lib/lib/expandTailwindAtRules.js +153 -150
- package/lib/lib/generateRules.js +81 -73
- 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 +92 -85
- package/lib/lib/setupContextUtils.js +109 -97
- package/lib/lib/setupTrackingContext.js +82 -75
- 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 +27 -19
- 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 +21 -14
- package/lib/util/getAllConfigs.js +12 -9
- 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 +13 -2
- 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 +10 -10
- package/peers/index.js +950 -825
- package/resolveConfig.d.ts +3 -0
- package/src/lib/evaluateTailwindFunctions.js +41 -15
- package/src/lib/expandApplyAtRules.js +6 -0
- package/src/lib/generateRules.js +6 -5
- package/src/lib/setupContextUtils.js +4 -2
- package/src/util/cloneNodes.js +5 -1
- package/src/util/resolveConfig.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,19 +9,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Nothing yet!
|
|
11
11
|
|
|
12
|
-
## [3.1.
|
|
12
|
+
## [3.1.8] - 2022-08-05
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Don’t prefix classes within reused arbitrary variants ([#8992](https://github.com/tailwindlabs/tailwindcss/pull/8992))
|
|
17
|
+
- Fix usage of alpha values inside single-named colors that are functions ([#9008](https://github.com/tailwindlabs/tailwindcss/pull/9008))
|
|
18
|
+
- Fix `@apply` of user utilities when negative and non-negative versions both exist ([#9027](https://github.com/tailwindlabs/tailwindcss/pull/9027))
|
|
19
|
+
|
|
20
|
+
## [3.1.7] - 2022-07-29
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Don't rewrite source maps for `@layer` rules ([#8971](https://github.com/tailwindlabs/tailwindcss/pull/8971))
|
|
13
25
|
|
|
14
26
|
### Added
|
|
15
27
|
|
|
16
|
-
-
|
|
28
|
+
- Added types for `resolveConfig` ([#8924](https://github.com/tailwindlabs/tailwindcss/pull/8924))
|
|
29
|
+
|
|
30
|
+
## [3.1.6] - 2022-07-11
|
|
17
31
|
|
|
18
32
|
### Fixed
|
|
19
33
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
- Fix usage on Node 12.x ([b4e637e](https://github.com/tailwindlabs/tailwindcss/commit/b4e637e2e096a9d6f2210efba9541f6fd4f28e56))
|
|
35
|
+
- Handle theme keys with slashes when using `theme()` in CSS ([#8831](https://github.com/tailwindlabs/tailwindcss/pull/8831))
|
|
36
|
+
|
|
37
|
+
## [3.1.5] - 2022-07-07
|
|
38
|
+
|
|
39
|
+
### Added
|
|
40
|
+
|
|
41
|
+
- Support configuring a default `font-weight` for each font size utility ([#8763](https://github.com/tailwindlabs/tailwindcss/pull/8763))
|
|
24
42
|
- Add support for alpha values in safe list ([#8774](https://github.com/tailwindlabs/tailwindcss/pull/8774))
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- Improve types to support fallback values in the CSS-in-JS syntax used in plugin APIs ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))
|
|
47
|
+
- Support including `tailwindcss` and `autoprefixer` in `postcss.config.js` in standalone CLI ([#8769](https://github.com/tailwindlabs/tailwindcss/pull/8769))
|
|
48
|
+
- Fix using special-characters as prefixes ([#8772](https://github.com/tailwindlabs/tailwindcss/pull/8772))
|
|
49
|
+
- Don’t prefix classes used within arbitrary variants ([#8773](https://github.com/tailwindlabs/tailwindcss/pull/8773))
|
|
25
50
|
- Add more explicit types for the default theme ([#8780](https://github.com/tailwindlabs/tailwindcss/pull/8780))
|
|
26
51
|
|
|
27
52
|
## [3.1.4] - 2022-06-21
|
|
@@ -1638,7 +1663,7 @@ No release notes
|
|
|
1638
1663
|
|
|
1639
1664
|
- Make it possible to disable all core plugins using `corePlugins: false`
|
|
1640
1665
|
- Make it possible to configure a single list of variants that applies to all utility plugins
|
|
1641
|
-
- Make it possible to
|
|
1666
|
+
- Make it possible to safelist which core plugins should be enabled
|
|
1642
1667
|
|
|
1643
1668
|
### Fixed
|
|
1644
1669
|
|
|
@@ -2004,7 +2029,10 @@ No release notes
|
|
|
2004
2029
|
|
|
2005
2030
|
- Everything!
|
|
2006
2031
|
|
|
2007
|
-
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.
|
|
2032
|
+
[unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.8...HEAD
|
|
2033
|
+
[3.1.8]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.7...v3.1.8
|
|
2034
|
+
[3.1.7]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.6...v3.1.7
|
|
2035
|
+
[3.1.6]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.5...v3.1.6
|
|
2008
2036
|
[3.1.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.4...v3.1.5
|
|
2009
2037
|
[3.1.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...v3.1.4
|
|
2010
2038
|
[3.1.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...v3.1.3
|
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>
|
|
@@ -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,7 @@ async function build() {
|
|
|
425
428
|
return [
|
|
426
429
|
beforePlugins,
|
|
427
430
|
afterPlugins,
|
|
428
|
-
|
|
431
|
+
config.options
|
|
429
432
|
];
|
|
430
433
|
}
|
|
431
434
|
function loadBuiltinPostcssPlugins() {
|
|
@@ -447,7 +450,7 @@ async function build() {
|
|
|
447
450
|
try {
|
|
448
451
|
return require("postcss-import");
|
|
449
452
|
} catch {}
|
|
450
|
-
return (0, _indexJs
|
|
453
|
+
return (0, _indexJs.lazyPostcssImport)();
|
|
451
454
|
})(),
|
|
452
455
|
(root)=>{
|
|
453
456
|
root.walkComments((rule)=>{
|
|
@@ -478,18 +481,18 @@ async function build() {
|
|
|
478
481
|
}
|
|
479
482
|
if (args["--content"]) {
|
|
480
483
|
let files = args["--content"].split(/(?<!{[^}]+),/);
|
|
481
|
-
let resolvedConfig = (0, _resolveConfig
|
|
484
|
+
let resolvedConfig = (0, _resolveConfig.default)(config, {
|
|
482
485
|
content: {
|
|
483
486
|
files
|
|
484
487
|
}
|
|
485
488
|
});
|
|
486
489
|
resolvedConfig.content.files = files;
|
|
487
|
-
resolvedConfig = (0, _validateConfigJs
|
|
490
|
+
resolvedConfig = (0, _validateConfigJs.validateConfig)(resolvedConfig);
|
|
488
491
|
return resolvedConfig;
|
|
489
492
|
}
|
|
490
|
-
let
|
|
491
|
-
|
|
492
|
-
return
|
|
493
|
+
let resolvedConfig1 = (0, _resolveConfig.default)(config);
|
|
494
|
+
resolvedConfig1 = (0, _validateConfigJs.validateConfig)(resolvedConfig1);
|
|
495
|
+
return resolvedConfig1;
|
|
493
496
|
}
|
|
494
497
|
function extractFileGlobs(config) {
|
|
495
498
|
return config.content.files.filter((file)=>{
|
|
@@ -497,7 +500,7 @@ async function build() {
|
|
|
497
500
|
// like an object it's probably a raw content object. But this object
|
|
498
501
|
// is not watchable, so let's remove it.
|
|
499
502
|
return typeof file === "string";
|
|
500
|
-
}).map((glob)=>(0, _normalizePath
|
|
503
|
+
}).map((glob)=>(0, _normalizePath.default)(glob));
|
|
501
504
|
}
|
|
502
505
|
function extractRawContent(config) {
|
|
503
506
|
return config.content.files.filter((file)=>{
|
|
@@ -531,7 +534,7 @@ async function build() {
|
|
|
531
534
|
return {
|
|
532
535
|
postcssPlugin: "tailwindcss",
|
|
533
536
|
Once (root, { result }) {
|
|
534
|
-
(0, _processTailwindFeatures
|
|
537
|
+
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
535
538
|
return ()=>{
|
|
536
539
|
return createContext(config, changedContent);
|
|
537
540
|
};
|
|
@@ -551,7 +554,7 @@ async function build() {
|
|
|
551
554
|
try {
|
|
552
555
|
return require("autoprefixer");
|
|
553
556
|
} catch {}
|
|
554
|
-
return (0, _indexJs
|
|
557
|
+
return (0, _indexJs.lazyAutoprefixer)();
|
|
555
558
|
})(),
|
|
556
559
|
args["--minify"] && (()=>{
|
|
557
560
|
let options = {
|
|
@@ -566,7 +569,7 @@ async function build() {
|
|
|
566
569
|
try {
|
|
567
570
|
return require("cssnano");
|
|
568
571
|
} catch {}
|
|
569
|
-
return (0, _indexJs
|
|
572
|
+
return (0, _indexJs.lazyCssnano)()(options);
|
|
570
573
|
})(),
|
|
571
574
|
].filter(Boolean);
|
|
572
575
|
let postcss = loadPostcss();
|
|
@@ -593,7 +596,7 @@ async function build() {
|
|
|
593
596
|
console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
|
|
594
597
|
});
|
|
595
598
|
}
|
|
596
|
-
let
|
|
599
|
+
let css = await (()=>{
|
|
597
600
|
// Piping in data, let's drain the stdin
|
|
598
601
|
if (input === "-") {
|
|
599
602
|
return drainStdin();
|
|
@@ -605,7 +608,7 @@ async function build() {
|
|
|
605
608
|
// No input file provided, fallback to default atrules
|
|
606
609
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
607
610
|
})();
|
|
608
|
-
return processCSS(
|
|
611
|
+
return processCSS(css);
|
|
609
612
|
}
|
|
610
613
|
let context = null;
|
|
611
614
|
async function startWatcher() {
|
|
@@ -615,11 +618,11 @@ async function build() {
|
|
|
615
618
|
let watcher = null;
|
|
616
619
|
function refreshConfig() {
|
|
617
620
|
env.DEBUG && console.time("Module dependencies");
|
|
618
|
-
for (let
|
|
619
|
-
delete require.cache[require.resolve(
|
|
621
|
+
for (let file of configDependencies){
|
|
622
|
+
delete require.cache[require.resolve(file)];
|
|
620
623
|
}
|
|
621
624
|
if (configPath) {
|
|
622
|
-
configDependencies = (0, _getModuleDependencies
|
|
625
|
+
configDependencies = (0, _getModuleDependencies.default)(configPath).map(({ file })=>file);
|
|
623
626
|
for (let dependency of configDependencies){
|
|
624
627
|
contextDependencies.add(dependency);
|
|
625
628
|
}
|
|
@@ -638,7 +641,7 @@ async function build() {
|
|
|
638
641
|
try {
|
|
639
642
|
return require("autoprefixer");
|
|
640
643
|
} catch {}
|
|
641
|
-
return (0, _indexJs
|
|
644
|
+
return (0, _indexJs.lazyAutoprefixer)();
|
|
642
645
|
})(),
|
|
643
646
|
args["--minify"] && (()=>{
|
|
644
647
|
let options = {
|
|
@@ -653,7 +656,7 @@ async function build() {
|
|
|
653
656
|
try {
|
|
654
657
|
return require("cssnano");
|
|
655
658
|
} catch {}
|
|
656
|
-
return (0, _indexJs
|
|
659
|
+
return (0, _indexJs.lazyCssnano)()(options);
|
|
657
660
|
})(),
|
|
658
661
|
].filter(Boolean);
|
|
659
662
|
async function rebuild(config) {
|
|
@@ -663,7 +666,7 @@ async function build() {
|
|
|
663
666
|
postcssPlugin: "tailwindcss",
|
|
664
667
|
Once (root, { result }) {
|
|
665
668
|
env.DEBUG && console.time("Compiling CSS");
|
|
666
|
-
(0, _processTailwindFeatures
|
|
669
|
+
(0, _processTailwindFeatures.default)(({ createContext })=>{
|
|
667
670
|
console.error();
|
|
668
671
|
console.error("Rebuilding...");
|
|
669
672
|
return ()=>{
|
|
@@ -721,7 +724,7 @@ async function build() {
|
|
|
721
724
|
}
|
|
722
725
|
});
|
|
723
726
|
}
|
|
724
|
-
let
|
|
727
|
+
let css = await (()=>{
|
|
725
728
|
// Piping in data, let's drain the stdin
|
|
726
729
|
if (input === "-") {
|
|
727
730
|
return drainStdin();
|
|
@@ -733,17 +736,17 @@ async function build() {
|
|
|
733
736
|
// No input file provided, fallback to default atrules
|
|
734
737
|
return "@tailwind base; @tailwind components; @tailwind utilities";
|
|
735
738
|
})();
|
|
736
|
-
let
|
|
739
|
+
let result = await processCSS(css);
|
|
737
740
|
env.DEBUG && console.timeEnd("Finished in");
|
|
738
|
-
return
|
|
741
|
+
return result;
|
|
739
742
|
}
|
|
740
|
-
let
|
|
743
|
+
let config = refreshConfig(configPath);
|
|
741
744
|
if (input) {
|
|
742
745
|
contextDependencies.add(_path.default.resolve(input));
|
|
743
746
|
}
|
|
744
747
|
watcher = _chokidar.default.watch([
|
|
745
748
|
...contextDependencies,
|
|
746
|
-
...extractFileGlobs(
|
|
749
|
+
...extractFileGlobs(config)
|
|
747
750
|
], {
|
|
748
751
|
usePolling: shouldPoll,
|
|
749
752
|
interval: shouldPoll ? pollInterval : undefined,
|
|
@@ -758,16 +761,16 @@ async function build() {
|
|
|
758
761
|
if (contextDependencies.has(file)) {
|
|
759
762
|
env.DEBUG && console.time("Resolve config");
|
|
760
763
|
context = null;
|
|
761
|
-
|
|
764
|
+
config = refreshConfig(configPath);
|
|
762
765
|
env.DEBUG && console.timeEnd("Resolve config");
|
|
763
766
|
env.DEBUG && console.time("Watch new files");
|
|
764
|
-
let globs = extractFileGlobs(
|
|
767
|
+
let globs = extractFileGlobs(config);
|
|
765
768
|
watcher.add(configDependencies);
|
|
766
769
|
watcher.add(globs);
|
|
767
770
|
env.DEBUG && console.timeEnd("Watch new files");
|
|
768
771
|
chain = chain.then(async ()=>{
|
|
769
|
-
changedContent.push(...getChangedContent(
|
|
770
|
-
await rebuild(
|
|
772
|
+
changedContent.push(...getChangedContent(config));
|
|
773
|
+
await rebuild(config);
|
|
771
774
|
});
|
|
772
775
|
} else {
|
|
773
776
|
chain = chain.then(async ()=>{
|
|
@@ -775,7 +778,7 @@ async function build() {
|
|
|
775
778
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
776
779
|
extension: _path.default.extname(file).slice(1)
|
|
777
780
|
});
|
|
778
|
-
await rebuild(
|
|
781
|
+
await rebuild(config);
|
|
779
782
|
});
|
|
780
783
|
}
|
|
781
784
|
});
|
|
@@ -785,12 +788,12 @@ async function build() {
|
|
|
785
788
|
content: _fs.default.readFileSync(_path.default.resolve(file), "utf8"),
|
|
786
789
|
extension: _path.default.extname(file).slice(1)
|
|
787
790
|
});
|
|
788
|
-
await rebuild(
|
|
791
|
+
await rebuild(config);
|
|
789
792
|
});
|
|
790
793
|
});
|
|
791
794
|
chain = chain.then(()=>{
|
|
792
|
-
changedContent.push(...getChangedContent(
|
|
793
|
-
return rebuild(
|
|
795
|
+
changedContent.push(...getChangedContent(config));
|
|
796
|
+
return rebuild(config);
|
|
794
797
|
});
|
|
795
798
|
}
|
|
796
799
|
if (shouldWatch) {
|
package/lib/constants.js
CHANGED
|
@@ -2,36 +2,43 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
var
|
|
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
|
+
cli: ()=>cli,
|
|
13
|
+
defaultConfigFile: ()=>defaultConfigFile,
|
|
14
|
+
defaultPostCssConfigFile: ()=>defaultPostCssConfigFile,
|
|
15
|
+
cjsConfigFile: ()=>cjsConfigFile,
|
|
16
|
+
cjsPostCssConfigFile: ()=>cjsPostCssConfigFile,
|
|
17
|
+
supportedConfigFiles: ()=>supportedConfigFiles,
|
|
18
|
+
supportedPostCssConfigFile: ()=>supportedPostCssConfigFile,
|
|
19
|
+
defaultConfigStubFile: ()=>defaultConfigStubFile,
|
|
20
|
+
simpleConfigStubFile: ()=>simpleConfigStubFile,
|
|
21
|
+
defaultPostCssConfigStubFile: ()=>defaultPostCssConfigStubFile
|
|
22
|
+
});
|
|
23
|
+
const _path = /*#__PURE__*/ _interopRequireDefault(require("path"));
|
|
7
24
|
function _interopRequireDefault(obj) {
|
|
8
25
|
return obj && obj.__esModule ? obj : {
|
|
9
26
|
default: obj
|
|
10
27
|
};
|
|
11
28
|
}
|
|
12
29
|
const cli = "tailwind";
|
|
13
|
-
exports.cli = cli;
|
|
14
30
|
const defaultConfigFile = "./tailwind.config.js";
|
|
15
|
-
exports.defaultConfigFile = defaultConfigFile;
|
|
16
31
|
const defaultPostCssConfigFile = "./postcss.config.js";
|
|
17
|
-
exports.defaultPostCssConfigFile = defaultPostCssConfigFile;
|
|
18
32
|
const cjsConfigFile = "./tailwind.config.cjs";
|
|
19
|
-
exports.cjsConfigFile = cjsConfigFile;
|
|
20
33
|
const cjsPostCssConfigFile = "./postcss.config.cjs";
|
|
21
|
-
exports.cjsPostCssConfigFile = cjsPostCssConfigFile;
|
|
22
34
|
const supportedConfigFiles = [
|
|
23
35
|
cjsConfigFile,
|
|
24
36
|
defaultConfigFile
|
|
25
37
|
];
|
|
26
|
-
exports.supportedConfigFiles = supportedConfigFiles;
|
|
27
38
|
const supportedPostCssConfigFile = [
|
|
28
39
|
cjsPostCssConfigFile,
|
|
29
40
|
defaultPostCssConfigFile
|
|
30
41
|
];
|
|
31
|
-
exports.supportedPostCssConfigFile = supportedPostCssConfigFile;
|
|
32
42
|
const defaultConfigStubFile = _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js");
|
|
33
|
-
exports.defaultConfigStubFile = defaultConfigStubFile;
|
|
34
43
|
const simpleConfigStubFile = _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js");
|
|
35
|
-
exports.simpleConfigStubFile = simpleConfigStubFile;
|
|
36
44
|
const defaultPostCssConfigStubFile = _path.default.resolve(__dirname, "../stubs/defaultPostCssConfig.stub.js");
|
|
37
|
-
exports.defaultPostCssConfigStubFile = defaultPostCssConfigStubFile;
|
package/lib/corePluginList.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
exports
|
|
6
|
-
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>_default
|
|
8
|
+
});
|
|
9
|
+
const _default = [
|
|
7
10
|
"preflight",
|
|
8
11
|
"container",
|
|
9
12
|
"accessibility",
|
|
@@ -176,4 +179,3 @@ var _default = [
|
|
|
176
179
|
"willChange",
|
|
177
180
|
"content"
|
|
178
181
|
];
|
|
179
|
-
exports.default = _default;
|