/
index.d.ts
94 lines (83 loc) 路 2.64 KB
/
index.d.ts
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
// Type definitions for react-static 7.0.0
// Project: https://github.com/nozzle/react-static
// Definitions for 4.0.1 by: D1no <https://github.com/D1no>
// Updated to 5.1.7 by: Balvajs <https://github.com/Balvajs>
// TypeScript Version: 3.4
// VERY lightly maintained, we need all the help we can get
// / <reference types="react" />
declare module 'react-static' {
import * as React from 'react'
import { ComponentType, ReactNodeArray } from 'react'
import { Configuration as WebpackDevServerConfig } from 'webpack-dev-server'
type AnyReactComponent = ComponentType<Record<string, any>>
// Passing on helmet typings as "Head"
export { Helmet as Head } from 'react-helmet'
export class Routes extends React.Component<{ path?: String, default?: boolean }> {}
export class Root extends React.Component {}
export function useRouteData<T = any>(): T
export function useSiteData<T = any>(): T
export function withRouteData(comp: any): any
export function withSiteData(comp: any): any
export function prefetch(path: any): Promise<any>
export function addPrefetchExcludes(arg: String[]): void
export const Prefetch: React.Component
/**
* @see https://github.com/nozzle/react-static/blob/master/docs/config.md
*/
export interface ReactStaticConfig {
siteRoot?: string
stagingSiteRoot?: string
basePath?: string
stagingBasePath?: string
devBasePath?: string
assetsPath?: string
extractCssChunks?: boolean
inlineCss?: boolean
disablePreload?: boolean
outputFileRate?: number
prefetchRate?: number
maxThreads?: number
minLoadTime?: number
disableRoutePrefixing?: boolean
paths?: PathsConfig
babelExcludes?: RegExp[]
devServer?: WebpackDevServerConfig
plugins?: Array<string | [string, object]>
Document?: AnyReactComponent
getRoutes?(flags: RouteFlags): Route[]
getSiteData?(flags: RouteFlags): any
}
export interface PathsConfig {
root?: string
src?: string
temp?: string
dist?: string
devDist?: string
public?: string
assets?: string
pages?: string
plugins?: string
nodeModules?: string
}
export interface RouteFlags {
stage: string
}
export interface Route {
path: string
template?: string
redirect?: string
children?: Route[]
getData?(resolvedRoute: Route, flags: RouteFlags): any
replace: boolean
}
export interface DocumentProps {
Html: AnyReactComponent
Head: AnyReactComponent
Body: AnyReactComponent
children: ReactNodeArray
state: any // TODO: This should be changed
}
export interface OnStartArgs {
devServerConfig: Readonly<WebpackDevServerConfig>
}
}