-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathconstants.mjs
More file actions
115 lines (105 loc) · 2.63 KB
/
constants.mjs
File metadata and controls
115 lines (105 loc) · 2.63 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/**
* UI classes for Node.js API stability levels
*
* @see https://nodejs.org/api/documentation.html#stability-index
*/
export const STABILITY_LEVELS = [
'danger', // (0) Deprecated
'warning', // (1) Experimental
'success', // (2) Stable
'info', // (3) Legacy
];
/**
* HTML tag to UI component mappings
*/
export const TAG_TRANSFORMS = {
pre: 'CodeBox',
blockquote: 'Blockquote',
};
/**
* @see transformer.mjs's TODO comment
*/
export const TYPE_TRANSFORMS = {
raw: 'text',
};
/**
* API type icon configurations
*/
export const API_ICONS = {
event: { symbol: 'E', color: 'red' },
method: { symbol: 'M', color: 'red' },
property: { symbol: 'P', color: 'red' },
class: { symbol: 'C', color: 'red' },
module: { symbol: 'M', color: 'red' },
classMethod: { symbol: 'S', color: 'red' },
ctor: { symbol: 'C', color: 'red' },
};
/**
* API lifecycle change labels
*/
export const LIFECYCLE_LABELS = {
added_in: 'Added in',
deprecated_in: 'Deprecated in',
removed_in: 'Removed in',
introduced_in: 'Introduced in',
};
// TODO(@avivkeller): These should be inherited from @node-core/website-i18n
export const INTERNATIONALIZABLE = {
sourceCode: 'Source Code: ',
};
/**
* Abstract Syntax Tree node type constants
*/
export const AST_NODE_TYPES = {
MDX: {
/**
* Text-level JSX element
*
* @see https://github.com/syntax-tree/mdast-util-mdx-jsx#mdxjsxtextelement
*/
JSX_INLINE_ELEMENT: 'mdxJsxTextElement',
/**
* Block-level JSX element
*
* @see https://github.com/syntax-tree/mdast-util-mdx-jsx#mdxjsxflowelement
*/
JSX_BLOCK_ELEMENT: 'mdxJsxFlowElement',
/**
* JSX attribute
*
* @see https://github.com/syntax-tree/mdast-util-mdx-jsx#mdxjsxattribute
*/
JSX_ATTRIBUTE: 'mdxJsxAttribute',
/**
* JSX expression attribute
*
* @see https://github.com/syntax-tree/mdast-util-mdx-jsx#mdxjsxattributevalueexpression
*/
JSX_ATTRIBUTE_EXPRESSION: 'mdxJsxAttributeValueExpression',
},
ESTREE: {
/**
* AST Program node
*
* @see https://github.com/estree/estree/blob/master/es5.md#programs
*/
PROGRAM: 'Program',
/**
* Expression statement
*
* @see https://github.com/estree/estree/blob/master/es5.md#expressionstatement
*/
EXPRESSION_STATEMENT: 'ExpressionStatement',
},
// TODO(@avivkeller): These should be inherited from the elements themselves
JSX: {
ALERT_BOX: 'AlertBox',
CHANGE_HISTORY: 'ChangeHistory',
CIRCULAR_ICON: 'CircularIcon',
NAV_BAR: 'NavBar',
ARTICLE: 'Article',
SIDE_BAR: 'SideBar',
META_BAR: 'MetaBar',
FOOTER: 'Footer',
},
};