@stylexjs/babel-plugin 0.14.1 → 0.14.3
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.
- package/lib/index.js +96 -96
- package/lib/shared/common-types.d.ts +1 -0
- package/lib/shared/common-types.js.flow +1 -0
- package/lib/shared/physical-rtl/generate-rtl.d.ts +1 -1
- package/lib/shared/physical-rtl/generate-rtl.js.flow +1 -1
- package/lib/shared/stylex-create-theme.d.ts +1 -1
- package/lib/shared/stylex-create-theme.js.flow +1 -1
- package/lib/shared/stylex-define-consts.d.ts +2 -2
- package/lib/shared/stylex-define-consts.js.flow +1 -1
- package/lib/shared/stylex-define-vars.d.ts +4 -4
- package/lib/shared/stylex-define-vars.js.flow +2 -2
- package/lib/utils/state-manager.d.ts +2 -0
- package/lib/utils/state-manager.js.flow +1 -0
- package/package.json +3 -3
- package/lib/babel-path-utils.d.ts +0 -1100
- package/lib/babel-path-utils.js.flow +0 -1108
- package/lib/shared/utils/genCSSRule.d.ts +0 -15
- package/lib/shared/utils/genCSSRule.js.flow +0 -15
- package/lib/visitors/stylex-attrs.d.ts +0 -21
- package/lib/visitors/stylex-attrs.js.flow +0 -25
- package/lib/visitors/stylex-create/index.d.ts +0 -17
- package/lib/visitors/stylex-create/index.js.flow +0 -24
- package/lib/visitors/stylex-create/parse-stylex-create-arg.d.ts +0 -37
- package/lib/visitors/stylex-create/parse-stylex-create-arg.js.flow +0 -41
|
@@ -1,15 +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 function genCSSRule(
|
|
11
|
-
className: string,
|
|
12
|
-
decls: string,
|
|
13
|
-
pseudos: ReadonlyArray<string>,
|
|
14
|
-
atRules: ReadonlyArray<string>,
|
|
15
|
-
): string;
|
|
@@ -1,15 +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
|
-
declare export function genCSSRule(
|
|
11
|
-
className: string,
|
|
12
|
-
decls: string,
|
|
13
|
-
pseudos: $ReadOnlyArray<string>,
|
|
14
|
-
atRules: $ReadOnlyArray<string>,
|
|
15
|
-
): string;
|
|
@@ -1,21 +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
|
-
import type { NodePath } from '@babel/traverse';
|
|
11
|
-
import * as t from '@babel/types';
|
|
12
|
-
import StateManager from '../utils/state-manager';
|
|
13
|
-
export declare function skipStylexAttrsChildren(
|
|
14
|
-
path: NodePath<t.CallExpression>,
|
|
15
|
-
state: StateManager,
|
|
16
|
-
): void;
|
|
17
|
-
declare function transformStylexAttrs(
|
|
18
|
-
path: NodePath<t.CallExpression>,
|
|
19
|
-
state: StateManager,
|
|
20
|
-
): void;
|
|
21
|
-
export default transformStylexAttrs;
|
|
@@ -1,25 +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
|
-
import type { NodePath } from '../../flow_modules/@babel/traverse';
|
|
11
|
-
|
|
12
|
-
import * as t from '../../flow_modules/@babel/types';
|
|
13
|
-
import StateManager from '../utils/state-manager';
|
|
14
|
-
declare export function skipStylexAttrsChildren(
|
|
15
|
-
path: NodePath<t.CallExpression>,
|
|
16
|
-
state: StateManager,
|
|
17
|
-
): void;
|
|
18
|
-
|
|
19
|
-
// If a `stylex()` call uses styles that are all locally defined,
|
|
20
|
-
// This function is able to pre-compute that into a single string or
|
|
21
|
-
// a single expression of strings and ternary expressions.
|
|
22
|
-
declare export default function transformStylexAttrs(
|
|
23
|
-
path: NodePath<t.CallExpression>,
|
|
24
|
-
state: StateManager,
|
|
25
|
-
): void;
|
|
@@ -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
|
-
import * as t from '@babel/types';
|
|
11
|
-
import type { NodePath } from '@babel/traverse';
|
|
12
|
-
import StateManager from '../../utils/state-manager';
|
|
13
|
-
declare function transformStyleXCreate(
|
|
14
|
-
path: NodePath<t.CallExpression>,
|
|
15
|
-
state: StateManager,
|
|
16
|
-
): void;
|
|
17
|
-
export default transformStyleXCreate;
|
|
@@ -1,24 +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
|
-
import * as t from '../../../flow_modules/@babel/types';
|
|
11
|
-
import type { NodePath } from '../../../flow_modules/@babel/traverse';
|
|
12
|
-
import StateManager from '../../utils/state-manager';
|
|
13
|
-
/// This function looks for `stylex.create` calls and transforms them.
|
|
14
|
-
/// 1. It finds the first argument to `stylex.create` and validates it.
|
|
15
|
-
/// 2. It pre-processes valid-dynamic parts of style object such as custom presets (spreads)
|
|
16
|
-
/// 3. It evaluates the style object to get a JS object. This also handles local constants automatically.
|
|
17
|
-
/// 4. It uses the `stylexCreate` from `@stylexjs/shared` to transform the JS
|
|
18
|
-
/// object and to get a list of injected styles.
|
|
19
|
-
/// 5. It converts the resulting Object back into an AST and replaces the call with it.
|
|
20
|
-
/// 6. It also inserts `stylex.inject` calls above the current statement as needed.
|
|
21
|
-
declare export default function transformStyleXCreate(
|
|
22
|
-
path: NodePath<t.CallExpression>,
|
|
23
|
-
state: StateManager,
|
|
24
|
-
): void;
|
|
@@ -1,37 +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
|
-
import type { NodePath } from '@babel/traverse';
|
|
11
|
-
import * as t from '@babel/types';
|
|
12
|
-
import StateManager from '../../utils/state-manager';
|
|
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
|
-
};
|
|
27
|
-
export declare function evaluateStyleXCreateArg(
|
|
28
|
-
path: NodePath,
|
|
29
|
-
traversalState: StateManager,
|
|
30
|
-
functions: FunctionConfig,
|
|
31
|
-
): Readonly<{
|
|
32
|
-
confident: boolean;
|
|
33
|
-
value: any;
|
|
34
|
-
deopt?: null | NodePath;
|
|
35
|
-
reason?: string;
|
|
36
|
-
fns?: DynamicFns;
|
|
37
|
-
}>;
|
|
@@ -1,41 +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
|
-
/* eslint-disable no-unused-vars */
|
|
11
|
-
import type { NodePath } from '../../../flow_modules/@babel/traverse';
|
|
12
|
-
import * as t from '../../../flow_modules/@babel/types';
|
|
13
|
-
import StateManager from '../../utils/state-manager';
|
|
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
|
-
|
|
30
|
-
// This
|
|
31
|
-
declare export function evaluateStyleXCreateArg(
|
|
32
|
-
path: NodePath<>,
|
|
33
|
-
traversalState: StateManager,
|
|
34
|
-
functions: FunctionConfig,
|
|
35
|
-
): $ReadOnly<{
|
|
36
|
-
confident: boolean,
|
|
37
|
-
value: any,
|
|
38
|
-
deopt?: null | NodePath<>,
|
|
39
|
-
reason?: string,
|
|
40
|
-
fns?: DynamicFns,
|
|
41
|
-
}>;
|