-
-
Notifications
You must be signed in to change notification settings - Fork 338
Expand file tree
/
Copy pathindex.tsx
More file actions
62 lines (54 loc) · 1.51 KB
/
index.tsx
File metadata and controls
62 lines (54 loc) · 1.51 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
// Re-export everything from the base libraries file
// This is the 90% use case - lightweight data for navigation, lists, etc.
export {
libraries,
librariesByGroup,
librariesGroupNamesMap,
libraryIds,
SIDEBAR_LIBRARY_IDS,
findLibrary,
getLibrary,
// Individual library exports
query,
router,
start,
table,
form,
virtual,
ranger,
store,
pacer,
hotkeys,
db,
ai,
config,
devtools,
cli,
} from './libraries'
// Re-export types
export type { Framework, Library, LibraryId, LibrarySlim } from './types'
// NOTE: Extended library projects (queryProject, routerProject, etc.) with
// testimonials, featureHighlights (containing React components) are NOT
// re-exported here to keep this import lightweight.
//
// Import them directly in routes that need the full library landing page data:
// import { queryProject } from '~/libraries/query'
// import { tableProject } from '~/libraries/table'
// etc.
//
// Similarly, frameworkOptions is in './frameworks' to avoid bundling SVG imports
// in server/background functions.
import type { Library } from './types'
export function getBranch(library: Library, argVersion?: string) {
if (!library) {
throw new Error('Library is required')
}
const version = argVersion || library.latestVersion
const resolvedVersion = ['latest', library.latestVersion].includes(version)
? library.latestBranch
: version
if (!resolvedVersion) {
throw new Error(`Could not resolve version for ${library.name}`)
}
return resolvedVersion
}