@stylexjs/babel-plugin 0.8.0 → 0.9.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.
@@ -25,13 +25,13 @@ export type ImportPathResolution =
25
25
  type ModuleResolution =
26
26
  | Readonly<{
27
27
  type: 'commonJS';
28
- rootDir: string;
28
+ rootDir?: string;
29
29
  themeFileExtension?: null | undefined | string;
30
30
  }>
31
31
  | Readonly<{ type: 'haste'; themeFileExtension?: null | undefined | string }>
32
32
  | Readonly<{
33
33
  type: 'experimental_crossFileParsing';
34
- rootDir: string;
34
+ rootDir?: string;
35
35
  themeFileExtension?: null | undefined | string;
36
36
  }>;
37
37
  export type StyleXOptions = Readonly<
@@ -141,6 +141,10 @@ declare class StateManager {
141
141
  get cssVars(): any;
142
142
  get treeshakeCompensation(): boolean;
143
143
  get fileNameForHashing(): null | string;
144
+ getPackageNameAndPath(
145
+ filepath: string,
146
+ ): null | readonly [packageName: string, packageDir: string];
147
+ getCanonicalFilePath(filePath: string): string;
144
148
  importPathResolver(importPath: string): ImportPathResolution;
145
149
  addStyle(style: [string, { ltr: string; rtl?: string | null }, number]): void;
146
150
  registerStyles(
@@ -27,7 +27,7 @@ export type ImportPathResolution =
27
27
  type ModuleResolution =
28
28
  | $ReadOnly<{
29
29
  type: 'commonJS',
30
- rootDir: string,
30
+ rootDir?: string,
31
31
  themeFileExtension?: ?string,
32
32
  }>
33
33
  | $ReadOnly<{
@@ -36,7 +36,7 @@ type ModuleResolution =
36
36
  }>
37
37
  | $ReadOnly<{
38
38
  type: 'experimental_crossFileParsing',
39
- rootDir: string,
39
+ rootDir?: string,
40
40
  themeFileExtension?: ?string,
41
41
  }>;
42
42
 
@@ -104,6 +104,10 @@ declare export default class StateManager {
104
104
  get cssVars(): any;
105
105
  get treeshakeCompensation(): boolean;
106
106
  get fileNameForHashing(): null | string;
107
+ getPackageNameAndPath(
108
+ filepath: string,
109
+ ): null | [+packageName: string, +packageDir: string];
110
+ getCanonicalFilePath(filePath: string): string;
107
111
  importPathResolver(importPath: string): ImportPathResolution;
108
112
  addStyle(style: [string, { ltr: string, rtl?: string | null }, number]): void;
109
113
  registerStyles(
@@ -11,6 +11,19 @@ import type { NodePath } from '@babel/traverse';
11
11
  import * as t from '@babel/types';
12
12
  import StateManager from '../../utils/state-manager';
13
13
  import { type FunctionConfig } from '../../utils/evaluate-path';
14
+ type TInlineStyles = {
15
+ [$$Key$$: string]: {
16
+ readonly path: ReadonlyArray<string>;
17
+ readonly originalExpression: t.Expression;
18
+ readonly expression: t.Expression | t.PatternLike;
19
+ };
20
+ };
21
+ type DynamicFns = {
22
+ [$$Key$$: string]: readonly [
23
+ params: Array<t.Identifier>,
24
+ inlineStyles: Readonly<TInlineStyles>,
25
+ ];
26
+ };
14
27
  export declare function evaluateStyleXCreateArg(
15
28
  path: NodePath,
16
29
  traversalState: StateManager,
@@ -19,10 +32,5 @@ export declare function evaluateStyleXCreateArg(
19
32
  confident: boolean;
20
33
  value: any;
21
34
  deopt?: null | NodePath;
22
- fns?: {
23
- [$$Key$$: string]: [
24
- Array<t.Identifier>,
25
- { readonly [$$Key$$: string]: t.Expression | t.PatternLike },
26
- ];
27
- };
35
+ fns?: DynamicFns;
28
36
  }>;
@@ -12,6 +12,21 @@ import type { NodePath } from '../../../flow_modules/@babel/traverse';
12
12
  import * as t from '../../../flow_modules/@babel/types';
13
13
  import StateManager from '../../utils/state-manager';
14
14
  import { type FunctionConfig } from '../../utils/evaluate-path';
15
+ type TInlineStyles = {
16
+ [string]: {
17
+ +path: $ReadOnlyArray<string>,
18
+ +originalExpression: t.Expression,
19
+ +expression: t.Expression | t.PatternLike,
20
+ },
21
+ };
22
+
23
+ type DynamicFns = {
24
+ [string]: [
25
+ +params: Array<t.Identifier>,
26
+ +inlineStyles: $ReadOnly<TInlineStyles>,
27
+ ],
28
+ };
29
+
15
30
  // This
16
31
  declare export function evaluateStyleXCreateArg(
17
32
  path: NodePath<>,
@@ -21,10 +36,5 @@ declare export function evaluateStyleXCreateArg(
21
36
  confident: boolean,
22
37
  value: any,
23
38
  deopt?: null | NodePath<>,
24
- fns?: {
25
- [string]: [
26
- Array<t.Identifier>,
27
- { +[string]: t.Expression | t.PatternLike },
28
- ],
29
- },
39
+ fns?: DynamicFns,
30
40
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stylexjs/babel-plugin",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "StyleX babel plugin.",
5
5
  "main": "lib/index.js",
6
6
  "repository": "https://github.com/facebook/stylex",
@@ -14,11 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@babel/helper-module-imports": "^7.22.15",
17
- "@stylexjs/shared": "0.8.0",
18
- "@stylexjs/stylex": "0.8.0",
19
- "@babel/core": "^7.23.6",
20
- "@babel/traverse": "^7.23.6",
21
- "@babel/types": "^7.23.6"
17
+ "@stylexjs/shared": "0.9.0",
18
+ "@stylexjs/stylex": "0.9.0",
19
+ "@babel/core": "^7.25.8",
20
+ "@babel/traverse": "^7.25.7",
21
+ "@babel/types": "^7.25.8",
22
+ "esm-resolve": "^1.0.11"
22
23
  },
23
24
  "jest": {
24
25
  "verbose": true,