forked from nodejs/doc-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.mjs
More file actions
205 lines (200 loc) · 5.13 KB
/
constants.mjs
File metadata and controls
205 lines (200 loc) · 5.13 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
export const ROOT = dirname(fileURLToPath(import.meta.url));
/**
* @typedef {Object} JSXImportConfig
* @property {string} name - The name of the component to be imported.
* @property {string} source - The path to the component's source file or package.
* @property {boolean} [isDefaultExport=true] - Indicates if it's a default export (true) or named export (false). Defaults to true if not specified.
*/
/**
* An object containing mappings for various JSX components to their import paths.
*/
export const JSX_IMPORTS = {
Layout: {
name: 'Layout',
source: '#theme/Layout',
},
CodeBox: {
name: 'CodeBox',
source: resolve(ROOT, './ui/components/CodeBox'),
},
CodeTabs: {
name: 'CodeTabs',
source: '@node-core/ui-components/MDX/CodeTabs',
},
MDXTooltip: {
name: 'MDXTooltip',
isDefaultExport: false,
source: '@node-core/ui-components/MDX/Tooltip',
},
MDXTooltipContent: {
name: 'MDXTooltipContent',
isDefaultExport: false,
source: '@node-core/ui-components/MDX/Tooltip',
},
MDXTooltipTrigger: {
name: 'MDXTooltipTrigger',
isDefaultExport: false,
source: '@node-core/ui-components/MDX/Tooltip',
},
ChangeHistory: {
name: 'ChangeHistory',
source: '@node-core/ui-components/Common/ChangeHistory',
},
AlertBox: {
name: 'AlertBox',
source: '@node-core/ui-components/Common/AlertBox',
},
Blockquote: {
name: 'Blockquote',
source: '@node-core/ui-components/Common/Blockquote',
},
DataTag: {
name: 'DataTag',
source: '@node-core/ui-components/Common/DataTag',
},
FunctionSignature: {
name: 'FunctionSignature',
source: '@node-core/ui-components/Containers/FunctionSignature',
},
ArrowUpRightIcon: {
name: 'ArrowUpRightIcon',
source: '@heroicons/react/24/solid/ArrowUpRightIcon',
},
};
/**
* Specification rules for resource hints like prerendering and prefetching.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Speculation_Rules_API
*/
export const SPECULATION_RULES = JSON.stringify({
// Eagerly prefetch all links that point to the API docs themselves
// in a moderate eagerness to improve resource loading
prefetch: [{ where: { href_matches: '/*' }, eagerness: 'eager' }],
prerender: [
// Eagerly prerender Sidebar links for faster navigation
// These will be done in a moderate eagerness (hover, likely next navigation)
{ where: { selector_matches: '[rel~=prefetch]' }, eagerness: 'moderate' },
],
});
/**
* @deprecated This is being exported temporarily during the transition period.
* For a more general solution, category information should be added to pages in
* YAML format, and this array should be removed.
*
* Defines the sidebar navigation groups and their associated page URLs.
* @type {Array<{ groupName: string, items: Array<string> }>}
*/
export const SIDEBAR_GROUPS = [
{
groupName: 'Getting Started',
items: [
'documentation.html',
'synopsis.html',
'cli.html',
'environment_variables.html',
'globals.html',
],
},
{
groupName: 'Module System',
items: [
'modules.html',
'esm.html',
'module.html',
'packages.html',
'typescript.html',
],
},
{
groupName: 'Networking & Protocols',
items: [
'http.html',
'http2.html',
'https.html',
'net.html',
'dns.html',
'dgram.html',
'quic.html',
],
},
{
groupName: 'File System & I/O',
items: [
'fs.html',
'path.html',
'buffer.html',
'stream.html',
'string_decoder.html',
'zlib.html',
'readline.html',
'tty.html',
],
},
{
groupName: 'Asynchronous Programming',
items: [
'async_context.html',
'async_hooks.html',
'events.html',
'timers.html',
'webstreams.html',
],
},
{
groupName: 'Process & Concurrency',
items: [
'process.html',
'child_process.html',
'cluster.html',
'worker_threads.html',
'os.html',
],
},
{
groupName: 'Security & Cryptography',
items: ['crypto.html', 'webcrypto.html', 'permissions.html', 'tls.html'],
},
{
groupName: 'Data & URL Utilities',
items: ['url.html', 'querystring.html', 'punycode.html', 'util.html'],
},
{
groupName: 'Debugging & Diagnostics',
items: [
'debugger.html',
'inspector.html',
'console.html',
'report.html',
'tracing.html',
'diagnostics_channel.html',
'errors.html',
],
},
{
groupName: 'Testing & Assertion',
items: ['test.html', 'assert.html', 'repl.html'],
},
{
groupName: 'Performance & Observability',
items: ['perf_hooks.html', 'v8.html'],
},
{
groupName: 'Runtime & Advanced APIs',
items: [
'vm.html',
'wasi.html',
'sqlite.html',
'single-executable-applications.html',
'intl.html',
],
},
{
groupName: 'Native & Low-level Extensions',
items: ['addons.html', 'n-api.html', 'embedding.html'],
},
{
groupName: 'Legacy & Deprecated',
items: ['deprecations.html', 'domain.html'],
},
];