@stylexjs/babel-plugin 0.16.2 → 0.17.0

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 (45) hide show
  1. package/lib/index.d.ts +5 -5
  2. package/lib/index.js +893 -1775
  3. package/lib/index.js.flow +2 -1
  4. package/lib/shared/common-types.d.ts +3 -4
  5. package/lib/shared/index.d.ts +1 -1
  6. package/lib/shared/index.js.flow +1 -1
  7. package/lib/shared/preprocess-rules/legacy-expand-shorthands.d.ts +4 -0
  8. package/lib/shared/preprocess-rules/legacy-expand-shorthands.js.flow +5 -0
  9. package/lib/shared/stylex-create-theme.d.ts +1 -1
  10. package/lib/shared/stylex-define-vars.d.ts +3 -3
  11. package/lib/shared/types/index.js.flow +12 -12
  12. package/lib/shared/utils/object-utils.js.flow +1 -1
  13. package/lib/shared/when/when.d.ts +5 -5
  14. package/lib/shared/when/when.js.flow +5 -5
  15. package/lib/utils/add-sourcemap-data.js.flow +2 -2
  16. package/lib/utils/ast-helpers.js.flow +3 -3
  17. package/lib/utils/evaluate-path.d.ts +1 -0
  18. package/lib/utils/evaluate-path.js.flow +3 -2
  19. package/lib/utils/js-to-ast.d.ts +0 -4
  20. package/lib/utils/js-to-ast.js.flow +1 -7
  21. package/lib/utils/state-manager.d.ts +37 -19
  22. package/lib/utils/state-manager.js.flow +37 -22
  23. package/lib/utils/validate.d.ts +1 -0
  24. package/lib/utils/validate.js.flow +2 -0
  25. package/lib/visitors/imports.js.flow +2 -2
  26. package/lib/visitors/parse-stylex-create-arg.js.flow +2 -2
  27. package/lib/visitors/stylex-create-theme.js.flow +2 -2
  28. package/lib/visitors/stylex-create.js.flow +2 -2
  29. package/lib/visitors/stylex-default-marker.js.flow +2 -2
  30. package/lib/visitors/stylex-define-consts.js.flow +2 -2
  31. package/lib/visitors/stylex-define-marker.d.ts +22 -0
  32. package/lib/visitors/stylex-define-marker.js.flow +22 -0
  33. package/lib/visitors/stylex-define-vars.js.flow +2 -2
  34. package/lib/visitors/stylex-keyframes.js.flow +2 -2
  35. package/lib/visitors/stylex-merge.js.flow +2 -2
  36. package/lib/visitors/stylex-position-try.js.flow +2 -2
  37. package/lib/visitors/stylex-props.js.flow +2 -2
  38. package/lib/visitors/stylex-view-transition-class.js.flow +2 -2
  39. package/package.json +4 -3
  40. package/flow_modules/@babel/core/index.js.flow +0 -854
  41. package/flow_modules/@babel/generator/index.js.flow +0 -216
  42. package/flow_modules/@babel/helper-module-imports/index.js.flow +0 -182
  43. package/flow_modules/@babel/parser/index.js.flow +0 -253
  44. package/flow_modules/@babel/traverse/index.js.flow +0 -1007
  45. package/flow_modules/@babel/types/index.js.flow +0 -5225
package/lib/index.js.flow CHANGED
@@ -7,7 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { PluginObj } from '../flow_modules/@babel/core';
10
+ import type { PluginObj } from '@babel/core';
11
11
  import type { StyleXOptions } from './utils/state-manager';
12
12
 
13
13
  export type Options = StyleXOptions;
@@ -45,6 +45,7 @@ export type Rule = [
45
45
  },
46
46
  number,
47
47
  ];
