-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathinterfaces.ts
217 lines (202 loc) · 4.85 KB
/
interfaces.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
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
206
207
208
209
210
211
212
213
214
215
216
217
/** This file is deprecated */
import { PicGo } from '../core/PicGo'
import LifecyclePlugins from '../lib/LifecyclePlugins'
/**
* for plugin config
*/
export interface IPluginConfig {
name: string
type: string
required: boolean
default?: any
[propName: string]: any
}
/**
* for lifecycle plugins
*/
export interface IHelper {
transformer: LifecyclePlugins
uploader: LifecyclePlugins
beforeTransformPlugins: LifecyclePlugins
beforeUploadPlugins: LifecyclePlugins
afterUploadPlugins: LifecyclePlugins
}
/**
* for uploading image info
*/
export interface IImgInfo {
buffer?: Buffer
base64Image?: string
fileName?: string
width?: number
height?: number
extname?: string
[propName: string]: any
}
export interface IPathTransformedImgInfo extends IImgInfo {
success: boolean
}
/** SM.MS 图床配置项 */
export interface ISmmsConfig {
token: string
}
/** 七牛云图床配置项 */
export interface IQiniuConfig {
accessKey: string
secretKey: string
/** 存储空间名 */
bucket: string
/** 自定义域名 */
url: string
/** 存储区域编号 */
area: 'z0' | 'z1' | 'z2' | 'na0' | 'as0'
/** 网址后缀,比如使用 `?imageslim` 可进行[图片瘦身](https://developer.qiniu.com/dora/api/1271/image-thin-body-imageslim) */
options: string
/** 自定义存储路径,比如 `img/` */
path: string
}
/** 又拍云图床配置项 */
export interface IUpyunConfig {
/** 存储空间名,及你的服务名 */
bucket: string
/** 操作员 */
operator: string
/** 密码 */
password: string
/** 针对图片的一些后缀处理参数 */
options: string
/** 自定义存储路径,比如 `img/` */
path: string
/** 加速域名,注意要加 `http://` 或者 `https://` */
url: string
}
/** 腾讯云图床配置项 */
export interface ITcyunConfig {
secretId: string
secretKey: string
/** 存储桶名,v4 和 v5 版本不一样 */
bucket: string
appId: string
/** 存储区域,例如 ap-beijing-1 */
area: string
/** 自定义存储路径,比如 img/ */
path: string
/** 自定义域名,注意要加 `http://` 或者 `https://` */
customUrl: string
/** COS 版本,v4 或者 v5 */
version: 'v5' | 'v4'
}
/** GitHub 图床配置项 */
export interface IGithubConfig {
/** 仓库名,格式是 `username/reponame` */
repo: string
/** github token */
token: string
/** 自定义存储路径,比如 `img/` */
path: string
/** 自定义域名,注意要加 `http://` 或者 `https://` */
customUrl: string
/** 分支名,默认是 `master` */
branch: string
}
/** 阿里云图床配置项 */
export interface IAliyunConfig {
accessKeyId: string
accessKeySecret: string
/** 存储空间名 */
bucket: string
/** 存储区域代号 */
area: string
/** 自定义存储路径 */
path: string
/** 自定义域名,注意要加 `http://` 或者 `https://` */
customUrl: string
/** 针对图片的一些后缀处理参数 PicGo 2.2.0+ PicGo-Core 1.4.0+ */
options: string
}
/** Imgur 图床配置项 */
export interface IImgurConfig {
/** imgur 的 `clientId` */
clientId: string
/** 代理地址,仅支持 http 代理 */
proxy: string
}
/** PicGo 配置文件类型定义 */
export interface IConfig {
picBed: {
uploader: string
current?: string
smms?: ISmmsConfig
qiniu?: IQiniuConfig
upyun?: IUpyunConfig
tcyun?: ITcyunConfig
github?: IGithubConfig
aliyun?: IAliyunConfig
imgur?: IImgurConfig
transformer?: string
proxy: string
}
picgoPlugins: {
[propName: string]: boolean
}
debug?: boolean
silent?: boolean
settings?: {
logLevel: string
logPath: string
}
/** 下载插件时 npm 命令自定义的 registry */
registry: string
}
/**
* for plugin
*/
export interface IPlugin {
handle: ((ctx: PicGo) => Promise<any>) | ((ctx: PicGo) => void)
[propName: string]: any
}
/**
* for spawn output
*/
export interface IResult {
code: number
data: string
}
/**
* for transformer - path
*/
export interface IImgSize {
width: number
height: number
real?: boolean
}
/**
* for initUtils
*/
export interface IOptions {
template: string // template name
dest: string // destination for template to generate
hasSlash: boolean // check if is officail template
inPlace: boolean // check if is given project name
clone: boolean // check if use git clone
offline: boolean // check if use offline mode
tmp: string // cache template
project: string // project name
}
/**
* for clipboard image
*/
export interface IClipboardImage {
imgPath: string
isExistFile: boolean
}
/**
* for install command environment variable
*/
export interface IProcessEnv {
[propName: string]: Undefinable<string>
}
export type ILogArgvType = string | number
export type ILogArgvTypeWithError = ILogArgvType | Error
export type Nullable<T> = T | null
export type Undefinable<T> = T | undefined