zhangjian
2023-05-30 dabbcc356af21f9f2f88ac69ff07994e6e32e4fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import * as t from '@babel/types';
import { NodePath } from '@babel/traverse';
import type { State } from './interface';
import SlotFlags from './slotFlags';
export declare const JSX_HELPER_KEY = "JSX_HELPER_KEY";
export declare const FRAGMENT = "Fragment";
export declare const KEEP_ALIVE = "KeepAlive";
/**
 * create Identifier
 * @param path NodePath
 * @param state
 * @param name string
 * @returns MemberExpression
 */
export declare const createIdentifier: (state: State, name: string) => t.Identifier | t.MemberExpression;
/**
 * Checks if string is describing a directive
 * @param src string
 */
export declare const isDirective: (src: string) => boolean;
/**
 * Should transformed to slots
 * @param tag string
 * @returns boolean
 */
export declare const shouldTransformedToSlots: (tag: string) => boolean;
/**
 * Check if a Node is a component
 *
 * @param t
 * @param path JSXOpeningElement
 * @returns boolean
 */
export declare const checkIsComponent: (path: NodePath<t.JSXOpeningElement>, state: State) => boolean;
/**
 * Transform JSXMemberExpression to MemberExpression
 * @param path JSXMemberExpression
 * @returns MemberExpression
 */
export declare const transformJSXMemberExpression: (path: NodePath<t.JSXMemberExpression>) => t.MemberExpression;
/**
 * Get tag (first attribute for h) from JSXOpeningElement
 * @param path JSXElement
 * @param state State
 * @returns Identifier | StringLiteral | MemberExpression | CallExpression
 */
export declare const getTag: (path: NodePath<t.JSXElement>, state: State) => t.Identifier | t.CallExpression | t.StringLiteral | t.MemberExpression;
export declare const getJSXAttributeName: (path: NodePath<t.JSXAttribute>) => string;
/**
 * Transform JSXText to StringLiteral
 * @param path JSXText
 * @returns StringLiteral | null
 */
export declare const transformJSXText: (path: NodePath<t.JSXText>) => t.StringLiteral | null;
/**
 * Transform JSXExpressionContainer to Expression
 * @param path JSXExpressionContainer
 * @returns Expression
 */
export declare const transformJSXExpressionContainer: (path: NodePath<t.JSXExpressionContainer>) => (t.Expression);
/**
 * Transform JSXSpreadChild
 * @param path JSXSpreadChild
 * @returns SpreadElement
 */
export declare const transformJSXSpreadChild: (path: NodePath<t.JSXSpreadChild>) => t.SpreadElement;
export declare const walksScope: (path: NodePath, name: string, slotFlag: SlotFlags) => void;
export declare const buildIIFE: (path: NodePath<t.JSXElement>, children: t.Expression[]) => t.Expression[];
export declare const isOn: (key: string) => boolean;
export declare const dedupeProperties: (properties?: t.ObjectProperty[], mergeProps?: boolean | undefined) => t.ObjectProperty[];
/**
 *  Check if an attribute value is constant
 * @param node
 * @returns boolean
 */
export declare const isConstant: (node: t.Expression | t.Identifier | t.Literal | t.SpreadElement | null) => boolean;
export declare const transformJSXSpreadAttribute: (nodePath: NodePath, path: NodePath<t.JSXSpreadAttribute>, mergeProps: boolean, args: (t.ObjectProperty | t.Expression | t.SpreadElement)[]) => void;