48
+
48
49
  declare function processStylexRules(
49
50
  rules: Array<Rule>,
50
51
  config?:
@@ -33,10 +33,9 @@ export type CompiledStyles = Readonly<{
33
33
  | string
34
34
  | Readonly<{ [$$Key$$: string]: null | string }>;
35
35
  }>;
36
- export type FlatCompiledStyles = Readonly<{
37
- [$$Key$$: string]: string | null;
38
- $$css: true | string;
39
- }>;
36
+ export type FlatCompiledStyles = Readonly<
37
+ { [$$Key$$: string]: string | null } & { $$css: true | string }
38
+ >;
40
39
  export type StyleXOptions = Readonly<{
41
40
  classNamePrefix: string;
42
41
  debug: null | undefined | boolean;
@@ -34,7 +34,7 @@ import {
34
34
  PSEUDO_CLASS_PRIORITIES as _PSEUDO_CLASS_PRIORITIES,
35
35
  AT_RULE_PRIORITIES as _AT_RULE_PRIORITIES,
36
36
  PSEUDO_ELEMENT_PRIORITY as _PSEUDO_ELEMENT_PRIORITY,
37
- } from './utils/property-priorities';
37
+ } from '@stylexjs/shared';
38
38
  export * as types from './types';
39
39
  export * as when from './when/when';
40
40
  export declare const create: typeof styleXCreateSet;
@@ -41,7 +41,7 @@ import {
41
41
  PSEUDO_CLASS_PRIORITIES as _PSEUDO_CLASS_PRIORITIES,
42
42
  AT_RULE_PRIORITIES as _AT_RULE_PRIORITIES,
43
43
  PSEUDO_ELEMENT_PRIORITY as _PSEUDO_ELEMENT_PRIORITY,
44
- } from './utils/property-priorities';
44
+ } from '@stylexjs/shared';
45
45
 
46
46
  export * as types from './types';
47
47
  export * as when from './when/when';
@@ -8,6 +8,8 @@
8
8
  */
9
9
 
10
10
  import type { TStyleValue } from '../common-types';
