tailwindcss 0.0.0-insiders.8259dfd → 0.0.0-insiders.8293c2d

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 (93) hide show
  1. package/CHANGELOG.md +207 -2
  2. package/README.md +8 -4
  3. package/colors.js +2 -1
  4. package/defaultConfig.js +2 -1
  5. package/defaultTheme.js +2 -1
  6. package/lib/cli.js +94 -61
  7. package/lib/constants.js +1 -1
  8. package/lib/corePluginList.js +8 -1
  9. package/lib/corePlugins.js +477 -517
  10. package/lib/css/preflight.css +18 -5
  11. package/lib/featureFlags.js +5 -6
  12. package/lib/index.js +1 -3
  13. package/lib/lib/collapseDuplicateDeclarations.js +80 -0
  14. package/lib/lib/defaultExtractor.js +42 -0
  15. package/lib/lib/detectNesting.js +17 -2
  16. package/lib/lib/evaluateTailwindFunctions.js +10 -6
  17. package/lib/lib/expandApplyAtRules.js +94 -45
  18. package/lib/lib/expandTailwindAtRules.js +32 -33
  19. package/lib/lib/generateRules.js +167 -21
  20. package/lib/lib/normalizeTailwindDirectives.js +8 -1
  21. package/lib/lib/partitionApplyAtRules.js +53 -0
  22. package/lib/lib/resolveDefaultsAtRules.js +28 -14
  23. package/lib/lib/setupContextUtils.js +153 -129
  24. package/lib/lib/setupTrackingContext.js +11 -10
  25. package/lib/lib/sharedState.js +34 -5
  26. package/lib/lib/substituteScreenAtRules.js +7 -4
  27. package/lib/processTailwindFeatures.js +7 -2
  28. package/lib/util/buildMediaQuery.js +13 -24
  29. package/lib/util/color.js +23 -8
  30. package/lib/util/createPlugin.js +1 -2
  31. package/lib/util/createUtilityPlugin.js +6 -10
  32. package/lib/util/dataTypes.js +38 -7
  33. package/lib/util/defaults.js +6 -0
  34. package/lib/util/flattenColorPalette.js +1 -3
  35. package/lib/util/formatVariantSelector.js +186 -0
  36. package/lib/util/isValidArbitraryValue.js +64 -0
  37. package/lib/util/log.js +4 -0
  38. package/lib/util/nameClass.js +1 -0
  39. package/lib/util/normalizeConfig.js +63 -21
  40. package/lib/util/normalizeScreens.js +59 -0
  41. package/lib/util/parseBoxShadowValue.js +77 -0
  42. package/lib/util/pluginUtils.js +27 -158
  43. package/lib/util/prefixSelector.js +1 -3
  44. package/lib/util/resolveConfig.js +30 -31
  45. package/lib/util/resolveConfigPath.js +1 -2
  46. package/lib/util/toColorValue.js +1 -2
  47. package/lib/util/toPath.js +6 -1
  48. package/lib/util/transformThemeValue.js +19 -13
  49. package/nesting/plugin.js +4 -1
  50. package/package.json +19 -21
  51. package/peers/index.js +4621 -5626
  52. package/plugin.js +2 -1
  53. package/resolveConfig.js +2 -1
  54. package/src/cli.js +66 -14
  55. package/src/corePluginList.js +1 -1
  56. package/src/corePlugins.js +406 -518
  57. package/src/css/preflight.css +18 -5
  58. package/src/featureFlags.js +1 -1
  59. package/src/index.js +1 -7
  60. package/src/lib/collapseDuplicateDeclarations.js +93 -0
  61. package/src/lib/defaultExtractor.js +48 -0
  62. package/src/lib/detectNesting.js +22 -3
  63. package/src/lib/evaluateTailwindFunctions.js +6 -3
  64. package/src/lib/expandApplyAtRules.js +101 -45
  65. package/src/lib/expandTailwindAtRules.js +33 -27
  66. package/src/lib/generateRules.js +178 -11
  67. package/src/lib/normalizeTailwindDirectives.js +6 -1
  68. package/src/lib/partitionApplyAtRules.js +52 -0
  69. package/src/lib/resolveDefaultsAtRules.js +31 -10
  70. package/src/lib/setupContextUtils.js +140 -84
  71. package/src/lib/setupTrackingContext.js +11 -10
  72. package/src/lib/sharedState.js +40 -4
  73. package/src/lib/substituteScreenAtRules.js +6 -3
  74. package/src/processTailwindFeatures.js +8 -2
  75. package/src/util/buildMediaQuery.js +14 -18
  76. package/src/util/color.js +20 -7
  77. package/src/util/dataTypes.js +43 -11
  78. package/src/util/defaults.js +6 -0
  79. package/src/util/formatVariantSelector.js +196 -0
  80. package/src/util/isValidArbitraryValue.js +61 -0
  81. package/src/util/log.js +4 -0
  82. package/src/util/nameClass.js +1 -1
  83. package/src/util/normalizeConfig.js +37 -2
  84. package/src/util/normalizeScreens.js +45 -0
  85. package/src/util/parseBoxShadowValue.js +71 -0
  86. package/src/util/pluginUtils.js +15 -138
  87. package/src/util/prefixSelector.js +1 -4
  88. package/src/util/resolveConfig.js +11 -1
  89. package/src/util/toPath.js +23 -1
  90. package/src/util/transformThemeValue.js +22 -7
  91. package/stubs/defaultConfig.stub.js +42 -16
  92. package/lib/lib/setupWatchingContext.js +0 -284
  93. package/src/lib/setupWatchingContext.js +0 -304
