esbuild 0.17.0 → 0.17.1

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 CHANGED
@@ -198,7 +198,7 @@ for your current platform.`);
198
198
  "node_modules",
199
199
  ".cache",
200
200
  "esbuild",
201
- `pnpapi-${pkg.replace("/", "-")}-${"0.17.0"}-${path.basename(subpath)}`
201
+ `pnpapi-${pkg.replace("/", "-")}-${"0.17.1"}-${path.basename(subpath)}`
202
202
  );
203
203
  if (!fs.existsSync(binTargetPath)) {
204
204
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
package/install.js CHANGED
@@ -126,8 +126,8 @@ which means the "esbuild" binary executable can't be run. You can either:
126
126
  }
127
127
  throw err;
128
128
  }
129
- if (stdout !== "0.17.0") {
130
- throw new Error(`Expected ${JSON.stringify("0.17.0")} but got ${JSON.stringify(stdout)}`);
129
+ if (stdout !== "0.17.1") {
130
+ throw new Error(`Expected ${JSON.stringify("0.17.1")} but got ${JSON.stringify(stdout)}`);
131
131
  }
132
132
  }
133
133
  function isYarn() {
@@ -179,7 +179,7 @@ function installUsingNPM(pkg, subpath, binPath) {
179
179
  try {
180
180
  fs2.writeFileSync(path2.join(installDir, "package.json"), "{}");
181
181
  child_process.execSync(
182
- `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.17.0"}`,
182
+ `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.17.1"}`,
183
183
  { cwd: installDir, stdio: "pipe", env }
184
184
  );
185
185
  const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath);
@@ -230,7 +230,7 @@ function maybeOptimizePackage(binPath) {
230
230
  }
231
231
  }
232
232
  async function downloadDirectlyFromNPM(pkg, subpath, binPath) {
233
- const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.17.0"}.tgz`;
233
+ const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${"0.17.1"}.tgz`;
234
234
  console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`);
235
235
  try {
236
236
  fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath));
package/lib/main.d.ts CHANGED
@@ -1,235 +1,235 @@
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';
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
101
  /** Documentation: https://esbuild.github.io/api/#packages */
102
- packages?: 'external';
102
+ packages?: 'external'
103
103
  /** Documentation: https://esbuild.github.io/api/#alias */
104
- alias?: Record<string, string>;
104
+ alias?: Record<string, string>
105
105
  /** Documentation: https://esbuild.github.io/api/#loader */
106
- loader?: { [ext: string]: Loader };
106
+ loader?: { [ext: string]: Loader }
107
107
  /** Documentation: https://esbuild.github.io/api/#resolve-extensions */
108
- resolveExtensions?: string[];
108
+ resolveExtensions?: string[]
109
109
  /** Documentation: https://esbuild.github.io/api/#main-fields */
110
- mainFields?: string[];
110
+ mainFields?: string[]
111
111
  /** Documentation: https://esbuild.github.io/api/#conditions */
112
- conditions?: string[];
112
+ conditions?: string[]
113
113
  /** Documentation: https://esbuild.github.io/api/#write */
114
- write?: boolean;
114
+ write?: boolean
115
115
  /** Documentation: https://esbuild.github.io/api/#allow-overwrite */
116
- allowOverwrite?: boolean;
116
+ allowOverwrite?: boolean
117
117
  /** Documentation: https://esbuild.github.io/api/#tsconfig */
118
- tsconfig?: string;
118
+ tsconfig?: string
119
119
  /** Documentation: https://esbuild.github.io/api/#out-extension */
120
- outExtension?: { [ext: string]: string };
120
+ outExtension?: { [ext: string]: string }
121
121
  /** Documentation: https://esbuild.github.io/api/#public-path */
122
- publicPath?: string;
122
+ publicPath?: string
123
123
  /** Documentation: https://esbuild.github.io/api/#entry-names */
124
- entryNames?: string;
124
+ entryNames?: string
125
125
  /** Documentation: https://esbuild.github.io/api/#chunk-names */
126
- chunkNames?: string;
126
+ chunkNames?: string
127
127
  /** Documentation: https://esbuild.github.io/api/#asset-names */
128
- assetNames?: string;
128
+ assetNames?: string
129
129
  /** Documentation: https://esbuild.github.io/api/#inject */
