11import { getCollection } from 'astro:content' ;
22import path from 'path' ;
33
4- import type { FunctionType , NotesType } from './types' ;
5-
6- type FunctionItem = Awaited < ReturnType < typeof getCollection > > [ number ] ;
7-
8- type BaseOOP = {
9- element : string ;
10- note ?: string ;
11- } ;
12-
13- // /!\ constructor is a reserved word in JS/TS, so we use constructorclass
14- type MethodOOP = BaseOOP & {
15- method : string ;
16- static : boolean ;
17- variable ?: string ;
18- constructorclass ?: never ; // mutually exclusive with constructor
19- } ;
20-
21- type ConstructorOOP = BaseOOP & {
22- constructorclass : string ;
23- method ?: never ; // mutually exclusive with method
24- static ?: never ;
25- variable ?: never ;
26- } ;
27-
28- export type OOPInfo = MethodOOP | ConstructorOOP ;
29-
30- export type FunctionInfo = {
31- description : string ;
32- incomplete ?: boolean ;
33- type : FunctionType ;
34- typePretty : string ;
35- pair ?: string ;
36- preview_images ?: string [ ] ;
37- oop ?: OOPInfo ;
38- notes ?: NotesType ;
39- version ?: VersionInfo
40- } ;
41-
42- type VersionInfo = {
43- added ?: string ;
44- updated ?: string ;
45- removed ?: string ;
46- } ;
47-
48- type FunctionsByCategory = {
49- [ folder : string ] : FunctionItem [ ] ;
50- } ;
51- type FunctionsByTypeByCategory = {
52- [ key in FunctionType ] : FunctionsByCategory ;
53- } ;
54-
55-
56- export type FunctionData = {
57- shared ?: any ;
58- client ?: any ;
59- server ?: any ;
60- } ;
4+ import type { FunctionData , FunctionInfo , FunctionsByCategory , FunctionsByTypeByCategory , FunctionType , Parameter , ReturnBlock , Syntax } from './types' ;
615
626export const functionTypePrettyName = {
637 'client' : 'Client-side' ,
@@ -75,34 +19,6 @@ function getFunctionTypePretty(data: FunctionData): string {
7519 return functionTypePrettyName [ funcType ] ;
7620}
7721
78-
79- type Parameter = {
80- name : string ;
81- type : string ;
82- description : string ;
83- default ?: string ;
84- templateList ?: string ;
85- } ;
86-
87- type ReturnValue = {
88- type : string ;
89- name : string ;
90- templateList ?: string ;
91- } ;
92-
93- type ReturnBlock = {
94- description ?: string ;
95- values : ReturnValue [ ] ;
96- } ;
97-
98- type Syntax = {
99- type : 'shared' | 'server' | 'client' ;
100- parameters : Parameter [ ] ;
101- returns : ReturnBlock | null ;
102- syntaxString : string ;
103- } ;
104-
105-
10622// return_type func_name ( param1, param2, [ optional param1 ] )
10723// e.g. bool setCursorPosition ( int cursorX, int cursorY )
10824function buildSyntaxString (
0 commit comments