tailwindcss 0.0.0-insiders.b49dc7c → 0.0.0-insiders.b4e637e

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +82 -5
  2. package/defaultTheme.d.ts +2 -1
  3. package/lib/cli-peer-dependencies.js +4 -0
  4. package/lib/cli.js +85 -58
  5. package/lib/corePlugins.js +114 -86
  6. package/lib/featureFlags.js +8 -6
  7. package/lib/index.js +1 -2
  8. package/lib/lib/cacheInvalidation.js +32 -14
  9. package/lib/lib/collapseAdjacentRules.js +1 -2
  10. package/lib/lib/defaultExtractor.js +115 -58
  11. package/lib/lib/evaluateTailwindFunctions.js +30 -14
  12. package/lib/lib/expandApplyAtRules.js +11 -26
  13. package/lib/lib/expandTailwindAtRules.js +36 -22
  14. package/lib/lib/generateRules.js +109 -49
  15. package/lib/lib/regex.js +1 -2
  16. package/lib/lib/resolveDefaultsAtRules.js +56 -45
  17. package/lib/lib/setupContextUtils.js +121 -66
  18. package/lib/lib/setupTrackingContext.js +7 -9
  19. package/lib/lib/sharedState.js +1 -2
  20. package/lib/lib/substituteScreenAtRules.js +1 -2
  21. package/lib/postcss-plugins/nesting/plugin.js +1 -2
  22. package/lib/util/buildMediaQuery.js +1 -2
  23. package/lib/util/cloneDeep.js +2 -4
  24. package/lib/util/color.js +5 -10
  25. package/lib/util/createPlugin.js +1 -2
  26. package/lib/util/createUtilityPlugin.js +1 -2
  27. package/lib/util/dataTypes.js +8 -15
  28. package/lib/util/flattenColorPalette.js +2 -5
  29. package/lib/util/formatVariantSelector.js +14 -16
  30. package/lib/util/getAllConfigs.js +10 -5
  31. package/lib/util/isValidArbitraryValue.js +1 -2
  32. package/lib/util/log.js +2 -3
  33. package/lib/util/negateValue.js +1 -2
  34. package/lib/util/normalizeConfig.js +33 -23
  35. package/lib/util/normalizeScreens.js +1 -2
  36. package/lib/util/parseAnimationValue.js +1 -2
  37. package/lib/util/pluginUtils.js +11 -3
  38. package/lib/util/removeAlphaVariables.js +18 -0
  39. package/lib/util/resolveConfig.js +57 -56
  40. package/lib/util/splitAtTopLevelOnly.js +32 -14
  41. package/lib/util/transformThemeValue.js +4 -2
  42. package/lib/util/validateConfig.js +21 -0
  43. package/lib/util/withAlphaVariable.js +5 -5
  44. package/package.json +19 -17
  45. package/peers/index.js +3537 -1462
  46. package/plugin.d.ts +10 -5
  47. package/scripts/generate-types.js +53 -0
  48. package/scripts/type-utils.js +27 -0
  49. package/src/cli-peer-dependencies.js +4 -0
  50. package/src/cli.js +80 -23
  51. package/src/corePlugins.js +75 -42
  52. package/src/featureFlags.js +2 -2
  53. package/src/lib/defaultExtractor.js +78 -47
  54. package/src/lib/evaluateTailwindFunctions.js +31 -7
  55. package/src/lib/generateRules.js +74 -14
  56. package/src/lib/resolveDefaultsAtRules.js +53 -36
  57. package/src/lib/setupContextUtils.js +93 -19
  58. package/src/lib/setupTrackingContext.js +4 -0
  59. package/src/util/dataTypes.js +3 -5
  60. package/src/util/formatVariantSelector.js +22 -14
  61. package/src/util/getAllConfigs.js +7 -0
  62. package/src/util/log.js +1 -1
  63. package/src/util/normalizeConfig.js +0 -8
  64. package/src/util/pluginUtils.js +13 -1
  65. package/src/util/removeAlphaVariables.js +24 -0
  66. package/src/util/resolveConfig.js +66 -52
  67. package/src/util/toPath.js +1 -1
  68. package/src/util/transformThemeValue.js +4 -2
  69. package/src/util/validateConfig.js +13 -0
  70. package/src/util/withAlphaVariable.js +1 -1
  71. package/stubs/defaultConfig.stub.js +2 -1
  72. package/stubs/simpleConfig.stub.js +1 -0
  73. package/types/config.d.ts +33 -29
  74. package/types/generated/default-theme.d.ts +331 -0
  75. package/types/index.d.ts +7 -1
  76. package/types.d.ts +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,62 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ - Nothing yet!