130
- inject?: string[];
130
+ inject?: string[]
131
131
  /** Documentation: https://esbuild.github.io/api/#banner */
132
- banner?: { [type: string]: string };
132
+ banner?: { [type: string]: string }
133
133
  /** Documentation: https://esbuild.github.io/api/#footer */
134
- footer?: { [type: string]: string };
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
145
  }
146
146
 
147
147
  export interface StdinOptions {
148
- contents: string | Uint8Array;
149
- resolveDir?: string;
150
- sourcefile?: string;
151
- loader?: Loader;
148
+ contents: string | Uint8Array
149
+ resolveDir?: string
150
+ sourcefile?: string
151
+ loader?: Loader
152
152
  }
153
153
 
154
154
  export interface Message {
155
- id: string;
156
- pluginName: string;
157
- text: string;
158
- location: Location | null;
159
- notes: Note[];
155
+ id: string
156
+ pluginName: string
157
+ text: string
158
+ location: Location | null
159
+ notes: Note[]
160
160
 
161
161
  /**
162
162
  * Optional user-specified data that is passed through unmodified. You can
163
163
  * use this to stash the original error, for example.
164
164
  */
165
- detail: any;
165
+ detail: any
166
166
  }
167
167
 
168
168
  export interface Note {
169
- text: string;
170
- location: Location | null;
169
+ text: string
170
+ location: Location | null
171
171
  }
172
172
 
173
173
  export interface Location {
174
- file: string;
175
- namespace: string;
174
+ file: string
175
+ namespace: string
176
176
  /** 1-based */
177
- line: number;
177
+ line: number
178
178
  /** 0-based, in bytes */
179
- column: number;
179
+ column: number
180
180
  /** in bytes */
181
- length: number;
182
- lineText: string;
183
- suggestion: string;
181
+ length: number
182
+ lineText: string
183
+ suggestion: string
184
184
  }
185
185
 
186
186
  export interface OutputFile {
187
- path: string;
187
+ path: string
188
188
  /** "text" as bytes */
189
- contents: Uint8Array;
189
+ contents: Uint8Array
190
190
  /** "contents" as text (changes automatically with "contents") */
191
- readonly text: string;
191
+ readonly text: string
192
192
  }
193
193
 
194
194
  export interface BuildResult<SpecificOptions extends BuildOptions = BuildOptions> {
195
- errors: Message[];
196
- warnings: Message[];
195
+ errors: Message[]
196
+ warnings: Message[]
197
197
  /** Only when "write: false" */
198
- outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined);
198
+ outputFiles: OutputFile[] | (SpecificOptions['write'] extends false ? never : undefined)
199
199
  /** Only when "metafile: true" */
200
- metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined);
200
+ metafile: Metafile | (SpecificOptions['metafile'] extends true ? never : undefined)
201
201
  /** Only when "mangleCache" is present */
202
- mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined);
202
+ mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
203
203
  }
204
204
 
205
205
  export interface BuildFailure extends Error {
206
- errors: Message[];
207
- warnings: Message[];
206
+ errors: Message[]
207
+ warnings: Message[]
208
208
  }
209
209
 
210
210
  /** Documentation: https://esbuild.github.io/api/#serve-arguments */
211
211
  export interface ServeOptions {
212
- port?: number;
213
- host?: string;
214
- servedir?: string;
212
+ port?: number
213
+ host?: string
214
+ servedir?: string
215
215
  keyfile?: string
216
216
  certfile?: string
217
- onRequest?: (args: ServeOnRequestArgs) => void;
217
+ onRequest?: (args: ServeOnRequestArgs) => void
218
218
  }
219
219
 
220
220
  export interface ServeOnRequestArgs {
221
- remoteAddress: string;
222
- method: string;
223
- path: string;
224
- status: number;
221
+ remoteAddress: string
222
+ method: string
223
+ path: string
224
+ status: number
225
225
  /** The time to generate the response, not to send it */
226
- timeInMS: number;
226
+ timeInMS: number
227
227
  }
228
228
 
229
229
  /** Documentation: https://esbuild.github.io/api/#serve-return-values */
230
230
  export interface ServeResult {
231
- port: number;
232
- host: string;
231
+ port: number
232
+ host: string
233
233
  }
234
234
 
