@donotdev/core 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/eslint/index.d.ts +79 -0
- package/functions/index.d.ts +752 -0
- package/next/index.d.ts +1476 -0
- package/package.json +2 -2
- package/vite/index.d.ts +1644 -0
|
@@ -0,0 +1,752 @@
|
|
|
1
|
+
type Platform = 'browser' | 'node' | 'neutral'
|
|
2
|
+
type Format = 'iife' | 'cjs' | 'esm'
|
|
3
|
+
type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx'
|
|
4
|
+
type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
type Charset = 'ascii' | 'utf8'
|
|
6
|
+
type Drop = 'console' | 'debugger'
|
|
7
|
+
type AbsPaths = 'code' | 'log' | 'metafile'
|
|
8
|
+
|
|
9
|
+
interface CommonOptions {
|
|
10
|
+
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
11
|
+
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
|
12
|
+
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
|
13
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
|
14
|
+
/** Documentation: https://esbuild.github.io/api/#source-root */
|
|
15
|
+
sourceRoot?: string
|
|
16
|
+
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
|
17
|
+
sourcesContent?: boolean
|
|
18
|
+
|
|
19
|
+
/** Documentation: https://esbuild.github.io/api/#format */
|
|
20
|
+
format?: Format
|
|
21
|
+
/** Documentation: https://esbuild.github.io/api/#global-name */
|
|
22
|
+
globalName?: string
|
|
23
|
+
/** Documentation: https://esbuild.github.io/api/#target */
|
|
24
|
+
target?: string | string[]
|
|
25
|
+
/** Documentation: https://esbuild.github.io/api/#supported */
|
|
26
|
+
supported?: Record<string, boolean>
|
|
27
|
+
/** Documentation: https://esbuild.github.io/api/#platform */
|
|
28
|
+
platform?: Platform
|
|
29
|
+
|
|
30
|
+
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
31
|
+
mangleProps?: RegExp
|
|
32
|
+
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
33
|
+
reserveProps?: RegExp
|
|
34
|
+
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
35
|
+
mangleQuoted?: boolean
|
|
36
|
+
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
37
|
+
mangleCache?: Record<string, string | false>
|
|
38
|
+
/** Documentation: https://esbuild.github.io/api/#drop */
|
|
39
|
+
drop?: Drop[]
|
|
40
|
+
/** Documentation: https://esbuild.github.io/api/#drop-labels */
|
|
41
|
+
dropLabels?: string[]
|
|
42
|
+
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
43
|
+
minify?: boolean
|
|
44
|
+
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
45
|
+
minifyWhitespace?: boolean
|
|
46
|
+
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
47
|
+
minifyIdentifiers?: boolean
|
|
48
|
+
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
49
|
+
minifySyntax?: boolean
|
|
50
|
+
/** Documentation: https://esbuild.github.io/api/#line-limit */
|
|
51
|
+
lineLimit?: number
|
|
52
|
+
/** Documentation: https://esbuild.github.io/api/#charset */
|
|
53
|
+
charset?: Charset
|
|
54
|
+
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
|
55
|
+
treeShaking?: boolean
|
|
56
|
+
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
|
57
|
+
ignoreAnnotations?: boolean
|
|
58
|
+
|
|
59
|
+
/** Documentation: https://esbuild.github.io/api/#jsx */
|
|
60
|
+
jsx?: 'transform' | 'preserve' | 'automatic'
|
|
61
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
|
62
|
+
jsxFactory?: string
|
|
63
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
|
64
|
+
jsxFragment?: string
|
|
65
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
|
66
|
+
jsxImportSource?: string
|
|
67
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
|
68
|
+
jsxDev?: boolean
|
|
69
|
+
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
|
70
|
+
jsxSideEffects?: boolean
|
|
71
|
+
|
|
72
|
+
/** Documentation: https://esbuild.github.io/api/#define */
|
|
73
|
+
define?: { [key: string]: string }
|
|
74
|
+
/** Documentation: https://esbuild.github.io/api/#pure */
|
|
75
|
+
pure?: string[]
|
|
76
|
+
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
77
|
+
keepNames?: boolean
|
|
78
|
+
|
|
79
|
+
/** Documentation: https://esbuild.github.io/api/#abs-paths */
|
|
80
|
+
absPaths?: AbsPaths[]
|
|
81
|
+
/** Documentation: https://esbuild.github.io/api/#color */
|
|
82
|
+
color?: boolean
|
|
83
|
+
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
84
|
+
logLevel?: LogLevel
|
|
85
|
+
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
|
86
|
+
logLimit?: number
|
|
87
|
+
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
88
|
+
logOverride?: Record<string, LogLevel>
|
|
89
|
+
|
|
90
|
+
/** Documentation: https://esbuild.github.io/api/#tsconfig-raw */
|
|
91
|
+
tsconfigRaw?: string | TsconfigRaw
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface TsconfigRaw {
|
|
95
|
+
compilerOptions?: {
|
|
96
|
+
alwaysStrict?: boolean
|
|
97
|
+
baseUrl?: string
|
|
98
|
+
experimentalDecorators?: boolean
|
|
99
|
+
importsNotUsedAsValues?: 'remove' | 'preserve' | 'error'
|
|
100
|
+
jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev'
|
|
101
|
+
jsxFactory?: string
|
|
102
|
+
jsxFragmentFactory?: string
|
|
103
|
+
jsxImportSource?: string
|
|
104
|
+
paths?: Record<string, string[]>
|
|
105
|
+
preserveValueImports?: boolean
|
|
106
|
+
strict?: boolean
|
|
107
|
+
target?: string
|
|
108
|
+
useDefineForClassFields?: boolean
|
|
109
|
+
verbatimModuleSyntax?: boolean
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface BuildOptions extends CommonOptions {
|
|
114
|
+
/** Documentation: https://esbuild.github.io/api/#bundle */
|
|
115
|
+
bundle?: boolean
|
|
116
|
+
/** Documentation: https://esbuild.github.io/api/#splitting */
|
|
117
|
+
splitting?: boolean
|
|
118
|
+
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
|
119
|
+
preserveSymlinks?: boolean
|
|
120
|
+
/** Documentation: https://esbuild.github.io/api/#outfile */
|
|
121
|
+
outfile?: string
|
|
122
|
+
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
123
|
+
metafile?: boolean
|
|
124
|
+
/** Documentation: https://esbuild.github.io/api/#outdir */
|
|
125
|
+
outdir?: string
|
|
126
|
+
/** Documentation: https://esbuild.github.io/api/#outbase */
|
|
127
|
+
outbase?: string
|
|
128
|
+
/** Documentation: https://esbuild.github.io/api/#external */
|
|
129
|
+
external?: string[]
|
|
130
|
+
/** Documentation: https://esbuild.github.io/api/#packages */
|
|
131
|
+
packages?: 'bundle' | 'external'
|
|
132
|
+
/** Documentation: https://esbuild.github.io/api/#alias */
|
|
133
|
+
alias?: Record<string, string>
|
|
134
|
+
/** Documentation: https://esbuild.github.io/api/#loader */
|
|
135
|
+
loader?: { [ext: string]: Loader }
|
|
136
|
+
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
|
137
|
+
resolveExtensions?: string[]
|
|
138
|
+
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
|
139
|
+
mainFields?: string[]
|
|
140
|
+
/** Documentation: https://esbuild.github.io/api/#conditions */
|
|
141
|
+
conditions?: string[]
|
|
142
|
+
/** Documentation: https://esbuild.github.io/api/#write */
|
|
143
|
+
write?: boolean
|
|
144
|
+
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
|
145
|
+
allowOverwrite?: boolean
|
|
146
|
+
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
|
147
|
+
tsconfig?: string
|
|
148
|
+
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
|
149
|
+
outExtension?: { [ext: string]: string }
|
|
150
|
+
/** Documentation: https://esbuild.github.io/api/#public-path */
|
|
151
|
+
publicPath?: string
|
|
152
|
+
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
|
153
|
+
entryNames?: string
|
|
154
|
+
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
|
155
|
+
chunkNames?: string
|
|
156
|
+
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
|
157
|
+
assetNames?: string
|
|
158
|
+
/** Documentation: https://esbuild.github.io/api/#inject */
|
|
159
|
+
inject?: string[]
|
|
160
|
+
/** Documentation: https://esbuild.github.io/api/#banner */
|
|
161
|
+
banner?: { [type: string]: string }
|
|
162
|
+
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
163
|
+
footer?: { [type: string]: string }
|
|
164
|
+
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
165
|
+
entryPoints?: (string | { in: string, out: string })[] | Record<string, string>
|
|
166
|
+
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
167
|
+
stdin?: StdinOptions
|
|
168
|
+
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
169
|
+
plugins?: Plugin[]
|
|
170
|
+
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
|
171
|
+
absWorkingDir?: string
|
|
172
|
+
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
|
173
|
+
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface StdinOptions {
|
|
177
|
+
contents: string | Uint8Array
|
|
178
|
+
resolveDir?: string
|
|
179
|
+
sourcefile?: string
|
|
180
|
+
loader?: Loader
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
interface Message {
|
|
184
|
+
id: string
|
|
185
|
+
pluginName: string
|
|
186
|
+
text: string
|
|
187
|
+
location: Location | null
|
|
188
|
+
notes: Note[]
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Optional user-specified data that is passed through unmodified. You can
|
|
192
|
+
* use this to stash the original error, for example.
|
|
193
|
+
*/
|
|
194
|
+
detail: any
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface Note {
|
|
198
|
+
text: string
|
|
199
|
+
location: Location | null
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
interface Location {
|
|
203
|
+
file: string
|
|
204
|
+
namespace: string
|
|
205
|
+
/** 1-based */
|
|
206
|
+
line: number
|
|
207
|
+
/** 0-based, in bytes */
|
|
208
|
+
column: number
|
|
209
|
+
/** in bytes */
|
|
210
|
+
length: number
|
|
211
|
+
lineText: string
|
|
212
|
+
suggestion: string
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface OutputFile {
|
|
216
|
+
path: string
|
|
217
|
+
contents: Uint8Array
|
|
218
|
+
hash: string
|
|
219
|
+
/** "contents" as text (changes automatically with "contents") */
|
|
220
|
+
readonly text: string
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
interface BuildResult<ProvidedOptions extends BuildOptions = BuildOptions> {
|
|
224
|
+
errors: Message[]
|
|
225
|
+
warnings: Message[]
|
|
226
|
+
/** Only when "write: false" */
|
|
227
|
+
outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined)
|
|
228
|
+
/** Only when "metafile: true" */
|
|
229
|
+
metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined)
|
|
230
|
+
/** Only when "mangleCache" is present */
|
|
231
|
+
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
|
235
|
+
interface ServeOptions {
|
|
236
|
+
port?: number
|
|
237
|
+
host?: string
|
|
238
|
+
servedir?: string
|
|
239
|
+
keyfile?: string
|
|
240
|
+
certfile?: string
|
|
241
|
+
fallback?: string
|
|
242
|
+
cors?: CORSOptions
|
|
243
|
+
onRequest?: (args: ServeOnRequestArgs) => void
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Documentation: https://esbuild.github.io/api/#cors */
|
|
247
|
+
interface CORSOptions {
|
|
248
|
+
origin?: string | string[]
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
interface ServeOnRequestArgs {
|
|
252
|
+
remoteAddress: string
|
|
253
|
+
method: string
|
|
254
|
+
path: string
|
|
255
|
+
status: number
|
|
256
|
+
/** The time to generate the response, not to send it */
|
|
257
|
+
timeInMS: number
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
|
261
|
+
interface ServeResult {
|
|
262
|
+
port: number
|
|
263
|
+
hosts: string[]
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
interface TransformOptions extends CommonOptions {
|
|
267
|
+
/** Documentation: https://esbuild.github.io/api/#sourcefile */
|
|
268
|
+
sourcefile?: string
|
|
269
|
+
/** Documentation: https://esbuild.github.io/api/#loader */
|
|
270
|
+
loader?: Loader
|
|
271
|
+
/** Documentation: https://esbuild.github.io/api/#banner */
|
|
272
|
+
banner?: string
|
|
273
|
+
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
274
|
+
footer?: string
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
interface TransformResult<ProvidedOptions extends TransformOptions = TransformOptions> {
|
|
278
|
+
code: string
|
|
279
|
+
map: string
|
|
280
|
+
warnings: Message[]
|
|
281
|
+
/** Only when "mangleCache" is present */
|
|
282
|
+
mangleCache: Record<string, string | false> | (ProvidedOptions['mangleCache'] extends Object ? never : undefined)
|
|
283
|
+
/** Only when "legalComments" is "external" */
|
|
284
|
+
legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined)
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
interface Plugin {
|
|
288
|
+
name: string
|
|
289
|
+
setup: (build: PluginBuild) => (void | Promise<void>)
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
interface PluginBuild {
|
|
293
|
+
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
|
294
|
+
initialOptions: BuildOptions
|
|
295
|
+
|
|
296
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
|
297
|
+
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
|
298
|
+
|
|
299
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
|
300
|
+
onStart(callback: () =>
|
|
301
|
+
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
|
302
|
+
|
|
303
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
|
304
|
+
onEnd(callback: (result: BuildResult) =>
|
|
305
|
+
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
|
306
|
+
|
|
307
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
|
308
|
+
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
|
309
|
+
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
|
310
|
+
|
|
311
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
|
312
|
+
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
|
313
|
+
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
|
314
|
+
|
|
315
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
|
316
|
+
onDispose(callback: () => void): void
|
|
317
|
+
|
|
318
|
+
// This is a full copy of the esbuild library in case you need it
|
|
319
|
+
esbuild: {
|
|
320
|
+
context: typeof context,
|
|
321
|
+
build: typeof build,
|
|
322
|
+
buildSync: typeof buildSync,
|
|
323
|
+
transform: typeof transform,
|
|
324
|
+
transformSync: typeof transformSync,
|
|
325
|
+
formatMessages: typeof formatMessages,
|
|
326
|
+
formatMessagesSync: typeof formatMessagesSync,
|
|
327
|
+
analyzeMetafile: typeof analyzeMetafile,
|
|
328
|
+
analyzeMetafileSync: typeof analyzeMetafileSync,
|
|
329
|
+
initialize: typeof initialize,
|
|
330
|
+
version: typeof version,
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
|
335
|
+
interface ResolveOptions {
|
|
336
|
+
pluginName?: string
|
|
337
|
+
importer?: string
|
|
338
|
+
namespace?: string
|
|
339
|
+
resolveDir?: string
|
|
340
|
+
kind?: ImportKind
|
|
341
|
+
pluginData?: any
|
|
342
|
+
with?: Record<string, string>
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
|
346
|
+
interface ResolveResult {
|
|
347
|
+
errors: Message[]
|
|
348
|
+
warnings: Message[]
|
|
349
|
+
|
|
350
|
+
path: string
|
|
351
|
+
external: boolean
|
|
352
|
+
sideEffects: boolean
|
|
353
|
+
namespace: string
|
|
354
|
+
suffix: string
|
|
355
|
+
pluginData: any
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
interface OnStartResult {
|
|
359
|
+
errors?: PartialMessage[]
|
|
360
|
+
warnings?: PartialMessage[]
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
interface OnEndResult {
|
|
364
|
+
errors?: PartialMessage[]
|
|
365
|
+
warnings?: PartialMessage[]
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
|
369
|
+
interface OnResolveOptions {
|
|
370
|
+
filter: RegExp
|
|
371
|
+
namespace?: string
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
|
375
|
+
interface OnResolveArgs {
|
|
376
|
+
path: string
|
|
377
|
+
importer: string
|
|
378
|
+
namespace: string
|
|
379
|
+
resolveDir: string
|
|
380
|
+
kind: ImportKind
|
|
381
|
+
pluginData: any
|
|
382
|
+
with: Record<string, string>
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
type ImportKind =
|
|
386
|
+
| 'entry-point'
|
|
387
|
+
|
|
388
|
+
// JS
|
|
389
|
+
| 'import-statement'
|
|
390
|
+
| 'require-call'
|
|
391
|
+
| 'dynamic-import'
|
|
392
|
+
| 'require-resolve'
|
|
393
|
+
|
|
394
|
+
// CSS
|
|
395
|
+
| 'import-rule'
|
|
396
|
+
| 'composes-from'
|
|
397
|
+
| 'url-token'
|
|
398
|
+
|
|
399
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
|
400
|
+
interface OnResolveResult {
|
|
401
|
+
pluginName?: string
|
|
402
|
+
|
|
403
|
+
errors?: PartialMessage[]
|
|
404
|
+
warnings?: PartialMessage[]
|
|
405
|
+
|
|
406
|
+
path?: string
|
|
407
|
+
external?: boolean
|
|
408
|
+
sideEffects?: boolean
|
|
409
|
+
namespace?: string
|
|
410
|
+
suffix?: string
|
|
411
|
+
pluginData?: any
|
|
412
|
+
|
|
413
|
+
watchFiles?: string[]
|
|
414
|
+
watchDirs?: string[]
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
|
418
|
+
interface OnLoadOptions {
|
|
419
|
+
filter: RegExp
|
|
420
|
+
namespace?: string
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
|
424
|
+
interface OnLoadArgs {
|
|
425
|
+
path: string
|
|
426
|
+
namespace: string
|
|
427
|
+
suffix: string
|
|
428
|
+
pluginData: any
|
|
429
|
+
with: Record<string, string>
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
|
433
|
+
interface OnLoadResult {
|
|
434
|
+
pluginName?: string
|
|
435
|
+
|
|
436
|
+
errors?: PartialMessage[]
|
|
437
|
+
warnings?: PartialMessage[]
|
|
438
|
+
|
|
439
|
+
contents?: string | Uint8Array
|
|
440
|
+
resolveDir?: string
|
|
441
|
+
loader?: Loader
|
|
442
|
+
pluginData?: any
|
|
443
|
+
|
|
444
|
+
watchFiles?: string[]
|
|
445
|
+
watchDirs?: string[]
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
interface PartialMessage {
|
|
449
|
+
id?: string
|
|
450
|
+
pluginName?: string
|
|
451
|
+
text?: string
|
|
452
|
+
location?: Partial<Location> | null
|
|
453
|
+
notes?: PartialNote[]
|
|
454
|
+
detail?: any
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
interface PartialNote {
|
|
458
|
+
text?: string
|
|
459
|
+
location?: Partial<Location> | null
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
463
|
+
interface Metafile {
|
|
464
|
+
inputs: {
|
|
465
|
+
[path: string]: {
|
|
466
|
+
bytes: number
|
|
467
|
+
imports: {
|
|
468
|
+
path: string
|
|
469
|
+
kind: ImportKind
|
|
470
|
+
external?: boolean
|
|
471
|
+
original?: string
|
|
472
|
+
with?: Record<string, string>
|
|
473
|
+
}[]
|
|
474
|
+
format?: 'cjs' | 'esm'
|
|
475
|
+
with?: Record<string, string>
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
outputs: {
|
|
479
|
+
[path: string]: {
|
|
480
|
+
bytes: number
|
|
481
|
+
inputs: {
|
|
482
|
+
[path: string]: {
|
|
483
|
+
bytesInOutput: number
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
imports: {
|
|
487
|
+
path: string
|
|
488
|
+
kind: ImportKind | 'file-loader'
|
|
489
|
+
external?: boolean
|
|
490
|
+
}[]
|
|
491
|
+
exports: string[]
|
|
492
|
+
entryPoint?: string
|
|
493
|
+
cssBundle?: string
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
interface FormatMessagesOptions {
|
|
499
|
+
kind: 'error' | 'warning'
|
|
500
|
+
color?: boolean
|
|
501
|
+
terminalWidth?: number
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
interface AnalyzeMetafileOptions {
|
|
505
|
+
color?: boolean
|
|
506
|
+
verbose?: boolean
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/** Documentation: https://esbuild.github.io/api/#watch-arguments */
|
|
510
|
+
interface WatchOptions {
|
|
511
|
+
delay?: number // In milliseconds
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
interface BuildContext<ProvidedOptions extends BuildOptions = BuildOptions> {
|
|
515
|
+
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
|
516
|
+
rebuild(): Promise<BuildResult<ProvidedOptions>>
|
|
517
|
+
|
|
518
|
+
/** Documentation: https://esbuild.github.io/api/#watch */
|
|
519
|
+
watch(options?: WatchOptions): Promise<void>
|
|
520
|
+
|
|
521
|
+
/** Documentation: https://esbuild.github.io/api/#serve */
|
|
522
|
+
serve(options?: ServeOptions): Promise<ServeResult>
|
|
523
|
+
|
|
524
|
+
cancel(): Promise<void>
|
|
525
|
+
dispose(): Promise<void>
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
// This is a TypeScript type-level function which replaces any keys in "In"
|
|
529
|
+
// that aren't in "Out" with "never". We use this to reject properties with
|
|
530
|
+
// typos in object literals. See: https://stackoverflow.com/questions/49580725
|
|
531
|
+
type SameShape<Out, In extends Out> = In & { [Key in Exclude<keyof In, keyof Out>]: never }
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* This function invokes the "esbuild" command-line tool for you. It returns a
|
|
535
|
+
* promise that either resolves with a "BuildResult" object or rejects with a
|
|
536
|
+
* "BuildFailure" object.
|
|
537
|
+
*
|
|
538
|
+
* - Works in node: yes
|
|
539
|
+
* - Works in browser: yes
|
|
540
|
+
*
|
|
541
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
542
|
+
*/
|
|
543
|
+
declare function build<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildResult<T>>
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* This is the advanced long-running form of "build" that supports additional
|
|
547
|
+
* features such as watch mode and a local development server.
|
|
548
|
+
*
|
|
549
|
+
* - Works in node: yes
|
|
550
|
+
* - Works in browser: no
|
|
551
|
+
*
|
|
552
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
553
|
+
*/
|
|
554
|
+
declare function context<T extends BuildOptions>(options: SameShape<BuildOptions, T>): Promise<BuildContext<T>>
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* This function transforms a single JavaScript file. It can be used to minify
|
|
558
|
+
* JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript
|
|
559
|
+
* to older JavaScript. It returns a promise that is either resolved with a
|
|
560
|
+
* "TransformResult" object or rejected with a "TransformFailure" object.
|
|
561
|
+
*
|
|
562
|
+
* - Works in node: yes
|
|
563
|
+
* - Works in browser: yes
|
|
564
|
+
*
|
|
565
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
566
|
+
*/
|
|
567
|
+
declare function transform<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): Promise<TransformResult<T>>
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Converts log messages to formatted message strings suitable for printing in
|
|
571
|
+
* the terminal. This allows you to reuse the built-in behavior of esbuild's
|
|
572
|
+
* log message formatter. This is a batch-oriented API for efficiency.
|
|
573
|
+
*
|
|
574
|
+
* - Works in node: yes
|
|
575
|
+
* - Works in browser: yes
|
|
576
|
+
*/
|
|
577
|
+
declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
|
581
|
+
* convenience to be able to match esbuild's pretty-printing exactly. If you want
|
|
582
|
+
* to customize it, you can just inspect the data in the metafile yourself.
|
|
583
|
+
*
|
|
584
|
+
* - Works in node: yes
|
|
585
|
+
* - Works in browser: yes
|
|
586
|
+
*
|
|
587
|
+
* Documentation: https://esbuild.github.io/api/#analyze
|
|
588
|
+
*/
|
|
589
|
+
declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* A synchronous version of "build".
|
|
593
|
+
*
|
|
594
|
+
* - Works in node: yes
|
|
595
|
+
* - Works in browser: no
|
|
596
|
+
*
|
|
597
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
598
|
+
*/
|
|
599
|
+
declare function buildSync<T extends BuildOptions>(options: SameShape<BuildOptions, T>): BuildResult<T>
|
|
600
|
+
|
|
601
|
+
/**
|
|
602
|
+
* A synchronous version of "transform".
|
|
603
|
+
*
|
|
604
|
+
* - Works in node: yes
|
|
605
|
+
* - Works in browser: no
|
|
606
|
+
*
|
|
607
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
608
|
+
*/
|
|
609
|
+
declare function transformSync<T extends TransformOptions>(input: string | Uint8Array, options?: SameShape<TransformOptions, T>): TransformResult<T>
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* A synchronous version of "formatMessages".
|
|
613
|
+
*
|
|
614
|
+
* - Works in node: yes
|
|
615
|
+
* - Works in browser: no
|
|
616
|
+
*/
|
|
617
|
+
declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A synchronous version of "analyzeMetafile".
|
|
621
|
+
*
|
|
622
|
+
* - Works in node: yes
|
|
623
|
+
* - Works in browser: no
|
|
624
|
+
*
|
|
625
|
+
* Documentation: https://esbuild.github.io/api/#analyze
|
|
626
|
+
*/
|
|
627
|
+
declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* This configures the browser-based version of esbuild. It is necessary to
|
|
631
|
+
* call this first and wait for the returned promise to be resolved before
|
|
632
|
+
* making other API calls when using esbuild in the browser.
|
|
633
|
+
*
|
|
634
|
+
* - Works in node: yes
|
|
635
|
+
* - Works in browser: yes ("options" is required)
|
|
636
|
+
*
|
|
637
|
+
* Documentation: https://esbuild.github.io/api/#browser
|
|
638
|
+
*/
|
|
639
|
+
declare function initialize(options: InitializeOptions): Promise<void>
|
|
640
|
+
|
|
641
|
+
interface InitializeOptions {
|
|
642
|
+
/**
|
|
643
|
+
* The URL of the "esbuild.wasm" file. This must be provided when running
|
|
644
|
+
* esbuild in the browser.
|
|
645
|
+
*/
|
|
646
|
+
wasmURL?: string | URL
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* The result of calling "new WebAssembly.Module(buffer)" where "buffer"
|
|
650
|
+
* is a typed array or ArrayBuffer containing the binary code of the
|
|
651
|
+
* "esbuild.wasm" file.
|
|
652
|
+
*
|
|
653
|
+
* You can use this as an alternative to "wasmURL" for environments where it's
|
|
654
|
+
* not possible to download the WebAssembly module.
|
|
655
|
+
*/
|
|
656
|
+
wasmModule?: WebAssembly.Module
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* By default esbuild runs the WebAssembly-based browser API in a web worker
|
|
660
|
+
* to avoid blocking the UI thread. This can be disabled by setting "worker"
|
|
661
|
+
* to false.
|
|
662
|
+
*/
|
|
663
|
+
worker?: boolean
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
declare let version: string
|
|
667
|
+
|
|
668
|
+
// Note: These declarations exist to avoid type errors when you omit "dom" from
|
|
669
|
+
// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
|
|
670
|
+
// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
|
|
671
|
+
// with the browser DOM and is present in many non-browser JavaScript runtimes
|
|
672
|
+
// (e.g. node and deno). Declaring it here allows esbuild's API to be used in
|
|
673
|
+
// these scenarios.
|
|
674
|
+
//
|
|
675
|
+
// There's an open issue about getting this problem corrected (although these
|
|
676
|
+
// declarations will need to remain even if this is fixed for backward
|
|
677
|
+
// compatibility with older TypeScript versions):
|
|
678
|
+
//
|
|
679
|
+
// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826
|
|
680
|
+
//
|
|
681
|
+
declare global {
|
|
682
|
+
namespace WebAssembly {
|
|
683
|
+
interface Module {
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
interface URL {
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
// packages/core/config/functions/index.d.ts
|
|
691
|
+
/**
|
|
692
|
+
* @fileoverview Type Definitions for esbuild Configuration
|
|
693
|
+
* @description TypeScript type definitions for esbuild configuration used in Firebase and Vercel function builds.
|
|
694
|
+
*
|
|
695
|
+
* @version 0.0.1
|
|
696
|
+
* @since 0.0.1
|
|
697
|
+
* @author AMBROISE PARK Consulting
|
|
698
|
+
*/
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Esbuild configuration options
|
|
704
|
+
*
|
|
705
|
+
* @version 0.0.1
|
|
706
|
+
* @since 0.0.1
|
|
707
|
+
* @author AMBROISE PARK Consulting
|
|
708
|
+
*/
|
|
709
|
+
interface EsbuildOptions {
|
|
710
|
+
entry?: string;
|
|
711
|
+
outDir?: string;
|
|
712
|
+
minify?: boolean;
|
|
713
|
+
sourcemap?: boolean;
|
|
714
|
+
platform?: 'firebase' | 'vercel' | 'framework';
|
|
715
|
+
bundleWorkspaceDeps?: boolean;
|
|
716
|
+
importFramework?: boolean;
|
|
717
|
+
external?: boolean;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Create esbuild configuration for functions
|
|
722
|
+
*
|
|
723
|
+
* @version 0.0.1
|
|
724
|
+
* @since 0.0.1
|
|
725
|
+
* @author AMBROISE PARK Consulting
|
|
726
|
+
*/
|
|
727
|
+
declare function createFunctionsEsbuildConfig(
|
|
728
|
+
options?: EsbuildOptions
|
|
729
|
+
): BuildOptions;
|
|
730
|
+
/**
|
|
731
|
+
* Create root functions esbuild configuration
|
|
732
|
+
*
|
|
733
|
+
* @version 0.0.1
|
|
734
|
+
* @since 0.0.1
|
|
735
|
+
* @author AMBROISE PARK Consulting
|
|
736
|
+
*/
|
|
737
|
+
declare function createRootFunctionsConfig(
|
|
738
|
+
options?: EsbuildOptions
|
|
739
|
+
): BuildOptions;
|
|
740
|
+
/**
|
|
741
|
+
* Create app functions esbuild configuration
|
|
742
|
+
*
|
|
743
|
+
* @version 0.0.1
|
|
744
|
+
* @since 0.0.1
|
|
745
|
+
* @author AMBROISE PARK Consulting
|
|
746
|
+
*/
|
|
747
|
+
declare function createAppFunctionsConfig(
|
|
748
|
+
options?: EsbuildOptions
|
|
749
|
+
): BuildOptions;
|
|
750
|
+
|
|
751
|
+
export { createAppFunctionsConfig, createFunctionsEsbuildConfig, createRootFunctionsConfig };
|
|
752
|
+
export type { EsbuildOptions };
|