@stylexjs/babel-plugin 0.17.0 → 0.17.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.
Files changed (53) hide show
  1. package/lib/index.js +159 -76
  2. package/lib/shared/common-types.js.flow +9 -0
  3. package/lib/shared/hash.d.ts +3 -0
  4. package/lib/shared/index.d.ts +12 -0
  5. package/lib/shared/messages.d.ts +32 -0
  6. package/lib/shared/physical-rtl/generate-ltr.d.ts +1 -1
  7. package/lib/shared/physical-rtl/generate-ltr.js.flow +1 -1
  8. package/lib/shared/physical-rtl/generate-rtl.d.ts +1 -1
  9. package/lib/shared/physical-rtl/generate-rtl.js.flow +1 -1
  10. package/lib/shared/preprocess-rules/application-order.d.ts +35 -34
  11. package/lib/shared/preprocess-rules/application-order.js.flow +35 -29
  12. package/lib/shared/preprocess-rules/basic-validation.d.ts +1 -1
  13. package/lib/shared/preprocess-rules/basic-validation.js.flow +1 -1
  14. package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +22 -15
  15. package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +14 -14
  16. package/lib/shared/preprocess-rules/property-specificity.d.ts +12 -11
  17. package/lib/shared/preprocess-rules/property-specificity.js.flow +12 -6
  18. package/lib/shared/stylex-define-consts.d.ts +1 -1
  19. package/lib/shared/stylex-keyframes.d.ts +1 -1
  20. package/lib/shared/stylex-keyframes.js.flow +1 -1
  21. package/lib/shared/stylex-position-try.d.ts +1 -1
  22. package/lib/shared/stylex-position-try.js.flow +1 -1
  23. package/lib/shared/stylex-vars-utils.d.ts +2 -2
  24. package/lib/shared/stylex-vars-utils.js.flow +3 -3
  25. package/lib/shared/stylex-view-transition-class.d.ts +1 -1
  26. package/lib/shared/stylex-view-transition-class.js.flow +1 -1
  27. package/lib/shared/types/index.d.ts +14 -0
  28. package/lib/shared/utils/convert-to-className.d.ts +1 -1
  29. package/lib/shared/utils/convert-to-className.js.flow +1 -1
  30. package/lib/shared/utils/default-options.d.ts +1 -0
  31. package/lib/shared/utils/file-based-identifier.js.flow +1 -1
  32. package/lib/shared/utils/generate-css-rule.d.ts +1 -1
  33. package/lib/shared/utils/generate-css-rule.js.flow +1 -1
  34. package/lib/shared/utils/normalize-value.js.flow +1 -1
  35. package/lib/shared/utils/object-utils.d.ts +10 -8
  36. package/lib/shared/utils/object-utils.js.flow +1 -1
  37. package/lib/shared/utils/rule-utils.d.ts +2 -0
  38. package/lib/shared/utils/transform-value.d.ts +2 -0
  39. package/lib/shared/validate.js.flow +3 -1
  40. package/lib/shared/when/when.d.ts +5 -5
  41. package/lib/shared/when/when.js.flow +5 -5
  42. package/lib/utils/evaluate-path.d.ts +2 -2
  43. package/lib/utils/evaluate-path.js.flow +2 -2
  44. package/lib/utils/evaluation-errors.d.ts +15 -0
  45. package/lib/utils/state-manager.d.ts +40 -35
  46. package/lib/utils/state-manager.js.flow +4 -0
  47. package/lib/utils/validate.d.ts +18 -3
  48. package/lib/utils/validate.js.flow +5 -3
  49. package/lib/visitors/parse-stylex-create-arg.d.ts +1 -1
  50. package/lib/visitors/parse-stylex-create-arg.js.flow +1 -1
  51. package/package.json +5 -5
  52. package/lib/shared/utils/property-priorities.d.ts +0 -17
  53. package/lib/shared/utils/property-priorities.js.flow +0 -78
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- declare export default function genFileBasedIdentifier({
10
+ declare export default function genFileBasedIdentifier($$PARAM_0$$: {
11
11
  +fileName: string,
12
12
  +exportName: string,
13
13
  +key?: string,
@@ -15,5 +15,5 @@ export declare function generateCSSRule(
15
15
  pseudos: ReadonlyArray<string>,
16
16
  atRules: ReadonlyArray<string>,
17
17
  constRules: ReadonlyArray<string>,
18
- options: StyleXOptions,
18
+ options?: StyleXOptions,
19
19
  ): InjectableStyle;
@@ -15,5 +15,5 @@ declare export function generateCSSRule(
15
15
  pseudos: $ReadOnlyArray<string>,
16
16
  atRules: $ReadOnlyArray<string>,
17
17
  constRules: $ReadOnlyArray<string>,
18
- options: StyleXOptions,
18
+ options?: StyleXOptions,
19
19
  ): InjectableStyle;
@@ -12,5 +12,5 @@ import type { StyleXOptions } from '../common-types';
12
12
  declare export default function normalizeValue(
13
13
  value: string,
14
14
  key: string,
15
- StyleXOptions,
15
+ $$PARAM_2$$: StyleXOptions,
16
16
  ): string;
@@ -26,28 +26,28 @@ export declare function objValues<
26
26
  >(obj: Obj): ReadonlyArray<Obj[keyof Obj]>;
27
27
  export declare function objFromEntries<K extends string | number, V>(
28
28
  entries: ReadonlyArray<Readonly<[K, V]>>,
29
- ): { [$$Key$$: K]: V };
29
+ ): { [$$Key$$ in K]: V };
30
30
  export declare function objMapKeys<
31
31
  V,
32
32
  K1 extends string = string,
33
33
  K2 extends string = string,
34
34
  >(
35
- obj: { readonly [$$Key$$: K1]: V },
35
+ obj: { readonly [$$Key$$ in K1]: V },
36
36
  mapper: ($$PARAM_0$$: K1) => K2,
37
- ): { readonly [$$Key$$: K2]: V };
37
+ ): { readonly [$$Key$$ in K2]: V };
38
38
  export declare function objMapEntry<
39
39
  V,
40
40
  V2,
41
41
  K1 extends string = string,
42
42
  K2 extends string = string,
43
43
  >(
44
- obj: { readonly [$$Key$$: K1]: V },
44
+ obj: { readonly [$$Key$$ in K1]: V },
45
45
  mapper: ($$PARAM_0$$: Readonly<[K1, V]>) => Readonly<[K2, V2]>,
46
- ): { readonly [$$Key$$: K2]: V2 };
46
+ ): { readonly [$$Key$$ in K2]: V2 };
47
47
  export declare function objMap<V, V2, K extends string = string>(
48
- obj: { readonly [$$Key$$: K]: V },
48
+ obj: { readonly [$$Key$$ in K]: V },
49
49
  mapper: ($$PARAM_0$$: V, $$PARAM_1$$: K) => V2,
50
- ): { readonly [$$Key$$: K]: V2 };
50
+ ): { readonly [$$Key$$ in K]: V2 };
51
51
  export declare class Pipe<T> {
52
52
  value: T;
53
53
  constructor(val: T);
@@ -59,8 +59,10 @@ export declare const arraySort: <T>(
59
59
  arr: ReadonlyArray<T>,
60
60
  fn?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => number,
61
61
  ) => ReadonlyArray<T>;
62
+ export declare type arraySort = typeof arraySort;
62
63
  export declare const arrayEquals: <T>(
63
64
  arr1: ReadonlyArray<T>,
64
65
  arr2: ReadonlyArray<T>,
65
- equals: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean,
66
+ equals?: ($$PARAM_0$$: T, $$PARAM_1$$: T) => boolean,
66
67
  ) => boolean;
68
+ export declare type arrayEquals = typeof arrayEquals;
@@ -74,5 +74,5 @@ declare export const arraySort: <T>(
74
74
  declare export const arrayEquals: <T>(
75
75
  arr1: $ReadOnlyArray<T>,
76
76
  arr2: $ReadOnlyArray<T>,
77
- equals: (T, T) => boolean,
77
+ equals?: (T, T) => boolean,
78
78
  ) => boolean;
@@ -10,6 +10,8 @@
10
10
  export declare const sortPseudos: (
11
11
  pseudos: ReadonlyArray<string>,
12
12
  ) => ReadonlyArray<string>;
13
+ export declare type sortPseudos = typeof sortPseudos;
13
14
  export declare const sortAtRules: (
14
15
  atRules: ReadonlyArray<string>,
15
16
  ) => ReadonlyArray<string>;
17
+ export declare type sortAtRules = typeof sortAtRules;
@@ -19,4 +19,6 @@ declare function transformValue(
19
19
  export default transformValue;
20
20
  export declare function getNumberSuffix(key: string): string;
21
21
  export declare const timeUnits: Set<string>;
22
+ export declare type timeUnits = typeof timeUnits;
22
23
  export declare const lengthUnits: Set<string>;
24
+ export declare type lengthUnits = typeof lengthUnits;
@@ -9,4 +9,6 @@
9
9
 
10
10
  import type { TRawValue } from './common-types';
11
11
 
12
- declare export default function validateEntry([string, TRawValue]): void;
12
+ declare export default function validateEntry(
13
+ $$PARAM_0$$: [string, TRawValue],
14
+ ): void;
@@ -18,7 +18,7 @@ import type { StyleXOptions } from '../common-types';
18
18
  */
19
19
  export declare function ancestor(
20
20
  pseudo: `:${string}`,
21
- options: string | StyleXOptions,
21
+ options?: string | StyleXOptions,
22
22
  ): string;
23
23
  /**
24
24
  * Creates selector that observes if the given pseudo-class is
@@ -29,7 +29,7 @@ export declare function ancestor(
29
29
  */
30
30
  export declare function descendant(
31
31
  pseudo: `:${string}`,
32
- options: string | StyleXOptions,
32
+ options?: string | StyleXOptions,
33
33
  ): string;
34
34
  /**
35
35
  * Creates selector that observes if the given pseudo-class is
@@ -40,7 +40,7 @@ export declare function descendant(
40
40
  */
41
41
  export declare function siblingBefore(
42
42
  pseudo: `:${string}`,
43
- options: string | StyleXOptions,
43
+ options?: string | StyleXOptions,
44
44
  ): string;
45
45
  /**
46
46
  * Creates selector that observes if the given pseudo-class is
@@ -51,7 +51,7 @@ export declare function siblingBefore(
51
51
  */
52
52
  export declare function siblingAfter(
53
53
  pseudo: `:${string}`,
54
- options: string | StyleXOptions,
54
+ options?: string | StyleXOptions,
55
55
  ): string;
56
56
  /**
57
57
  * Creates selector that observes if the given pseudo-class is
@@ -62,5 +62,5 @@ export declare function siblingAfter(
62
62
  */
63
63
  export declare function anySibling(
64
64
  pseudo: `:${string}`,
65
- options: string | StyleXOptions,
65
+ options?: string | StyleXOptions,
66
66
  ): string;
@@ -19,7 +19,7 @@ import type { StyleXOptions } from '../common-types';
19
19
  */
20
20
  declare export function ancestor(
21
21
  pseudo: StringPrefix<':'>,
22
- options: string | StyleXOptions,
22
+ options?: string | StyleXOptions,
23
23
  ): string;
24
24
 
25
25
  /**
@@ -31,7 +31,7 @@ declare export function ancestor(
31
31
  */
32
32
  declare export function descendant(
33
33
  pseudo: StringPrefix<':'>,
34
- options: string | StyleXOptions,
34
+ options?: string | StyleXOptions,
35
35
  ): string;
36
36
 
37
37
  /**
@@ -43,7 +43,7 @@ declare export function descendant(
43
43
  */
44
44
  declare export function siblingBefore(
45
45
  pseudo: StringPrefix<':'>,
46
- options: string | StyleXOptions,
46
+ options?: string | StyleXOptions,
47
47
  ): string;
48
48
 
49
49
  /**
@@ -55,7 +55,7 @@ declare export function siblingBefore(
55
55
  */
56
56
  declare export function siblingAfter(
57
57
  pseudo: StringPrefix<':'>,
58
- options: string | StyleXOptions,
58
+ options?: string | StyleXOptions,
59
59
  ): string;
60
60
 
61
61
  /**
@@ -67,5 +67,5 @@ declare export function siblingAfter(
67
67
  */
68
68
  declare export function anySibling(
69
69
  pseudo: StringPrefix<':'>,
70
- options: string | StyleXOptions,
70
+ options?: string | StyleXOptions,
71
71
  ): string;
@@ -42,8 +42,8 @@ type Result =
42
42
  export declare function evaluate(
43
43
  path: NodePath,
44
44
  traversalState: StateManager,
45
- functions: FunctionConfig,
46
- seen: Map<t.Node, Result>,
45
+ functions?: FunctionConfig,
46
+ seen?: Map<t.Node, Result>,
47
47
  ): Readonly<{
48
48
  confident: boolean;
49
49
  value: any;
@@ -52,8 +52,8 @@ type Result =
52
52
  declare export function evaluate(
53
53
  path: NodePath<>,
54
54
  traversalState: StateManager,
55
- functions: FunctionConfig,
56
- seen: Map<t.Node, Result>,
55
+ functions?: FunctionConfig,
56
+ seen?: Map<t.Node, Result>,
57
57
  ): $ReadOnly<{
58
58
  confident: boolean,
59
59
  value: any,
@@ -8,15 +8,30 @@
8
8
  */
9
9
 
10
10
  export declare const IMPORT_FILE_PARSING_ERROR: any;
11
+ export declare type IMPORT_FILE_PARSING_ERROR =
12
+ typeof IMPORT_FILE_PARSING_ERROR;
11
13
  export declare const IMPORT_FILE_EVAL_ERROR: any;
14
+ export declare type IMPORT_FILE_EVAL_ERROR = typeof IMPORT_FILE_EVAL_ERROR;
12
15
  export declare const DEFAULT_IMPORT: any;
16
+ export declare type DEFAULT_IMPORT = typeof DEFAULT_IMPORT;
13
17
  export declare const PATH_WITHOUT_NODE: any;
18
+ export declare type PATH_WITHOUT_NODE = typeof PATH_WITHOUT_NODE;
14
19
  export declare const UNEXPECTED_MEMBER_LOOKUP: any;
20
+ export declare type UNEXPECTED_MEMBER_LOOKUP = typeof UNEXPECTED_MEMBER_LOOKUP;
15
21
  export declare const IMPORT_PATH_RESOLUTION_ERROR: any;
22
+ export declare type IMPORT_PATH_RESOLUTION_ERROR =
23
+ typeof IMPORT_PATH_RESOLUTION_ERROR;
16
24
  export declare const NON_CONSTANT: 'Referenced value is not a constant.\n\n';
25
+ export declare type NON_CONSTANT = typeof NON_CONSTANT;
17
26
  export declare const USED_BEFORE_DECLARATION: 'Referenced value is used before declaration.\n\n';
27
+ export declare type USED_BEFORE_DECLARATION = typeof USED_BEFORE_DECLARATION;
18
28
  export declare const UNINITIALIZED_CONST: 'Referenced constant is not initialized.\n\n';
29
+ export declare type UNINITIALIZED_CONST = typeof UNINITIALIZED_CONST;
19
30
  export declare const UNDEFINED_CONST: 'Referenced constant is not defined.';
31
+ export declare type UNDEFINED_CONST = typeof UNDEFINED_CONST;
20
32
  export declare const UNSUPPORTED_OPERATOR: (op: string) => string;
33
+ export declare type UNSUPPORTED_OPERATOR = typeof UNSUPPORTED_OPERATOR;
21
34
  export declare const OBJECT_METHOD: 'Unsupported object method.\n\n';
35
+ export declare type OBJECT_METHOD = typeof OBJECT_METHOD;
22
36
  export declare const UNSUPPORTED_EXPRESSION: (type: string) => string;
37
+ export declare type UNSUPPORTED_EXPRESSION = typeof UNSUPPORTED_EXPRESSION;
@@ -45,31 +45,32 @@ type ModuleResolution =
45
45
  export type StyleXOptions = Readonly<
46
46
  Omit<
47
47
  RuntimeOptions,
48
- keyof ({
49
- aliases?:
50
- | null
51
- | undefined
52
- | Readonly<{ [$$Key$$: string]: string | ReadonlyArray<string> }>;
53
- enableDebugClassNames?: boolean;
54
- enableDebugDataProp?: boolean;
55
- enableDevClassNames?: boolean;
56
- enableInlinedConditionalMerge?: boolean;
57
- enableMediaQueryOrder?: boolean;
58
- enableLegacyValueFlipping?: boolean;
59
- enableLogicalStylesPolyfill?: boolean;
60
- enableLTRRTLComments?: boolean;
61
- enableMinifiedKeys?: boolean;
62
- importSources: ReadonlyArray<
63
- string | Readonly<{ from: string; as: string }>
64
- >;
65
- rewriteAliases?: boolean;
66
- runtimeInjection:
67
- | boolean
68
- | (null | undefined | string)
69
- | Readonly<{ from: string; as: string }>;
70
- treeshakeCompensation?: boolean;
71
- unstable_moduleResolution?: null | undefined | ModuleResolution;
72
- })
48
+ | keyof {
49
+ aliases?:
50
+ | null
51
+ | undefined
52
+ | Readonly<{ [$$Key$$: string]: string | ReadonlyArray<string> }>;
53
+ enableDebugClassNames?: boolean;
54
+ enableDebugDataProp?: boolean;
55
+ enableDevClassNames?: boolean;
56
+ enableInlinedConditionalMerge?: boolean;
57
+ enableMediaQueryOrder?: boolean;
58
+ enableLegacyValueFlipping?: boolean;
59
+ enableLogicalStylesPolyfill?: boolean;
60
+ enableLTRRTLComments?: boolean;
61
+ enableMinifiedKeys?: boolean;
62
+ importSources: ReadonlyArray<
63
+ string | Readonly<{ from: string; as: string }>
64
+ >;
65
+ rewriteAliases?: boolean;
66
+ runtimeInjection:
67
+ | boolean
68
+ | (null | undefined | string)
69
+ | Readonly<{ from: string; as: string }>;
70
+ treeshakeCompensation?: boolean;
71
+ unstable_moduleResolution?: null | undefined | ModuleResolution;
72
+ debugFilePath?: (filePath: string) => string;
73
+ }
73
74
  > & {
74
75
  aliases?:
75
76
  | null
@@ -94,21 +95,22 @@ export type StyleXOptions = Readonly<
94
95
  | Readonly<{ from: string; as: string }>;
95
96
  treeshakeCompensation?: boolean;
96
97
  unstable_moduleResolution?: null | undefined | ModuleResolution;
98
+ debugFilePath?: (filePath: string) => string;
97
99
  }
98
100
  >;
99
101
  type StyleXStateOptions = Readonly<
100
102
  Omit<
101
103
  StyleXOptions,
102
- keyof ({
103
- runtimeInjection:
104
- | (null | undefined | string)
105
- | Readonly<{ from: string; as: null | undefined | string }>;
106
- aliases?:
107
- | null
108
- | undefined
109
- | Readonly<{ [$$Key$$: string]: ReadonlyArray<string> }>;
110
- rewriteAliases: boolean;
111
- })
104
+ | keyof {
105
+ runtimeInjection:
106
+ | (null | undefined | string)
107
+ | Readonly<{ from: string; as: null | undefined | string }>;
108
+ aliases?:
109
+ | null
110
+ | undefined
111
+ | Readonly<{ [$$Key$$: string]: ReadonlyArray<string> }>;
112
+ rewriteAliases: boolean;
113
+ }
112
114
  > & {
113
115
  runtimeInjection:
114
116
  | (null | undefined | string)
@@ -218,8 +220,11 @@ export declare const filePathResolver: (
218
220
  sourceFilePath: string,
219
221
  aliases: StyleXStateOptions['aliases'],
220
222
  ) => null | undefined | string;
223
+ export declare type filePathResolver = typeof filePathResolver;
221
224
  export declare const EXTENSIONS: any;
225
+ export declare type EXTENSIONS = typeof EXTENSIONS;
222
226
  export declare const matchesFileSuffix: (
223
227
  $$PARAM_0$$: string,
224
228
  ) => ($$PARAM_0$$: string) => boolean;
229
+ export declare type matchesFileSuffix = typeof matchesFileSuffix;
225
230
  export declare function getRelativePath(from: string, to: string): string;
@@ -63,6 +63,7 @@ export type StyleXOptions = $ReadOnly<{
63
63
  runtimeInjection: boolean | ?string | $ReadOnly<{ from: string, as: string }>,
64
64
  treeshakeCompensation?: boolean,
65
65
  unstable_moduleResolution?: ?ModuleResolution,
66
+ debugFilePath?: (filePath: string) => string,
66
67
  ...
67
68
  }>;
68
69
 
@@ -76,6 +77,7 @@ type StyleXStateOptions = $ReadOnly<{
76
77
 
77
78
  declare export default class StateManager {
78
79
  +_state: PluginPass;
80
+ // Imports
79
81
  +importPaths: Set<string>;
80
82
  +stylexImport: Set<string>;
81
83
  +stylexPropsImport: Set<string>;
@@ -94,8 +96,10 @@ declare export default class StateManager {
94
96
  +stylexDefaultMarkerImport: Set<string>;
95
97
  +stylexWhenImport: Set<string>;
96
98
  injectImportInserted: ?t.Identifier;
99
+ // `stylex.create` calls
97
100
  +styleMap: Map<string, CompiledNamespaces>;
98
101
  +styleVars: Map<string, NodePath<>>;
102
+ // results of `stylex.create` calls that should be kept
99
103
  +styleVarsToKeep: Set<[string, true | string, true | Array<string>]>;
100
104
  inStyleXCreate: boolean;
101
105
  +options: StyleXStateOptions;
@@ -19,18 +19,27 @@ export type InferCheckType<T> =
19
19
  type Msg = (value: unknown, name?: string) => string;
20
20
  type PrimitiveChecker<T> = (message?: Msg) => Check<T>;
21
21
  export declare const string: PrimitiveChecker<string>;
22
+ export declare type string = typeof string;
22
23
  export declare const nullish: PrimitiveChecker<null | void>;
24
+ export declare type nullish = typeof nullish;
25
+ export declare const optional: <T>($$PARAM_0$$: Check<T>) => Check<void | T>;
26
+ export declare type optional = typeof optional;
23
27
  export declare const boolean: PrimitiveChecker<boolean>;
28
+ export declare type boolean = typeof boolean;
24
29
  export declare const number: PrimitiveChecker<number>;
30
+ export declare type number = typeof number;
25
31
  export declare const func: <T extends Function>(msg?: Msg) => Check<T>;
32
+ export declare type func = typeof func;
26
33
  export declare const literal: <T extends string | number | boolean>(
27
34
  $$PARAM_0$$: T,
28
35
  msg?: Msg,
29
36
  ) => Check<T>;
37
+ export declare type literal = typeof literal;
30
38
  export declare const array: <T>(
31
39
  $$PARAM_0$$: Check<T>,
32
40
  msg?: Msg,
33
41
  ) => Check<ReadonlyArray<T>>;
42
+ export declare type array = typeof array;
34
43
  type ObjOfChecks<T extends { readonly [$$Key$$: string]: Check<unknown> }> =
35
44
  Readonly<{ [K in keyof T]: InferCheckType<T[K]> }>;
36
45
  export declare const object: <
@@ -39,31 +48,37 @@ export declare const object: <
39
48
  $$PARAM_0$$: T,
40
49
  msg?: Msg,
41
50
  ) => Check<ObjOfChecks<T>>;
51
+ export declare type object = typeof object;
42
52
  export declare const objectOf: <T>(
43
53
  $$PARAM_0$$: Check<T>,
44
54
  message?: Msg,
45
55
  ) => Check<{ readonly [$$Key$$: string]: T }>;
56
+ export declare type objectOf = typeof objectOf;
46
57
  export declare const unionOf: <A, B>(
47
58
  a: Check<A>,
48
59
  b: Check<B>,
49
- message: Msg,
60
+ message?: Msg,
50
61
  ) => Check<A | B>;
62
+ export declare type unionOf = typeof unionOf;
51
63
  export declare const unionOf3: <A, B, C>(
52
64
  a: Check<A>,
53
65
  b: Check<B>,
54
66
  c: Check<C>,
55
- message: Msg,
67
+ message?: Msg,
56
68
  ) => Check<A | B | C>;
69
+ export declare type unionOf3 = typeof unionOf3;
57
70
  export declare const unionOf4: <A, B, C, D>(
58
71
  a: Check<A>,
59
72
  b: Check<B>,
60
73
  c: Check<C>,
61
74
  d: Check<D>,
62
- message: Msg,
75
+ message?: Msg,
63
76
  ) => Check<A | B | C | D>;
77
+ export declare type unionOf4 = typeof unionOf4;
64
78
  export declare const logAndDefault: <T>(
65
79
  check: Check<T>,
66
80
  value: unknown,
67
81
  def: T,
68
82
  name?: string,
69
83
  ) => T;
84
+ export declare type logAndDefault = typeof logAndDefault;
@@ -17,6 +17,8 @@ declare export const string: PrimitiveChecker<string>;
17
17
 
18
18
  declare export const nullish: PrimitiveChecker<null | void>;
19
19
 
20
+ declare export const optional: <T>(Check<T>) => Check<void | T>;
21
+
20
22
  declare export const boolean: PrimitiveChecker<boolean>;
21
23
 
22
24
  declare export const number: PrimitiveChecker<number>;
@@ -50,14 +52,14 @@ declare export const objectOf: <T>(
50
52
  declare export const unionOf: <A, B>(
51
53
  a: Check<A>,
52
54
  b: Check<B>,
53
- message: Msg,
55
+ message?: Msg,
54
56
  ) => Check<A | B>;
55
57
 
56
58
  declare export const unionOf3: <A, B, C>(
57
59
  a: Check<A>,
58
60
  b: Check<B>,
59
61
  c: Check<C>,
60
- message: Msg,
62
+ message?: Msg,
61
63
  ) => Check<A | B | C>;
62
64
 
63
65
  declare export const unionOf4: <A, B, C, D>(
@@ -65,7 +67,7 @@ declare export const unionOf4: <A, B, C, D>(
65
67
  b: Check<B>,
66
68
  c: Check<C>,
67
69
  d: Check<D>,
68
- message: Msg,
70
+ message?: Msg,
69
71
  ) => Check<A | B | C | D>;
70
72
 
71
73
  declare export const logAndDefault: <T>(
@@ -27,7 +27,7 @@ type DynamicFns = {
27
27
  export declare function evaluateStyleXCreateArg(
28
28
  path: NodePath,
29
29
  traversalState: StateManager,
30
- functions: FunctionConfig,
30
+ functions?: FunctionConfig,
31
31
  ): Readonly<{
32
32
  confident: boolean;
33
33
  value: any;
@@ -32,7 +32,7 @@ type DynamicFns = {
32
32
  declare export function evaluateStyleXCreateArg(
33
33
  path: NodePath<>,
34
34
  traversalState: StateManager,
35
- functions: FunctionConfig,
35
+ functions?: FunctionConfig,
36
36
  ): $ReadOnly<{
37
37
  confident: boolean,
38
38
  value: any,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -21,8 +21,8 @@
21
21
  "@babel/traverse": "^7.26.8",
22
22
  "@babel/types": "^7.26.8",
23
23
  "@dual-bundle/import-meta-resolve": "^4.1.0",
24
- "@stylexjs/shared": "0.17.0",
25
- "@stylexjs/stylex": "0.17.0",
24
+ "@stylexjs/shared": "0.17.2",
25
+ "@stylexjs/stylex": "0.17.2",
26
26
  "postcss-value-parser": "^4.1.0"
27
27
  },
28
28
  "devDependencies": {
@@ -32,9 +32,9 @@
32
32
  "@rollup/plugin-json": "^6.1.0",
33
33
  "@rollup/plugin-node-resolve": "^15.3.0",
34
34
  "@rollup/plugin-replace": "^6.0.1",
35
- "babel-plugin-syntax-hermes-parser": "^0.26.0",
35
+ "babel-plugin-syntax-hermes-parser": "^0.32.1",
36
36
  "rollup": "^4.24.0",
37
- "scripts": "0.17.0"
37
+ "scripts": "0.17.2"
38
38
  },
39
39
  "files": [
40
40
  "flow_modules/*",
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- *
8
- */
9
-
10
- export declare const PSEUDO_CLASS_PRIORITIES: Readonly<{
11
- [$$Key$$: string]: number;
12
- }>;
13
- type AtRulePriorities = { '@supports': 30; '@media': 200; '@container': 300 };
14
- export declare const AT_RULE_PRIORITIES: Readonly<AtRulePriorities>;
15
- export declare const PSEUDO_ELEMENT_PRIORITY: number;
16
- declare function getPriority(key: string): number;
17
- export default getPriority;
@@ -1,78 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict
8
- */
9
-
10
- // type PseudoClassPriorities = {
11
- // ':is': 40,
12
- // ':where': 40,
13
- // ':not': 40,
14
- // ':has': 45,
15
- // ':dir': 50,
16
- // ':lang': 51,
17
- // ':first-child': 52,
18
- // ':first-of-type': 53,
19
- // ':last-child': 54,
20
- // ':last-of-type': 55,
21
- // ':only-child': 56,
22
- // ':only-of-type': 57,
23
- // ':nth-child': 60,
24
- // ':nth-last-child': 61,
25
- // ':nth-of-type': 62,
26
- // ':nth-last-of-type': 63, // 'nth-last-of-type' is the same priority as 'nth-of-type
27
- // ':empty': 70,
28
- // ':link': 80,
29
- // ':any-link': 81,
30
- // ':local-link': 82,
31
- // ':target-within': 83,
32
- // ':target': 84,
33
- // ':visited': 85,
34
- // ':enabled': 91,
35
- // ':disabled': 92,
36
- // ':required': 93,
37
- // ':optional': 94,
38
- // ':read-only': 95,
39
- // ':read-write': 96,
40
- // ':placeholder-shown': 97,
41
- // ':in-range': 98,
42
- // ':out-of-range': 99,
43
- // ':default': 100,
44
- // ':checked': 101,
45
- // ':indeterminate': 101,
46
- // ':blank': 102,
47
- // ':valid': 103,
48
- // ':invalid': 104,
49
- // ':user-invalid': 105,
50
- // ':autofill': 110,
51
- // ':picture-in-picture': 120,
52
- // ':modal': 121,
53
- // ':fullscreen': 122,
54
- // ':paused': 123,
55
- // ':playing': 124,
56
- // ':current': 125,
57
- // ':past': 126,
58
- // ':future': 127,
59
- // ':hover': 130,
60
- // ':focusWithin': 140,
61
- // ':focus': 150,
62
- // ':focusVisible': 160,
63
- // ':active': 170,
64
- // };
65
-
66
- declare export const PSEUDO_CLASS_PRIORITIES: $ReadOnly<{ [string]: number }>;
67
-
68
- type AtRulePriorities = {
69
- '@supports': 30,
70
- '@media': 200,
71
- '@container': 300,
72
- };
73
-
74
- declare export const AT_RULE_PRIORITIES: $ReadOnly<AtRulePriorities>;
75
-
76
- declare export const PSEUDO_ELEMENT_PRIORITY: number;
77
-
78
- declare export default function getPriority(key: string): number;