235
235
  export interface TransformOptions extends CommonOptions {
@@ -245,46 +245,56 @@ export interface TransformOptions extends CommonOptions {
245
245
  target?: string,
246
246
  useDefineForClassFields?: boolean,
247
247
  },
248
- };
248
+ }
249
249
 
250
- sourcefile?: string;
251
- loader?: Loader;
252
- banner?: string;
253
- footer?: string;
250
+ sourcefile?: string
251
+ loader?: Loader
252
+ banner?: string
253
+ footer?: string
254
254
  }
255
255
 
256
256
  export interface TransformResult<SpecificOptions extends TransformOptions = TransformOptions> {
257
- code: string;
258
- map: string;
259
- warnings: Message[];
257
+ code: string
258
+ map: string
259
+ warnings: Message[]
260
260
  /** Only when "mangleCache" is present */
261
- mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined);
261
+ mangleCache: Record<string, string | false> | (SpecificOptions['mangleCache'] extends Object ? never : undefined)
262
262
  /** Only when "legalComments" is "external" */
263
- legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined);
263
+ legalComments: string | (SpecificOptions['legalComments'] extends 'external' ? never : undefined)
264
264
  }
265
265
 
266
266
  export interface TransformFailure extends Error {
267
- errors: Message[];
268
- warnings: Message[];
267
+ errors: Message[]
268
+ warnings: Message[]
269
269
  }
270
270
 
271
271
  export interface Plugin {
272
- name: string;
273
- setup: (build: PluginBuild) => (void | Promise<void>);
272
+ name: string
273
+ setup: (build: PluginBuild) => (void | Promise<void>)
274
274
  }
275
275
 
276
276
  export interface PluginBuild {
277
- initialOptions: BuildOptions;
278
- resolve(path: string, options?: ResolveOptions): Promise<ResolveResult>;
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>
279
282
 
283
+ /** Documentation: https://esbuild.github.io/plugins/#on-start */
280
284
  onStart(callback: () =>
281
- (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 */
282
288
  onEnd(callback: (result: BuildResult) =>
283
- (OnEndResult | null | void | Promise<OnEndResult | null | void>)): void;
289
+ (OnEndResult | null | void | Promise<OnEndResult | null | void>)): void
290
+
291
+ /** Documentation: https://esbuild.github.io/plugins/#on-resolve */
284
292
  onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) =>
285
- (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 */
286
296
  onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) =>
287
- (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void;
297
+ (OnLoadResult | null | undefined | Promise<OnLoadResult | null | undefined>)): void
288
298
 
289
299
  // This is a full copy of the esbuild library in case you need it
290
300
  esbuild: {
@@ -299,52 +309,56 @@ export interface PluginBuild {
299
309
  analyzeMetafileSync: typeof analyzeMetafileSync,
300
310
  initialize: typeof initialize,
301
311
  version: typeof version,
302
- };
312
+ }
303
313
  }
304
314
 
315
+ /** Documentation: https://esbuild.github.io/plugins/#resolve-options */
305
316
  export interface ResolveOptions {
306
- pluginName?: string;
307
- importer?: string;
308
- namespace?: string;
309
- resolveDir?: string;
310
- kind?: ImportKind;
311
- pluginData?: any;
317
+ pluginName?: string
318
+ importer?: string
319
+ namespace?: string
320
+ resolveDir?: string
321
+ kind?: ImportKind
322
+ pluginData?: any
312
323
  }
313
324
 
325
+ /** Documentation: https://esbuild.github.io/plugins/#resolve-results */
314
326
  export interface ResolveResult {
315
- errors: Message[];
316
- warnings: Message[];
327
+ errors: Message[]
328
+ warnings: Message[]
317
329
 
318
- path: string;
319
- external: boolean;
320
- sideEffects: boolean;
321
- namespace: string;
322
- suffix: string;
323
- pluginData: any;
330
+ path: string
331
+ external: boolean
332
+ sideEffects: boolean
333
+ namespace: string
334
+ suffix: string
335
+ pluginData: any
324
336
  }
325
337
 
326
338
  export interface OnStartResult {
327
- errors?: PartialMessage[];
328
- warnings?: PartialMessage[];
339
+ errors?: PartialMessage[]
340
+ warnings?: PartialMessage[]
329
341
  }
330
342
 
