@@ -4,6 +4,7 @@ import { pathToFileURL } from 'url'
44import escalade from 'escalade/sync'
55import prettier from 'prettier'
66import type { ParserOptions } from 'prettier'
7+ import * as console from './console'
78import { expiringMap } from './expiring-map.js'
89import { resolveJsFrom } from './resolve'
910import type { UnifiedApi } from './types'
@@ -89,6 +90,7 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
8990 // In this case the user explicitly gave us a stylesheet and a config.
9091 // Warn them about this and use the bundled v4.
9192 console . error (
93+ 'explicit-stylesheet-and-config-together' ,
9294 'You have specified a Tailwind CSS stylesheet and a Tailwind CSS config at the same time. Use tailwindStylesheet unless you are using v3. Preferring the stylesheet.' ,
9395 )
9496 }
@@ -102,6 +104,7 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
102104 // installation is not v4. We'll fallback to the bundled v4 in this case.
103105 mod = null
104106 console . error (
107+ 'stylesheet-unsupported' ,
105108 'You have specified a Tailwind CSS stylesheet but your installed version of Tailwind CSS does not support this feature.' ,
106109 )
107110 }
@@ -130,8 +133,8 @@ async function resolvePrettierConfigPath(filePath: string): Promise<string> {
130133 try {
131134 return await prettier . resolveConfigFile ( filePath )
132135 } catch ( err ) {
133- console . error ( 'Failed to resolve Prettier Config' )
134- console . error ( err )
136+ console . error ( 'prettier-config-not-found' , ' Failed to resolve Prettier Config')
137+ console . error ( 'prettier-config-not-found-err' , err )
135138 return null
136139 }
137140 } )
@@ -201,6 +204,7 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
201204 options . tailwindStylesheet . endsWith ( '.cts' )
202205 ) {
203206 console . error (
207+ 'stylesheet-is-js-file' ,
204208 "Your `tailwindStylesheet` option points to a JS/TS config file. You must point to your project's `.css` file for v4 projects." ,
205209 )
206210 } else if (
@@ -210,10 +214,12 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
210214 options . tailwindStylesheet . endsWith ( '.styl' )
211215 ) {
212216 console . error (
217+ 'stylesheet-is-preprocessor-file' ,
213218 'Your `tailwindStylesheet` option points to a preprocessor file. This is unsupported and you may get unexpected results.' ,
214219 )
215220 } else if ( ! options . tailwindStylesheet . endsWith ( '.css' ) ) {
216221 console . error (
222+ 'stylesheet-is-not-css-file' ,
217223 'Your `tailwindStylesheet` option does not point to a CSS file. This is unsupported and you may get unexpected results.' ,
218224 )
219225 }
@@ -222,13 +228,19 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
222228 }
223229
224230 if ( options . tailwindEntryPoint ) {
225- console . warn ( 'Deprecated: Use the `tailwindStylesheet` option for v4 projects instead of `tailwindEntryPoint`.' )
231+ console . warn (
232+ 'entrypoint-is-deprecated' ,
233+ 'Deprecated: Use the `tailwindStylesheet` option for v4 projects instead of `tailwindEntryPoint`.' ,
234+ )
226235
227236 return path . resolve ( baseDir , options . tailwindEntryPoint )
228237 }
229238
230239 if ( options . tailwindConfig && options . tailwindConfig . endsWith ( '.css' ) ) {
231- console . warn ( 'Deprecated: Use the `tailwindStylesheet` option for v4 projects instead of `tailwindConfig`.' )
240+ console . warn (
241+ 'config-as-css-is-deprecated' ,
242+ 'Deprecated: Use the `tailwindStylesheet` option for v4 projects instead of `tailwindConfig`.' ,
243+ )
232244
233245 return path . resolve ( baseDir , options . tailwindConfig )
234246 }
0 commit comments