11
+ export declare const LOGICAL_FLOAT_START_VAR: '--stylex-logical-start';
12
+ export declare const LOGICAL_FLOAT_END_VAR: '--stylex-logical-end';
11
13
  /**
12
14
  * Shorthand properties:
13
15
  * - [x] all - Should be banned
@@ -150,6 +152,8 @@ declare const aliases: {
150
152
  paddingInline: any;
151
153
  scrollMarginBlockStart: (value: TStyleValue) => TReturn;
152
154
  scrollMarginBlockEnd: (value: TStyleValue) => TReturn;
155
+ float: (value: TStyleValue) => TReturn;
156
+ clear: (value: TStyleValue) => TReturn;
153
157
  };
154
158
  declare const expansions: Omit<shorthands, keyof (aliases | {})> &
155
159
  Omit<aliases, keyof ({})> & {};
@@ -9,6 +9,9 @@
9
9
 
10
10
  import type { TStyleValue } from '../common-types';
11
11
 
12
+ declare export const LOGICAL_FLOAT_START_VAR: '--stylex-logical-start';
13
+ declare export const LOGICAL_FLOAT_END_VAR: '--stylex-logical-end';
14
+
12
15
  // TODO: to be added later.
13
16
  // const aliases = {
14
17
  // marginInlineStart: (rawValue) => [['marginStart', rawValue]],
@@ -129,6 +132,8 @@ declare const aliases: {
129
132
  paddingInline: $FlowFixMe,
130
133
  scrollMarginBlockStart: (value: TStyleValue) => TReturn,
131
134
  scrollMarginBlockEnd: (value: TStyleValue) => TReturn,
135
+ float: (value: TStyleValue) => TReturn,
136
+ clear: (value: TStyleValue) => TReturn,
132
137
  };
133
138
 
134
139
  declare const expansions: { ...shorthands, ...aliases };
@@ -20,7 +20,7 @@ declare function styleXCreateTheme(
20
20
  },
21
21
  options?: StyleXOptions,
22
22
  ): [
23
- { $$css: true; readonly [$$Key$$: string]: string },
23
+ { $$css: true } & { readonly [$$Key$$: string]: string },
24
24
  { [$$Key$$: string]: InjectableStyle },
25
25
  ];
26
26
  export default styleXCreateTheme;
@@ -10,17 +10,17 @@
10
10
  import type { InjectableStyle, StyleXOptions } from './common-types';
11
11
  import type { VarsConfig } from './stylex-vars-utils';
12
12
  type VarsKeysWithStringValues<Vars extends VarsConfig> = Readonly<{
13
- [$$Key$$: keyof Vars]: string;
13
+ [$$Key$$ in keyof Vars]: string;
14
14
  }>;
15
15
  type VarsObject<Vars extends VarsConfig> = Readonly<
16
- Omit<VarsKeysWithStringValues<Vars>, keyof ({ __varGroupHash__: string })> & {
16
+ Omit<VarsKeysWithStringValues<Vars>, keyof { __varGroupHash__: string }> & {
17
17
  __varGroupHash__: string;
18
18
  }
19
19
  >;
20
20
  declare function styleXDefineVars<Vars extends VarsConfig>(
21
21
  variables: Vars,
22
22
  options: Readonly<
23
- Omit<Partial<StyleXOptions>, keyof ({ exportId: string })> & {
23
+ Omit<Partial<StyleXOptions>, keyof { exportId: string }> & {
24
24
  exportId: string;
25
25
  }
26
26
  >,
@@ -65,7 +65,7 @@ export interface CSSType<+_T: string | number = string | number> {
65
65
 
66
66
  declare export const isCSSType: (
67
67
  value: mixed,
68
- ) => value is CSSType<string | number>;
68
+ ) => implies value is CSSType<string | number>;
69
69
 
70
70
  type AngleValue = string;
71
71
  declare export class Angle<+T: AngleValue>
@@ -79,7 +79,7 @@ declare export class Angle<+T: AngleValue>
79
79
  }
80
80
  declare export const angle: <T: AngleValue = AngleValue>(
81
81
  value: ValueWithDefault,
82
- // $FlowIgnore[method-unbinding]
82
+ // $FlowFixMe[method-unbinding]
83
83
  ) => Angle<T>;
84
84
 
85
85
  type ColorValue = string;
@@ -93,7 +93,7 @@ declare export class Color<+T: ColorValue>
93
93
  }
94
94
  declare export const color: <T: ColorValue = ColorValue>(
95
95
  value: ValueWithDefault,
96
- // $FlowIgnore[method-unbinding]
96
+ // $FlowFixMe[method-unbinding]
97
97
  ) => Color<T>;
98
98
 
99
99
  type URLValue = string;
@@ -123,7 +123,7 @@ declare export class Image<+T: ImageValue>
123
123
  }
124
124
  declare export const image: <T: ImageValue = ImageValue>(
125
125
  value: ValueWithDefault,
126
- // $FlowIgnore[method-unbinding]
126
+ // $FlowFixMe[method-unbinding]
127
127
  ) => Image<T>;
128
128
 
129
129
  type IntegerValue = number;
@@ -157,7 +157,7 @@ declare export class LengthPercentage<+_T: LengthPercentageValue>
157
157
  }
158
158
  declare export const lengthPercentage: <_T: LengthPercentageValue | number>(
159
159
  value: ValueWithDefault,
160
- // $FlowIgnore[method-unbinding]
160
+ // $FlowFixMe[method-unbinding]
161
161
  ) => LengthPercentage<string>;
162
162
 
163
163
  type LengthValue = number | string;
@@ -174,7 +174,7 @@ declare export class Length<+_T: LengthValue>
174
174
  }
175
175
  declare export const length: <T: LengthValue = LengthValue>(
176
176
  value: NestedWithNumbers,
177
- // $FlowIgnore[method-unbinding]
177
+ // $FlowFixMe[method-unbinding]
178
178
  ) => Length<T>;
179
179
 
180
180
  type PercentageValue = string | number;
@@ -191,7 +191,7 @@ declare export class Percentage<+_T: PercentageValue>
191
191
  }
192
192
  declare export const percentage: <T: PercentageValue = PercentageValue>(
193
193
  value: NestedWithNumbers,
194
- // $FlowIgnore[method-unbinding]
194
+ // $FlowFixMe[method-unbinding]
195
195
  ) => Percentage<T>;
196
196
 
197
197
  type NumberValue = number;
@@ -206,7 +206,7 @@ declare export class Num<+T: NumberValue>
206
206
  }
207
207
  declare export const number: <T: NumberValue = NumberValue>(
208
208
  value: NestedWithNumbers,
209
- // $FlowIgnore[method-unbinding]
209
+ // $FlowFixMe[method-unbinding]
210
210
  ) => Num<T>;
211
211
 
212
212
  type ResolutionValue = string | 0;
@@ -223,7 +223,7 @@ declare export class Resolution<+T: ResolutionValue>
223
223
  }
224
224
  declare export const resolution: <T: ResolutionValue = ResolutionValue>(
225
225
  value: ValueWithDefault,
226
- // $FlowIgnore[method-unbinding]
226
+ // $FlowFixMe[method-unbinding]
227
227
  ) => Resolution<T>;
228
228
 
229
229
  type TimeValue = string | 0;
@@ -238,7 +238,7 @@ declare export class Time<+T: TimeValue>
238
238
  }
239
239
  declare export const time: <T: TimeValue = TimeValue>(
240
240
  value: ValueWithDefault,
241
- // $FlowIgnore[method-unbinding]
241
+ // $FlowFixMe[method-unbinding]
242
242
  ) => Time<T>;
243
243
 
244
244
  type TransformFunctionValue = string;
@@ -257,7 +257,7 @@ declare export const transformFunction: <
257
257
  T: TransformFunctionValue = TransformFunctionValue,
258
258
  >(
259
259
  value: ValueWithDefault,
260
- // $FlowIgnore[method-unbinding]
260
+ // $FlowFixMe[method-unbinding]
261
261
  ) => TransformFunction<T>;
262
262
 
263
263
  type TransformListValue = string;
@@ -276,5 +276,5 @@ declare export const transformList: <
276
276
  T: TransformListValue = TransformListValue,
277
277
  >(
278
278
  value: ValueWithDefault,
279
- // $FlowIgnore[method-unbinding]
279
+ // $FlowFixMe[method-unbinding]
280
280
  ) => TransformList<T>;
@@ -14,7 +14,7 @@ import type { CompiledStyles } from '../common-types';
14
14
  // eslint-disable-next-line no-unused-vars
15
15
  type AnyObject = { +[string]: mixed };
16
16
 
17
- declare export function isPlainObject(obj: mixed): obj is AnyObject;
17
+ declare export function isPlainObject(obj: mixed): implies obj is AnyObject;
18
18
 
19
19
  declare export function flattenObject(obj: CompiledStyles): {
20
20
  +[string]: null | string,
@@ -17,7 +17,7 @@ import type { StyleXOptions } from '../common-types';
17
17
  * @returns A :where() clause for the ancestor observer
18
18
  */