331
343
  export interface OnEndResult {
332
- errors?: PartialMessage[];
333
- warnings?: PartialMessage[];
344
+ errors?: PartialMessage[]
345
+ warnings?: PartialMessage[]
334
346
  }
335
347
 
348
+ /** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */
336
349
  export interface OnResolveOptions {
337
- filter: RegExp;
338
- namespace?: string;
350
+ filter: RegExp
351
+ namespace?: string
339
352
  }
340
353
 
354
+ /** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */
341
355
  export interface OnResolveArgs {
342
- path: string;
343
- importer: string;
344
- namespace: string;
345
- resolveDir: string;
346
- kind: ImportKind;
347
- pluginData: any;
356
+ path: string
357
+ importer: string
358
+ namespace: string
359
+ resolveDir: string
360
+ kind: ImportKind
361
+ pluginData: any
348
362
  }
349
363
 
350
364
  export type ImportKind =
@@ -360,64 +374,69 @@ export type ImportKind =
360
374
  | 'import-rule'
361
375
  | 'url-token'
362
376
 
377
+ /** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */
363
378
  export interface OnResolveResult {
364
- pluginName?: string;
379
+ pluginName?: string
365
380
 
366
- errors?: PartialMessage[];
367
- warnings?: PartialMessage[];
381
+ errors?: PartialMessage[]
382
+ warnings?: PartialMessage[]
368
383
 
369
- path?: string;
370
- external?: boolean;
371
- sideEffects?: boolean;
372
- namespace?: string;
373
- suffix?: string;
374
- pluginData?: any;
384
+ path?: string
385
+ external?: boolean
386
+ sideEffects?: boolean
387
+ namespace?: string
388
+ suffix?: string
389
+ pluginData?: any
375
390
 
376
- watchFiles?: string[];
377
- watchDirs?: string[];
391
+ watchFiles?: string[]
392
+ watchDirs?: string[]
378
393
  }
379
394
 
395
+ /** Documentation: https://esbuild.github.io/plugins/#on-load-options */
380
396
  export interface OnLoadOptions {
381
- filter: RegExp;
382
- namespace?: string;
397
+ filter: RegExp
398
+ namespace?: string
383
399
  }
384
400
 
401
+ /** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */
385
402
  export interface OnLoadArgs {
386
- path: string;
387
- namespace: string;
388
- suffix: string;
389
- pluginData: any;
403
+ path: string
404
+ namespace: string
405
+ suffix: string
406
+ pluginData: any
390
407
  }
391
408
 
409
+ /** Documentation: https://esbuild.github.io/plugins/#on-load-results */
392
410
  export interface OnLoadResult {
393
- pluginName?: string;
411
+ pluginName?: string
394
412
 
395
- errors?: PartialMessage[];
396
- warnings?: PartialMessage[];
413
+ errors?: PartialMessage[]
414
+ warnings?: PartialMessage[]
397
415
 
398
- contents?: string | Uint8Array;
399
- resolveDir?: string;
400
- loader?: Loader;
401
- pluginData?: any;
416
+ contents?: string | Uint8Array
417
+ resolveDir?: string
418
+ loader?: Loader
419
+ pluginData?: any
402
420
 
403
- watchFiles?: string[];
404
- watchDirs?: string[];
421
+ watchFiles?: string[]
422
+ watchDirs?: string[]
405
423
  }
406
424
 
407
425
  export interface PartialMessage {
408
- id?: string;
409
- pluginName?: string;
410
- text?: string;
411
- location?: Partial<Location> | null;
412
- notes?: PartialNote[];
413
- detail?: any;
426
+ id?: string
427
+ pluginName?: string
428
+ text?: string
429
+ location?: Partial<Location> | null
430
+ notes?: PartialNote[]
431
+ detail?: any
414
432
  }
415
433
 
416
434
  export interface PartialNote {
417
- text?: string;
418
- location?: Partial<Location> | null;
435
+ text?: string
436
+ location?: Partial<Location> | null
419
437
  }
420
438
 
