1+ /**
2+ * @fileoverview Test to reproduce the parsing error with @apply outline-ring/50
3+ */
4+
5+ import assert from "node:assert" ;
6+ import { tailwind3 } from "../src/tailwind3.js" ;
7+ import { tailwind4 } from "../src/tailwind4.js" ;
8+ import { fork } from "@eslint/css-tree" ;
9+
10+ describe ( "Issue Reproduction" , function ( ) {
11+ describe ( "@apply with slash notation" , ( ) => {
12+ const problematicCSS = `
13+ @layer base {
14+ * {
15+ @apply border-border outline-ring/50;
16+ }
17+ body {
18+ @apply bg-background text-foreground;
19+ }
20+ }
21+ ` ;
22+
23+ const simpleCase = `a { @apply outline-ring/50; }` ;
24+
25+ it ( "should parse @apply with slash notation in Tailwind 3" , ( ) => {
26+ const { parse, toPlainObject } = fork ( tailwind3 ) ;
27+ try {
28+ const result = parse ( simpleCase ) ;
29+ console . log ( "Tailwind 3 result:" , JSON . stringify ( toPlainObject ( result ) , null , 2 ) ) ;
30+ assert . ok ( result , "Should parse successfully" ) ;
31+ } catch ( error ) {
32+ console . error ( "Tailwind 3 error:" , error . message ) ;
33+ throw error ;
34+ }
35+ } ) ;
36+
37+ it ( "should parse @apply with slash notation in Tailwind 4" , ( ) => {
38+ const { parse, toPlainObject } = fork ( tailwind4 ) ;
39+ try {
40+ const result = parse ( simpleCase ) ;
41+ console . log ( "Tailwind 4 result:" , JSON . stringify ( toPlainObject ( result ) , null , 2 ) ) ;
42+ assert . ok ( result , "Should parse successfully" ) ;
43+ } catch ( error ) {
44+ console . error ( "Tailwind 4 error:" , error . message ) ;
45+ throw error ;
46+ }
47+ } ) ;
48+
49+ it ( "should test @apply border-border outline-ring/50 specifically" , ( ) => {
50+ const specificCase = "* { @apply border-border outline-ring/50; }" ;
51+
52+ console . log ( "Testing:" , specificCase ) ;
53+
54+ const { parse, toPlainObject } = fork ( tailwind3 ) ;
55+ try {
56+ const result = parse ( specificCase ) ;
57+ console . log ( "Parsed successfully:" , JSON . stringify ( toPlainObject ( result ) , null , 2 ) ) ;
58+ assert . ok ( result , "Should parse successfully" ) ;
59+ } catch ( error ) {
60+ console . error ( "Parse error:" , error . message ) ;
61+ console . error ( "Full error:" , error ) ;
62+ throw error ;
63+ }
64+ } ) ;
65+
66+ it ( "should parse complex @apply with slash notation in Tailwind 3" , ( ) => {
67+ const { parse } = fork ( tailwind3 ) ;
68+ const result = parse ( problematicCSS ) ;
69+ assert . ok ( result , "Should parse successfully" ) ;
70+ } ) ;
71+
72+ it ( "should parse complex @apply with slash notation in Tailwind 4" , ( ) => {
73+ const { parse } = fork ( tailwind4 ) ;
74+ const result = parse ( problematicCSS ) ;
75+ assert . ok ( result , "Should parse successfully" ) ;
76+ } ) ;
77+ } ) ;
78+ } ) ;
0 commit comments