tailwindcss 3.1.1 → 3.1.2

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 CHANGED
@@ -9,6 +9,13 @@ 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.2] - 2022-06-10
13
+
14
+ ### Fixed
15
+
16
+ - Ensure `\` is a valid arbitrary variant token ([#8576](https://github.com/tailwindlabs/tailwindcss/pull/8576))
17
+ - 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))
18
+
12
19
  ## [3.1.1] - 2022-06-09
13
20
 
14
21
  ### Fixed
@@ -1961,7 +1968,8 @@ No release notes
1961
1968
 
1962
1969
  - Everything!
1963
1970
 
1964
- [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...HEAD
1971
+ [unreleased]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.2...HEAD
1972
+ [3.1.2]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.1...v3.1.2
1965
1973
  [3.1.1]: https://github.com/tailwindlabs/tailwindcss/compare/v3.1.0...v3.1.1
1966
1974
  [3.1.0]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.24...v3.1.0
1967
1975
  [3.0.24]: https://github.com/tailwindlabs/tailwindcss/compare/v3.0.23...v3.0.24
package/lib/cli.js CHANGED
@@ -428,6 +428,43 @@ async function build() {
428
428
  config1.options
429
429
  ];
430
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
+ }
431
468
  function resolveConfig() {
432
469
  let config = configPath ? require(configPath) : {};
433
470
  if (args["--purge"]) {
@@ -503,40 +540,7 @@ async function build() {
503
540
  };
504
541
  };
505
542
  tailwindPlugin.postcss = true;
506
- let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
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
- ];
543
+ let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
540
544
  let plugins = [
541
545
  ...beforePlugins,
542
546
  tailwindPlugin,
@@ -623,10 +627,7 @@ async function build() {
623
627
  env.DEBUG && console.timeEnd("Module dependencies");
624
628
  return resolveConfig();
625
629
  }
626
- let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [
627
- [],
628
- []
629
- ];
630
+ let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : loadBuiltinPostcssPlugins();
630
631
  let plugins = [
631
632
  ...beforePlugins,
632
633
  "__TAILWIND_PLUGIN_POSITION__",
@@ -95,7 +95,7 @@ function* buildRegExps(context) {
95
95
  "((?=((",
96
96
  regex.any([
97
97
  regex.pattern([
98
- /([^\s"'`\[\\]+-)?\[[^\s"'`\\]+\]/,
98
+ /([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/,
99
99
  separator
100
100
  ]),
101
101
  regex.pattern([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
package/src/cli.js CHANGED
@@ -484,6 +484,45 @@ async function build() {
484
484
  return [beforePlugins, afterPlugins, config.options]
485
485
  }
486
486
 
487
+ function loadBuiltinPostcssPlugins() {
488
+ let postcss = loadPostcss()
489
+ let IMPORT_COMMENT = '__TAILWIND_RESTORE_IMPORT__: '
490
+ return [
491
+ [
492
+ (root) => {
493
+ root.walkAtRules('import', (rule) => {
494
+ if (rule.params.slice(1).startsWith('tailwindcss/')) {
495
+ rule.after(postcss.comment({ text: IMPORT_COMMENT + rule.params }))
496
+ rule.remove()
497
+ }
498
+ })
499
+ },
500
+ (() => {
501
+ try {
502
+ return require('postcss-import')
503
+ } catch {}
504
+
505
+ return lazyPostcssImport()
506
+ })(),
507
+ (root) => {
508
+ root.walkComments((rule) => {
509
+ if (rule.text.startsWith(IMPORT_COMMENT)) {
510
+ rule.after(
511
+ postcss.atRule({
512
+ name: 'import',
513
+ params: rule.text.replace(IMPORT_COMMENT, ''),
514
+ })
515
+ )
516
+ rule.remove()
517
+ }
518
+ })
519
+ },
520
+ ],
521
+ [],
522
+ {},
523
+ ]
524
+ }
525
+
487
526
  function resolveConfig() {
488
527
  let config = configPath ? require(configPath) : {}
489
528
 
@@ -568,44 +607,9 @@ async function build() {
568
607
 
569
608
  tailwindPlugin.postcss = true
570
609
 
571
- let IMPORT_COMMENT = '__TAILWIND_RESTORE_IMPORT__: '
572
-
573
610
  let [beforePlugins, afterPlugins, postcssOptions] = includePostCss
574
611
  ? await loadPostCssPlugins()
575
- : [
576
- [
577
- (root) => {
578
- root.walkAtRules('import', (rule) => {
579
- if (rule.params.slice(1).startsWith('tailwindcss/')) {
580
- rule.after(postcss.comment({ text: IMPORT_COMMENT + rule.params }))
581
- rule.remove()
582
- }
583
- })
584
- },
585
- (() => {
586
- try {
587
- return require('postcss-import')
588
- } catch {}
589
-
590
- return lazyPostcssImport()
591
- })(),
592
- (root) => {
593
- root.walkComments((rule) => {
594
- if (rule.text.startsWith(IMPORT_COMMENT)) {
595
- rule.after(
596
- postcss.atRule({
597
- name: 'import',
598
- params: rule.text.replace(IMPORT_COMMENT, ''),
599
- })
600
- )
601
- rule.remove()
602
- }
603
- })
604
- },
605
- ],
606
- [],
607
- {},
608
- ]
612
+ : loadBuiltinPostcssPlugins()
609
613
 
610
614
  let plugins = [
611
615
  ...beforePlugins,
@@ -705,7 +709,9 @@ async function build() {
705
709
  return resolveConfig()
706
710
  }
707
711
 
708
- let [beforePlugins, afterPlugins] = includePostCss ? await loadPostCssPlugins() : [[], []]
712
+ let [beforePlugins, afterPlugins] = includePostCss
713
+ ? await loadPostCssPlugins()
714
+ : loadBuiltinPostcssPlugins()
709
715
 
710
716
  let plugins = [
711
717
  ...beforePlugins,
@@ -69,7 +69,7 @@ function* buildRegExps(context) {
69
69
  '((?=((',
70
70
  regex.any(
71
71
  [
72
- regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`\\]+\]/, separator]),
72
+ regex.pattern([/([^\s"'`\[\\]+-)?\[[^\s"'`]+\]/, separator]),
73
73
  regex.pattern([/[^\s"'`\[\\]+/, separator]),
74
74
  ],
75
75
  true