11
+
12
+ ## [3.1.5] - 2022-07-07
13
+
14
+ ### Added
15
+
16
+ - Support configuring a default `font-weight` for each font size utility ([#8763](https://github.com/tailwindlabs/tailwindcss/pull/8763))
17
+ - Add support for alpha values in safe list ([#8774](https://github.com/tailwindlabs/tailwindcss/pull/8774))
18
+
19
+ ### Fixed
20
+
21
+ - Improve types to support fallback values in the CSS-in-JS syntax used in plugin APIs ([#8762](https://github.com/tailwindlabs/tailwindcss/pull/8762))
22
+ - Support including `tailwindcss` and `autoprefixer` in `postcss.config.js` in standalone CLI ([#8769](https://github.com/tailwindlabs/tailwindcss/pull/8769))
23
+ - Fix using special-characters as prefixes ([#8772](https://github.com/tailwindlabs/tailwindcss/pull/8772))
24
+ - Don’t prefix classes used within arbitrary variants ([#8773](https://github.com/tailwindlabs/tailwindcss/pull/8773))
25
+ - Add more explicit types for the default theme ([#8780](https://github.com/tailwindlabs/tailwindcss/pull/8780))
26
+
27
+ ## [3.1.4] - 2022-06-21
28
+
29
+ ### Fixed
30
+
31
+ - Provide default to `<alpha-value>` when using `theme()` ([#8652](https://github.com/tailwindlabs/tailwindcss/pull/8652))
32
+ - Detect arbitrary variants with quotes ([#8687](https://github.com/tailwindlabs/tailwindcss/pull/8687))
33
+ - Don’t add spaces around raw `/` that are preceded by numbers ([#8688](https://github.com/tailwindlabs/tailwindcss/pull/8688))
34
+
35
+ ## [3.1.3] - 2022-06-14
36
+
37
+ ### Fixed
38
+
39
+ - Fix extraction of multi-word utilities with arbitrary values and quotes ([#8604](https://github.com/tailwindlabs/tailwindcss/pull/8604))
40
+ - Fix casing of import of `corePluginList` type definition ([#8587](https://github.com/tailwindlabs/tailwindcss/pull/8587))
41
+ - Ignore PostCSS nodes returned by `addVariant` ([#8608](https://github.com/tailwindlabs/tailwindcss/pull/8608))
42
+ - Fix missing spaces around arithmetic operators ([#8615](https://github.com/tailwindlabs/tailwindcss/pull/8615))
43
+ - Detect alpha value in CSS `theme()` function when using quotes ([#8625](https://github.com/tailwindlabs/tailwindcss/pull/8625))
44
+ - Fix "Maximum call stack size exceeded" bug ([#8636](https://github.com/tailwindlabs/tailwindcss/pull/8636))
45
+ - Allow functions returning parallel variants to mutate the container ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
46
+ - Remove text opacity CSS variables from `::marker` ([#8622](https://github.com/tailwindlabs/tailwindcss/pull/8622))
47
+
48
+ ## [3.1.2] - 2022-06-10
49
+
50
+ ### Fixed
51
+
52
+ - Ensure `\` is a valid arbitrary variant token ([#8576](https://github.com/tailwindlabs/tailwindcss/pull/8576))
53
+ - 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))
54
+
55
+ ## [3.1.1] - 2022-06-09
56
+
57
+ ### Fixed
58
+
59
+ - Fix candidate extractor regression ([#8558](https://github.com/tailwindlabs/tailwindcss/pull/8558))
60
+ - Split `::backdrop` into separate defaults group ([#8567](https://github.com/tailwindlabs/tailwindcss/pull/8567))
61
+ - Fix postcss plugin type ([#8564](https://github.com/tailwindlabs/tailwindcss/pull/8564))
62
+ - Fix class detection in markdown code fences and slim templates ([#8569](https://github.com/tailwindlabs/tailwindcss/pull/8569))
63
+
64
+ ## [3.1.0] - 2022-06-08
65
+
10
66
  ### Fixed
11
67
 
12
68
  - Types: allow for arbitrary theme values (for 3rd party plugins) ([#7926](https://github.com/tailwindlabs/tailwindcss/pull/7926))
@@ -21,15 +77,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
77
  - Only check selectors containing base apply candidates for circular dependencies ([#8222](https://github.com/tailwindlabs/tailwindcss/pull/8222))
22
78
  - Rewrite default class extractor ([#8204](https://github.com/tailwindlabs/tailwindcss/pull/8204))
23
79
  - Move `important` selector to the front when `@apply`-ing selector-modifying variants in custom utilities ([#8313](https://github.com/tailwindlabs/tailwindcss/pull/8313))
80
+ - Error when registering an invalid custom variant ([#8345](https://github.com/tailwindlabs/tailwindcss/pull/8345))
81
+ - Create tailwind.config.cjs file in ESM package when running init ([#8363](https://github.com/tailwindlabs/tailwindcss/pull/8363))
82
+ - Fix `matchVariants` that use at-rules and placeholders ([#8392](https://github.com/tailwindlabs/tailwindcss/pull/8392))
83
+ - Improve types of the `tailwindcss/plugin` ([#8400](https://github.com/tailwindlabs/tailwindcss/pull/8400))
84
+ - Allow returning parallel variants from `addVariant` or `matchVariant` callback functions ([#8455](https://github.com/tailwindlabs/tailwindcss/pull/8455))
85
+ - Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
86
+ - Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
87
+ - Don't inherit `to` value from parent gradients ([#8489](https://github.com/tailwindlabs/tailwindcss/pull/8489))
88
+ - Remove process dependency from log functions ([#8530](https://github.com/tailwindlabs/tailwindcss/pull/8530))
89
+ - Ensure we can use `@import 'tailwindcss/...'` without node_modules ([#8537](https://github.com/tailwindlabs/tailwindcss/pull/8537))
24
90
 
25
91
  ### Changed
26
92
 
27
- - Try using local `postcss` installation first in the CLI ([#8270](https://github.com/tailwindlabs/tailwindcss/pull/8270))
93
+ - Only apply hover styles when supported (future) ([#8394](https://github.com/tailwindlabs/tailwindcss/pull/8394))
94
+ - Respect default ring color opacity (future) ([#8448](https://github.com/tailwindlabs/tailwindcss/pull/8448), [3f4005e](https://github.com/tailwindlabs/tailwindcss/commit/3f4005e833445f7549219eb5ae89728cbb3a2630))
28
95
 
29
96
  ### Added
30
97
 
31
- - Allow default ring color to be a function ([#7587](https://github.com/tailwindlabs/tailwindcss/pull/7587))
32
- - Add `rgb` and `hsl` color helpers for CSS variables ([#7665](https://github.com/tailwindlabs/tailwindcss/pull/7665))
33
98
  - Support PostCSS `Document` nodes ([#7291](https://github.com/tailwindlabs/tailwindcss/pull/7291))
34
99
  - Add `text-start` and `text-end` utilities ([#6656](https://github.com/tailwindlabs/tailwindcss/pull/6656))
35
100
  - Support customizing class name when using `darkMode: 'class'` ([#5800](https://github.com/tailwindlabs/tailwindcss/pull/5800))
@@ -37,10 +102,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
37
102
  - Add new `border-spacing` utilities ([#7102](https://github.com/tailwindlabs/tailwindcss/pull/7102))
38
103
  - Add `enabled` variant ([#7905](https://github.com/tailwindlabs/tailwindcss/pull/7905))
39
104
  - Add TypeScript types for the `tailwind.config.js` file ([#7891](https://github.com/tailwindlabs/tailwindcss/pull/7891))
40
- - Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924))
105
+ - Add `backdrop` variant ([#7924](https://github.com/tailwindlabs/tailwindcss/pull/7924), [#8526](https://github.com/tailwindlabs/tailwindcss/pull/8526))
41
106
  - Add `grid-flow-dense` utility ([#8193](https://github.com/tailwindlabs/tailwindcss/pull/8193))
42
107
  - Add `mix-blend-plus-lighter` utility ([#8288](https://github.com/tailwindlabs/tailwindcss/pull/8288))
43
108
  - Add arbitrary variants ([#8299](https://github.com/tailwindlabs/tailwindcss/pull/8299))
109
+ - Add experimental `matchVariant` API ([#8310](https://github.com/tailwindlabs/tailwindcss/pull/8310), [34fd0fb8](https://github.com/tailwindlabs/tailwindcss/commit/34fd0fb82aa574cddc5c7aa3ad7d1af5e3735e5d))
110
+ - Add `prefers-contrast` media query variants ([#8410](https://github.com/tailwindlabs/tailwindcss/pull/8410))
111
+ - Add opacity support when referencing colors with `theme` function ([#8416](https://github.com/tailwindlabs/tailwindcss/pull/8416))
112
+ - Add `postcss-import` support to the CLI ([#8437](https://github.com/tailwindlabs/tailwindcss/pull/8437))
113
+ - Add `optional` variant ([#8486](https://github.com/tailwindlabs/tailwindcss/pull/8486))
114
+ - Add `<alpha-value>` placeholder support for custom colors ([#8501](https://github.com/tailwindlabs/tailwindcss/pull/8501))
44
115
 
45
116
  ## [3.0.24] - 2022-04-12
46
117
 
@@ -1933,7 +2004,13 @@ No release notes
1933
2004
 
1934
2005
  - Everything!
1935
2006
 
1936
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...HEAD
2007
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.5...HEAD
2008
+ [3.1.5]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.4...v3.1.5
2009
+ [3.1.4]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.3...v3.1.4
2010
+ [3.1.3]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...v3.1.3
2011
+ [3.1.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...v3.1.2
2012
+ [3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
2013
+ [3.1.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...v3.1.0
1937
2014
  [3.0.24]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...v3.0.24
1938
2015
  [3.0.23]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.22...v3.0.23
1939
2016
  [3.0.22]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.21...v3.0.22
package/defaultTheme.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import type { Config } from './types/config'
2
- declare const theme: Config['theme']
2
+ import { DefaultTheme } from './types/generated/default-theme'
3
+ declare const theme: Config['theme'] & DefaultTheme
3
4
  export = theme
@@ -3,11 +3,15 @@ Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
5
  exports.lazyPostcss = lazyPostcss;
6
+ exports.lazyPostcssImport = lazyPostcssImport;
6
7
  exports.lazyAutoprefixer = lazyAutoprefixer;
7
8
  exports.lazyCssnano = lazyCssnano;
8
9
  function lazyPostcss() {
9
10
  return require("postcss");
10
11
  }
12
+ function lazyPostcssImport() {
13
+ return require("postcss-import");
14
+ }
11
15
  function lazyAutoprefixer() {
12
16
  return require("autoprefixer");
13
17
  }
package/lib/cli.js CHANGED
@@ -18,6 +18,7 @@ var _getModuleDependencies = _interopRequireDefault(require("./lib/getModuleDepe
18
18
  var _log = _interopRequireDefault(require("./util/log"));
19
19
  var _packageJson = _interopRequireDefault(require("../package.json"));
20
20
  var _normalizePath = _interopRequireDefault(require("normalize-path"));
21
+ var _validateConfigJs = require("./util/validateConfig.js");
21
22
  function _interopRequireDefault(obj) {
22
23
  return obj && obj.__esModule ? obj : {
23
24
  default: obj
@@ -26,6 +27,22 @@ function _interopRequireDefault(obj) {
26
27
  let env = {
27
28
  DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== "0"
28
29
  };
30
+ function isESM() {
31
+ const pkgPath = _path.default.resolve("./package.json");
32
+ try {
33
+ let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
34
+ return pkg.type && pkg.type === "module";
35
+ } catch (err) {
36
+ return false;
37
+ }
38
+ }
39
+ let configs = isESM() ? {
40
+ tailwind: "tailwind.config.cjs",
41
+ postcss: "postcss.config.cjs"
42
+ } : {
43
+ tailwind: "tailwind.config.js",
44
+ postcss: "postcss.config.js"
45
+ };
29
46
  // ---
30
47
  function indentRecursive(node, indent = 0) {
31
48
  node.each && node.each((child, i)=>{
@@ -55,10 +72,8 @@ function drainStdin() {
55
72
  process.stdin.on("data", (chunk)=>{
56
73
  result += chunk;
57
74
  });
58
- process.stdin.on("end", ()=>resolve(result)
59
- );
60
- process.stdin.on("error", (err)=>reject(err)
61
- );
75
+ process.stdin.on("end", ()=>resolve(result));
76
+ process.stdin.on("error", (err)=>reject(err));
62
77
  });
63
78
  }
64
79
  function help({ message , usage , commands: commands1 , options }) {
@@ -143,15 +158,11 @@ let commands = {
143
158
  args: {
144
159
  "--full": {
145
160
  type: Boolean,
146
- description: "Initialize a full `tailwind.config.js` file"
161
+ description: `Initialize a full \`${configs.tailwind}\` file`
147
162
  },
148
163
  "--postcss": {
149
164
  type: Boolean,
150
- description: "Initialize a `postcss.config.js` file"
151
- },
152
- "--types": {
153
- type: Boolean,
154
- description: "Add TypeScript types for the `tailwind.config.js` file"
165
+ description: `Initialize a \`${configs.postcss}\` file`
155
166
  },
156
167
  "-f": "--full",
157
168
  "-p": "--postcss"
@@ -216,16 +227,13 @@ let sharedFlags = {
216
227
  },
217
228
  "-h": "--help"
218
229
  };
219
- if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined
220
- ))) {
230
+ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
221
231
  help({
222
232
  usage: [
223
233
  "tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
224
- "tailwindcss init [--full] [--postcss] [--types] [options...]",
234
+ "tailwindcss init [--full] [--postcss] [options...]",
225
235
  ],
226
- commands: Object.keys(commands).filter((command2)=>command2 !== "build"
227
- ).map((command3)=>`${command3} [options]`
228
- ),
236
+ commands: Object.keys(commands).filter((command2)=>command2 !== "build").map((command3)=>`${command3} [options]`),
229
237
  options: {
230
238
  ...commands.build.args,
231
239
  ...sharedFlags
@@ -233,8 +241,7 @@ if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.
233
241
  });
234
242
  process.exit(0);
235
243
  }
236
- let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg
237
- )(process.argv[2]) || "build";
244
+ let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
238
245
  if (commands[command] === undefined) {
239
246
  if (_fs.default.existsSync(_path.default.resolve(command))) {
240
247
  // TODO: Deprecate this in future versions
@@ -246,9 +253,7 @@ if (commands[command] === undefined) {
246
253
  usage: [
247
254
  "tailwindcss <command> [options]"
248
255
  ],
249
- commands: Object.keys(commands).filter((command4)=>command4 !== "build"
250
- ).map((command5)=>`${command5} [options]`
251
- ),
256
+ commands: Object.keys(commands).filter((command4)=>command4 !== "build").map((command5)=>`${command5} [options]`),
252
257
  options: sharedFlags
253
258
  });
254
259
  process.exit(1);
@@ -267,8 +272,7 @@ let args = (()=>{
267
272
  }).map(([key, value])=>[
268
273
  key,
269
274
  typeof value === "object" ? value.type : value
270
- ]
271
- )), {
275
+ ])), {
272
276
  permissive: true
273
277
  });
274
278
  // Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
@@ -335,22 +339,18 @@ run();
335
339
  function init() {
336
340
  let messages = [];
337
341
  var ref;
338
- let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : "./tailwind.config.js");
342
+ let tailwindConfigLocation = _path.default.resolve((ref = args["_"][1]) !== null && ref !== void 0 ? ref : `./${configs.tailwind}`);
339
343
  if (_fs.default.existsSync(tailwindConfigLocation)) {
340
344
  messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
341
345
  } else {
342
346
  let stubFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../stubs/defaultConfig.stub.js") : _path.default.resolve(__dirname, "../stubs/simpleConfig.stub.js"), "utf8");
343
- if (args["--types"]) {
344
- let typesHeading = "/** @type {import('tailwindcss/types').Config} */";
345
- stubFile = stubFile.replace(`module.exports = `, `${typesHeading}\nconst config = `) + "\nmodule.exports = config";
346
- }
347
347
  // Change colors import
348
348
  stubFile = stubFile.replace("../colors", "tailwindcss/colors");
349
349
  _fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
350
350
  messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
351
351
  }
352
352
  if (args["--postcss"]) {
353
- let postcssConfigLocation = _path.default.resolve("./postcss.config.js");
353
+ let postcssConfigLocation = _path.default.resolve(`./${configs.postcss}`);
354
354
  if (_fs.default.existsSync(postcssConfigLocation)) {
355
355
  messages.push(`${_path.default.basename(postcssConfigLocation)} already exists.`);
356
356
  } else {
@@ -389,8 +389,7 @@ async function build() {
389
389
  console.error(`Specified config file ${args["--config"]} does not exist.`);
390
390
  process.exit(9);
391
391
  }
392
- let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null
393
- )(_path.default.resolve("./tailwind.config.js"));
392
+ let configPath = args["--config"] ? args["--config"] : ((defaultPath)=>_fs.default.existsSync(defaultPath) ? defaultPath : null)(_path.default.resolve(`./${configs.tailwind}`));
394
393
  async function loadPostCssPlugins() {
395
394
  let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
396
395
  let config1 = customPostCssPath ? await (async ()=>{
@@ -429,6 +428,43 @@ async function build() {
429
428
  config1.options
430
429
  ];
431
430
  }
431
+ function loadBuiltinPostcssPlugins() {
432
+ let postcss = loadPostcss();
433
+ let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
434
+ return [
435
+ [
436
+ (root)=>{
437
+ root.walkAtRules("import", (rule)=>{
438
+ if (rule.params.slice(1).startsWith("tailwindcss/")) {
439
+ rule.after(postcss.comment({
440
+ text: IMPORT_COMMENT + rule.params
441
+ }));
442
+ rule.remove();
443
+ }
444
+ });
445
+ },
446
+ (()=>{
447
+ try {
448
+ return require("postcss-import");
449
+ } catch {}
450
+ return (0, _indexJs).lazyPostcssImport();
451
+ })(),
452
+ (root)=>{
453
+ root.walkComments((rule)=>{
454
+ if (rule.text.startsWith(IMPORT_COMMENT)) {
455
+ rule.after(postcss.atRule({
456
+ name: "import",
457
+ params: rule.text.replace(IMPORT_COMMENT, "")
458
+ }));
459
+ rule.remove();
460
+ }
461
+ });
462
+ },
463
+ ],
464
+ [],
465
+ {},
466
+ ];
467
+ }
432
468
  function resolveConfig() {
433
469
  let config = configPath ? require(configPath) : {};
434
470
  if (args["--purge"]) {
@@ -448,9 +484,12 @@ async function build() {
448
484
  }
449
485
  });
450
486
  resolvedConfig.content.files = files;
487
+ resolvedConfig = (0, _validateConfigJs).validateConfig(resolvedConfig);
451
488
  return resolvedConfig;
452
489
  }
453
- return (0, _resolveConfig).default(config);
490
+ let resolvedConfig = (0, _resolveConfig).default(config);
491
+ resolvedConfig = (0, _validateConfigJs).validateConfig(resolvedConfig);
492
+ return resolvedConfig;
454
493
  }
455
494
  function extractFileGlobs(config) {
456
495
  return config.content.files.filter((file)=>{
@@ -458,8 +497,7 @@ async function build() {
458
497
  // like an object it's probably a raw content object. But this object
459
498
  // is not watchable, so let's remove it.
460
499
  return typeof file === "string";
461
- }).map((glob)=>(0, _normalizePath).default(glob)
462
- );
500
+ }).map((glob)=>(0, _normalizePath).default(glob));
463
501
  }
464
502
  function extractRawContent(config) {
465
503
  return config.content.files.filter((file)=>{
@@ -502,11 +540,7 @@ async function build() {
502
540
  };
503
541
  };
504
542
  tailwindPlugin.postcss = true;
505
- let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : [
506
- [],
507
- [],
508
- {}
509
- ];
543
+ let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
510
544
  let plugins = [
511
545
  ...beforePlugins,
512
546
  tailwindPlugin,
@@ -541,13 +575,11 @@ async function build() {
541
575
  let start = process.hrtime.bigint();
542
576
  return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
543
577
  recursive: true
544
- }) : null
545
- ).then(()=>processor.process(css, {
578
+ }) : null).then(()=>processor.process(css, {
546
579
  ...postcssOptions,
547
580
  from: input,
548
581
  to: output
549
- })
550
- ).then((result)=>{
582
+ })).then((result)=>{
551
583
  if (!output) {
552
584
  return process.stdout.write(result.css);
553
585
  }
@@ -558,7 +590,7 @@ async function build() {
558
590
  }).then(()=>{
559
591
  let end = process.hrtime.bigint();
560
592
  console.error();
561
- console.error("Done in", (end - start) / BigInt(1000000) + "ms.");
593
+ console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
562
594
  });
563
595
  }
564
596
  let css1 = await (()=>{
@@ -587,8 +619,7 @@ async function build() {
587
619
  delete require.cache[require.resolve(file1)];
588
620
  }
589
621
  if (configPath) {
590
- configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file
591
- );
622
+ configDependencies = (0, _getModuleDependencies).default(configPath).map(({ file })=>file);
592
623
  for (let dependency of configDependencies){
593
624
  contextDependencies.add(dependency);
594
625
  }
@@ -596,10 +627,7 @@ async function build() {
596
627
  env.DEBUG && console.timeEnd("Module dependencies");
597
628
  return resolveConfig();
598
629
  }
599
- let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [
600
- [],
601
- []
602
- ];
630
+ let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
603
631
  let plugins = [
604
632
  ...beforePlugins,
605
633
  "__TAILWIND_PLUGIN_POSITION__",
@@ -663,12 +691,10 @@ async function build() {
663
691
  let start = process.hrtime.bigint();
664
692
  return Promise.resolve().then(()=>output ? _fs.default.promises.mkdir(_path.default.dirname(output), {
665
693
  recursive: true
666
- }) : null
667
- ).then(()=>processor.process(css, {
694
+ }) : null).then(()=>processor.process(css, {
668
695
  from: input,
669
696
  to: output
670
- })
671
- ).then(async (result)=>{
697
+ })).then(async (result)=>{
672
698
  for (let message of result.messages){
673
699
  if (message.type === "dependency") {
674
700
  contextDependencies.add(message.file);
@@ -686,7 +712,7 @@ async function build() {
686
712
  ].filter(Boolean));
687
713
  }).then(()=>{
688
714
  let end = process.hrtime.bigint();
689
- console.error("Done in", (end - start) / BigInt(1000000) + "ms.");
715
+ console.error("Done in", (end - start) / BigInt(1e6) + "ms.");
690
716
  }).catch((err)=>{
691
717
  if (err.name === "CssSyntaxError") {
692
718
  console.error(err.toString());
@@ -768,9 +794,10 @@ async function build() {
768
794
  });
769
795
  }
770
796
  if (shouldWatch) {
771
- /* Abort the watcher if stdin is closed to avoid zombie processes */ process.stdin.on("end", ()=>process.exit(0)
772
- );
773
- process.stdin.resume();
797
+ /* Abort the watcher if stdin is closed to avoid zombie processes */ if (process.stdin.isTTY) {
798
+ process.stdin.on("end", ()=>process.exit(0));
799
+ process.stdin.resume();
800
+ }
774
801
  startWatcher();
775
802
  } else {
776
803
  buildOnce();