439
+ /** Documentation: https://esbuild.github.io/api/#metafile */
421
440
  export interface Metafile {
422
441
  inputs: {
423
442
  [path: string]: {
@@ -452,23 +471,30 @@ export interface Metafile {
452
471
  }
453
472
 
454
473
  export interface FormatMessagesOptions {
455
- kind: 'error' | 'warning';
456
- color?: boolean;
457
- terminalWidth?: number;
474
+ kind: 'error' | 'warning'
475
+ color?: boolean
476
+ terminalWidth?: number
458
477
  }
459
478
 
460
479
  export interface AnalyzeMetafileOptions {
461
- color?: boolean;
462
- verbose?: boolean;
480
+ color?: boolean
481
+ verbose?: boolean
463
482
  }
464
483
 
465
484
  export interface WatchOptions {
466
485
  }
467
486
 
468
487
  export interface BuildContext<SpecificOptions extends BuildOptions = BuildOptions> {
488
+ /** Documentation: https://esbuild.github.io/api/#rebuild */
469
489
  rebuild(): Promise<BuildResult<SpecificOptions>>
490
+
491
+ /** Documentation: https://esbuild.github.io/api/#watch */
470
492
  watch(options?: WatchOptions): void
493
+
494
+ /** Documentation: https://esbuild.github.io/api/#serve */
471
495
  serve(options?: ServeOptions): Promise<ServeResult>
496
+
497
+ cancel(): Promise<void>
472
498
  dispose(): Promise<void>
473
499
  }
474
500
 
@@ -480,10 +506,10 @@ export interface BuildContext<SpecificOptions extends BuildOptions = BuildOption
480
506
  * - Works in node: yes
481
507
  * - Works in browser: yes
482
508
  *
483
- * Documentation: https://esbuild.github.io/api/#build-api
509
+ * Documentation: https://esbuild.github.io/api/#build
484
510
  */
485
- export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions>>;
486
- export declare function build(options: BuildOptions): Promise<BuildResult>;
511
+ export declare function build<SpecificOptions extends BuildOptions>(options: SpecificOptions): Promise<BuildResult<SpecificOptions>>
512
+ export declare function build(options: BuildOptions): Promise<BuildResult>
487
513
 
488
514
  /**
489
515
  * This is the advanced long-running form of "build" that supports additional
@@ -492,10 +518,10 @@ export declare function build(options: BuildOptions): Promise<BuildResult>;
492
518
  * - Works in node: yes
493
519
  * - Works in browser: no
494
520
  *
495
- * Documentation: https://esbuild.github.io/api/#context-api
521
+ * Documentation: https://esbuild.github.io/api/#build
496
522
  */
497
- export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T>>;
498
- export declare function context(options: BuildOptions): Promise<BuildContext>;
523
+ export declare function context<T extends BuildOptions>(options: T): Promise<BuildContext<T>>
524
+ export declare function context(options: BuildOptions): Promise<BuildContext>
499
525
 
500
526
  /**
501
527
  * This function transforms a single JavaScript file. It can be used to minify
@@ -506,10 +532,10 @@ export declare function context(options: BuildOptions): Promise<BuildContext>;
506
532
  * - Works in node: yes
507
533
  * - Works in browser: yes
508
534
  *
509
- * Documentation: https://esbuild.github.io/api/#transform-api
535
+ * Documentation: https://esbuild.github.io/api/#transform
510
536
  */
511
- export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions>>;
512
- export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>;
537
+ export declare function transform<SpecificOptions extends TransformOptions>(input: string | Uint8Array, options?: SpecificOptions): Promise<TransformResult<SpecificOptions>>
538
+ export declare function transform(input: string | Uint8Array, options?: TransformOptions): Promise<TransformResult>
513
539
 
514
540
  /**
515
541
  * Converts log messages to formatted message strings suitable for printing in
@@ -519,7 +545,7 @@ export declare function transform(input: string | Uint8Array, options?: Transfor
519
545
  * - Works in node: yes
520
546
  * - Works in browser: yes
521
547
  */
522
- export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
548
+ export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>
523
549
 
524
550
  /**
525
551
  * Pretty-prints an analysis of the metafile JSON to a string. This is just for
@@ -531,7 +557,7 @@ export declare function formatMessages(messages: PartialMessage[], options: Form
531
557
  *
532
558
  * Documentation: https://esbuild.github.io/api/#analyze
533
559
  */
534
- export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
560
+ export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>
535
561
 
536
562
  /**
537
563
  * A synchronous version of "build".
@@ -539,10 +565,10 @@ export declare function analyzeMetafile(metafile: Metafile | string, options?: A
539
565
  * - Works in node: yes
540
566
  * - Works in browser: no
541
567
  *
542
- * Documentation: https://esbuild.github.io/api/#build-api
568
+ * Documentation: https://esbuild.github.io/api/#build
543
569
  */
544
- export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions>;
545
- export declare function buildSync(options: BuildOptions): BuildResult;
570
+ export declare function buildSync<SpecificOptions extends BuildOptions>(options: SpecificOptions): BuildResult<SpecificOptions>
571
+ export declare function buildSync(options: BuildOptions): BuildResult
546
572
 
547
573
  /**
548
574
  * A synchronous version of "transform".
@@ -550,10 +576,10 @@ export declare function buildSync(options: BuildOptions): BuildResult;
550
576
  * - Works in node: yes
551
577
  * - Works in browser: no
552
578
  *
553
- * Documentation: https://esbuild.github.io/api/#transform-api
579
+ * Documentation: https://esbuild.github.io/api/#transform
554
580
  */
555
- export declare function transformSync<SpecificOptions extends TransformOptions>(input: string, options?: SpecificOptions): TransformResult<SpecificOptions>;
556
- export declare function transformSync(input: string | Uint8Array, options?: TransformOptions): TransformResult;
581
+ export declare function transformSync<SpecificOptions extends TransformOptions>(input: string, options?: SpecificOptions): TransformResult<SpecificOptions>
582
+ export declare function transformSync(input: string | Uint8Array, options?: TransformOptions): TransformResult
557
583
 
558
584
  /**
559
585
  * A synchronous version of "formatMessages".
@@ -561,7 +587,7 @@ export declare function transformSync(input: string | Uint8Array, options?: Tran
561
587
  * - Works in node: yes
562
588
  * - Works in browser: no
563
589
  */
564
- export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[];
590
+ export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]
565
591
 
566
592
  /**
567
593
  * A synchronous version of "analyzeMetafile".
@@ -571,7 +597,7 @@ export declare function formatMessagesSync(messages: PartialMessage[], options:
571
597
  *
572
598
  * Documentation: https://esbuild.github.io/api/#analyze
573
599
  */
574
- export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string;
600
+ export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string
575
601
 
576
602
  /**
577
603
  * This configures the browser-based version of esbuild. It is necessary to
@@ -581,9 +607,9 @@ export declare function analyzeMetafileSync(metafile: Metafile | string, options
581
607
  * - Works in node: yes
582
608
  * - Works in browser: yes ("options" is required)
583
609
  *
584
- * Documentation: https://esbuild.github.io/api/#running-in-the-browser
610
+ * Documentation: https://esbuild.github.io/api/#browser
585
611
  */
586
- export declare function initialize(options: InitializeOptions): Promise<void>;
612
+ export declare function initialize(options: InitializeOptions): Promise<void>
587
613
 
588
614
  export interface InitializeOptions {
589
615
  /**
@@ -610,4 +636,4 @@ export interface InitializeOptions {
610
636
  worker?: boolean
611
637
  }
612
638
 
613
- export let version: string;
639
+ export let version: string
package/lib/main.js CHANGED
@@ -231,8 +231,8 @@ var mustBeInteger = (value) => typeof value === "number" && value === (value | 0
231
231
  var mustBeFunction = (value) => typeof value === "function" ? null : "a function";
232
232
  var mustBeArray = (value) => Array.isArray(value) ? null : "an array";
233
233
  var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object";
234
+ var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
234
235
  var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module";
235
- var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object";
236
236
  var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null";
237
237
  var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean";
238
238
  var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object";
@@ -447,7 +447,7 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
447
447
  let inject = getFlag(options, keys, "inject", mustBeArray);
448
448
  let banner = getFlag(options, keys, "banner", mustBeObject);
449
449
  let footer = getFlag(options, keys, "footer", mustBeObject);
450
- let entryPoints = getFlag(options, keys, "entryPoints", mustBeArrayOrRecord);
450
+ let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints);
451
451
  let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString);
452
452
  let stdin = getFlag(options, keys, "stdin", mustBeObject);
453
453
  let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault;
@@ -558,8 +558,21 @@ function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeD
558
558
  }
559
559
  if (entryPoints) {
560
560
  if (Array.isArray(entryPoints)) {
561
- for (let entryPoint of entryPoints) {
562
- entries.push(["", validateStringValue(entryPoint, "entry point")]);
561
+ for (let i = 0, n = entryPoints.length; i < n; i++) {
562
+ let entryPoint = entryPoints[i];
563
+ if (typeof entryPoint === "object" && entryPoint !== null) {
564
+ let entryPointKeys = /* @__PURE__ */ Object.create(null);
565
+ let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString);
566
+ let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString);
567
+ checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i);
568
+ if (input === void 0)
569
+ throw new Error('Missing property "in" for entry point at index ' + i);
570
+ if (output === void 0)
571
+ throw new Error('Missing property "out" for entry point at index ' + i);
572
+ entries.push([output, input]);
573
+ } else {
574
+ entries.push(["", validateStringValue(entryPoint, "entry point at index " + i)]);
575
+ }
563
576
  }
