@mrgrain/cdk-esbuild 2.0.0-alpha.5 → 2.1.0
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/.gitattributes +21 -21
- package/.jsii +411 -196
- package/.projenrc.ts +20 -3
- package/API.md +333 -45
- package/CHANGELOG.md +11 -250
- package/README.md +55 -5
- package/lib/asset.js +5 -4
- package/lib/bundler.d.ts +17 -4
- package/lib/bundler.js +4 -3
- package/lib/code.js +2 -2
- package/lib/esbuild-types.d.ts +213 -0
- package/lib/esbuild-types.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/inline-code.d.ts +50 -19
- package/lib/inline-code.js +51 -29
- package/lib/source.js +2 -2
- package/package.json +28 -30
package/API.md
CHANGED
|
@@ -13,6 +13,22 @@ import { AssetProps } from '@mrgrain/cdk-esbuild'
|
|
|
13
13
|
const assetProps: AssetProps = { ... }
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildFn"></a>
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
public readonly buildFn: any;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- *Type:* `any`
|
|
23
|
+
- *Default:* esbuild.buildSync
|
|
24
|
+
|
|
25
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
26
|
+
|
|
27
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
28
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
16
32
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildOptions"></a>
|
|
17
33
|
|
|
18
34
|
```typescript
|
|
@@ -23,15 +39,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
23
39
|
|
|
24
40
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
25
41
|
|
|
26
|
-
`buildOptions.outdir: string`
|
|
42
|
+
`buildOptions.outdir: string`
|
|
27
43
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
28
44
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
29
45
|
*Cannot be used together with `outfile`*.
|
|
30
|
-
- `buildOptions.outfile: string`
|
|
31
|
-
Relative path to a file inside the CDK asset output directory.
|
|
46
|
+
- `buildOptions.outfile: string`
|
|
47
|
+
Relative path to a file inside the CDK asset output directory.
|
|
32
48
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
33
49
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
34
|
-
- `buildOptions.absWorkingDir: string`
|
|
50
|
+
- `buildOptions.absWorkingDir: string`
|
|
35
51
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
36
52
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
37
53
|
|
|
@@ -101,6 +117,8 @@ public readonly absWorkingDir: string;
|
|
|
101
117
|
|
|
102
118
|
- *Type:* `string`
|
|
103
119
|
|
|
120
|
+
Documentation: https://esbuild.github.io/api/#working-directory.
|
|
121
|
+
|
|
104
122
|
---
|
|
105
123
|
|
|
106
124
|
##### `allowOverwrite`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.allowOverwrite"></a>
|
|
@@ -111,6 +129,8 @@ public readonly allowOverwrite: boolean;
|
|
|
111
129
|
|
|
112
130
|
- *Type:* `boolean`
|
|
113
131
|
|
|
132
|
+
Documentation: https://esbuild.github.io/api/#allow-overwrite.
|
|
133
|
+
|
|
114
134
|
---
|
|
115
135
|
|
|
116
136
|
##### `assetNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.assetNames"></a>
|
|
@@ -121,6 +141,8 @@ public readonly assetNames: string;
|
|
|
121
141
|
|
|
122
142
|
- *Type:* `string`
|
|
123
143
|
|
|
144
|
+
Documentation: https://esbuild.github.io/api/#asset-names.
|
|
145
|
+
|
|
124
146
|
---
|
|
125
147
|
|
|
126
148
|
##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.banner"></a>
|
|
@@ -131,6 +153,8 @@ public readonly banner: {[ key: string ]: string};
|
|
|
131
153
|
|
|
132
154
|
- *Type:* {[ key: string ]: `string`}
|
|
133
155
|
|
|
156
|
+
Documentation: https://esbuild.github.io/api/#banner.
|
|
157
|
+
|
|
134
158
|
---
|
|
135
159
|
|
|
136
160
|
##### `bundle`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.bundle"></a>
|
|
@@ -141,6 +165,8 @@ public readonly bundle: boolean;
|
|
|
141
165
|
|
|
142
166
|
- *Type:* `boolean`
|
|
143
167
|
|
|
168
|
+
Documentation: https://esbuild.github.io/api/#bundle.
|
|
169
|
+
|
|
144
170
|
---
|
|
145
171
|
|
|
146
172
|
##### `charset`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.charset"></a>
|
|
@@ -151,6 +177,8 @@ public readonly charset: string;
|
|
|
151
177
|
|
|
152
178
|
- *Type:* `string`
|
|
153
179
|
|
|
180
|
+
Documentation: https://esbuild.github.io/api/#charset.
|
|
181
|
+
|
|
154
182
|
---
|
|
155
183
|
|
|
156
184
|
##### `chunkNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.chunkNames"></a>
|
|
@@ -161,6 +189,8 @@ public readonly chunkNames: string;
|
|
|
161
189
|
|
|
162
190
|
- *Type:* `string`
|
|
163
191
|
|
|
192
|
+
Documentation: https://esbuild.github.io/api/#chunk-names.
|
|
193
|
+
|
|
164
194
|
---
|
|
165
195
|
|
|
166
196
|
##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.color"></a>
|
|
@@ -171,6 +201,8 @@ public readonly color: boolean;
|
|
|
171
201
|
|
|
172
202
|
- *Type:* `boolean`
|
|
173
203
|
|
|
204
|
+
Documentation: https://esbuild.github.io/api/#color.
|
|
205
|
+
|
|
174
206
|
---
|
|
175
207
|
|
|
176
208
|
##### `conditions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.conditions"></a>
|
|
@@ -181,6 +213,8 @@ public readonly conditions: string[];
|
|
|
181
213
|
|
|
182
214
|
- *Type:* `string`[]
|
|
183
215
|
|
|
216
|
+
Documentation: https://esbuild.github.io/api/#conditions.
|
|
217
|
+
|
|
184
218
|
---
|
|
185
219
|
|
|
186
220
|
##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.define"></a>
|
|
@@ -191,6 +225,8 @@ public readonly define: {[ key: string ]: string};
|
|
|
191
225
|
|
|
192
226
|
- *Type:* {[ key: string ]: `string`}
|
|
193
227
|
|
|
228
|
+
Documentation: https://esbuild.github.io/api/#define.
|
|
229
|
+
|
|
194
230
|
---
|
|
195
231
|
|
|
196
232
|
##### `entryNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.entryNames"></a>
|
|
@@ -201,6 +237,8 @@ public readonly entryNames: string;
|
|
|
201
237
|
|
|
202
238
|
- *Type:* `string`
|
|
203
239
|
|
|
240
|
+
Documentation: https://esbuild.github.io/api/#entry-names.
|
|
241
|
+
|
|
204
242
|
---
|
|
205
243
|
|
|
206
244
|
##### `external`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.external"></a>
|
|
@@ -211,6 +249,8 @@ public readonly external: string[];
|
|
|
211
249
|
|
|
212
250
|
- *Type:* `string`[]
|
|
213
251
|
|
|
252
|
+
Documentation: https://esbuild.github.io/api/#external.
|
|
253
|
+
|
|
214
254
|
---
|
|
215
255
|
|
|
216
256
|
##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.footer"></a>
|
|
@@ -221,6 +261,8 @@ public readonly footer: {[ key: string ]: string};
|
|
|
221
261
|
|
|
222
262
|
- *Type:* {[ key: string ]: `string`}
|
|
223
263
|
|
|
264
|
+
Documentation: https://esbuild.github.io/api/#footer.
|
|
265
|
+
|
|
224
266
|
---
|
|
225
267
|
|
|
226
268
|
##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.format"></a>
|
|
@@ -231,6 +273,8 @@ public readonly format: string;
|
|
|
231
273
|
|
|
232
274
|
- *Type:* `string`
|
|
233
275
|
|
|
276
|
+
Documentation: https://esbuild.github.io/api/#format.
|
|
277
|
+
|
|
234
278
|
---
|
|
235
279
|
|
|
236
280
|
##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.globalName"></a>
|
|
@@ -241,6 +285,8 @@ public readonly globalName: string;
|
|
|
241
285
|
|
|
242
286
|
- *Type:* `string`
|
|
243
287
|
|
|
288
|
+
Documentation: https://esbuild.github.io/api/#globalName.
|
|
289
|
+
|
|
244
290
|
---
|
|
245
291
|
|
|
246
292
|
##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.ignoreAnnotations"></a>
|
|
@@ -251,6 +297,8 @@ public readonly ignoreAnnotations: boolean;
|
|
|
251
297
|
|
|
252
298
|
- *Type:* `boolean`
|
|
253
299
|
|
|
300
|
+
Documentation: https://esbuild.github.io/api/#ignore-annotations.
|
|
301
|
+
|
|
254
302
|
---
|
|
255
303
|
|
|
256
304
|
##### `incremental`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.incremental"></a>
|
|
@@ -261,6 +309,8 @@ public readonly incremental: boolean;
|
|
|
261
309
|
|
|
262
310
|
- *Type:* `boolean`
|
|
263
311
|
|
|
312
|
+
Documentation: https://esbuild.github.io/api/#incremental.
|
|
313
|
+
|
|
264
314
|
---
|
|
265
315
|
|
|
266
316
|
##### `inject`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.inject"></a>
|
|
@@ -271,6 +321,8 @@ public readonly inject: string[];
|
|
|
271
321
|
|
|
272
322
|
- *Type:* `string`[]
|
|
273
323
|
|
|
324
|
+
Documentation: https://esbuild.github.io/api/#inject.
|
|
325
|
+
|
|
274
326
|
---
|
|
275
327
|
|
|
276
328
|
##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsx"></a>
|
|
@@ -281,6 +333,8 @@ public readonly jsx: string;
|
|
|
281
333
|
|
|
282
334
|
- *Type:* `string`
|
|
283
335
|
|
|
336
|
+
Documentation: https://esbuild.github.io/api/#jsx.
|
|
337
|
+
|
|
284
338
|
---
|
|
285
339
|
|
|
286
340
|
##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsxFactory"></a>
|
|
@@ -291,6 +345,8 @@ public readonly jsxFactory: string;
|
|
|
291
345
|
|
|
292
346
|
- *Type:* `string`
|
|
293
347
|
|
|
348
|
+
Documentation: https://esbuild.github.io/api/#jsx-factory.
|
|
349
|
+
|
|
294
350
|
---
|
|
295
351
|
|
|
296
352
|
##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsxFragment"></a>
|
|
@@ -301,6 +357,8 @@ public readonly jsxFragment: string;
|
|
|
301
357
|
|
|
302
358
|
- *Type:* `string`
|
|
303
359
|
|
|
360
|
+
Documentation: https://esbuild.github.io/api/#jsx-fragment.
|
|
361
|
+
|
|
304
362
|
---
|
|
305
363
|
|
|
306
364
|
##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.keepNames"></a>
|
|
@@ -311,6 +369,8 @@ public readonly keepNames: boolean;
|
|
|
311
369
|
|
|
312
370
|
- *Type:* `boolean`
|
|
313
371
|
|
|
372
|
+
Documentation: https://esbuild.github.io/api/#keep-names.
|
|
373
|
+
|
|
314
374
|
---
|
|
315
375
|
|
|
316
376
|
##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.legalComments"></a>
|
|
@@ -321,6 +381,8 @@ public readonly legalComments: string;
|
|
|
321
381
|
|
|
322
382
|
- *Type:* `string`
|
|
323
383
|
|
|
384
|
+
Documentation: https://esbuild.github.io/api/#legal-comments.
|
|
385
|
+
|
|
324
386
|
---
|
|
325
387
|
|
|
326
388
|
##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.loader"></a>
|
|
@@ -331,6 +393,8 @@ public readonly loader: {[ key: string ]: string};
|
|
|
331
393
|
|
|
332
394
|
- *Type:* {[ key: string ]: `string`}
|
|
333
395
|
|
|
396
|
+
Documentation: https://esbuild.github.io/api/#loader.
|
|
397
|
+
|
|
334
398
|
---
|
|
335
399
|
|
|
336
400
|
##### `logLevel`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logLevel"></a>
|
|
@@ -341,6 +405,8 @@ public readonly logLevel: string;
|
|
|
341
405
|
|
|
342
406
|
- *Type:* `string`
|
|
343
407
|
|
|
408
|
+
Documentation: https://esbuild.github.io/api/#log-level.
|
|
409
|
+
|
|
344
410
|
---
|
|
345
411
|
|
|
346
412
|
##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logLimit"></a>
|
|
@@ -351,6 +417,8 @@ public readonly logLimit: number;
|
|
|
351
417
|
|
|
352
418
|
- *Type:* `number`
|
|
353
419
|
|
|
420
|
+
Documentation: https://esbuild.github.io/api/#log-limit.
|
|
421
|
+
|
|
354
422
|
---
|
|
355
423
|
|
|
356
424
|
##### `mainFields`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mainFields"></a>
|
|
@@ -361,6 +429,8 @@ public readonly mainFields: string[];
|
|
|
361
429
|
|
|
362
430
|
- *Type:* `string`[]
|
|
363
431
|
|
|
432
|
+
Documentation: https://esbuild.github.io/api/#mainFields.
|
|
433
|
+
|
|
364
434
|
---
|
|
365
435
|
|
|
366
436
|
##### `metafile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.metafile"></a>
|
|
@@ -371,6 +441,8 @@ public readonly metafile: boolean;
|
|
|
371
441
|
|
|
372
442
|
- *Type:* `boolean`
|
|
373
443
|
|
|
444
|
+
Documentation: https://esbuild.github.io/api/#metafile.
|
|
445
|
+
|
|
374
446
|
---
|
|
375
447
|
|
|
376
448
|
##### `minify`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minify"></a>
|
|
@@ -381,6 +453,8 @@ public readonly minify: boolean;
|
|
|
381
453
|
|
|
382
454
|
- *Type:* `boolean`
|
|
383
455
|
|
|
456
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
457
|
+
|
|
384
458
|
---
|
|
385
459
|
|
|
386
460
|
##### `minifyIdentifiers`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifyIdentifiers"></a>
|
|
@@ -391,6 +465,8 @@ public readonly minifyIdentifiers: boolean;
|
|
|
391
465
|
|
|
392
466
|
- *Type:* `boolean`
|
|
393
467
|
|
|
468
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
469
|
+
|
|
394
470
|
---
|
|
395
471
|
|
|
396
472
|
##### `minifySyntax`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifySyntax"></a>
|
|
@@ -401,6 +477,8 @@ public readonly minifySyntax: boolean;
|
|
|
401
477
|
|
|
402
478
|
- *Type:* `boolean`
|
|
403
479
|
|
|
480
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
481
|
+
|
|
404
482
|
---
|
|
405
483
|
|
|
406
484
|
##### `minifyWhitespace`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifyWhitespace"></a>
|
|
@@ -411,6 +489,8 @@ public readonly minifyWhitespace: boolean;
|
|
|
411
489
|
|
|
412
490
|
- *Type:* `boolean`
|
|
413
491
|
|
|
492
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
493
|
+
|
|
414
494
|
---
|
|
415
495
|
|
|
416
496
|
##### `nodePaths`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.nodePaths"></a>
|
|
@@ -421,6 +501,8 @@ public readonly nodePaths: string[];
|
|
|
421
501
|
|
|
422
502
|
- *Type:* `string`[]
|
|
423
503
|
|
|
504
|
+
Documentation: https://esbuild.github.io/api/#node-paths.
|
|
505
|
+
|
|
424
506
|
---
|
|
425
507
|
|
|
426
508
|
##### `outbase`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outbase"></a>
|
|
@@ -431,6 +513,8 @@ public readonly outbase: string;
|
|
|
431
513
|
|
|
432
514
|
- *Type:* `string`
|
|
433
515
|
|
|
516
|
+
Documentation: https://esbuild.github.io/api/#outbase.
|
|
517
|
+
|
|
434
518
|
---
|
|
435
519
|
|
|
436
520
|
##### `outdir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outdir"></a>
|
|
@@ -441,6 +525,8 @@ public readonly outdir: string;
|
|
|
441
525
|
|
|
442
526
|
- *Type:* `string`
|
|
443
527
|
|
|
528
|
+
Documentation: https://esbuild.github.io/api/#outdir.
|
|
529
|
+
|
|
444
530
|
---
|
|
445
531
|
|
|
446
532
|
##### `outExtension`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outExtension"></a>
|
|
@@ -451,6 +537,8 @@ public readonly outExtension: {[ key: string ]: string};
|
|
|
451
537
|
|
|
452
538
|
- *Type:* {[ key: string ]: `string`}
|
|
453
539
|
|
|
540
|
+
Documentation: https://esbuild.github.io/api/#out-extension.
|
|
541
|
+
|
|
454
542
|
---
|
|
455
543
|
|
|
456
544
|
##### `outfile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outfile"></a>
|
|
@@ -461,6 +549,8 @@ public readonly outfile: string;
|
|
|
461
549
|
|
|
462
550
|
- *Type:* `string`
|
|
463
551
|
|
|
552
|
+
Documentation: https://esbuild.github.io/api/#outfile.
|
|
553
|
+
|
|
464
554
|
---
|
|
465
555
|
|
|
466
556
|
##### `platform`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.platform"></a>
|
|
@@ -471,6 +561,8 @@ public readonly platform: string;
|
|
|
471
561
|
|
|
472
562
|
- *Type:* `string`
|
|
473
563
|
|
|
564
|
+
Documentation: https://esbuild.github.io/api/#platform.
|
|
565
|
+
|
|
474
566
|
---
|
|
475
567
|
|
|
476
568
|
##### `preserveSymlinks`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.preserveSymlinks"></a>
|
|
@@ -481,6 +573,8 @@ public readonly preserveSymlinks: boolean;
|
|
|
481
573
|
|
|
482
574
|
- *Type:* `boolean`
|
|
483
575
|
|
|
576
|
+
Documentation: https://esbuild.github.io/api/#preserve-symlinks.
|
|
577
|
+
|
|
484
578
|
---
|
|
485
579
|
|
|
486
580
|
##### `publicPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.publicPath"></a>
|
|
@@ -491,6 +585,8 @@ public readonly publicPath: string;
|
|
|
491
585
|
|
|
492
586
|
- *Type:* `string`
|
|
493
587
|
|
|
588
|
+
Documentation: https://esbuild.github.io/api/#public-path.
|
|
589
|
+
|
|
494
590
|
---
|
|
495
591
|
|
|
496
592
|
##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.pure"></a>
|
|
@@ -501,6 +597,8 @@ public readonly pure: string[];
|
|
|
501
597
|
|
|
502
598
|
- *Type:* `string`[]
|
|
503
599
|
|
|
600
|
+
Documentation: https://esbuild.github.io/api/#pure.
|
|
601
|
+
|
|
504
602
|
---
|
|
505
603
|
|
|
506
604
|
##### `resolveExtensions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.resolveExtensions"></a>
|
|
@@ -511,6 +609,8 @@ public readonly resolveExtensions: string[];
|
|
|
511
609
|
|
|
512
610
|
- *Type:* `string`[]
|
|
513
611
|
|
|
612
|
+
Documentation: https://esbuild.github.io/api/#resolve-extensions.
|
|
613
|
+
|
|
514
614
|
---
|
|
515
615
|
|
|
516
616
|
##### `sourcemap`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourcemap"></a>
|
|
@@ -521,6 +621,8 @@ public readonly sourcemap: boolean | string;
|
|
|
521
621
|
|
|
522
622
|
- *Type:* `boolean` | `string`
|
|
523
623
|
|
|
624
|
+
Documentation: https://esbuild.github.io/api/#sourcemap.
|
|
625
|
+
|
|
524
626
|
---
|
|
525
627
|
|
|
526
628
|
##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourceRoot"></a>
|
|
@@ -531,6 +633,8 @@ public readonly sourceRoot: string;
|
|
|
531
633
|
|
|
532
634
|
- *Type:* `string`
|
|
533
635
|
|
|
636
|
+
Documentation: https://esbuild.github.io/api/#source-root.
|
|
637
|
+
|
|
534
638
|
---
|
|
535
639
|
|
|
536
640
|
##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourcesContent"></a>
|
|
@@ -541,6 +645,8 @@ public readonly sourcesContent: boolean;
|
|
|
541
645
|
|
|
542
646
|
- *Type:* `boolean`
|
|
543
647
|
|
|
648
|
+
Documentation: https://esbuild.github.io/api/#sources-content.
|
|
649
|
+
|
|
544
650
|
---
|
|
545
651
|
|
|
546
652
|
##### `splitting`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.splitting"></a>
|
|
@@ -551,6 +657,8 @@ public readonly splitting: boolean;
|
|
|
551
657
|
|
|
552
658
|
- *Type:* `boolean`
|
|
553
659
|
|
|
660
|
+
Documentation: https://esbuild.github.io/api/#splitting.
|
|
661
|
+
|
|
554
662
|
---
|
|
555
663
|
|
|
556
664
|
##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.target"></a>
|
|
@@ -561,6 +669,8 @@ public readonly target: string | string[];
|
|
|
561
669
|
|
|
562
670
|
- *Type:* `string` | `string`[]
|
|
563
671
|
|
|
672
|
+
Documentation: https://esbuild.github.io/api/#target.
|
|
673
|
+
|
|
564
674
|
---
|
|
565
675
|
|
|
566
676
|
##### `treeShaking`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.treeShaking"></a>
|
|
@@ -571,6 +681,8 @@ public readonly treeShaking: boolean;
|
|
|
571
681
|
|
|
572
682
|
- *Type:* `boolean`
|
|
573
683
|
|
|
684
|
+
Documentation: https://esbuild.github.io/api/#tree-shaking.
|
|
685
|
+
|
|
574
686
|
---
|
|
575
687
|
|
|
576
688
|
##### `tsconfig`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.tsconfig"></a>
|
|
@@ -581,6 +693,8 @@ public readonly tsconfig: string;
|
|
|
581
693
|
|
|
582
694
|
- *Type:* `string`
|
|
583
695
|
|
|
696
|
+
Documentation: https://esbuild.github.io/api/#tsconfig.
|
|
697
|
+
|
|
584
698
|
---
|
|
585
699
|
|
|
586
700
|
##### `write`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.write"></a>
|
|
@@ -591,6 +705,8 @@ public readonly write: boolean;
|
|
|
591
705
|
|
|
592
706
|
- *Type:* `boolean`
|
|
593
707
|
|
|
708
|
+
Documentation: https://esbuild.github.io/api/#write.
|
|
709
|
+
|
|
594
710
|
---
|
|
595
711
|
|
|
596
712
|
### BundlerProps <a name="@mrgrain/cdk-esbuild.BundlerProps"></a>
|
|
@@ -603,6 +719,22 @@ import { BundlerProps } from '@mrgrain/cdk-esbuild'
|
|
|
603
719
|
const bundlerProps: BundlerProps = { ... }
|
|
604
720
|
```
|
|
605
721
|
|
|
722
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.buildFn"></a>
|
|
723
|
+
|
|
724
|
+
```typescript
|
|
725
|
+
public readonly buildFn: any;
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
- *Type:* `any`
|
|
729
|
+
- *Default:* esbuild.buildSync
|
|
730
|
+
|
|
731
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
732
|
+
|
|
733
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
734
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
606
738
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.buildOptions"></a>
|
|
607
739
|
|
|
608
740
|
```typescript
|
|
@@ -613,15 +745,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
613
745
|
|
|
614
746
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
615
747
|
|
|
616
|
-
`buildOptions.outdir: string`
|
|
748
|
+
`buildOptions.outdir: string`
|
|
617
749
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
618
750
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
619
751
|
*Cannot be used together with `outfile`*.
|
|
620
|
-
- `buildOptions.outfile: string`
|
|
621
|
-
Relative path to a file inside the CDK asset output directory.
|
|
752
|
+
- `buildOptions.outfile: string`
|
|
753
|
+
Relative path to a file inside the CDK asset output directory.
|
|
622
754
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
623
755
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
624
|
-
- `buildOptions.absWorkingDir: string`
|
|
756
|
+
- `buildOptions.absWorkingDir: string`
|
|
625
757
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
626
758
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
627
759
|
|
|
@@ -675,6 +807,22 @@ import { JavaScriptCodeProps } from '@mrgrain/cdk-esbuild'
|
|
|
675
807
|
const javaScriptCodeProps: JavaScriptCodeProps = { ... }
|
|
676
808
|
```
|
|
677
809
|
|
|
810
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.buildFn"></a>
|
|
811
|
+
|
|
812
|
+
```typescript
|
|
813
|
+
public readonly buildFn: any;
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
- *Type:* `any`
|
|
817
|
+
- *Default:* esbuild.buildSync
|
|
818
|
+
|
|
819
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
820
|
+
|
|
821
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
822
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
823
|
+
|
|
824
|
+
---
|
|
825
|
+
|
|
678
826
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.buildOptions"></a>
|
|
679
827
|
|
|
680
828
|
```typescript
|
|
@@ -685,15 +833,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
685
833
|
|
|
686
834
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
687
835
|
|
|
688
|
-
`buildOptions.outdir: string`
|
|
836
|
+
`buildOptions.outdir: string`
|
|
689
837
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
690
838
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
691
839
|
*Cannot be used together with `outfile`*.
|
|
692
|
-
- `buildOptions.outfile: string`
|
|
693
|
-
Relative path to a file inside the CDK asset output directory.
|
|
840
|
+
- `buildOptions.outfile: string`
|
|
841
|
+
Relative path to a file inside the CDK asset output directory.
|
|
694
842
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
695
843
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
696
|
-
- `buildOptions.absWorkingDir: string`
|
|
844
|
+
- `buildOptions.absWorkingDir: string`
|
|
697
845
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
698
846
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
699
847
|
|
|
@@ -741,6 +889,22 @@ import { JavaScriptSourceProps } from '@mrgrain/cdk-esbuild'
|
|
|
741
889
|
const javaScriptSourceProps: JavaScriptSourceProps = { ... }
|
|
742
890
|
```
|
|
743
891
|
|
|
892
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.buildFn"></a>
|
|
893
|
+
|
|
894
|
+
```typescript
|
|
895
|
+
public readonly buildFn: any;
|
|
896
|
+
```
|
|
897
|
+
|
|
898
|
+
- *Type:* `any`
|
|
899
|
+
- *Default:* esbuild.buildSync
|
|
900
|
+
|
|
901
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
902
|
+
|
|
903
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
904
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
905
|
+
|
|
906
|
+
---
|
|
907
|
+
|
|
744
908
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.buildOptions"></a>
|
|
745
909
|
|
|
746
910
|
```typescript
|
|
@@ -751,15 +915,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
751
915
|
|
|
752
916
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
753
917
|
|
|
754
|
-
`buildOptions.outdir: string`
|
|
918
|
+
`buildOptions.outdir: string`
|
|
755
919
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
756
920
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
757
921
|
*Cannot be used together with `outfile`*.
|
|
758
|
-
- `buildOptions.outfile: string`
|
|
759
|
-
Relative path to a file inside the CDK asset output directory.
|
|
922
|
+
- `buildOptions.outfile: string`
|
|
923
|
+
Relative path to a file inside the CDK asset output directory.
|
|
760
924
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
761
925
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
762
|
-
- `buildOptions.absWorkingDir: string`
|
|
926
|
+
- `buildOptions.absWorkingDir: string`
|
|
763
927
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
764
928
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
765
929
|
|
|
@@ -797,6 +961,48 @@ Defaults to a hash of all files in the resulting bundle.
|
|
|
797
961
|
|
|
798
962
|
---
|
|
799
963
|
|
|
964
|
+
### TransformerProps <a name="@mrgrain/cdk-esbuild.TransformerProps"></a>
|
|
965
|
+
|
|
966
|
+
#### Initializer <a name="[object Object].Initializer"></a>
|
|
967
|
+
|
|
968
|
+
```typescript
|
|
969
|
+
import { TransformerProps } from '@mrgrain/cdk-esbuild'
|
|
970
|
+
|
|
971
|
+
const transformerProps: TransformerProps = { ... }
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
##### `transformFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformerProps.property.transformFn"></a>
|
|
975
|
+
|
|
976
|
+
```typescript
|
|
977
|
+
public readonly transformFn: any;
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
- *Type:* `any`
|
|
981
|
+
- *Default:* esbuild.transformSync
|
|
982
|
+
|
|
983
|
+
Escape hatch to provide the bundler with a custom transform function.
|
|
984
|
+
|
|
985
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however a TransformResult must be returned to integrate with CDK.
|
|
986
|
+
Must throw a `TransformFailure` on failure to correctly inform the bundler.
|
|
987
|
+
|
|
988
|
+
---
|
|
989
|
+
|
|
990
|
+
##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformerProps.property.transformOptions"></a>
|
|
991
|
+
|
|
992
|
+
```typescript
|
|
993
|
+
public readonly transformOptions: TransformOptions;
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
997
|
+
|
|
998
|
+
Transform options passed on to esbuild.
|
|
999
|
+
|
|
1000
|
+
Please refer to the esbuild Transform API docs for details.
|
|
1001
|
+
|
|
1002
|
+
> https://esbuild.github.io/api/#transform-api
|
|
1003
|
+
|
|
1004
|
+
---
|
|
1005
|
+
|
|
800
1006
|
### TransformOptions <a name="@mrgrain/cdk-esbuild.TransformOptions"></a>
|
|
801
1007
|
|
|
802
1008
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
@@ -825,6 +1031,8 @@ public readonly charset: string;
|
|
|
825
1031
|
|
|
826
1032
|
- *Type:* `string`
|
|
827
1033
|
|
|
1034
|
+
Documentation: https://esbuild.github.io/api/#charset.
|
|
1035
|
+
|
|
828
1036
|
---
|
|
829
1037
|
|
|
830
1038
|
##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.color"></a>
|
|
@@ -835,6 +1043,8 @@ public readonly color: boolean;
|
|
|
835
1043
|
|
|
836
1044
|
- *Type:* `boolean`
|
|
837
1045
|
|
|
1046
|
+
Documentation: https://esbuild.github.io/api/#color.
|
|
1047
|
+
|
|
838
1048
|
---
|
|
839
1049
|
|
|
840
1050
|
##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.define"></a>
|
|
@@ -845,6 +1055,8 @@ public readonly define: {[ key: string ]: string};
|
|
|
845
1055
|
|
|
846
1056
|
- *Type:* {[ key: string ]: `string`}
|
|
847
1057
|
|
|
1058
|
+
Documentation: https://esbuild.github.io/api/#define.
|
|
1059
|
+
|
|
848
1060
|
---
|
|
849
1061
|
|
|
850
1062
|
##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.footer"></a>
|
|
@@ -865,6 +1077,8 @@ public readonly format: string;
|
|
|
865
1077
|
|
|
866
1078
|
- *Type:* `string`
|
|
867
1079
|
|
|
1080
|
+
Documentation: https://esbuild.github.io/api/#format.
|
|
1081
|
+
|
|
868
1082
|
---
|
|
869
1083
|
|
|
870
1084
|
##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.globalName"></a>
|
|
@@ -875,6 +1089,8 @@ public readonly globalName: string;
|
|
|
875
1089
|
|
|
876
1090
|
- *Type:* `string`
|
|
877
1091
|
|
|
1092
|
+
Documentation: https://esbuild.github.io/api/#globalName.
|
|
1093
|
+
|
|
878
1094
|
---
|
|
879
1095
|
|
|
880
1096
|
##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.ignoreAnnotations"></a>
|
|
@@ -885,6 +1101,8 @@ public readonly ignoreAnnotations: boolean;
|
|
|
885
1101
|
|
|
886
1102
|
- *Type:* `boolean`
|
|
887
1103
|
|
|
1104
|
+
Documentation: https://esbuild.github.io/api/#ignore-annotations.
|
|
1105
|
+
|
|
888
1106
|
---
|
|
889
1107
|
|
|
890
1108
|
##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsx"></a>
|
|
@@ -895,6 +1113,8 @@ public readonly jsx: string;
|
|
|
895
1113
|
|
|
896
1114
|
- *Type:* `string`
|
|
897
1115
|
|
|
1116
|
+
Documentation: https://esbuild.github.io/api/#jsx.
|
|
1117
|
+
|
|
898
1118
|
---
|
|
899
1119
|
|
|
900
1120
|
##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFactory"></a>
|
|
@@ -905,6 +1125,8 @@ public readonly jsxFactory: string;
|
|
|
905
1125
|
|
|
906
1126
|
- *Type:* `string`
|
|
907
1127
|
|
|
1128
|
+
Documentation: https://esbuild.github.io/api/#jsx-factory.
|
|
1129
|
+
|
|
908
1130
|
---
|
|
909
1131
|
|
|
910
1132
|
##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFragment"></a>
|
|
@@ -915,6 +1137,8 @@ public readonly jsxFragment: string;
|
|
|
915
1137
|
|
|
916
1138
|
- *Type:* `string`
|
|
917
1139
|
|
|
1140
|
+
Documentation: https://esbuild.github.io/api/#jsx-fragment.
|
|
1141
|
+
|
|
918
1142
|
---
|
|
919
1143
|
|
|
920
1144
|
##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.keepNames"></a>
|
|
@@ -925,6 +1149,8 @@ public readonly keepNames: boolean;
|
|
|
925
1149
|
|
|
926
1150
|
- *Type:* `boolean`
|
|
927
1151
|
|
|
1152
|
+
Documentation: https://esbuild.github.io/api/#keep-names.
|
|
1153
|
+
|
|
928
1154
|
---
|
|
929
1155
|
|
|
930
1156
|
##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.legalComments"></a>
|
|
@@ -935,6 +1161,8 @@ public readonly legalComments: string;
|
|
|
935
1161
|
|
|
936
1162
|
- *Type:* `string`
|
|
937
1163
|
|
|
1164
|
+
Documentation: https://esbuild.github.io/api/#legal-comments.
|
|
1165
|
+
|
|
938
1166
|
---
|
|
939
1167
|
|
|
940
1168
|
##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.loader"></a>
|
|
@@ -955,6 +1183,8 @@ public readonly logLevel: string;
|
|
|
955
1183
|
|
|
956
1184
|
- *Type:* `string`
|
|
957
1185
|
|
|
1186
|
+
Documentation: https://esbuild.github.io/api/#log-level.
|
|
1187
|
+
|
|
958
1188
|
---
|
|
959
1189
|
|
|
960
1190
|
##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLimit"></a>
|
|
@@ -965,6 +1195,8 @@ public readonly logLimit: number;
|
|
|
965
1195
|
|
|
966
1196
|
- *Type:* `number`
|
|
967
1197
|
|
|
1198
|
+
Documentation: https://esbuild.github.io/api/#log-limit.
|
|
1199
|
+
|
|
968
1200
|
---
|
|
969
1201
|
|
|
970
1202
|
##### `minify`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minify"></a>
|
|
@@ -975,6 +1207,8 @@ public readonly minify: boolean;
|
|
|
975
1207
|
|
|
976
1208
|
- *Type:* `boolean`
|
|
977
1209
|
|
|
1210
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
1211
|
+
|
|
978
1212
|
---
|
|
979
1213
|
|
|
980
1214
|
##### `minifyIdentifiers`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyIdentifiers"></a>
|
|
@@ -985,6 +1219,8 @@ public readonly minifyIdentifiers: boolean;
|
|
|
985
1219
|
|
|
986
1220
|
- *Type:* `boolean`
|
|
987
1221
|
|
|
1222
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
1223
|
+
|
|
988
1224
|
---
|
|
989
1225
|
|
|
990
1226
|
##### `minifySyntax`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifySyntax"></a>
|
|
@@ -995,6 +1231,8 @@ public readonly minifySyntax: boolean;
|
|
|
995
1231
|
|
|
996
1232
|
- *Type:* `boolean`
|
|
997
1233
|
|
|
1234
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
1235
|
+
|
|
998
1236
|
---
|
|
999
1237
|
|
|
1000
1238
|
##### `minifyWhitespace`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyWhitespace"></a>
|
|
@@ -1005,6 +1243,8 @@ public readonly minifyWhitespace: boolean;
|
|
|
1005
1243
|
|
|
1006
1244
|
- *Type:* `boolean`
|
|
1007
1245
|
|
|
1246
|
+
Documentation: https://esbuild.github.io/api/#minify.
|
|
1247
|
+
|
|
1008
1248
|
---
|
|
1009
1249
|
|
|
1010
1250
|
##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.pure"></a>
|
|
@@ -1015,6 +1255,8 @@ public readonly pure: string[];
|
|
|
1015
1255
|
|
|
1016
1256
|
- *Type:* `string`[]
|
|
1017
1257
|
|
|
1258
|
+
Documentation: https://esbuild.github.io/api/#pure.
|
|
1259
|
+
|
|
1018
1260
|
---
|
|
1019
1261
|
|
|
1020
1262
|
##### `sourcefile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcefile"></a>
|
|
@@ -1035,6 +1277,8 @@ public readonly sourcemap: boolean | string;
|
|
|
1035
1277
|
|
|
1036
1278
|
- *Type:* `boolean` | `string`
|
|
1037
1279
|
|
|
1280
|
+
Documentation: https://esbuild.github.io/api/#sourcemap.
|
|
1281
|
+
|
|
1038
1282
|
---
|
|
1039
1283
|
|
|
1040
1284
|
##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourceRoot"></a>
|
|
@@ -1045,6 +1289,8 @@ public readonly sourceRoot: string;
|
|
|
1045
1289
|
|
|
1046
1290
|
- *Type:* `string`
|
|
1047
1291
|
|
|
1292
|
+
Documentation: https://esbuild.github.io/api/#source-root.
|
|
1293
|
+
|
|
1048
1294
|
---
|
|
1049
1295
|
|
|
1050
1296
|
##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcesContent"></a>
|
|
@@ -1055,6 +1301,8 @@ public readonly sourcesContent: boolean;
|
|
|
1055
1301
|
|
|
1056
1302
|
- *Type:* `boolean`
|
|
1057
1303
|
|
|
1304
|
+
Documentation: https://esbuild.github.io/api/#sources-content.
|
|
1305
|
+
|
|
1058
1306
|
---
|
|
1059
1307
|
|
|
1060
1308
|
##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
|
|
@@ -1065,6 +1313,8 @@ public readonly target: string | string[];
|
|
|
1065
1313
|
|
|
1066
1314
|
- *Type:* `string` | `string`[]
|
|
1067
1315
|
|
|
1316
|
+
Documentation: https://esbuild.github.io/api/#target.
|
|
1317
|
+
|
|
1068
1318
|
---
|
|
1069
1319
|
|
|
1070
1320
|
##### `treeShaking`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.treeShaking"></a>
|
|
@@ -1075,6 +1325,8 @@ public readonly treeShaking: boolean;
|
|
|
1075
1325
|
|
|
1076
1326
|
- *Type:* `boolean`
|
|
1077
1327
|
|
|
1328
|
+
Documentation: https://esbuild.github.io/api/#tree-shaking.
|
|
1329
|
+
|
|
1078
1330
|
---
|
|
1079
1331
|
|
|
1080
1332
|
##### `tsconfigRaw`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.tsconfigRaw"></a>
|
|
@@ -1097,6 +1349,22 @@ import { TypeScriptCodeProps } from '@mrgrain/cdk-esbuild'
|
|
|
1097
1349
|
const typeScriptCodeProps: TypeScriptCodeProps = { ... }
|
|
1098
1350
|
```
|
|
1099
1351
|
|
|
1352
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.buildFn"></a>
|
|
1353
|
+
|
|
1354
|
+
```typescript
|
|
1355
|
+
public readonly buildFn: any;
|
|
1356
|
+
```
|
|
1357
|
+
|
|
1358
|
+
- *Type:* `any`
|
|
1359
|
+
- *Default:* esbuild.buildSync
|
|
1360
|
+
|
|
1361
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
1362
|
+
|
|
1363
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
1364
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
1365
|
+
|
|
1366
|
+
---
|
|
1367
|
+
|
|
1100
1368
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.buildOptions"></a>
|
|
1101
1369
|
|
|
1102
1370
|
```typescript
|
|
@@ -1107,15 +1375,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
1107
1375
|
|
|
1108
1376
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
1109
1377
|
|
|
1110
|
-
`buildOptions.outdir: string`
|
|
1378
|
+
`buildOptions.outdir: string`
|
|
1111
1379
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
1112
1380
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
1113
1381
|
*Cannot be used together with `outfile`*.
|
|
1114
|
-
- `buildOptions.outfile: string`
|
|
1115
|
-
Relative path to a file inside the CDK asset output directory.
|
|
1382
|
+
- `buildOptions.outfile: string`
|
|
1383
|
+
Relative path to a file inside the CDK asset output directory.
|
|
1116
1384
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
1117
1385
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
1118
|
-
- `buildOptions.absWorkingDir: string`
|
|
1386
|
+
- `buildOptions.absWorkingDir: string`
|
|
1119
1387
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
1120
1388
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
1121
1389
|
|
|
@@ -1163,6 +1431,22 @@ import { TypeScriptSourceProps } from '@mrgrain/cdk-esbuild'
|
|
|
1163
1431
|
const typeScriptSourceProps: TypeScriptSourceProps = { ... }
|
|
1164
1432
|
```
|
|
1165
1433
|
|
|
1434
|
+
##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.buildFn"></a>
|
|
1435
|
+
|
|
1436
|
+
```typescript
|
|
1437
|
+
public readonly buildFn: any;
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
- *Type:* `any`
|
|
1441
|
+
- *Default:* esbuild.buildSync
|
|
1442
|
+
|
|
1443
|
+
Escape hatch to provide the bundler with a custom build function.
|
|
1444
|
+
|
|
1445
|
+
The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
|
|
1446
|
+
Must throw a `BuildFailure` on failure to correctly inform the bundler.
|
|
1447
|
+
|
|
1448
|
+
---
|
|
1449
|
+
|
|
1166
1450
|
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.buildOptions"></a>
|
|
1167
1451
|
|
|
1168
1452
|
```typescript
|
|
@@ -1173,15 +1457,15 @@ public readonly buildOptions: BuildOptions;
|
|
|
1173
1457
|
|
|
1174
1458
|
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
1175
1459
|
|
|
1176
|
-
`buildOptions.outdir: string`
|
|
1460
|
+
`buildOptions.outdir: string`
|
|
1177
1461
|
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
1178
1462
|
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
1179
1463
|
*Cannot be used together with `outfile`*.
|
|
1180
|
-
- `buildOptions.outfile: string`
|
|
1181
|
-
Relative path to a file inside the CDK asset output directory.
|
|
1464
|
+
- `buildOptions.outfile: string`
|
|
1465
|
+
Relative path to a file inside the CDK asset output directory.
|
|
1182
1466
|
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
1183
1467
|
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
1184
|
-
- `buildOptions.absWorkingDir: string`
|
|
1468
|
+
- `buildOptions.absWorkingDir: string`
|
|
1185
1469
|
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
1186
1470
|
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
1187
1471
|
|
|
@@ -1317,7 +1601,7 @@ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline
|
|
|
1317
1601
|
```typescript
|
|
1318
1602
|
import { InlineJavaScriptCode } from '@mrgrain/cdk-esbuild'
|
|
1319
1603
|
|
|
1320
|
-
new InlineJavaScriptCode(code: string,
|
|
1604
|
+
new InlineJavaScriptCode(code: string, props?: TransformOptions | TransformerProps)
|
|
1321
1605
|
```
|
|
1322
1606
|
|
|
1323
1607
|
##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.code"></a>
|
|
@@ -1328,14 +1612,15 @@ The inline code to be transformed.
|
|
|
1328
1612
|
|
|
1329
1613
|
---
|
|
1330
1614
|
|
|
1331
|
-
##### `
|
|
1615
|
+
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.props"></a>
|
|
1332
1616
|
|
|
1333
|
-
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1617
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
|
|
1334
1618
|
|
|
1335
|
-
|
|
1619
|
+
Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
|
|
1336
1620
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1621
|
+
Props to change the behaviour of the transformer.
|
|
1622
|
+
|
|
1623
|
+
Default values for `props.transformOptions`:
|
|
1339
1624
|
- `loader='js'`
|
|
1340
1625
|
|
|
1341
1626
|
> https://esbuild.github.io/api/#transform-api
|
|
@@ -1355,7 +1640,7 @@ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline
|
|
|
1355
1640
|
```typescript
|
|
1356
1641
|
import { InlineJsxCode } from '@mrgrain/cdk-esbuild'
|
|
1357
1642
|
|
|
1358
|
-
new InlineJsxCode(code: string,
|
|
1643
|
+
new InlineJsxCode(code: string, props?: TransformOptions | TransformerProps)
|
|
1359
1644
|
```
|
|
1360
1645
|
|
|
1361
1646
|
##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.code"></a>
|
|
@@ -1366,13 +1651,14 @@ The inline code to be transformed.
|
|
|
1366
1651
|
|
|
1367
1652
|
---
|
|
1368
1653
|
|
|
1369
|
-
##### `
|
|
1654
|
+
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.props"></a>
|
|
1370
1655
|
|
|
1371
|
-
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1656
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
|
|
1372
1657
|
|
|
1373
|
-
|
|
1658
|
+
Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
|
|
1659
|
+
|
|
1660
|
+
Props to change the behaviour of the transformer.
|
|
1374
1661
|
|
|
1375
|
-
Please refer to the esbuild Transform API docs for details. \
|
|
1376
1662
|
Default values for `transformOptions`:
|
|
1377
1663
|
- `loader='jsx'`
|
|
1378
1664
|
|
|
@@ -1393,7 +1679,7 @@ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline
|
|
|
1393
1679
|
```typescript
|
|
1394
1680
|
import { InlineTsxCode } from '@mrgrain/cdk-esbuild'
|
|
1395
1681
|
|
|
1396
|
-
new InlineTsxCode(code: string,
|
|
1682
|
+
new InlineTsxCode(code: string, props?: TransformOptions | TransformerProps)
|
|
1397
1683
|
```
|
|
1398
1684
|
|
|
1399
1685
|
##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.code"></a>
|
|
@@ -1404,13 +1690,14 @@ The inline code to be transformed.
|
|
|
1404
1690
|
|
|
1405
1691
|
---
|
|
1406
1692
|
|
|
1407
|
-
##### `
|
|
1693
|
+
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.props"></a>
|
|
1408
1694
|
|
|
1409
|
-
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1695
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
|
|
1410
1696
|
|
|
1411
|
-
|
|
1697
|
+
Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
|
|
1698
|
+
|
|
1699
|
+
Props to change the behaviour of the transformer.
|
|
1412
1700
|
|
|
1413
|
-
Please refer to the esbuild Transform API docs for details. \
|
|
1414
1701
|
Default values for `transformOptions`:
|
|
1415
1702
|
- `loader='tsx'`
|
|
1416
1703
|
|
|
@@ -1431,7 +1718,7 @@ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline
|
|
|
1431
1718
|
```typescript
|
|
1432
1719
|
import { InlineTypeScriptCode } from '@mrgrain/cdk-esbuild'
|
|
1433
1720
|
|
|
1434
|
-
new InlineTypeScriptCode(code: string,
|
|
1721
|
+
new InlineTypeScriptCode(code: string, props?: TransformOptions | TransformerProps)
|
|
1435
1722
|
```
|
|
1436
1723
|
|
|
1437
1724
|
##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.code"></a>
|
|
@@ -1442,13 +1729,14 @@ The inline code to be transformed.
|
|
|
1442
1729
|
|
|
1443
1730
|
---
|
|
1444
1731
|
|
|
1445
|
-
##### `
|
|
1732
|
+
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.props"></a>
|
|
1446
1733
|
|
|
1447
|
-
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1734
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
|
|
1448
1735
|
|
|
1449
|
-
|
|
1736
|
+
Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
|
|
1737
|
+
|
|
1738
|
+
Props to change the behaviour of the transformer.
|
|
1450
1739
|
|
|
1451
|
-
Please refer to the esbuild Transform API docs for details. \
|
|
1452
1740
|
Default values for `transformOptions`:
|
|
1453
1741
|
- `loader='ts'`
|
|
1454
1742
|
|