File tree 3 files changed +29
-4
lines changed
3 files changed +29
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @compiled/react ' : patch
3
+ ---
4
+
5
+ Add custom error message to be shown when any output from createStrictAPI() is unexpectedly executed.
Original file line number Diff line number Diff line change 1
1
import type { StrictCSSProperties , CSSPseudos } from '../types' ;
2
- import { createSetupError } from '../utils/error' ;
2
+ import { createStrictSetupError } from '../utils/error' ;
3
3
import { type CompiledStyles , cx , type Internal$XCSSProp } from '../xcss-prop' ;
4
4
5
5
type PseudosDeclarations = {
@@ -210,14 +210,14 @@ type CompiledSchema = StrictCSSProperties & PseudosDeclarations;
210
210
export function createStrictAPI < TSchema extends CompiledSchema > ( ) : CompiledAPI < TSchema > {
211
211
return {
212
212
css ( ) {
213
- throw createSetupError ( ) ;
213
+ throw createStrictSetupError ( ) ;
214
214
} ,
215
215
cssMap ( ) {
216
- throw createSetupError ( ) ;
216
+ throw createStrictSetupError ( ) ;
217
217
} ,
218
218
cx,
219
219
XCSSProp ( ) {
220
- throw createSetupError ( ) ;
220
+ throw createStrictSetupError ( ) ;
221
221
} ,
222
222
} ;
223
223
}
Original file line number Diff line number Diff line change @@ -17,3 +17,23 @@ export const createSetupError = (): Error => {
17
17
Good luck!
18
18
` ) ;
19
19
} ;
20
+
21
+ export const createStrictSetupError = ( ) : Error => {
22
+ return new Error ( `
23
+ ██████╗ ██████╗ ███╗ ███╗██████╗ ██╗██╗ ███████╗██████╗
24
+ ██╔════╝██╔═══██╗████╗ ████║██╔══██╗██║██║ ██╔════╝██╔══██╗
25
+ ██║ ██║ ██║██╔████╔██║██████╔╝██║██║ █████╗ ██║ ██║
26
+ ██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║██║ ██╔══╝ ██║ ██║
27
+ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ██║███████╗███████╗██████╔╝
28
+ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝╚═════╝
29
+
30
+ @compiled/react
31
+
32
+ Code was executed when it shouldn't have. To resolve make sure to:
33
+
34
+ 1. Set up Compiled.
35
+ 2. Configure importSources in your Compiled config to point to the module that exports the output of createStrictAPI().
36
+
37
+ For more information visit https://compiledcssinjs.com/docs/installation and follow the instructions.
38
+ ` ) ;
39
+ } ;
You can’t perform that action at this time.
0 commit comments