564
577
  } else {
565
578
  for (let key in entryPoints) {
@@ -722,8 +735,8 @@ function createChannel(streamIn) {
722
735
  if (isFirstPacket) {
723
736
  isFirstPacket = false;
724
737
  let binaryVersion = String.fromCharCode(...bytes);
725
- if (binaryVersion !== "0.17.0") {
726
- throw new Error(`Cannot start service: Host version "${"0.17.0"}" does not match binary version ${quote(binaryVersion)}`);
738
+ if (binaryVersion !== "0.17.1") {
739
+ throw new Error(`Cannot start service: Host version "${"0.17.1"}" does not match binary version ${quote(binaryVersion)}`);
727
740
  }
728
741
  return;
729
742
  }
@@ -1146,6 +1159,17 @@ function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs,
1146
1159
  resolve(response2);
1147
1160
  });
1148
1161
  }),
1162
+ cancel: () => new Promise((resolve) => {
1163
+ if (didDispose)
1164
+ return resolve();
1165
+ const request2 = {
1166
+ command: "cancel",
1167
+ key: buildKey
1168
+ };
1169
+ sendRequest(refs, request2, () => {
1170
+ resolve();
1171
+ });
1172
+ }),
1149
1173
  dispose: () => new Promise((resolve) => {
1150
1174
  if (didDispose)
1151
1175
  return resolve();
@@ -1864,7 +1888,7 @@ for your current platform.`);
1864
1888
  "node_modules",
1865
1889
  ".cache",
1866
1890
  "esbuild",
1867
- `pnpapi-${pkg.replace("/", "-")}-${"0.17.0"}-${path.basename(subpath)}`
1891
+ `pnpapi-${pkg.replace("/", "-")}-${"0.17.1"}-${path.basename(subpath)}`
1868
1892
  );
1869
1893
  if (!fs.existsSync(binTargetPath)) {
1870
1894
  fs.mkdirSync(path.dirname(binTargetPath), { recursive: true });
@@ -1899,7 +1923,7 @@ if (process.env.ESBUILD_WORKER_THREADS !== "0") {
1899
1923
  }
1900
1924
  }
1901
1925
  var _a;
1902
- var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.17.0";
1926
+ var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.17.1";
1903
1927
  var esbuildCommandAndArgs = () => {
1904
1928
  if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) {
1905
1929
  throw new Error(
@@ -1966,7 +1990,7 @@ var fsAsync = {
1966
1990
  }
1967
1991
  }
1968
1992
  };
1969
- var version = "0.17.0";
1993
+ var version = "0.17.1";
1970
1994
  var build = (options) => ensureServiceIsRunning().build(options);
1971
1995
  var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions);
1972
1996
  var transform = (input, options) => ensureServiceIsRunning().transform(input, options);
@@ -2076,7 +2100,7 @@ var ensureServiceIsRunning = () => {
2076
2100
  if (longLivedService)
2077
2101
  return longLivedService;
2078
2102
  let [command, args] = esbuildCommandAndArgs();
2079
- let child = child_process.spawn(command, args.concat(`--service=${"0.17.0"}`, "--ping"), {
2103
+ let child = child_process.spawn(command, args.concat(`--service=${"0.17.1"}`, "--ping"), {
2080
2104
  windowsHide: true,
2081
2105
  stdio: ["pipe", "pipe", "inherit"],
2082
2106
  cwd: defaultWD
@@ -2176,7 +2200,7 @@ var runServiceSync = (callback) => {
2176
2200
  esbuild: node_exports
2177
2201
  });
2178
2202
  callback(service);
2179
- let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.17.0"}`), {
2203
+ let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.17.1"}`), {
2180
2204
  cwd: defaultWD,
2181
2205
  windowsHide: true,
2182
2206
  input: stdin,
@@ -2196,7 +2220,7 @@ var workerThreadService = null;
2196
2220
  var startWorkerThreadService = (worker_threads2) => {
2197
2221
  let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel();
2198
2222
  let worker = new worker_threads2.Worker(__filename, {
2199
- workerData: { workerPort, defaultWD, esbuildVersion: "0.17.0" },
2223
+ workerData: { workerPort, defaultWD, esbuildVersion: "0.17.1" },
2200
2224
  transferList: [workerPort],
2201
2225
  // From node's documentation: https://nodejs.org/api/worker_threads.html
2202
2226
  //
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esbuild",
3
- "version": "0.17.0",
3
+ "version": "0.17.1",
4
4
  "description": "An extremely fast JavaScript and CSS bundler and minifier.",
5
5
  "repository": "https://github.com/evanw/esbuild",
6
6
  "scripts": {
@@ -15,28 +15,28 @@
15
15
  "esbuild": "bin/esbuild"
16
16
  },
17
17
  "optionalDependencies": {
18
- "@esbuild/android-arm": "0.17.0",
19
- "@esbuild/android-arm64": "0.17.0",
20
- "@esbuild/android-x64": "0.17.0",
21
- "@esbuild/darwin-arm64": "0.17.0",
22
- "@esbuild/darwin-x64": "0.17.0",
23
- "@esbuild/freebsd-arm64": "0.17.0",
24
- "@esbuild/freebsd-x64": "0.17.0",
25
- "@esbuild/linux-arm": "0.17.0",
26
- "@esbuild/linux-arm64": "0.17.0",
27
- "@esbuild/linux-ia32": "0.17.0",
28
- "@esbuild/linux-loong64": "0.17.0",
29
- "@esbuild/linux-mips64el": "0.17.0",
30
- "@esbuild/linux-ppc64": "0.17.0",
31
- "@esbuild/linux-riscv64": "0.17.0",
32
- "@esbuild/linux-s390x": "0.17.0",
33
- "@esbuild/linux-x64": "0.17.0",
34
- "@esbuild/netbsd-x64": "0.17.0",
35
- "@esbuild/openbsd-x64": "0.17.0",
36
- "@esbuild/sunos-x64": "0.17.0",
37
- "@esbuild/win32-arm64": "0.17.0",
38
- "@esbuild/win32-ia32": "0.17.0",
39
- "@esbuild/win32-x64": "0.17.0"
18
+ "@esbuild/android-arm": "0.17.1",
19
+ "@esbuild/android-arm64": "0.17.1",
20
+ "@esbuild/android-x64": "0.17.1",
21
+ "@esbuild/darwin-arm64": "0.17.1",
22
+ "@esbuild/darwin-x64": "0.17.1",
23
+ "@esbuild/freebsd-arm64": "0.17.1",
24
+ "@esbuild/freebsd-x64": "0.17.1",
25
+ "@esbuild/linux-arm": "0.17.1",
26
+ "@esbuild/linux-arm64": "0.17.1",
27
+ "@esbuild/linux-ia32": "0.17.1",
28
+ "@esbuild/linux-loong64": "0.17.1",
29
+ "@esbuild/linux-mips64el": "0.17.1",
30
+ "@esbuild/linux-ppc64": "0.17.1",
31
+ "@esbuild/linux-riscv64": "0.17.1",
32
+ "@esbuild/linux-s390x": "0.17.1",
33
+ "@esbuild/linux-x64": "0.17.1",
34
+ "@esbuild/netbsd-x64": "0.17.1",
35
+ "@esbuild/openbsd-x64": "0.17.1",
36
+ "@esbuild/sunos-x64": "0.17.1",
37
+ "@esbuild/win32-arm64": "0.17.1",
38
+ "@esbuild/win32-ia32": "0.17.1",
39
+ "@esbuild/win32-x64": "0.17.1"
40
40
  },
41
41
  "license": "MIT"
42
42
  }