@@ -4,6 +4,7 @@ import { pathToFileURL } from 'url'
4
4
import escalade from 'escalade/sync'
5
5
import prettier from 'prettier'
6
6
import type { ParserOptions } from 'prettier'
7
+ import * as console from './console'
7
8
import { expiringMap } from './expiring-map.js'
8
9
import { resolveJsFrom } from './resolve'
9
10
import type { UnifiedApi } from './types'
@@ -89,6 +90,7 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
89
90
// In this case the user explicitly gave us a stylesheet and a config.
90
91
// Warn them about this and use the bundled v4.
91
92
console . error (
93
+ 'explicit-stylesheet-and-config-together' ,
92
94
'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.' ,
93
95
)
94
96
}
@@ -102,6 +104,7 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
102
104
// installation is not v4. We'll fallback to the bundled v4 in this case.
103
105
mod = null
104
106
console . error (
107
+ 'stylesheet-unsupported' ,
105
108
'You have specified a Tailwind CSS stylesheet but your installed version of Tailwind CSS does not support this feature.' ,
106
109
)
107
110
}
@@ -130,8 +133,8 @@ async function resolvePrettierConfigPath(filePath: string): Promise<string> {
130
133
try {
131
134
return await prettier . resolveConfigFile ( filePath )
132
135
} 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 )
135
138
return null
136
139
}
137
140
} )
@@ -201,6 +204,7 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
201
204
options . tailwindStylesheet . endsWith ( '.cts' )
202
205
) {
203
206
console . error (
207
+ 'stylesheet-is-js-file' ,
204
208
"Your `tailwindStylesheet` option points to a JS/TS config file. You must point to your project's `.css` file for v4 projects." ,
205
209
)
206
210
} else if (
@@ -210,10 +214,12 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
210
214
options . tailwindStylesheet . endsWith ( '.styl' )
211
215
) {
212
216
console . error (
217
+ 'stylesheet-is-preprocessor-file' ,
213
218
'Your `tailwindStylesheet` option points to a preprocessor file. This is unsupported and you may get unexpected results.' ,
214
219
)
215
220
} else if ( ! options . tailwindStylesheet . endsWith ( '.css' ) ) {
216
221
console . error (
222
+ 'stylesheet-is-not-css-file' ,
217
223
'Your `tailwindStylesheet` option does not point to a CSS file. This is unsupported and you may get unexpected results.' ,
218
224
)
219
225
}
@@ -222,13 +228,19 @@ function resolveStylesheet(options: ParserOptions, baseDir: string): string | nu
222
228
}
223
229
224
230
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
+ )
226
235
227
236
return path . resolve ( baseDir , options . tailwindEntryPoint )
228
237
}
229
238
230
239
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
+ )
232
244
233
245
return path . resolve ( baseDir , options . tailwindConfig )
234
246
}
0 commit comments