forked from roxiness/routify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
typedef.js
144 lines (131 loc) · 3.62 KB
/
typedef.js
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
/**
// * @typedef {import("svelte/store").Readable<{component: RouteNode}>} ContextStore
* @typedef {import("svelte").SvelteComponent} SvelteComponent
*/
/**
* ClientNode
* @typedef {Object.<string, *> & DefinedFile & ClientNodeSpecifics} ClientNode
*
* @typedef {Object} ClientNodeSpecifics
* @prop {ClientNode[]} layouts
* @prop {ClientNode|undefined} parent
* @prop {ClientNode|undefined} nextSibling
* @prop {ClientNode|undefined} prevSibling
* @prop {ClientNode[]} lineage
* @prop {String} ext
* @prop {Meta} meta
* @prop {String} id
* @prop {String} path
* @prop {String} shortPath
* @prop {String} ranking
* @prop {Boolean} isIndexable
* @prop {Boolean} isNonIndexable
* @prop {String[]} paramKeys
* @prop {String} regex
* @prop {function():SvelteComponent|Promise<SvelteComponent>} component
* @prop {ClientNode} last
* @prop {ClientNodeApi} api
*/
/**
* ClientNodeApi
* @typedef {Object} ClientNodeApi
* @prop {ClientNodeApi|undefined} parent
* @prop {ClientNodeApi|undefined} next
* @prop {ClientNodeApi|undefined} prev
* @prop {ClientNodeApi[]} children
* @prop {Boolean} isMeta
* @prop {String} path
* @prop {String} title
* @prop {Meta} meta
* @prop {ClientNode} __file
*/
/**
* File
* @typedef {Object.<string, *> & MiscFile & GeneratedFile & DefinedFile} RouteNode
*
* @typedef {Object} DefinedFile
* @prop {Boolean=} isFile
* @prop {Boolean=} isDir
* @prop {Boolean=} isPage
* @prop {Boolean=} isLayout
* @prop {Boolean=} isReset
* @prop {Boolean=} isIndex
* @prop {Boolean=} isFallback
*
* @typedef {Object} GeneratedFile
* @prop {String} name
* @prop {String} path
* @prop {RouteNode[]=} dir
* @prop {String} absolutePath
* @prop {String} isFile
* @prop {String} filepath
* @prop {String} ext
* @prop {Boolean} badExt
*
* @typedef {Object} MiscFile
* @prop {String} id
* @prop {GetParentFile} getParent
* @prop {RouteNode} parent
* @prop {Meta} meta
*
* @typedef {function():RouteNode} GetParentFile
* @returns {RouteNode}
*/
/**
* @typedef {Object.<string, *>} Meta
* @prop {Boolean=} preload Bundle with main app
* @prop {*=} precache-order
* @prop {*=} precache-proximity
* @prop {Boolean=} recursive
* @prop {Boolean=} bundle Bundle folder recursively in a single .js file
* @prop {String|Number|false=} index Position among siblings
* @prop {String=} name Custom identifier
* @prop {String=} title Title of the page
* @prop {MetaChild[]} [children]
* @prop {String} [$$bundleId]
*
* @typedef {Object} MetaChild
* @prop {String} [title]
* @prop {String} [path]
* @prop {MetaChild[]} [children]
*/
/**
* Tree Payload
* @typedef {Object} TreePayload
* @prop {RouteNode[]} routes
* @prop {RouteNode} tree
* @prop {BuildConfig} options
* @prop {Object} metaParser
* @prop {Object} defaultMeta
*/
/**
* Build Config
* @typedef {Object} BuildConfig
* @prop {String=} pages
* @prop {String=} routifyDir
* @prop {Boolean=} dynamicImports
* @prop {Boolean=} singleBuild
* @prop {String=} distDir
* @prop {(String|Array)=} extensions
* @prop {(String|Array)=} ignore
* @prop {Boolean=} noHashScroll
*/
/**
* @typedef {Object.<string, *>} UrlParams
*
* @typedef {Object} UrlOptions
* @prop {Boolean=} strict
*/
/**
* @typedef {Object} GotoOptions
* @prop {Boolean=} strict preserve filename in url, ie. /index
* @prop {Boolean} [redirect=false] use replaceState instead pushState
* @prop {Boolean} [static=false] render url without redirecting
* @prop {Boolean} [shallow=false] use the current layouts instead of those of the target
*/
/**
* @typedef {UrlOptions} IsActiveOptions
*/
/**
* @typedef {[ClientNodeApi, ClientNodeApi, ClientNodeApi]} ConcestorReturn
*/