19
19
  export declare function ancestor(
20
- pseudo: string,
20
+ pseudo: `:${string}`,
21
21
  options: string | StyleXOptions,
22
22
  ): string;
23
23
  /**
@@ -28,7 +28,7 @@ export declare function ancestor(
28
28
  * @returns A :has() clause for the descendant observer
29
29
  */
30
30
  export declare function descendant(
31
- pseudo: string,
31
+ pseudo: `:${string}`,
32
32
  options: string | StyleXOptions,
33
33
  ): string;
34
34
  /**
@@ -39,7 +39,7 @@ export declare function descendant(
39
39
  * @returns A :where() clause for the previous sibling observer
40
40
  */
41
41
  export declare function siblingBefore(
42
- pseudo: string,
42
+ pseudo: `:${string}`,
43
43
  options: string | StyleXOptions,
44
44
  ): string;
45
45
  /**
@@ -50,7 +50,7 @@ export declare function siblingBefore(
50
50
  * @returns A :has() clause for the next sibling observer
51
51
  */
52
52
  export declare function siblingAfter(
53
- pseudo: string,
53
+ pseudo: `:${string}`,
54
54
  options: string | StyleXOptions,
55
55
  ): string;
56
56
  /**
@@ -61,6 +61,6 @@ export declare function siblingAfter(
61
61
  * @returns A :where() clause for the any sibling observer
62
62
  */
63
63
  export declare function anySibling(
64
- pseudo: string,
64
+ pseudo: `:${string}`,
65
65
  options: string | StyleXOptions,
66
66
  ): string;
@@ -18,7 +18,7 @@ import type { StyleXOptions } from '../common-types';
18
18
  * @returns A :where() clause for the ancestor observer
19
19
  */
20
20
  declare export function ancestor(
21
- pseudo: string,
21
+ pseudo: StringPrefix<':'>,
22
22
  options: string | StyleXOptions,
23
23
  ): string;
24
24
 
