esbuild 0.15.18 → 0.17.2
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/bin/esbuild +33 -25
- package/install.js +70 -30
- package/lib/main.d.ts +274 -243
- package/lib/main.js +410 -350
- package/package.json +23 -23
package/lib/main.d.ts
CHANGED
|
@@ -1,254 +1,235 @@
|
|
|
1
|
-
export type Platform = 'browser' | 'node' | 'neutral'
|
|
2
|
-
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
|
-
export type Loader = '
|
|
4
|
-
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
-
export type Charset = 'ascii' | 'utf8'
|
|
6
|
-
export type Drop = 'console' | 'debugger'
|
|
1
|
+
export type Platform = 'browser' | 'node' | 'neutral'
|
|
2
|
+
export type Format = 'iife' | 'cjs' | 'esm'
|
|
3
|
+
export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'text' | 'ts' | 'tsx'
|
|
4
|
+
export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'
|
|
5
|
+
export type Charset = 'ascii' | 'utf8'
|
|
6
|
+
export type Drop = 'console' | 'debugger'
|
|
7
7
|
|
|
8
8
|
interface CommonOptions {
|
|
9
9
|
/** Documentation: https://esbuild.github.io/api/#sourcemap */
|
|
10
|
-
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
|
10
|
+
sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'
|
|
11
11
|
/** Documentation: https://esbuild.github.io/api/#legal-comments */
|
|
12
|
-
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
|
12
|
+
legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'
|
|
13
13
|
/** Documentation: https://esbuild.github.io/api/#source-root */
|
|
14
|
-
sourceRoot?: string
|
|
14
|
+
sourceRoot?: string
|
|
15
15
|
/** Documentation: https://esbuild.github.io/api/#sources-content */
|
|
16
|
-
sourcesContent?: boolean
|
|
16
|
+
sourcesContent?: boolean
|
|
17
17
|
|
|
18
18
|
/** Documentation: https://esbuild.github.io/api/#format */
|
|
19
|
-
format?: Format
|
|
19
|
+
format?: Format
|
|
20
20
|
/** Documentation: https://esbuild.github.io/api/#global-name */
|
|
21
|
-
globalName?: string
|
|
21
|
+
globalName?: string
|
|
22
22
|
/** Documentation: https://esbuild.github.io/api/#target */
|
|
23
|
-
target?: string | string[]
|
|
23
|
+
target?: string | string[]
|
|
24
24
|
/** Documentation: https://esbuild.github.io/api/#supported */
|
|
25
|
-
supported?: Record<string, boolean
|
|
25
|
+
supported?: Record<string, boolean>
|
|
26
26
|
/** Documentation: https://esbuild.github.io/api/#platform */
|
|
27
|
-
platform?: Platform
|
|
27
|
+
platform?: Platform
|
|
28
28
|
|
|
29
29
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
30
|
-
mangleProps?: RegExp
|
|
30
|
+
mangleProps?: RegExp
|
|
31
31
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
32
|
-
reserveProps?: RegExp
|
|
32
|
+
reserveProps?: RegExp
|
|
33
33
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
34
|
-
mangleQuoted?: boolean
|
|
34
|
+
mangleQuoted?: boolean
|
|
35
35
|
/** Documentation: https://esbuild.github.io/api/#mangle-props */
|
|
36
|
-
mangleCache?: Record<string, string | false
|
|
36
|
+
mangleCache?: Record<string, string | false>
|
|
37
37
|
/** Documentation: https://esbuild.github.io/api/#drop */
|
|
38
|
-
drop?: Drop[]
|
|
38
|
+
drop?: Drop[]
|
|
39
39
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
40
|
-
minify?: boolean
|
|
40
|
+
minify?: boolean
|
|
41
41
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
42
|
-
minifyWhitespace?: boolean
|
|
42
|
+
minifyWhitespace?: boolean
|
|
43
43
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
44
|
-
minifyIdentifiers?: boolean
|
|
44
|
+
minifyIdentifiers?: boolean
|
|
45
45
|
/** Documentation: https://esbuild.github.io/api/#minify */
|
|
46
|
-
minifySyntax?: boolean
|
|
46
|
+
minifySyntax?: boolean
|
|
47
47
|
/** Documentation: https://esbuild.github.io/api/#charset */
|
|
48
|
-
charset?: Charset
|
|
48
|
+
charset?: Charset
|
|
49
49
|
/** Documentation: https://esbuild.github.io/api/#tree-shaking */
|
|
50
|
-
treeShaking?: boolean
|
|
50
|
+
treeShaking?: boolean
|
|
51
51
|
/** Documentation: https://esbuild.github.io/api/#ignore-annotations */
|
|
52
|
-
ignoreAnnotations?: boolean
|
|
52
|
+
ignoreAnnotations?: boolean
|
|
53
53
|
|
|
54
54
|
/** Documentation: https://esbuild.github.io/api/#jsx */
|
|
55
|
-
jsx?: 'transform' | 'preserve' | 'automatic'
|
|
55
|
+
jsx?: 'transform' | 'preserve' | 'automatic'
|
|
56
56
|
/** Documentation: https://esbuild.github.io/api/#jsx-factory */
|
|
57
|
-
jsxFactory?: string
|
|
57
|
+
jsxFactory?: string
|
|
58
58
|
/** Documentation: https://esbuild.github.io/api/#jsx-fragment */
|
|
59
|
-
jsxFragment?: string
|
|
59
|
+
jsxFragment?: string
|
|
60
60
|
/** Documentation: https://esbuild.github.io/api/#jsx-import-source */
|
|
61
|
-
jsxImportSource?: string
|
|
61
|
+
jsxImportSource?: string
|
|
62
62
|
/** Documentation: https://esbuild.github.io/api/#jsx-development */
|
|
63
|
-
jsxDev?: boolean
|
|
63
|
+
jsxDev?: boolean
|
|
64
64
|
/** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
|
|
65
|
-
jsxSideEffects?: boolean
|
|
65
|
+
jsxSideEffects?: boolean
|
|
66
66
|
|
|
67
67
|
/** Documentation: https://esbuild.github.io/api/#define */
|
|
68
|
-
define?: { [key: string]: string }
|
|
68
|
+
define?: { [key: string]: string }
|
|
69
69
|
/** Documentation: https://esbuild.github.io/api/#pure */
|
|
70
|
-
pure?: string[]
|
|
70
|
+
pure?: string[]
|
|
71
71
|
/** Documentation: https://esbuild.github.io/api/#keep-names */
|
|
72
|
-
keepNames?: boolean
|
|
72
|
+
keepNames?: boolean
|
|
73
73
|
|
|
74
74
|
/** Documentation: https://esbuild.github.io/api/#color */
|
|
75
|
-
color?: boolean
|
|
75
|
+
color?: boolean
|
|
76
76
|
/** Documentation: https://esbuild.github.io/api/#log-level */
|
|
77
|
-
logLevel?: LogLevel
|
|
77
|
+
logLevel?: LogLevel
|
|
78
78
|
/** Documentation: https://esbuild.github.io/api/#log-limit */
|
|
79
|
-
logLimit?: number
|
|
79
|
+
logLimit?: number
|
|
80
80
|
/** Documentation: https://esbuild.github.io/api/#log-override */
|
|
81
|
-
logOverride?: Record<string, LogLevel
|
|
81
|
+
logOverride?: Record<string, LogLevel>
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export interface BuildOptions extends CommonOptions {
|
|
85
85
|
/** Documentation: https://esbuild.github.io/api/#bundle */
|
|
86
|
-
bundle?: boolean
|
|
86
|
+
bundle?: boolean
|
|
87
87
|
/** Documentation: https://esbuild.github.io/api/#splitting */
|
|
88
|
-
splitting?: boolean
|
|
88
|
+
splitting?: boolean
|
|
89
89
|
/** Documentation: https://esbuild.github.io/api/#preserve-symlinks */
|
|
90
|
-
preserveSymlinks?: boolean
|
|
90
|
+
preserveSymlinks?: boolean
|
|
91
91
|
/** Documentation: https://esbuild.github.io/api/#outfile */
|
|
92
|
-
outfile?: string
|
|
92
|
+
outfile?: string
|
|
93
93
|
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
94
|
-
metafile?: boolean
|
|
94
|
+
metafile?: boolean
|
|
95
95
|
/** Documentation: https://esbuild.github.io/api/#outdir */
|
|
96
|
-
outdir?: string
|
|
96
|
+
outdir?: string
|
|
97
97
|
/** Documentation: https://esbuild.github.io/api/#outbase */
|
|
98
|
-
outbase?: string
|
|
98
|
+
outbase?: string
|
|
99
99
|
/** Documentation: https://esbuild.github.io/api/#external */
|
|
100
|
-
external?: string[]
|
|
100
|
+
external?: string[]
|
|
101
|
+
/** Documentation: https://esbuild.github.io/api/#packages */
|
|
102
|
+
packages?: 'external'
|
|
101
103
|
/** Documentation: https://esbuild.github.io/api/#alias */
|
|
102
|
-
alias?: Record<string, string
|
|
104
|
+
alias?: Record<string, string>
|
|
103
105
|
/** Documentation: https://esbuild.github.io/api/#loader */
|
|
104
|
-
loader?: { [ext: string]: Loader }
|
|
106
|
+
loader?: { [ext: string]: Loader }
|
|
105
107
|
/** Documentation: https://esbuild.github.io/api/#resolve-extensions */
|
|
106
|
-
resolveExtensions?: string[]
|
|
108
|
+
resolveExtensions?: string[]
|
|
107
109
|
/** Documentation: https://esbuild.github.io/api/#main-fields */
|
|
108
|
-
mainFields?: string[]
|
|
110
|
+
mainFields?: string[]
|
|
109
111
|
/** Documentation: https://esbuild.github.io/api/#conditions */
|
|
110
|
-
conditions?: string[]
|
|
112
|
+
conditions?: string[]
|
|
111
113
|
/** Documentation: https://esbuild.github.io/api/#write */
|
|
112
|
-
write?: boolean
|
|
114
|
+
write?: boolean
|
|
113
115
|
/** Documentation: https://esbuild.github.io/api/#allow-overwrite */
|
|
114
|
-
allowOverwrite?: boolean
|
|
116
|
+
allowOverwrite?: boolean
|
|
115
117
|
/** Documentation: https://esbuild.github.io/api/#tsconfig */
|
|
116
|
-
tsconfig?: string
|
|
118
|
+
tsconfig?: string
|
|
117
119
|
/** Documentation: https://esbuild.github.io/api/#out-extension */
|
|
118
|
-
outExtension?: { [ext: string]: string }
|
|
120
|
+
outExtension?: { [ext: string]: string }
|
|
119
121
|
/** Documentation: https://esbuild.github.io/api/#public-path */
|
|
120
|
-
publicPath?: string
|
|
122
|
+
publicPath?: string
|
|
121
123
|
/** Documentation: https://esbuild.github.io/api/#entry-names */
|
|
122
|
-
entryNames?: string
|
|
124
|
+
entryNames?: string
|
|
123
125
|
/** Documentation: https://esbuild.github.io/api/#chunk-names */
|
|
124
|
-
chunkNames?: string
|
|
126
|
+
chunkNames?: string
|
|
125
127
|
/** Documentation: https://esbuild.github.io/api/#asset-names */
|
|
126
|
-
assetNames?: string
|
|
128
|
+
assetNames?: string
|
|
127
129
|
/** Documentation: https://esbuild.github.io/api/#inject */
|
|
128
|
-
inject?: string[]
|
|
130
|
+
inject?: string[]
|
|
129
131
|
/** Documentation: https://esbuild.github.io/api/#banner */
|
|
130
|
-
banner?: { [type: string]: string }
|
|
132
|
+
banner?: { [type: string]: string }
|
|
131
133
|
/** Documentation: https://esbuild.github.io/api/#footer */
|
|
132
|
-
footer?: { [type: string]: string }
|
|
133
|
-
/** Documentation: https://esbuild.github.io/api/#incremental */
|
|
134
|
-
incremental?: boolean;
|
|
134
|
+
footer?: { [type: string]: string }
|
|
135
135
|
/** Documentation: https://esbuild.github.io/api/#entry-points */
|
|
136
|
-
entryPoints?: string[] | Record<string, string
|
|
136
|
+
entryPoints?: string[] | Record<string, string> | { in: string, out: string }[]
|
|
137
137
|
/** Documentation: https://esbuild.github.io/api/#stdin */
|
|
138
|
-
stdin?: StdinOptions
|
|
138
|
+
stdin?: StdinOptions
|
|
139
139
|
/** Documentation: https://esbuild.github.io/plugins/ */
|
|
140
|
-
plugins?: Plugin[]
|
|
140
|
+
plugins?: Plugin[]
|
|
141
141
|
/** Documentation: https://esbuild.github.io/api/#working-directory */
|
|
142
|
-
absWorkingDir?: string
|
|
142
|
+
absWorkingDir?: string
|
|
143
143
|
/** Documentation: https://esbuild.github.io/api/#node-paths */
|
|
144
144
|
nodePaths?: string[]; // The "NODE_PATH" variable from Node.js
|
|
145
|
-
/** Documentation: https://esbuild.github.io/api/#watch */
|
|
146
|
-
watch?: boolean | WatchMode;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface WatchMode {
|
|
150
|
-
onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void;
|
|
151
145
|
}
|
|
152
146
|
|
|
153
147
|
export interface StdinOptions {
|
|
154
|
-
contents: string | Uint8Array
|
|
155
|
-
resolveDir?: string
|
|
156
|
-
sourcefile?: string
|
|
157
|
-
loader?: Loader
|
|
148
|
+
contents: string | Uint8Array
|
|
149
|
+
resolveDir?: string
|
|
150
|
+
sourcefile?: string
|
|
151
|
+
loader?: Loader
|
|
158
152
|
}
|
|
159
153
|
|
|
160
154
|
export interface Message {
|
|
161
|
-
id: string
|
|
162
|
-
pluginName: string
|
|
163
|
-
text: string
|
|
164
|
-
location: Location | null
|
|
165
|
-
notes: Note[]
|
|
155
|
+
id: string
|
|
156
|
+
pluginName: string
|
|
157
|
+
text: string
|
|
158
|
+
location: Location | null
|
|
159
|
+
notes: Note[]
|
|
166
160
|
|
|
167
161
|
/**
|
|
168
162
|
* Optional user-specified data that is passed through unmodified. You can
|
|
169
163
|
* use this to stash the original error, for example.
|
|
170
164
|
*/
|
|
171
|
-
detail: any
|
|
165
|
+
detail: any
|
|
172
166
|
}
|
|
173
167
|
|
|
174
168
|
export interface Note {
|
|
175
|
-
text: string
|
|
176
|
-
location: Location | null
|
|
169
|
+
text: string
|
|
170
|
+
location: Location | null
|
|
177
171
|
}
|
|
178
172
|
|
|
179
173
|
export interface Location {
|
|
180
|
-
file: string
|
|
181
|
-
namespace: string
|
|
174
|
+
file: string
|
|
175
|
+
namespace: string
|
|
182
176
|
/** 1-based */
|
|
183
|
-
line: number
|
|
177
|
+
line: number
|
|
184
178
|
/** 0-based, in bytes */
|
|
185
|
-
column: number
|
|
179
|
+
column: number
|
|
186
180
|
/** in bytes */
|
|
187
|
-
length: number
|
|
188
|
-
lineText: string
|
|
189
|
-
suggestion: string
|
|
181
|
+
length: number
|
|
182
|
+
lineText: string
|
|
183
|
+
suggestion: string
|
|
190
184
|
}
|
|
191
185
|
|
|
192
186
|
export interface OutputFile {
|
|
193
|
-
path: string
|
|
187
|
+
path: string
|
|
194
188
|
/** "text" as bytes */
|
|
195
|
-
contents: Uint8Array
|
|
196
|
-
/** "contents" as text */
|
|
197
|
-
text: string
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface BuildInvalidate {
|
|
201
|
-
(): Promise<BuildIncremental>;
|
|
202
|
-
dispose(): void;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface BuildIncremental extends BuildResult {
|
|
206
|
-
rebuild: BuildInvalidate;
|
|
189
|
+
contents: Uint8Array
|
|
190
|
+
/** "contents" as text (changes automatically with "contents") */
|
|
191
|
+
readonly text: string
|
|
207
192
|
}
|
|
208
193
|
|
|
209
|
-
export interface BuildResult {
|
|
210
|
-
errors: Message[]
|
|
211
|
-
warnings: Message[]
|
|
194
|
+
export interface BuildResult<SpecificOptions extends BuildOptions = BuildOptions> {
|
|
195
|
+
errors: Message[]
|
|
196
|
+
warnings: Message[]
|
|
212
197
|
/** Only when "write: false" */
|
|
213
|
-
outputFiles
|
|
214
|
-
/** Only when "incremental: true" */
|
|
215
|
-
rebuild?: BuildInvalidate;
|
|
216
|
-
/** Only when "watch: true" */
|
|
217
|
-
stop?: () => void;
|
|
198
|
+
outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined)
|
|
218
199
|
/** Only when "metafile: true" */
|
|
219
|
-
metafile
|
|
200
|
+
metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined)
|
|
220
201
|
/** Only when "mangleCache" is present */
|
|
221
|
-
mangleCache
|
|
202
|
+
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
222
203
|
}
|
|
223
204
|
|
|
224
205
|
export interface BuildFailure extends Error {
|
|
225
|
-
errors: Message[]
|
|
226
|
-
warnings: Message[]
|
|
206
|
+
errors: Message[]
|
|
207
|
+
warnings: Message[]
|
|
227
208
|
}
|
|
228
209
|
|
|
229
210
|
/** Documentation: https://esbuild.github.io/api/#serve-arguments */
|
|
230
211
|
export interface ServeOptions {
|
|
231
|
-
port?: number
|
|
232
|
-
host?: string
|
|
233
|
-
servedir?: string
|
|
234
|
-
|
|
212
|
+
port?: number
|
|
213
|
+
host?: string
|
|
214
|
+
servedir?: string
|
|
215
|
+
keyfile?: string
|
|
216
|
+
certfile?: string
|
|
217
|
+
onRequest?: (args: ServeOnRequestArgs) => void
|
|
235
218
|
}
|
|
236
219
|
|
|
237
220
|
export interface ServeOnRequestArgs {
|
|
238
|
-
remoteAddress: string
|
|
239
|
-
method: string
|
|
240
|
-
path: string
|
|
241
|
-
status: number
|
|
221
|
+
remoteAddress: string
|
|
222
|
+
method: string
|
|
223
|
+
path: string
|
|
224
|
+
status: number
|
|
242
225
|
/** The time to generate the response, not to send it */
|
|
243
|
-
timeInMS: number
|
|
226
|
+
timeInMS: number
|
|
244
227
|
}
|
|
245
228
|
|
|
246
229
|
/** Documentation: https://esbuild.github.io/api/#serve-return-values */
|
|
247
230
|
export interface ServeResult {
|
|
248
|
-
port: number
|
|
249
|
-
host: string
|
|
250
|
-
wait: Promise<void>;
|
|
251
|
-
stop: () => void;
|
|
231
|
+
port: number
|
|
232
|
+
host: string
|
|
252
233
|
}
|
|
253
234
|
|
|
254
235
|
export interface TransformOptions extends CommonOptions {
|
|
@@ -264,48 +245,63 @@ export interface TransformOptions extends CommonOptions {
|
|
|
264
245
|
target?: string,
|
|
265
246
|
useDefineForClassFields?: boolean,
|
|
266
247
|
},
|
|
267
|
-
}
|
|
248
|
+
}
|
|
268
249
|
|
|
269
|
-
sourcefile?: string
|
|
270
|
-
loader?: Loader
|
|
271
|
-
banner?: string
|
|
272
|
-
footer?: string
|
|
250
|
+
sourcefile?: string
|
|
251
|
+
loader?: Loader
|
|
252
|
+
banner?: string
|
|
253
|
+
footer?: string
|
|
273
254
|
}
|
|
274
255
|
|
|
275
|
-
export interface TransformResult {
|
|
276
|
-
code: string
|
|
277
|
-
map: string
|
|
278
|
-
warnings: Message[]
|
|
256
|
+
export interface TransformResult<SpecificOptions extends TransformOptions = TransformOptions> {
|
|
257
|
+
code: string
|
|
258
|
+
map: string
|
|
259
|
+
warnings: Message[]
|
|
279
260
|
/** Only when "mangleCache" is present */
|
|
280
|
-
mangleCache
|
|
261
|
+
mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
|
|
262
|
+
/** Only when "legalComments" is "external" */
|
|
263
|
+
legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined)
|
|
281
264
|
}
|
|
282
265
|
|
|
283
266
|
export interface TransformFailure extends Error {
|
|
284
|
-
errors: Message[]
|
|
285
|
-
warnings: Message[]
|
|
267
|
+
errors: Message[]
|
|
268
|
+
warnings: Message[]
|
|
286
269
|
}
|
|
287
270
|
|
|
288
271
|
export interface Plugin {
|
|
289
|
-
name: string
|
|
290
|
-
setup: (build: PluginBuild) => (void | Promise<void>)
|
|
272
|
+
name: string
|
|
273
|
+
setup: (build: PluginBuild) => (void | Promise<void>)
|
|
291
274
|
}
|
|
292
275
|
|
|
293
276
|
export interface PluginBuild {
|
|
294
|
-
|
|
295
|
-
|
|
277
|
+
/** Documentation: https://esbuild.github.io/plugins/#build-options */
|
|
278
|
+
initialOptions: BuildOptions
|
|
279
|
+
|
|
280
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve */
|
|
281
|
+
resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>
|
|
296
282
|
|
|
283
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-start */
|
|
297
284
|
onStart(callback: () =>
|
|
298
|
-
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
|
285
|
+
(OnStartResult | null | void | Promise<OnStartResult | null | void>)): void
|
|
286
|
+
|
|
287
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-end */
|
|
299
288
|
onEnd(callback: (result: BuildResult) =>
|
|
300
|
-
(void | Promise<void>)): void
|
|
289
|
+
(OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
|
|
290
|
+
|
|
291
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve */
|
|
301
292
|
onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
|
|
302
|
-
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
|
293
|
+
(OnResolveResult | null | undefined | Promise<OnResolveResult | null | undefined>)): void
|
|
294
|
+
|
|
295
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load */
|
|
303
296
|
onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
|
|
304
|
-
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
|
297
|
+
(OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
|
|
298
|
+
|
|
299
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-dispose */
|
|
300
|
+
onDispose(callback: () => void): void
|
|
305
301
|
|
|
306
302
|
// This is a full copy of the esbuild library in case you need it
|
|
307
303
|
esbuild: {
|
|
308
|
-
|
|
304
|
+
context: typeof context,
|
|
309
305
|
build: typeof build,
|
|
310
306
|
buildSync: typeof buildSync,
|
|
311
307
|
transform: typeof transform,
|
|
@@ -316,47 +312,56 @@ export interface PluginBuild {
|
|
|
316
312
|
analyzeMetafileSync: typeof analyzeMetafileSync,
|
|
317
313
|
initialize: typeof initialize,
|
|
318
314
|
version: typeof version,
|
|
319
|
-
}
|
|
315
|
+
}
|
|
320
316
|
}
|
|
321
317
|
|
|
318
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-options */
|
|
322
319
|
export interface ResolveOptions {
|
|
323
|
-
pluginName?: string
|
|
324
|
-
importer?: string
|
|
325
|
-
namespace?: string
|
|
326
|
-
resolveDir?: string
|
|
327
|
-
kind?: ImportKind
|
|
328
|
-
pluginData?: any
|
|
320
|
+
pluginName?: string
|
|
321
|
+
importer?: string
|
|
322
|
+
namespace?: string
|
|
323
|
+
resolveDir?: string
|
|
324
|
+
kind?: ImportKind
|
|
325
|
+
pluginData?: any
|
|
329
326
|
}
|
|
330
327
|
|
|
328
|
+
/** Documentation: https://esbuild.github.io/plugins/#resolve-results */
|
|
331
329
|
export interface ResolveResult {
|
|
332
|
-
errors: Message[]
|
|
333
|
-
warnings: Message[]
|
|
330
|
+
errors: Message[]
|
|
331
|
+
warnings: Message[]
|
|
334
332
|
|
|
335
|
-
path: string
|
|
336
|
-
external: boolean
|
|
337
|
-
sideEffects: boolean
|
|
338
|
-
namespace: string
|
|
339
|
-
suffix: string
|
|
340
|
-
pluginData: any
|
|
333
|
+
path: string
|
|
334
|
+
external: boolean
|
|
335
|
+
sideEffects: boolean
|
|
336
|
+
namespace: string
|
|
337
|
+
suffix: string
|
|
338
|
+
pluginData: any
|
|
341
339
|
}
|
|
342
340
|
|
|
343
341
|
export interface OnStartResult {
|
|
344
|
-
errors?: PartialMessage[]
|
|
345
|
-
warnings?: PartialMessage[]
|
|
342
|
+
errors?: PartialMessage[]
|
|
343
|
+
warnings?: PartialMessage[]
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface OnEndResult {
|
|
347
|
+
errors?: PartialMessage[]
|
|
348
|
+
warnings?: PartialMessage[]
|
|
346
349
|
}
|
|
347
350
|
|
|
351
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
|
|
348
352
|
export interface OnResolveOptions {
|
|
349
|
-
filter: RegExp
|
|
350
|
-
namespace?: string
|
|
353
|
+
filter: RegExp
|
|
354
|
+
namespace?: string
|
|
351
355
|
}
|
|
352
356
|
|
|
357
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
|
|
353
358
|
export interface OnResolveArgs {
|
|
354
|
-
path: string
|
|
355
|
-
importer: string
|
|
356
|
-
namespace: string
|
|
357
|
-
resolveDir: string
|
|
358
|
-
kind: ImportKind
|
|
359
|
-
pluginData: any
|
|
359
|
+
path: string
|
|
360
|
+
importer: string
|
|
361
|
+
namespace: string
|
|
362
|
+
resolveDir: string
|
|
363
|
+
kind: ImportKind
|
|
364
|
+
pluginData: any
|
|
360
365
|
}
|
|
361
366
|
|
|
362
367
|
export type ImportKind =
|
|
@@ -372,64 +377,69 @@ export type ImportKind =
|
|
|
372
377
|
| 'import-rule'
|
|
373
378
|
| 'url-token'
|
|
374
379
|
|
|
380
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
|
|
375
381
|
export interface OnResolveResult {
|
|
376
|
-
pluginName?: string
|
|
382
|
+
pluginName?: string
|
|
377
383
|
|
|
378
|
-
errors?: PartialMessage[]
|
|
379
|
-
warnings?: PartialMessage[]
|
|
384
|
+
errors?: PartialMessage[]
|
|
385
|
+
warnings?: PartialMessage[]
|
|
380
386
|
|
|
381
|
-
path?: string
|
|
382
|
-
external?: boolean
|
|
383
|
-
sideEffects?: boolean
|
|
384
|
-
namespace?: string
|
|
385
|
-
suffix?: string
|
|
386
|
-
pluginData?: any
|
|
387
|
+
path?: string
|
|
388
|
+
external?: boolean
|
|
389
|
+
sideEffects?: boolean
|
|
390
|
+
namespace?: string
|
|
391
|
+
suffix?: string
|
|
392
|
+
pluginData?: any
|
|
387
393
|
|
|
388
|
-
watchFiles?: string[]
|
|
389
|
-
watchDirs?: string[]
|
|
394
|
+
watchFiles?: string[]
|
|
395
|
+
watchDirs?: string[]
|
|
390
396
|
}
|
|
391
397
|
|
|
398
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-options */
|
|
392
399
|
export interface OnLoadOptions {
|
|
393
|
-
filter: RegExp
|
|
394
|
-
namespace?: string
|
|
400
|
+
filter: RegExp
|
|
401
|
+
namespace?: string
|
|
395
402
|
}
|
|
396
403
|
|
|
404
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
|
|
397
405
|
export interface OnLoadArgs {
|
|
398
|
-
path: string
|
|
399
|
-
namespace: string
|
|
400
|
-
suffix: string
|
|
401
|
-
pluginData: any
|
|
406
|
+
path: string
|
|
407
|
+
namespace: string
|
|
408
|
+
suffix: string
|
|
409
|
+
pluginData: any
|
|
402
410
|
}
|
|
403
411
|
|
|
412
|
+
/** Documentation: https://esbuild.github.io/plugins/#on-load-results */
|
|
404
413
|
export interface OnLoadResult {
|
|
405
|
-
pluginName?: string
|
|
414
|
+
pluginName?: string
|
|
406
415
|
|
|
407
|
-
errors?: PartialMessage[]
|
|
408
|
-
warnings?: PartialMessage[]
|
|
416
|
+
errors?: PartialMessage[]
|
|
417
|
+
warnings?: PartialMessage[]
|
|
409
418
|
|
|
410
|
-
contents?: string | Uint8Array
|
|
411
|
-
resolveDir?: string
|
|
412
|
-
loader?: Loader
|
|
413
|
-
pluginData?: any
|
|
419
|
+
contents?: string | Uint8Array
|
|
420
|
+
resolveDir?: string
|
|
421
|
+
loader?: Loader
|
|
422
|
+
pluginData?: any
|
|
414
423
|
|
|
415
|
-
watchFiles?: string[]
|
|
416
|
-
watchDirs?: string[]
|
|
424
|
+
watchFiles?: string[]
|
|
425
|
+
watchDirs?: string[]
|
|
417
426
|
}
|
|
418
427
|
|
|
419
428
|
export interface PartialMessage {
|
|
420
|
-
id?: string
|
|
421
|
-
pluginName?: string
|
|
422
|
-
text?: string
|
|
423
|
-
location?: Partial<Location> | null
|
|
424
|
-
notes?: PartialNote[]
|
|
425
|
-
detail?: any
|
|
429
|
+
id?: string
|
|
430
|
+
pluginName?: string
|
|
431
|
+
text?: string
|
|
432
|
+
location?: Partial<Location> | null
|
|
433
|
+
notes?: PartialNote[]
|
|
434
|
+
detail?: any
|
|
426
435
|
}
|
|
427
436
|
|
|
428
437
|
export interface PartialNote {
|
|
429
|
-
text?: string
|
|
430
|
-
location?: Partial<Location> | null
|
|
438
|
+
text?: string
|
|
439
|
+
location?: Partial<Location> | null
|
|
431
440
|
}
|
|
432
441
|
|
|
442
|
+
/** Documentation: https://esbuild.github.io/api/#metafile */
|
|
433
443
|
export interface Metafile {
|
|
434
444
|
inputs: {
|
|
435
445
|
[path: string]: {
|
|
@@ -437,7 +447,10 @@ export interface Metafile {
|
|
|
437
447
|
imports: {
|
|
438
448
|
path: string
|
|
439
449
|
kind: ImportKind
|
|
450
|
+
external?: boolean
|
|
451
|
+
original?: string
|
|
440
452
|
}[]
|
|
453
|
+
format?: 'cjs' | 'esm'
|
|
441
454
|
}
|
|
442
455
|
}
|
|
443
456
|
outputs: {
|
|
@@ -450,7 +463,8 @@ export interface Metafile {
|
|
|
450
463
|
}
|
|
451
464
|
imports: {
|
|
452
465
|
path: string
|
|
453
|
-
kind: ImportKind
|
|
466
|
+
kind: ImportKind | 'file-loader'
|
|
467
|
+
external?: boolean
|
|
454
468
|
}[]
|
|
455
469
|
exports: string[]
|
|
456
470
|
entryPoint?: string
|
|
@@ -460,14 +474,31 @@ export interface Metafile {
|
|
|
460
474
|
}
|
|
461
475
|
|
|
462
476
|
export interface FormatMessagesOptions {
|
|
463
|
-
kind: 'error' | 'warning'
|
|
464
|
-
color?: boolean
|
|
465
|
-
terminalWidth?: number
|
|
477
|
+
kind: 'error' | 'warning'
|
|
478
|
+
color?: boolean
|
|
479
|
+
terminalWidth?: number
|
|
466
480
|
}
|
|
467
481
|
|
|
468
482
|
export interface AnalyzeMetafileOptions {
|
|
469
|
-
color?: boolean
|
|
470
|
-
verbose?: boolean
|
|
483
|
+
color?: boolean
|
|
484
|
+
verbose?: boolean
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface WatchOptions {
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
export interface BuildContext<SpecificOptions extends BuildOptions = BuildOptions> {
|
|
491
|
+
/** Documentation: https://esbuild.github.io/api/#rebuild */
|
|
492
|
+
rebuild(): Promise<BuildResult<SpecificOptions>>
|
|
493
|
+
|
|
494
|
+
/** Documentation: https://esbuild.github.io/api/#watch */
|
|
495
|
+
watch(options?: WatchOptions): Promise<void>
|
|
496
|
+
|
|
497
|
+
/** Documentation: https://esbuild.github.io/api/#serve */
|
|
498
|
+
serve(options?: ServeOptions): Promise<ServeResult>
|
|
499
|
+
|
|
500
|
+
cancel(): Promise<void>
|
|
501
|
+
dispose(): Promise<void>
|
|
471
502
|
}
|
|
472
503
|
|
|
473
504
|
/**
|
|
@@ -478,24 +509,22 @@ export interface AnalyzeMetafileOptions {
|
|
|
478
509
|
* - Works in node: yes
|
|
479
510
|
* - Works in browser: yes
|
|
480
511
|
*
|
|
481
|
-
* Documentation: https://esbuild.github.io/api/#build
|
|
512
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
482
513
|
*/
|
|
483
|
-
export declare function build(options:
|
|
484
|
-
export declare function build(options: BuildOptions
|
|
485
|
-
export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
|
|
486
|
-
export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
|
|
487
|
-
export declare function build(options: BuildOptions): Promise<BuildResult>;
|
|
514
|
+
export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions>>
|
|
515
|
+
export declare function build(options: BuildOptions): Promise<BuildResult>
|
|
488
516
|
|
|
489
517
|
/**
|
|
490
|
-
* This
|
|
491
|
-
*
|
|
518
|
+
* This is the advanced long-running form of "build" that supports additional
|
|
519
|
+
* features such as watch mode and a local development server.
|
|
492
520
|
*
|
|
493
521
|
* - Works in node: yes
|
|
494
522
|
* - Works in browser: no
|
|
495
523
|
*
|
|
496
|
-
* Documentation: https://esbuild.github.io/api/#
|
|
524
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
497
525
|
*/
|
|
498
|
-
export declare function
|
|
526
|
+
export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T>>
|
|
527
|
+
export declare function context(options: BuildOptions): Promise<BuildContext>
|
|
499
528
|
|
|
500
529
|
/**
|
|
501
530
|
* This function transforms a single JavaScript file. It can be used to minify
|
|
@@ -506,9 +535,10 @@ export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOpt
|
|
|
506
535
|
* - Works in node: yes
|
|
507
536
|
* - Works in browser: yes
|
|
508
537
|
*
|
|
509
|
-
* Documentation: https://esbuild.github.io/api/#transform
|
|
538
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
510
539
|
*/
|
|
511
|
-
export declare function transform(input: string | Uint8Array, options?:
|
|
540
|
+
export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions>>
|
|
541
|
+
export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>
|
|
512
542
|
|
|
513
543
|
/**
|
|
514
544
|
* Converts log messages to formatted message strings suitable for printing in
|
|
@@ -518,7 +548,7 @@ export declare function transform(input: string | Uint8Array, options?: Transfor
|
|
|
518
548
|
* - Works in node: yes
|
|
519
549
|
* - Works in browser: yes
|
|
520
550
|
*/
|
|
521
|
-
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]
|
|
551
|
+
export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
|
|
522
552
|
|
|
523
553
|
/**
|
|
524
554
|
* Pretty-prints an analysis of the metafile JSON to a string. This is just for
|
|
@@ -530,7 +560,7 @@ export declare function formatMessages(messages: PartialMessage[], options: Form
|
|
|
530
560
|
*
|
|
531
561
|
* Documentation: https://esbuild.github.io/api/#analyze
|
|
532
562
|
*/
|
|
533
|
-
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string
|
|
563
|
+
export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
|
|
534
564
|
|
|
535
565
|
/**
|
|
536
566
|
* A synchronous version of "build".
|
|
@@ -538,10 +568,10 @@ export declare function analyzeMetafile(metafile: Metafile | string, options?: A
|
|
|
538
568
|
* - Works in node: yes
|
|
539
569
|
* - Works in browser: no
|
|
540
570
|
*
|
|
541
|
-
* Documentation: https://esbuild.github.io/api/#build
|
|
571
|
+
* Documentation: https://esbuild.github.io/api/#build
|
|
542
572
|
*/
|
|
543
|
-
export declare function buildSync(options:
|
|
544
|
-
export declare function buildSync(options: BuildOptions): BuildResult
|
|
573
|
+
export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions>
|
|
574
|
+
export declare function buildSync(options: BuildOptions): BuildResult
|
|
545
575
|
|
|
546
576
|
/**
|
|
547
577
|
* A synchronous version of "transform".
|
|
@@ -549,9 +579,10 @@ export declare function buildSync(options: BuildOptions): BuildResult;
|
|
|
549
579
|
* - Works in node: yes
|
|
550
580
|
* - Works in browser: no
|
|
551
581
|
*
|
|
552
|
-
* Documentation: https://esbuild.github.io/api/#transform
|
|
582
|
+
* Documentation: https://esbuild.github.io/api/#transform
|
|
553
583
|
*/
|
|
554
|
-
export declare function transformSync(input: string, options?:
|
|
584
|
+
export declare function transformSync<SpecificOptions extends TransformOptions>(input: string, options?: SpecificOptions): TransformResult<SpecificOptions>
|
|
585
|
+
export declare function transformSync(input: string | Uint8Array, options?: TransformOptions): TransformResult
|
|
555
586
|
|
|
556
587
|
/**
|
|
557
588
|
* A synchronous version of "formatMessages".
|
|
@@ -559,7 +590,7 @@ export declare function transformSync(input: string, options?: TransformOptions)
|
|
|
559
590
|
* - Works in node: yes
|
|
560
591
|
* - Works in browser: no
|
|
561
592
|
*/
|
|
562
|
-
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
|
593
|
+
export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
|
|
563
594
|
|
|
564
595
|
/**
|
|
565
596
|
* A synchronous version of "analyzeMetafile".
|
|
@@ -569,7 +600,7 @@ export declare function formatMessagesSync(messages: PartialMessage[], options:
|
|
|
569
600
|
*
|
|
570
601
|
* Documentation: https://esbuild.github.io/api/#analyze
|
|
571
602
|
*/
|
|
572
|
-
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
|
603
|
+
export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
|
|
573
604
|
|
|
574
605
|
/**
|
|
575
606
|
* This configures the browser-based version of esbuild. It is necessary to
|
|
@@ -579,9 +610,9 @@ export declare function analyzeMetafileSync(metafile: Metafile | string, options
|
|
|
579
610
|
* - Works in node: yes
|
|
580
611
|
* - Works in browser: yes ("options" is required)
|
|
581
612
|
*
|
|
582
|
-
* Documentation: https://esbuild.github.io/api/#
|
|
613
|
+
* Documentation: https://esbuild.github.io/api/#browser
|
|
583
614
|
*/
|
|
584
|
-
export declare function initialize(options: InitializeOptions): Promise<void
|
|
615
|
+
export declare function initialize(options: InitializeOptions): Promise<void>
|
|
585
616
|
|
|
586
617
|
export interface InitializeOptions {
|
|
587
618
|
/**
|
|
@@ -608,4 +639,4 @@ export interface InitializeOptions {
|
|
|
608
639
|
worker?: boolean
|
|
609
640
|
}
|
|
610
641
|
|
|
611
|
-
export let version: string
|
|
642
|
+
export let version: string
|