package/plugin.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = require('./lib/public/create-plugin').default
1
+ let createPlugin = require('./lib/public/create-plugin')
2
+ module.exports = (createPlugin.__esModule ? createPlugin : { default: createPlugin }).default
package/resolveConfig.js CHANGED
@@ -1 +1,2 @@
1
- module.exports = require('./lib/public/resolve-config').default
1
+ let resolveConfig = require('./lib/public/resolve-config')
2
+ module.exports = (resolveConfig.__esModule ? resolveConfig : { default: resolveConfig }).default
package/src/cli.js CHANGED
@@ -18,7 +18,7 @@ import packageJson from '../package.json'
18
18
  import normalizePath from 'normalize-path'
19
19
 
20
20
  let env = {
21
- DEBUG: process.env.DEBUG !== undefined,
21
+ DEBUG: process.env.DEBUG !== undefined && process.env.DEBUG !== '0',
22
22
  }
23
23
 
24
24
  // ---
@@ -41,6 +41,26 @@ function formatNodes(root) {
41
41
  }
42
42
  }
43
43
 
44
+ async function outputFile(file, contents) {
45
+ if (fs.existsSync(file) && (await fs.promises.readFile(file, 'utf8')) === contents) {
46
+ return // Skip writing the file
47
+ }
48
+
49
+ // Write the file
50
+ await fs.promises.writeFile(file, contents, 'utf8')
51
+ }
52
+
53
+ function drainStdin() {
54
+ return new Promise((resolve, reject) => {
55
+ let result = ''
56
+ process.stdin.on('data', (chunk) => {
57
+ result += chunk
58
+ })
59
+ process.stdin.on('end', () => resolve(result))
60
+ process.stdin.on('error', (err) => reject(err))
61
+ })
62
+ }
63
+
44
64
  function help({ message, usage, commands, options }) {
45
65
  let indent = 2
46
66
 
@@ -355,7 +375,7 @@ async function build() {
355
375
  input = args['--input'] = args['_'][1]
356
376
  }
357
377
 
358
- if (input && !fs.existsSync((input = path.resolve(input)))) {
378
+ if (input && input !== '-' && !fs.existsSync((input = path.resolve(input)))) {
359
379
  console.error(`Specified input file ${args['--input']} does not exist.`)
360
380
  process.exit(9)
361
381
  }
@@ -430,7 +450,7 @@ async function build() {
430
450
  }
431
451
 
432
452
  if (args['--content']) {
433
- resolvedConfig.content = args['--content'].split(/(?<!{[^}]+),/)
453
+ resolvedConfig.content.files = args['--content'].split(/(?<!{[^}]+),/)
434
454
  }
435
455
 
436
456
  return resolvedConfig
@@ -534,10 +554,11 @@ async function build() {
534
554
  if (!output) {
535
555
  return process.stdout.write(result.css)
536
556
  }
557
+
537
558
  return Promise.all(
538
559
  [
539
- fs.promises.writeFile(output, result.css, () => true),
540
- result.map && fs.writeFile(output + '.map', result.map.toString(), () => true),
560
+ outputFile(output, result.css),
561
+ result.map && outputFile(output + '.map', result.map.toString()),
541
562
  ].filter(Boolean)
542
563
  )
543
564
  })
@@ -548,9 +569,21 @@ async function build() {
548
569
  })