@@ -30,7 +30,7 @@ declare export function ancestor(
30
30
  * @returns A :has() clause for the descendant observer
31
31
  */
32
32
  declare export function descendant(
33
- pseudo: string,
33
+ pseudo: StringPrefix<':'>,
34
34
  options: string | StyleXOptions,
35
35
  ): string;
36
36
 
@@ -42,7 +42,7 @@ declare export function descendant(
42
42
  * @returns A :where() clause for the previous sibling observer
43
43
  */
44
44
  declare export function siblingBefore(
45
- pseudo: string,
45
+ pseudo: StringPrefix<':'>,
46
46
  options: string | StyleXOptions,
47
47
  ): string;
48
48
 
@@ -54,7 +54,7 @@ declare export function siblingBefore(
54
54
  * @returns A :has() clause for the next sibling observer
55
55
  */
56
56
  declare export function siblingAfter(
57
- pseudo: string,
57
+ pseudo: StringPrefix<':'>,
58
58
  options: string | StyleXOptions,
59
59
  ): string;
60
60
 
@@ -66,6 +66,6 @@ declare export function siblingAfter(
66
66
  * @returns A :where() clause for the any sibling observer
67
67
  */
68
68
  declare export function anySibling(
69
- pseudo: string,
69
+ pseudo: StringPrefix<':'>,
70
70
  options: string | StyleXOptions,
71
71
  ): string;
@@ -7,10 +7,10 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { NodePath } from '@babel/traverse';
11
11
  import type { CompiledNamespaces } from '../shared';
12
12
 
13
- import * as t from '../../flow_modules/@babel/types';
13
+ import * as t from '@babel/types';
14
14
  import StateManager from './state-manager';
15
15
 
16
16
  /**
@@ -7,14 +7,14 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { ImportOptions } from '../../flow_modules/@babel/helper-module-imports';
11
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { ImportOptions } from '@babel/helper-module-imports';
11
+ import type { NodePath } from '@babel/traverse';
12
12
  type ImportAdditionOptions = Omit<
13
13
  Partial<ImportOptions>,
14
14
  'ensureLiveReference' | 'ensureNoContext',
15
15
  >;
16
16
 
17
- import * as t from '../../flow_modules/@babel/types';
17
+ import * as t from '@babel/types';
18
18
 
19
19
  declare export function hoistExpression(
20
20
  path: NodePath<>,
@@ -34,6 +34,7 @@ export type FunctionConfig = {
34
34
  };
35
35
  };
36
36
  };
37
+ disableImports?: boolean;
37
38
  };
38
39
  type Result =
39
40
  | { resolved: true; value: any }
@@ -21,9 +21,9 @@
21
21
  * - It can handle object spreads when the spread value itself is statically evaluated.
22
22
  */
23
23
 
24
- import type { NodePath } from '../../flow_modules/@babel/traverse';
24
+ import type { NodePath } from '@babel/traverse';
25
25
 
26
- import * as t from '../../flow_modules/@babel/types';
26
+ import * as t from '@babel/types';
27
27
  import StateManager from './state-manager';
28
28
  export type FunctionConfig = {
29
29
  identifiers: {
@@ -37,6 +37,7 @@ export type FunctionConfig = {
37
37
  },
38
38
  },
39
39
  },
40
+ disableImports?: boolean,
40
41
  };
41
42
 
42
43
  type Result =
@@ -7,7 +7,6 @@
7
7
  *
8
8
  */
9
9
 
10
- import type { FlatCompiledStyles } from '../shared/common-types';
11
10
  import * as t from '@babel/types';
12
11
  type NestedStringObject = Readonly<{
13
12
  [key: string]: string | number | null | boolean | NestedStringObject;
@@ -15,6 +14,3 @@ type NestedStringObject = Readonly<{
15
14
  export declare function convertObjectToAST(
16
15
  obj: NestedStringObject,
17
16
  ): t.ObjectExpression;
18
- export declare function removeObjectsWithSpreads(obj: {
19
- readonly [$$Key$$: string]: FlatCompiledStyles;
20
- }): { readonly [$$Key$$: string]: FlatCompiledStyles };
@@ -7,9 +7,7 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { FlatCompiledStyles } from '../shared/common-types';
11
-
12
- import * as t from '../../flow_modules/@babel/types';
10
+ import * as t from '@babel/types';
13
11
 
14
12
  type NestedStringObject = $ReadOnly<{
15
13
  [key: string]: string | number | null | boolean | NestedStringObject,
@@ -18,7 +16,3 @@ type NestedStringObject = $ReadOnly<{
18
16
  declare export function convertObjectToAST(
19
17
  obj: NestedStringObject,
20
18
  ): t.ObjectExpression;
21
-
22
- declare export function removeObjectsWithSpreads(obj: {
23
- +[string]: FlatCompiledStyles,
24
- }): { +[string]: FlatCompiledStyles };
@@ -28,6 +28,19 @@ type ModuleResolution =
28
28
  type: 'experimental_crossFileParsing';
29
29
  rootDir?: string;
30
30
  themeFileExtension?: null | undefined | string;
31
+ }>
32
+ | Readonly<{
33
+ type: 'custom';
34
+ themeFileExtension?: null | undefined | string;
35
+ filePathResolver: (
36
+ importPath: string,
37
+ sourceFilePath: string,
38
+ aliases:
39
+ | null
40
+ | undefined
41
+ | Readonly<{ [$$Key$$: string]: ReadonlyArray<string> }>,
42
+ ) => string | void;
43
+ getCanonicalFilePath: (filePath: string) => string;
31
44
  }>;
32
45
  export type StyleXOptions = Readonly<
33
46
  Omit<
@@ -119,6 +132,7 @@ declare class StateManager {
119
132
  readonly stylexKeyframesImport: Set<string>;
120
133
  readonly stylexPositionTryImport: Set<string>;
121
134
  readonly stylexDefineVarsImport: Set<string>;
135
+ readonly stylexDefineMarkerImport: Set<string>;
122
136
  readonly stylexDefineConstsImport: Set<string>;
123
137
  readonly stylexCreateThemeImport: Set<string>;
124
138
  readonly stylexTypesImport: Set<string>;
@@ -158,36 +172,40 @@ declare class StateManager {
158
172
  getCanonicalFilePath(filePath: string): string;
159
173
  importPathResolver(importPath: string): ImportPathResolution;
160
174
  addStyle(
161
- style: [
162
- string,
163
- (
164
- | { ltr: string; rtl?: string | null }
165
- | {
166
- constKey: string;
167
- constVal: string | number;
168
- rtl?: string | null;
169
- ltr: string;
170
- }
171
- ),
172
- number,
173
- ],
174
- ): void;
175
- registerStyles(
176
- styles: ReadonlyArray<
175
+ style: Readonly<
177
176
  [
178
177
  string,
179
178
  (
180
- | { ltr: string; rtl?: string | null }
181
- | {
179
+ | Readonly<{ ltr: string; rtl?: string | null }>
180
+ | Readonly<{
182
181
  constKey: string;
183
182
  constVal: string | number;
184
183
  rtl?: string | null;
185
184
  ltr: string;
186
- }
185
+ }>
187
186
  ),
188
187
  number,
189
188
  ]
190
189
  >,
190
+ ): void;
191
+ registerStyles(
192
+ styles: ReadonlyArray<
193
+ Readonly<
194
+ [
195
+ string,
196
+ (
197
+ | Readonly<{ ltr: string; rtl?: string | null }>
198
+ | Readonly<{
199
+ constKey: string;
200
+ constVal: string | number;
201
+ rtl?: string | null;
202
+ ltr: string;
203
+ }>
204
+ ),
205
+ number,
206
+ ]
207
+ >
208
+ >,
191
209
  path?: null | undefined | NodePath,
192
210
  ): void;
193
211
  markComposedNamespace(
@@ -7,13 +7,13 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { PluginPass } from '../../flow_modules/@babel/core';
11
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { PluginPass } from '@babel/core';
11
+ import type { NodePath } from '@babel/traverse';
12
12
  import type {
13
13
  CompiledNamespaces,
14
14
  StyleXOptions as RuntimeOptions,
15
15
  } from '../shared';
16
- import * as t from '../../flow_modules/@babel/types';
16
+ import * as t from '@babel/types';
17
17
  export type ImportPathResolution =
18
18
  | false
19
19
  | ['themeNameRef' | 'filePath', string];
@@ -32,6 +32,16 @@ type ModuleResolution =
32
32
  type: 'experimental_crossFileParsing',
33
33
  rootDir?: string,
34
34
  themeFileExtension?: ?string,
35
+ }>
36
+ | $ReadOnly<{
37
+ type: 'custom',
38
+ themeFileExtension?: ?string,
39
+ filePathResolver: (
40
+ importPath: string,
41
+ sourceFilePath: string,
42
+ aliases: ?$ReadOnly<{ [string]: $ReadOnlyArray<string> }>,
43
+ ) => string | void,
44
+ getCanonicalFilePath: (filePath: string) => string,
35
45
  }>;
36
46
 
37
47
  export type StyleXOptions = $ReadOnly<{
@@ -76,6 +86,7 @@ declare export default class StateManager {
76
86
  +stylexKeyframesImport: Set<string>;
77
87
  +stylexPositionTryImport: Set<string>;
78
88
  +stylexDefineVarsImport: Set<string>;
89
+ +stylexDefineMarkerImport: Set<string>;
79
90
  +stylexDefineConstsImport: Set<string>;
80
91
  +stylexCreateThemeImport: Set<string>;
81
92
  +stylexTypesImport: Set<string>;
@@ -110,36 +121,40 @@ declare export default class StateManager {
110
121
  getCanonicalFilePath(filePath: string): string;
111
122
  importPathResolver(importPath: string): ImportPathResolution;
112
123
  addStyle(
113
- style: [
114
- string,
115
- (
116
- | { ltr: string, rtl?: string | null }
117
- | {
118
- constKey: string,
119
- constVal: string | number,
120
- rtl?: string | null,
121
- ltr: string,
122
- }
123
- ),
124
- number,
125
- ],
126
- ): void;
127
- registerStyles(
128
- styles: $ReadOnlyArray<
124
+ style: $ReadOnly<
129
125
  [
130
126
  string,
131
127
  (
132
- | { ltr: string, rtl?: string | null }
133
- | {
128
+ | $ReadOnly<{ ltr: string, rtl?: string | null }>
129
+ | $ReadOnly<{
134
130
  constKey: string,
135
131
  constVal: string | number,
136
132
  rtl?: string | null,
137
133
  ltr: string,
138
- }
134
+ }>
139
135
  ),
140
136
  number,
141
137
  ],
142
138
  >,
139
+ ): void;
140
+ registerStyles(
141
+ styles: $ReadOnlyArray<
142
+ $ReadOnly<
143
+ [
144
+ string,
145
+ (
146
+ | $ReadOnly<{ ltr: string, rtl?: string | null }>
147
+ | $ReadOnly<{
148
+ constKey: string,
149
+ constVal: string | number,
150
+ rtl?: string | null,
151
+ ltr: string,
152
+ }>
153
+ ),
154
+ number,
155
+ ],
156
+ >,
157
+ >,
143
158
  path?: ?NodePath<>,
144
159
  ): void;
145
160
  markComposedNamespace(
@@ -22,6 +22,7 @@ export declare const string: PrimitiveChecker<string>;
22
22
  export declare const nullish: PrimitiveChecker<null | void>;
23
23
  export declare const boolean: PrimitiveChecker<boolean>;
24
24
  export declare const number: PrimitiveChecker<number>;
25
+ export declare const func: <T extends Function>(msg?: Msg) => Check<T>;
25
26
  export declare const literal: <T extends string | number | boolean>(
26
27
  $$PARAM_0$$: T,
27
28
  msg?: Msg,
@@ -21,6 +21,8 @@ declare export const boolean: PrimitiveChecker<boolean>;
21
21
 
22
22
  declare export const number: PrimitiveChecker<number>;
23
23
 
24
+ declare export const func: <T: Function>(msg?: Msg) => Check<T>;
25
+
24
26
  declare export const literal: <T: string | number | boolean>(
25
27
  T,
26
28
  msg?: Msg,
@@ -7,9 +7,9 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
10
+ import type { NodePath } from '@babel/traverse';
11
11
 
12
- import * as t from '../../flow_modules/@babel/types';
12
+ import * as t from '@babel/types';
13
13
  import StateManager from '../utils/state-manager';
14
14
 
15
15
  // Read imports of react and remember the name of the local variables for later
@@ -8,10 +8,10 @@
8
8
  */
9
9
 
10
10
  /* eslint-disable no-unused-vars */
11
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
+ import type { NodePath } from '@babel/traverse';
12
12
  import type { FunctionConfig } from '../utils/evaluate-path';
13
13
 
14
- import * as t from '../../flow_modules/@babel/types';
14
+ import * as t from '@babel/types';
15
15
  import StateManager from '../utils/state-manager';
16
16
  type TInlineStyles = {
17
17
  [string]: {
@@ -7,8 +7,8 @@
7
7
  * @flow strict
8
8
  */
9
9
 
10
- import type { NodePath } from '../../flow_modules/@babel/traverse';
11
- import * as t from '../../flow_modules/@babel/types';
10
+ import type { NodePath } from '@babel/traverse';
11
+ import * as t from '@babel/types';
12
12
  import StateManager from '../utils/state-manager';
13
13
  /// This function looks for `stylex.createTheme` calls and transforms them.
14
14
  /// 1. It finds the first two arguments to `stylex.createTheme` and validates those.