549
570
  }
550
571
 
551
- let css = input
552
- ? fs.readFileSync(path.resolve(input), 'utf8')
553
- : '@tailwind base; @tailwind components; @tailwind utilities'
572
+ let css = await (() => {
573
+ // Piping in data, let's drain the stdin
574
+ if (input === '-') {
575
+ return drainStdin()
576
+ }
577
+
578
+ // Input file has been provided
579
+ if (input) {
580
+ return fs.readFileSync(path.resolve(input), 'utf8')
581
+ }
582
+
583
+ // No input file provided, fallback to default atrules
584
+ return '@tailwind base; @tailwind components; @tailwind utilities'
585
+ })()
586
+
554
587
  return processCSS(css)
555
588
  }
556
589
 
@@ -664,10 +697,10 @@ async function build() {
664
697
  return process.stdout.write(result.css)
665
698
  }
666
699
 
667
- await Promise.all(
700
+ return Promise.all(
668
701
  [
669
- fs.promises.writeFile(output, result.css, () => true),
670
- result.map && fs.writeFile(output + '.map', result.map.toString(), () => true),
702
+ outputFile(output, result.css),
703
+ result.map && outputFile(output + '.map', result.map.toString()),
671
704
  ].filter(Boolean)
672
705
  )
673
706
  })
@@ -684,9 +717,21 @@ async function build() {
684
717
  })
685
718
  }
686
719
 
687
- let css = input
688
- ? fs.readFileSync(path.resolve(input), 'utf8')
689
- : '@tailwind base; @tailwind components; @tailwind utilities'
720
+ let css = await (() => {
721
+ // Piping in data, let's drain the stdin
722
+ if (input === '-') {
723
+ return drainStdin()
724
+ }
725
+
726
+ // Input file has been provided
727
+ if (input) {
728
+ return fs.readFileSync(path.resolve(input), 'utf8')
729
+ }
730
+
731
+ // No input file provided, fallback to default atrules
732
+ return '@tailwind base; @tailwind components; @tailwind utilities'
733
+ })()
734
+
690
735
  let result = await processCSS(css)
691
736
  env.DEBUG && console.timeEnd('Finished in')
692
737
  return result
@@ -700,6 +745,13 @@ async function build() {
700
745
 
701
746
  watcher = chokidar.watch([...contextDependencies, ...extractFileGlobs(config)], {
702
747
  ignoreInitial: true,
748
+ awaitWriteFinish:
749
+ process.platform === 'win32'
750
+ ? {
751
+ stabilityThreshold: 50,
752
+ pollInterval: 10,
753
+ }
754
+ : false,
703
755
  })
704
756
 
705
757
  let chain = Promise.resolve()
@@ -1 +1 @@
1
- export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","borderCollapse","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","whitespace","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","outline","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]
1
+ export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","borderCollapse","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","whitespace","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]