@mrgrain/cdk-esbuild 3.6.0 → 3.8.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/API.md DELETED
@@ -1,2510 +0,0 @@
1
- # API Reference <a name="API Reference"></a>
2
-
3
- ## Constructs <a name="Constructs"></a>
4
-
5
- ### EsbuildAsset <a name="@mrgrain/cdk-esbuild.EsbuildAsset"></a>
6
-
7
- Represents the a generic Esbuild Asset.
8
-
9
- #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildAsset.Initializer"></a>
10
-
11
- ```typescript
12
- import { EsbuildAsset } from '@mrgrain/cdk-esbuild'
13
-
14
- new EsbuildAsset(scope: Construct, id: string, props: AssetProps)
15
- ```
16
-
17
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.scope"></a>
18
-
19
- - *Type:* [`constructs.Construct`](#constructs.Construct)
20
-
21
- ---
22
-
23
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.id"></a>
24
-
25
- - *Type:* `string`
26
-
27
- ---
28
-
29
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.props"></a>
30
-
31
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
32
-
33
- ---
34
-
35
-
36
-
37
-
38
-
39
- ### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
40
-
41
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
42
-
43
- The asset can be used by other constructs.
44
-
45
- #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
46
-
47
- ```typescript
48
- import { JavaScriptAsset } from '@mrgrain/cdk-esbuild'
49
-
50
- new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
51
- ```
52
-
53
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.scope"></a>
54
-
55
- - *Type:* [`constructs.Construct`](#constructs.Construct)
56
-
57
- ---
58
-
59
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.id"></a>
60
-
61
- - *Type:* `string`
62
-
63
- ---
64
-
65
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.props"></a>
66
-
67
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
68
-
69
- ---
70
-
71
-
72
-
73
-
74
-
75
- ### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
76
-
77
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
78
-
79
- The asset can be used by other constructs.
80
-
81
- #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
82
-
83
- ```typescript
84
- import { TypeScriptAsset } from '@mrgrain/cdk-esbuild'
85
-
86
- new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
87
- ```
88
-
89
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.scope"></a>
90
-
91
- - *Type:* [`constructs.Construct`](#constructs.Construct)
92
-
93
- ---
94
-
95
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.id"></a>
96
-
97
- - *Type:* `string`
98
-
99
- ---
100
-
101
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.props"></a>
102
-
103
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
104
-
105
- ---
106
-
107
-
108
-
109
-
110
-
111
- ## Structs <a name="Structs"></a>
112
-
113
- ### AssetProps <a name="@mrgrain/cdk-esbuild.AssetProps"></a>
114
-
115
- #### Initializer <a name="[object Object].Initializer"></a>
116
-
117
- ```typescript
118
- import { AssetProps } from '@mrgrain/cdk-esbuild'
119
-
120
- const assetProps: AssetProps = { ... }
121
- ```
122
-
123
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildFn"></a>
124
-
125
- ```typescript
126
- public readonly buildFn: any;
127
- ```
128
-
129
- - *Type:* `any`
130
- - *Default:* esbuild.buildSync
131
-
132
- Escape hatch to provide the bundler with a custom build function.
133
-
134
- 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.
135
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
136
-
137
- ---
138
-
139
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildOptions"></a>
140
-
141
- ```typescript
142
- public readonly buildOptions: BuildOptions;
143
- ```
144
-
145
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
146
-
147
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
148
-
149
- * `buildOptions.outdir: string`
150
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
151
- 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. \
152
- *Cannot be used together with `outfile`*.
153
- * `buildOptions.outfile: string`
154
- Relative path to a file inside the CDK asset output directory.
155
- 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. \
156
- *Cannot be used with multiple entryPoints or together with `outdir`.*
157
- * `buildOptions.absWorkingDir: string`
158
- 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). \
159
- 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).
160
-
161
- > https://esbuild.github.io/api/#build-api
162
-
163
- ---
164
-
165
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.copyDir"></a>
166
-
167
- ```typescript
168
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
169
- ```
170
-
171
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
172
-
173
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
174
-
175
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
176
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
177
-
178
- Therefore the following values for `copyDir` are all equivalent:
179
- ```ts
180
- { copyDir: "path/to/source" }
181
- { copyDir: ["path/to/source"] }
182
- { copyDir: { ".": "path/to/source" } }
183
- { copyDir: { ".": ["path/to/source"] } }
184
- ```
185
- The destination cannot be outside of the asset staging directory.
186
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
187
- you are likely using `..` or an absolute path as key on the `copyDir` map.
188
- Instead use only relative paths and avoid `..`.
189
-
190
- ---
191
-
192
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.esbuildBinaryPath"></a>
193
-
194
- ```typescript
195
- public readonly esbuildBinaryPath: string;
196
- ```
197
-
198
- - *Type:* `string`
199
-
200
- Path to the binary used by esbuild.
201
-
202
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
203
-
204
- ---
205
-
206
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.entryPoints"></a>
207
-
208
- ```typescript
209
- public readonly entryPoints: string | string[] | {[ key: string ]: string};
210
- ```
211
-
212
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
213
-
214
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
215
-
216
- E.g. `src/index.ts`.
217
-
218
- ---
219
-
220
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.assetHash"></a>
221
-
222
- ```typescript
223
- public readonly assetHash: string;
224
- ```
225
-
226
- - *Type:* `string`
227
-
228
- A hash of this asset, which is available at construction time.
229
-
230
- As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
231
-
232
- Defaults to a hash of all files in the resulting bundle.
233
-
234
- ---
235
-
236
- ### BuildOptions <a name="@mrgrain/cdk-esbuild.BuildOptions"></a>
237
-
238
- #### Initializer <a name="[object Object].Initializer"></a>
239
-
240
- ```typescript
241
- import { BuildOptions } from '@mrgrain/cdk-esbuild'
242
-
243
- const buildOptions: BuildOptions = { ... }
244
- ```
245
-
246
- ##### `absWorkingDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.absWorkingDir"></a>
247
-
248
- ```typescript
249
- public readonly absWorkingDir: string;
250
- ```
251
-
252
- - *Type:* `string`
253
-
254
- Documentation: https://esbuild.github.io/api/#working-directory.
255
-
256
- ---
257
-
258
- ##### `allowOverwrite`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.allowOverwrite"></a>
259
-
260
- ```typescript
261
- public readonly allowOverwrite: boolean;
262
- ```
263
-
264
- - *Type:* `boolean`
265
-
266
- Documentation: https://esbuild.github.io/api/#allow-overwrite.
267
-
268
- ---
269
-
270
- ##### `assetNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.assetNames"></a>
271
-
272
- ```typescript
273
- public readonly assetNames: string;
274
- ```
275
-
276
- - *Type:* `string`
277
-
278
- Documentation: https://esbuild.github.io/api/#asset-names.
279
-
280
- ---
281
-
282
- ##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.banner"></a>
283
-
284
- ```typescript
285
- public readonly banner: {[ key: string ]: string};
286
- ```
287
-
288
- - *Type:* {[ key: string ]: `string`}
289
-
290
- Documentation: https://esbuild.github.io/api/#banner.
291
-
292
- ---
293
-
294
- ##### `bundle`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.bundle"></a>
295
-
296
- ```typescript
297
- public readonly bundle: boolean;
298
- ```
299
-
300
- - *Type:* `boolean`
301
-
302
- Documentation: https://esbuild.github.io/api/#bundle.
303
-
304
- ---
305
-
306
- ##### `charset`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.charset"></a>
307
-
308
- ```typescript
309
- public readonly charset: string;
310
- ```
311
-
312
- - *Type:* `string`
313
-
314
- Documentation: https://esbuild.github.io/api/#charset.
315
-
316
- ---
317
-
318
- ##### `chunkNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.chunkNames"></a>
319
-
320
- ```typescript
321
- public readonly chunkNames: string;
322
- ```
323
-
324
- - *Type:* `string`
325
-
326
- Documentation: https://esbuild.github.io/api/#chunk-names.
327
-
328
- ---
329
-
330
- ##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.color"></a>
331
-
332
- ```typescript
333
- public readonly color: boolean;
334
- ```
335
-
336
- - *Type:* `boolean`
337
-
338
- Documentation: https://esbuild.github.io/api/#color.
339
-
340
- ---
341
-
342
- ##### `conditions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.conditions"></a>
343
-
344
- ```typescript
345
- public readonly conditions: string[];
346
- ```
347
-
348
- - *Type:* `string`[]
349
-
350
- Documentation: https://esbuild.github.io/api/#conditions.
351
-
352
- ---
353
-
354
- ##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.define"></a>
355
-
356
- ```typescript
357
- public readonly define: {[ key: string ]: string};
358
- ```
359
-
360
- - *Type:* {[ key: string ]: `string`}
361
-
362
- Documentation: https://esbuild.github.io/api/#define.
363
-
364
- ---
365
-
366
- ##### `drop`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.drop"></a>
367
-
368
- ```typescript
369
- public readonly drop: string[];
370
- ```
371
-
372
- - *Type:* `string`[]
373
-
374
- Documentation: https://esbuild.github.io/api/#drop.
375
-
376
- ---
377
-
378
- ##### `entryNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.entryNames"></a>
379
-
380
- ```typescript
381
- public readonly entryNames: string;
382
- ```
383
-
384
- - *Type:* `string`
385
-
386
- Documentation: https://esbuild.github.io/api/#entry-names.
387
-
388
- ---
389
-
390
- ##### `external`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.external"></a>
391
-
392
- ```typescript
393
- public readonly external: string[];
394
- ```
395
-
396
- - *Type:* `string`[]
397
-
398
- Documentation: https://esbuild.github.io/api/#external.
399
-
400
- ---
401
-
402
- ##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.footer"></a>
403
-
404
- ```typescript
405
- public readonly footer: {[ key: string ]: string};
406
- ```
407
-
408
- - *Type:* {[ key: string ]: `string`}
409
-
410
- Documentation: https://esbuild.github.io/api/#footer.
411
-
412
- ---
413
-
414
- ##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.format"></a>
415
-
416
- ```typescript
417
- public readonly format: string;
418
- ```
419
-
420
- - *Type:* `string`
421
-
422
- Documentation: https://esbuild.github.io/api/#format.
423
-
424
- ---
425
-
426
- ##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.globalName"></a>
427
-
428
- ```typescript
429
- public readonly globalName: string;
430
- ```
431
-
432
- - *Type:* `string`
433
-
434
- Documentation: https://esbuild.github.io/api/#globalName.
435
-
436
- ---
437
-
438
- ##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.ignoreAnnotations"></a>
439
-
440
- ```typescript
441
- public readonly ignoreAnnotations: boolean;
442
- ```
443
-
444
- - *Type:* `boolean`
445
-
446
- Documentation: https://esbuild.github.io/api/#ignore-annotations.
447
-
448
- ---
449
-
450
- ##### `incremental`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.incremental"></a>
451
-
452
- ```typescript
453
- public readonly incremental: boolean;
454
- ```
455
-
456
- - *Type:* `boolean`
457
-
458
- Documentation: https://esbuild.github.io/api/#incremental.
459
-
460
- ---
461
-
462
- ##### `inject`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.inject"></a>
463
-
464
- ```typescript
465
- public readonly inject: string[];
466
- ```
467
-
468
- - *Type:* `string`[]
469
-
470
- Documentation: https://esbuild.github.io/api/#inject.
471
-
472
- ---
473
-
474
- ##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsx"></a>
475
-
476
- ```typescript
477
- public readonly jsx: string;
478
- ```
479
-
480
- - *Type:* `string`
481
-
482
- Documentation: https://esbuild.github.io/api/#jsx.
483
-
484
- ---
485
-
486
- ##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsxFactory"></a>
487
-
488
- ```typescript
489
- public readonly jsxFactory: string;
490
- ```
491
-
492
- - *Type:* `string`
493
-
494
- Documentation: https://esbuild.github.io/api/#jsx-factory.
495
-
496
- ---
497
-
498
- ##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.jsxFragment"></a>
499
-
500
- ```typescript
501
- public readonly jsxFragment: string;
502
- ```
503
-
504
- - *Type:* `string`
505
-
506
- Documentation: https://esbuild.github.io/api/#jsx-fragment.
507
-
508
- ---
509
-
510
- ##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.keepNames"></a>
511
-
512
- ```typescript
513
- public readonly keepNames: boolean;
514
- ```
515
-
516
- - *Type:* `boolean`
517
-
518
- Documentation: https://esbuild.github.io/api/#keep-names.
519
-
520
- ---
521
-
522
- ##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.legalComments"></a>
523
-
524
- ```typescript
525
- public readonly legalComments: string;
526
- ```
527
-
528
- - *Type:* `string`
529
-
530
- Documentation: https://esbuild.github.io/api/#legal-comments.
531
-
532
- ---
533
-
534
- ##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.loader"></a>
535
-
536
- ```typescript
537
- public readonly loader: {[ key: string ]: string};
538
- ```
539
-
540
- - *Type:* {[ key: string ]: `string`}
541
-
542
- Documentation: https://esbuild.github.io/api/#loader.
543
-
544
- ---
545
-
546
- ##### `logLevel`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logLevel"></a>
547
-
548
- ```typescript
549
- public readonly logLevel: string;
550
- ```
551
-
552
- - *Type:* `string`
553
-
554
- Documentation: https://esbuild.github.io/api/#log-level.
555
-
556
- ---
557
-
558
- ##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logLimit"></a>
559
-
560
- ```typescript
561
- public readonly logLimit: number;
562
- ```
563
-
564
- - *Type:* `number`
565
-
566
- Documentation: https://esbuild.github.io/api/#log-limit.
567
-
568
- ---
569
-
570
- ##### `logOverride`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logOverride"></a>
571
-
572
- ```typescript
573
- public readonly logOverride: {[ key: string ]: string};
574
- ```
575
-
576
- - *Type:* {[ key: string ]: `string`}
577
-
578
- Documentation: https://esbuild.github.io/api/#log-override.
579
-
580
- ---
581
-
582
- ##### `mainFields`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mainFields"></a>
583
-
584
- ```typescript
585
- public readonly mainFields: string[];
586
- ```
587
-
588
- - *Type:* `string`[]
589
-
590
- Documentation: https://esbuild.github.io/api/#mainFields.
591
-
592
- ---
593
-
594
- ##### `mangleCache`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mangleCache"></a>
595
-
596
- ```typescript
597
- public readonly mangleCache: {[ key: string ]: string | boolean};
598
- ```
599
-
600
- - *Type:* {[ key: string ]: `string` | `boolean`}
601
-
602
- Documentation: https://esbuild.github.io/api/#mangle-props.
603
-
604
- ---
605
-
606
- ##### `mangleProps`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mangleProps"></a>
607
-
608
- ```typescript
609
- public readonly mangleProps: any;
610
- ```
611
-
612
- - *Type:* `any`
613
-
614
- Documentation: https://esbuild.github.io/api/#mangle-props.
615
-
616
- ---
617
-
618
- ##### `mangleQuoted`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mangleQuoted"></a>
619
-
620
- ```typescript
621
- public readonly mangleQuoted: boolean;
622
- ```
623
-
624
- - *Type:* `boolean`
625
-
626
- Documentation: https://esbuild.github.io/api/#mangle-props.
627
-
628
- ---
629
-
630
- ##### `metafile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.metafile"></a>
631
-
632
- ```typescript
633
- public readonly metafile: boolean;
634
- ```
635
-
636
- - *Type:* `boolean`
637
-
638
- Documentation: https://esbuild.github.io/api/#metafile.
639
-
640
- ---
641
-
642
- ##### `minify`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minify"></a>
643
-
644
- ```typescript
645
- public readonly minify: boolean;
646
- ```
647
-
648
- - *Type:* `boolean`
649
-
650
- Documentation: https://esbuild.github.io/api/#minify.
651
-
652
- ---
653
-
654
- ##### `minifyIdentifiers`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifyIdentifiers"></a>
655
-
656
- ```typescript
657
- public readonly minifyIdentifiers: boolean;
658
- ```
659
-
660
- - *Type:* `boolean`
661
-
662
- Documentation: https://esbuild.github.io/api/#minify.
663
-
664
- ---
665
-
666
- ##### `minifySyntax`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifySyntax"></a>
667
-
668
- ```typescript
669
- public readonly minifySyntax: boolean;
670
- ```
671
-
672
- - *Type:* `boolean`
673
-
674
- Documentation: https://esbuild.github.io/api/#minify.
675
-
676
- ---
677
-
678
- ##### `minifyWhitespace`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.minifyWhitespace"></a>
679
-
680
- ```typescript
681
- public readonly minifyWhitespace: boolean;
682
- ```
683
-
684
- - *Type:* `boolean`
685
-
686
- Documentation: https://esbuild.github.io/api/#minify.
687
-
688
- ---
689
-
690
- ##### `nodePaths`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.nodePaths"></a>
691
-
692
- ```typescript
693
- public readonly nodePaths: string[];
694
- ```
695
-
696
- - *Type:* `string`[]
697
-
698
- Documentation: https://esbuild.github.io/api/#node-paths.
699
-
700
- ---
701
-
702
- ##### `outbase`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outbase"></a>
703
-
704
- ```typescript
705
- public readonly outbase: string;
706
- ```
707
-
708
- - *Type:* `string`
709
-
710
- Documentation: https://esbuild.github.io/api/#outbase.
711
-
712
- ---
713
-
714
- ##### `outdir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outdir"></a>
715
-
716
- ```typescript
717
- public readonly outdir: string;
718
- ```
719
-
720
- - *Type:* `string`
721
-
722
- Documentation: https://esbuild.github.io/api/#outdir.
723
-
724
- ---
725
-
726
- ##### `outExtension`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outExtension"></a>
727
-
728
- ```typescript
729
- public readonly outExtension: {[ key: string ]: string};
730
- ```
731
-
732
- - *Type:* {[ key: string ]: `string`}
733
-
734
- Documentation: https://esbuild.github.io/api/#out-extension.
735
-
736
- ---
737
-
738
- ##### `outfile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.outfile"></a>
739
-
740
- ```typescript
741
- public readonly outfile: string;
742
- ```
743
-
744
- - *Type:* `string`
745
-
746
- Documentation: https://esbuild.github.io/api/#outfile.
747
-
748
- ---
749
-
750
- ##### `platform`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.platform"></a>
751
-
752
- ```typescript
753
- public readonly platform: string;
754
- ```
755
-
756
- - *Type:* `string`
757
-
758
- Documentation: https://esbuild.github.io/api/#platform.
759
-
760
- ---
761
-
762
- ##### `preserveSymlinks`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.preserveSymlinks"></a>
763
-
764
- ```typescript
765
- public readonly preserveSymlinks: boolean;
766
- ```
767
-
768
- - *Type:* `boolean`
769
-
770
- Documentation: https://esbuild.github.io/api/#preserve-symlinks.
771
-
772
- ---
773
-
774
- ##### `publicPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.publicPath"></a>
775
-
776
- ```typescript
777
- public readonly publicPath: string;
778
- ```
779
-
780
- - *Type:* `string`
781
-
782
- Documentation: https://esbuild.github.io/api/#public-path.
783
-
784
- ---
785
-
786
- ##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.pure"></a>
787
-
788
- ```typescript
789
- public readonly pure: string[];
790
- ```
791
-
792
- - *Type:* `string`[]
793
-
794
- Documentation: https://esbuild.github.io/api/#pure.
795
-
796
- ---
797
-
798
- ##### `reserveProps`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.reserveProps"></a>
799
-
800
- ```typescript
801
- public readonly reserveProps: any;
802
- ```
803
-
804
- - *Type:* `any`
805
-
806
- Documentation: https://esbuild.github.io/api/#mangle-props.
807
-
808
- ---
809
-
810
- ##### `resolveExtensions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.resolveExtensions"></a>
811
-
812
- ```typescript
813
- public readonly resolveExtensions: string[];
814
- ```
815
-
816
- - *Type:* `string`[]
817
-
818
- Documentation: https://esbuild.github.io/api/#resolve-extensions.
819
-
820
- ---
821
-
822
- ##### `sourcemap`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourcemap"></a>
823
-
824
- ```typescript
825
- public readonly sourcemap: boolean | string;
826
- ```
827
-
828
- - *Type:* `boolean` | `string`
829
-
830
- Documentation: https://esbuild.github.io/api/#sourcemap.
831
-
832
- ---
833
-
834
- ##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourceRoot"></a>
835
-
836
- ```typescript
837
- public readonly sourceRoot: string;
838
- ```
839
-
840
- - *Type:* `string`
841
-
842
- Documentation: https://esbuild.github.io/api/#source-root.
843
-
844
- ---
845
-
846
- ##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.sourcesContent"></a>
847
-
848
- ```typescript
849
- public readonly sourcesContent: boolean;
850
- ```
851
-
852
- - *Type:* `boolean`
853
-
854
- Documentation: https://esbuild.github.io/api/#sources-content.
855
-
856
- ---
857
-
858
- ##### `splitting`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.splitting"></a>
859
-
860
- ```typescript
861
- public readonly splitting: boolean;
862
- ```
863
-
864
- - *Type:* `boolean`
865
-
866
- Documentation: https://esbuild.github.io/api/#splitting.
867
-
868
- ---
869
-
870
- ##### `supported`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.supported"></a>
871
-
872
- ```typescript
873
- public readonly supported: {[ key: string ]: boolean};
874
- ```
875
-
876
- - *Type:* {[ key: string ]: `boolean`}
877
-
878
- Documentation: https://esbuild.github.io/api/#supported.
879
-
880
- ---
881
-
882
- ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.target"></a>
883
-
884
- ```typescript
885
- public readonly target: string | string[];
886
- ```
887
-
888
- - *Type:* `string` | `string`[]
889
-
890
- Documentation: https://esbuild.github.io/api/#target.
891
-
892
- ---
893
-
894
- ##### `treeShaking`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.treeShaking"></a>
895
-
896
- ```typescript
897
- public readonly treeShaking: boolean;
898
- ```
899
-
900
- - *Type:* `boolean`
901
-
902
- Documentation: https://esbuild.github.io/api/#tree-shaking.
903
-
904
- ---
905
-
906
- ##### `tsconfig`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.tsconfig"></a>
907
-
908
- ```typescript
909
- public readonly tsconfig: string;
910
- ```
911
-
912
- - *Type:* `string`
913
-
914
- Documentation: https://esbuild.github.io/api/#tsconfig.
915
-
916
- ---
917
-
918
- ##### `write`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.write"></a>
919
-
920
- ```typescript
921
- public readonly write: boolean;
922
- ```
923
-
924
- - *Type:* `boolean`
925
-
926
- Documentation: https://esbuild.github.io/api/#write.
927
-
928
- ---
929
-
930
- ### BundlerProps <a name="@mrgrain/cdk-esbuild.BundlerProps"></a>
931
-
932
- #### Initializer <a name="[object Object].Initializer"></a>
933
-
934
- ```typescript
935
- import { BundlerProps } from '@mrgrain/cdk-esbuild'
936
-
937
- const bundlerProps: BundlerProps = { ... }
938
- ```
939
-
940
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.buildFn"></a>
941
-
942
- ```typescript
943
- public readonly buildFn: any;
944
- ```
945
-
946
- - *Type:* `any`
947
- - *Default:* esbuild.buildSync
948
-
949
- Escape hatch to provide the bundler with a custom build function.
950
-
951
- 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.
952
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
953
-
954
- ---
955
-
956
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.buildOptions"></a>
957
-
958
- ```typescript
959
- public readonly buildOptions: BuildOptions;
960
- ```
961
-
962
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
963
-
964
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
965
-
966
- * `buildOptions.outdir: string`
967
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
968
- 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. \
969
- *Cannot be used together with `outfile`*.
970
- * `buildOptions.outfile: string`
971
- Relative path to a file inside the CDK asset output directory.
972
- 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. \
973
- *Cannot be used with multiple entryPoints or together with `outdir`.*
974
- * `buildOptions.absWorkingDir: string`
975
- 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). \
976
- 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).
977
-
978
- > https://esbuild.github.io/api/#build-api
979
-
980
- ---
981
-
982
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.copyDir"></a>
983
-
984
- ```typescript
985
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
986
- ```
987
-
988
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
989
-
990
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
991
-
992
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
993
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
994
-
995
- Therefore the following values for `copyDir` are all equivalent:
996
- ```ts
997
- { copyDir: "path/to/source" }
998
- { copyDir: ["path/to/source"] }
999
- { copyDir: { ".": "path/to/source" } }
1000
- { copyDir: { ".": ["path/to/source"] } }
1001
- ```
1002
- The destination cannot be outside of the asset staging directory.
1003
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
1004
- you are likely using `..` or an absolute path as key on the `copyDir` map.
1005
- Instead use only relative paths and avoid `..`.
1006
-
1007
- ---
1008
-
1009
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.esbuildBinaryPath"></a>
1010
-
1011
- ```typescript
1012
- public readonly esbuildBinaryPath: string;
1013
- ```
1014
-
1015
- - *Type:* `string`
1016
-
1017
- Path to the binary used by esbuild.
1018
-
1019
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1020
-
1021
- ---
1022
-
1023
- ### CodeConfig <a name="@mrgrain/cdk-esbuild.CodeConfig"></a>
1024
-
1025
- Result of binding `Code` into a `Function`.
1026
-
1027
- #### Initializer <a name="[object Object].Initializer"></a>
1028
-
1029
- ```typescript
1030
- import { CodeConfig } from '@mrgrain/cdk-esbuild'
1031
-
1032
- const codeConfig: CodeConfig = { ... }
1033
- ```
1034
-
1035
- ##### `image`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.image"></a>
1036
-
1037
- ```typescript
1038
- public readonly image: CodeImageConfig;
1039
- ```
1040
-
1041
- - *Type:* [`aws-cdk-lib.aws_lambda.CodeImageConfig`](#aws-cdk-lib.aws_lambda.CodeImageConfig)
1042
- - *Default:* code is not an ECR container image
1043
-
1044
- Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`).
1045
-
1046
- ---
1047
-
1048
- ##### `inlineCode`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.inlineCode"></a>
1049
-
1050
- ```typescript
1051
- public readonly inlineCode: string;
1052
- ```
1053
-
1054
- - *Type:* `string`
1055
- - *Default:* code is not inline code
1056
-
1057
- Inline code (mutually exclusive with `s3Location` and `image`).
1058
-
1059
- ---
1060
-
1061
- ##### `s3Location`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.s3Location"></a>
1062
-
1063
- ```typescript
1064
- public readonly s3Location: Location;
1065
- ```
1066
-
1067
- - *Type:* [`aws-cdk-lib.aws_s3.Location`](#aws-cdk-lib.aws_s3.Location)
1068
- - *Default:* code is not an s3 location
1069
-
1070
- The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).
1071
-
1072
- ---
1073
-
1074
- ### JavaScriptCodeProps <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps"></a>
1075
-
1076
- #### Initializer <a name="[object Object].Initializer"></a>
1077
-
1078
- ```typescript
1079
- import { JavaScriptCodeProps } from '@mrgrain/cdk-esbuild'
1080
-
1081
- const javaScriptCodeProps: JavaScriptCodeProps = { ... }
1082
- ```
1083
-
1084
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.buildFn"></a>
1085
-
1086
- ```typescript
1087
- public readonly buildFn: any;
1088
- ```
1089
-
1090
- - *Type:* `any`
1091
- - *Default:* esbuild.buildSync
1092
-
1093
- Escape hatch to provide the bundler with a custom build function.
1094
-
1095
- 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.
1096
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
1097
-
1098
- ---
1099
-
1100
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.buildOptions"></a>
1101
-
1102
- ```typescript
1103
- public readonly buildOptions: BuildOptions;
1104
- ```
1105
-
1106
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1107
-
1108
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1109
-
1110
- * `buildOptions.outdir: string`
1111
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
1112
- 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
- *Cannot be used together with `outfile`*.
1114
- * `buildOptions.outfile: string`
1115
- Relative path to a file inside the CDK asset output directory.
1116
- 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
- *Cannot be used with multiple entryPoints or together with `outdir`.*
1118
- * `buildOptions.absWorkingDir: string`
1119
- 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
- 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
-
1122
- > https://esbuild.github.io/api/#build-api
1123
-
1124
- ---
1125
-
1126
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.copyDir"></a>
1127
-
1128
- ```typescript
1129
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
1130
- ```
1131
-
1132
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
1133
-
1134
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1135
-
1136
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
1137
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
1138
-
1139
- Therefore the following values for `copyDir` are all equivalent:
1140
- ```ts
1141
- { copyDir: "path/to/source" }
1142
- { copyDir: ["path/to/source"] }
1143
- { copyDir: { ".": "path/to/source" } }
1144
- { copyDir: { ".": ["path/to/source"] } }
1145
- ```
1146
- The destination cannot be outside of the asset staging directory.
1147
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
1148
- you are likely using `..` or an absolute path as key on the `copyDir` map.
1149
- Instead use only relative paths and avoid `..`.
1150
-
1151
- ---
1152
-
1153
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.esbuildBinaryPath"></a>
1154
-
1155
- ```typescript
1156
- public readonly esbuildBinaryPath: string;
1157
- ```
1158
-
1159
- - *Type:* `string`
1160
-
1161
- Path to the binary used by esbuild.
1162
-
1163
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1164
-
1165
- ---
1166
-
1167
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.assetHash"></a>
1168
-
1169
- ```typescript
1170
- public readonly assetHash: string;
1171
- ```
1172
-
1173
- - *Type:* `string`
1174
-
1175
- A hash of this asset, which is available at construction time.
1176
-
1177
- As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
1178
-
1179
- Defaults to a hash of all files in the resulting bundle.
1180
-
1181
- ---
1182
-
1183
- ### JavaScriptSourceProps <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps"></a>
1184
-
1185
- #### Initializer <a name="[object Object].Initializer"></a>
1186
-
1187
- ```typescript
1188
- import { JavaScriptSourceProps } from '@mrgrain/cdk-esbuild'
1189
-
1190
- const javaScriptSourceProps: JavaScriptSourceProps = { ... }
1191
- ```
1192
-
1193
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.buildFn"></a>
1194
-
1195
- ```typescript
1196
- public readonly buildFn: any;
1197
- ```
1198
-
1199
- - *Type:* `any`
1200
- - *Default:* esbuild.buildSync
1201
-
1202
- Escape hatch to provide the bundler with a custom build function.
1203
-
1204
- 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.
1205
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
1206
-
1207
- ---
1208
-
1209
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.buildOptions"></a>
1210
-
1211
- ```typescript
1212
- public readonly buildOptions: BuildOptions;
1213
- ```
1214
-
1215
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1216
-
1217
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1218
-
1219
- * `buildOptions.outdir: string`
1220
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
1221
- 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. \
1222
- *Cannot be used together with `outfile`*.
1223
- * `buildOptions.outfile: string`
1224
- Relative path to a file inside the CDK asset output directory.
1225
- 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. \
1226
- *Cannot be used with multiple entryPoints or together with `outdir`.*
1227
- * `buildOptions.absWorkingDir: string`
1228
- 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). \
1229
- 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).
1230
-
1231
- > https://esbuild.github.io/api/#build-api
1232
-
1233
- ---
1234
-
1235
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.copyDir"></a>
1236
-
1237
- ```typescript
1238
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
1239
- ```
1240
-
1241
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
1242
-
1243
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1244
-
1245
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
1246
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
1247
-
1248
- Therefore the following values for `copyDir` are all equivalent:
1249
- ```ts
1250
- { copyDir: "path/to/source" }
1251
- { copyDir: ["path/to/source"] }
1252
- { copyDir: { ".": "path/to/source" } }
1253
- { copyDir: { ".": ["path/to/source"] } }
1254
- ```
1255
- The destination cannot be outside of the asset staging directory.
1256
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
1257
- you are likely using `..` or an absolute path as key on the `copyDir` map.
1258
- Instead use only relative paths and avoid `..`.
1259
-
1260
- ---
1261
-
1262
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.esbuildBinaryPath"></a>
1263
-
1264
- ```typescript
1265
- public readonly esbuildBinaryPath: string;
1266
- ```
1267
-
1268
- - *Type:* `string`
1269
-
1270
- Path to the binary used by esbuild.
1271
-
1272
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1273
-
1274
- ---
1275
-
1276
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.assetHash"></a>
1277
-
1278
- ```typescript
1279
- public readonly assetHash: string;
1280
- ```
1281
-
1282
- - *Type:* `string`
1283
-
1284
- A hash of this asset, which is available at construction time.
1285
-
1286
- As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
1287
-
1288
- Defaults to a hash of all files in the resulting bundle.
1289
-
1290
- ---
1291
-
1292
- ### TransformerProps <a name="@mrgrain/cdk-esbuild.TransformerProps"></a>
1293
-
1294
- #### Initializer <a name="[object Object].Initializer"></a>
1295
-
1296
- ```typescript
1297
- import { TransformerProps } from '@mrgrain/cdk-esbuild'
1298
-
1299
- const transformerProps: TransformerProps = { ... }
1300
- ```
1301
-
1302
- ##### `transformFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformerProps.property.transformFn"></a>
1303
-
1304
- ```typescript
1305
- public readonly transformFn: any;
1306
- ```
1307
-
1308
- - *Type:* `any`
1309
- - *Default:* esbuild.transformSync
1310
-
1311
- Escape hatch to provide the bundler with a custom transform function.
1312
-
1313
- 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.
1314
- Must throw a `TransformFailure` on failure to correctly inform the bundler.
1315
-
1316
- ---
1317
-
1318
- ##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformerProps.property.transformOptions"></a>
1319
-
1320
- ```typescript
1321
- public readonly transformOptions: TransformOptions;
1322
- ```
1323
-
1324
- - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
1325
-
1326
- Transform options passed on to esbuild.
1327
-
1328
- Please refer to the esbuild Transform API docs for details.
1329
-
1330
- > https://esbuild.github.io/api/#transform-api
1331
-
1332
- ---
1333
-
1334
- ### TransformOptions <a name="@mrgrain/cdk-esbuild.TransformOptions"></a>
1335
-
1336
- #### Initializer <a name="[object Object].Initializer"></a>
1337
-
1338
- ```typescript
1339
- import { TransformOptions } from '@mrgrain/cdk-esbuild'
1340
-
1341
- const transformOptions: TransformOptions = { ... }
1342
- ```
1343
-
1344
- ##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.banner"></a>
1345
-
1346
- ```typescript
1347
- public readonly banner: string;
1348
- ```
1349
-
1350
- - *Type:* `string`
1351
-
1352
- ---
1353
-
1354
- ##### `charset`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.charset"></a>
1355
-
1356
- ```typescript
1357
- public readonly charset: string;
1358
- ```
1359
-
1360
- - *Type:* `string`
1361
-
1362
- Documentation: https://esbuild.github.io/api/#charset.
1363
-
1364
- ---
1365
-
1366
- ##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.color"></a>
1367
-
1368
- ```typescript
1369
- public readonly color: boolean;
1370
- ```
1371
-
1372
- - *Type:* `boolean`
1373
-
1374
- Documentation: https://esbuild.github.io/api/#color.
1375
-
1376
- ---
1377
-
1378
- ##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.define"></a>
1379
-
1380
- ```typescript
1381
- public readonly define: {[ key: string ]: string};
1382
- ```
1383
-
1384
- - *Type:* {[ key: string ]: `string`}
1385
-
1386
- Documentation: https://esbuild.github.io/api/#define.
1387
-
1388
- ---
1389
-
1390
- ##### `drop`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.drop"></a>
1391
-
1392
- ```typescript
1393
- public readonly drop: string[];
1394
- ```
1395
-
1396
- - *Type:* `string`[]
1397
-
1398
- Documentation: https://esbuild.github.io/api/#drop.
1399
-
1400
- ---
1401
-
1402
- ##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.footer"></a>
1403
-
1404
- ```typescript
1405
- public readonly footer: string;
1406
- ```
1407
-
1408
- - *Type:* `string`
1409
-
1410
- ---
1411
-
1412
- ##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.format"></a>
1413
-
1414
- ```typescript
1415
- public readonly format: string;
1416
- ```
1417
-
1418
- - *Type:* `string`
1419
-
1420
- Documentation: https://esbuild.github.io/api/#format.
1421
-
1422
- ---
1423
-
1424
- ##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.globalName"></a>
1425
-
1426
- ```typescript
1427
- public readonly globalName: string;
1428
- ```
1429
-
1430
- - *Type:* `string`
1431
-
1432
- Documentation: https://esbuild.github.io/api/#globalName.
1433
-
1434
- ---
1435
-
1436
- ##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.ignoreAnnotations"></a>
1437
-
1438
- ```typescript
1439
- public readonly ignoreAnnotations: boolean;
1440
- ```
1441
-
1442
- - *Type:* `boolean`
1443
-
1444
- Documentation: https://esbuild.github.io/api/#ignore-annotations.
1445
-
1446
- ---
1447
-
1448
- ##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsx"></a>
1449
-
1450
- ```typescript
1451
- public readonly jsx: string;
1452
- ```
1453
-
1454
- - *Type:* `string`
1455
-
1456
- Documentation: https://esbuild.github.io/api/#jsx.
1457
-
1458
- ---
1459
-
1460
- ##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFactory"></a>
1461
-
1462
- ```typescript
1463
- public readonly jsxFactory: string;
1464
- ```
1465
-
1466
- - *Type:* `string`
1467
-
1468
- Documentation: https://esbuild.github.io/api/#jsx-factory.
1469
-
1470
- ---
1471
-
1472
- ##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFragment"></a>
1473
-
1474
- ```typescript
1475
- public readonly jsxFragment: string;
1476
- ```
1477
-
1478
- - *Type:* `string`
1479
-
1480
- Documentation: https://esbuild.github.io/api/#jsx-fragment.
1481
-
1482
- ---
1483
-
1484
- ##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.keepNames"></a>
1485
-
1486
- ```typescript
1487
- public readonly keepNames: boolean;
1488
- ```
1489
-
1490
- - *Type:* `boolean`
1491
-
1492
- Documentation: https://esbuild.github.io/api/#keep-names.
1493
-
1494
- ---
1495
-
1496
- ##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.legalComments"></a>
1497
-
1498
- ```typescript
1499
- public readonly legalComments: string;
1500
- ```
1501
-
1502
- - *Type:* `string`
1503
-
1504
- Documentation: https://esbuild.github.io/api/#legal-comments.
1505
-
1506
- ---
1507
-
1508
- ##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.loader"></a>
1509
-
1510
- ```typescript
1511
- public readonly loader: string;
1512
- ```
1513
-
1514
- - *Type:* `string`
1515
-
1516
- ---
1517
-
1518
- ##### `logLevel`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLevel"></a>
1519
-
1520
- ```typescript
1521
- public readonly logLevel: string;
1522
- ```
1523
-
1524
- - *Type:* `string`
1525
-
1526
- Documentation: https://esbuild.github.io/api/#log-level.
1527
-
1528
- ---
1529
-
1530
- ##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLimit"></a>
1531
-
1532
- ```typescript
1533
- public readonly logLimit: number;
1534
- ```
1535
-
1536
- - *Type:* `number`
1537
-
1538
- Documentation: https://esbuild.github.io/api/#log-limit.
1539
-
1540
- ---
1541
-
1542
- ##### `logOverride`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logOverride"></a>
1543
-
1544
- ```typescript
1545
- public readonly logOverride: {[ key: string ]: string};
1546
- ```
1547
-
1548
- - *Type:* {[ key: string ]: `string`}
1549
-
1550
- Documentation: https://esbuild.github.io/api/#log-override.
1551
-
1552
- ---
1553
-
1554
- ##### `mangleCache`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.mangleCache"></a>
1555
-
1556
- ```typescript
1557
- public readonly mangleCache: {[ key: string ]: string | boolean};
1558
- ```
1559
-
1560
- - *Type:* {[ key: string ]: `string` | `boolean`}
1561
-
1562
- Documentation: https://esbuild.github.io/api/#mangle-props.
1563
-
1564
- ---
1565
-
1566
- ##### `mangleProps`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.mangleProps"></a>
1567
-
1568
- ```typescript
1569
- public readonly mangleProps: any;
1570
- ```
1571
-
1572
- - *Type:* `any`
1573
-
1574
- Documentation: https://esbuild.github.io/api/#mangle-props.
1575
-
1576
- ---
1577
-
1578
- ##### `mangleQuoted`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.mangleQuoted"></a>
1579
-
1580
- ```typescript
1581
- public readonly mangleQuoted: boolean;
1582
- ```
1583
-
1584
- - *Type:* `boolean`
1585
-
1586
- Documentation: https://esbuild.github.io/api/#mangle-props.
1587
-
1588
- ---
1589
-
1590
- ##### `minify`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minify"></a>
1591
-
1592
- ```typescript
1593
- public readonly minify: boolean;
1594
- ```
1595
-
1596
- - *Type:* `boolean`
1597
-
1598
- Documentation: https://esbuild.github.io/api/#minify.
1599
-
1600
- ---
1601
-
1602
- ##### `minifyIdentifiers`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyIdentifiers"></a>
1603
-
1604
- ```typescript
1605
- public readonly minifyIdentifiers: boolean;
1606
- ```
1607
-
1608
- - *Type:* `boolean`
1609
-
1610
- Documentation: https://esbuild.github.io/api/#minify.
1611
-
1612
- ---
1613
-
1614
- ##### `minifySyntax`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifySyntax"></a>
1615
-
1616
- ```typescript
1617
- public readonly minifySyntax: boolean;
1618
- ```
1619
-
1620
- - *Type:* `boolean`
1621
-
1622
- Documentation: https://esbuild.github.io/api/#minify.
1623
-
1624
- ---
1625
-
1626
- ##### `minifyWhitespace`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyWhitespace"></a>
1627
-
1628
- ```typescript
1629
- public readonly minifyWhitespace: boolean;
1630
- ```
1631
-
1632
- - *Type:* `boolean`
1633
-
1634
- Documentation: https://esbuild.github.io/api/#minify.
1635
-
1636
- ---
1637
-
1638
- ##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.pure"></a>
1639
-
1640
- ```typescript
1641
- public readonly pure: string[];
1642
- ```
1643
-
1644
- - *Type:* `string`[]
1645
-
1646
- Documentation: https://esbuild.github.io/api/#pure.
1647
-
1648
- ---
1649
-
1650
- ##### `reserveProps`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.reserveProps"></a>
1651
-
1652
- ```typescript
1653
- public readonly reserveProps: any;
1654
- ```
1655
-
1656
- - *Type:* `any`
1657
-
1658
- Documentation: https://esbuild.github.io/api/#mangle-props.
1659
-
1660
- ---
1661
-
1662
- ##### `sourcefile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcefile"></a>
1663
-
1664
- ```typescript
1665
- public readonly sourcefile: string;
1666
- ```
1667
-
1668
- - *Type:* `string`
1669
-
1670
- ---
1671
-
1672
- ##### `sourcemap`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcemap"></a>
1673
-
1674
- ```typescript
1675
- public readonly sourcemap: boolean | string;
1676
- ```
1677
-
1678
- - *Type:* `boolean` | `string`
1679
-
1680
- Documentation: https://esbuild.github.io/api/#sourcemap.
1681
-
1682
- ---
1683
-
1684
- ##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourceRoot"></a>
1685
-
1686
- ```typescript
1687
- public readonly sourceRoot: string;
1688
- ```
1689
-
1690
- - *Type:* `string`
1691
-
1692
- Documentation: https://esbuild.github.io/api/#source-root.
1693
-
1694
- ---
1695
-
1696
- ##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcesContent"></a>
1697
-
1698
- ```typescript
1699
- public readonly sourcesContent: boolean;
1700
- ```
1701
-
1702
- - *Type:* `boolean`
1703
-
1704
- Documentation: https://esbuild.github.io/api/#sources-content.
1705
-
1706
- ---
1707
-
1708
- ##### `supported`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.supported"></a>
1709
-
1710
- ```typescript
1711
- public readonly supported: {[ key: string ]: boolean};
1712
- ```
1713
-
1714
- - *Type:* {[ key: string ]: `boolean`}
1715
-
1716
- Documentation: https://esbuild.github.io/api/#supported.
1717
-
1718
- ---
1719
-
1720
- ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
1721
-
1722
- ```typescript
1723
- public readonly target: string | string[];
1724
- ```
1725
-
1726
- - *Type:* `string` | `string`[]
1727
-
1728
- Documentation: https://esbuild.github.io/api/#target.
1729
-
1730
- ---
1731
-
1732
- ##### `treeShaking`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.treeShaking"></a>
1733
-
1734
- ```typescript
1735
- public readonly treeShaking: boolean;
1736
- ```
1737
-
1738
- - *Type:* `boolean`
1739
-
1740
- Documentation: https://esbuild.github.io/api/#tree-shaking.
1741
-
1742
- ---
1743
-
1744
- ##### `tsconfigRaw`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.tsconfigRaw"></a>
1745
-
1746
- ```typescript
1747
- public readonly tsconfigRaw: string;
1748
- ```
1749
-
1750
- - *Type:* `string`
1751
-
1752
- ---
1753
-
1754
- ### TypeScriptCodeProps <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps"></a>
1755
-
1756
- #### Initializer <a name="[object Object].Initializer"></a>
1757
-
1758
- ```typescript
1759
- import { TypeScriptCodeProps } from '@mrgrain/cdk-esbuild'
1760
-
1761
- const typeScriptCodeProps: TypeScriptCodeProps = { ... }
1762
- ```
1763
-
1764
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.buildFn"></a>
1765
-
1766
- ```typescript
1767
- public readonly buildFn: any;
1768
- ```
1769
-
1770
- - *Type:* `any`
1771
- - *Default:* esbuild.buildSync
1772
-
1773
- Escape hatch to provide the bundler with a custom build function.
1774
-
1775
- 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.
1776
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
1777
-
1778
- ---
1779
-
1780
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.buildOptions"></a>
1781
-
1782
- ```typescript
1783
- public readonly buildOptions: BuildOptions;
1784
- ```
1785
-
1786
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1787
-
1788
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1789
-
1790
- * `buildOptions.outdir: string`
1791
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
1792
- 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. \
1793
- *Cannot be used together with `outfile`*.
1794
- * `buildOptions.outfile: string`
1795
- Relative path to a file inside the CDK asset output directory.
1796
- 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. \
1797
- *Cannot be used with multiple entryPoints or together with `outdir`.*
1798
- * `buildOptions.absWorkingDir: string`
1799
- 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). \
1800
- 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).
1801
-
1802
- > https://esbuild.github.io/api/#build-api
1803
-
1804
- ---
1805
-
1806
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.copyDir"></a>
1807
-
1808
- ```typescript
1809
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
1810
- ```
1811
-
1812
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
1813
-
1814
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1815
-
1816
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
1817
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
1818
-
1819
- Therefore the following values for `copyDir` are all equivalent:
1820
- ```ts
1821
- { copyDir: "path/to/source" }
1822
- { copyDir: ["path/to/source"] }
1823
- { copyDir: { ".": "path/to/source" } }
1824
- { copyDir: { ".": ["path/to/source"] } }
1825
- ```
1826
- The destination cannot be outside of the asset staging directory.
1827
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
1828
- you are likely using `..` or an absolute path as key on the `copyDir` map.
1829
- Instead use only relative paths and avoid `..`.
1830
-
1831
- ---
1832
-
1833
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.esbuildBinaryPath"></a>
1834
-
1835
- ```typescript
1836
- public readonly esbuildBinaryPath: string;
1837
- ```
1838
-
1839
- - *Type:* `string`
1840
-
1841
- Path to the binary used by esbuild.
1842
-
1843
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1844
-
1845
- ---
1846
-
1847
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.assetHash"></a>
1848
-
1849
- ```typescript
1850
- public readonly assetHash: string;
1851
- ```
1852
-
1853
- - *Type:* `string`
1854
-
1855
- A hash of this asset, which is available at construction time.
1856
-
1857
- As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
1858
-
1859
- Defaults to a hash of all files in the resulting bundle.
1860
-
1861
- ---
1862
-
1863
- ### TypeScriptSourceProps <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps"></a>
1864
-
1865
- #### Initializer <a name="[object Object].Initializer"></a>
1866
-
1867
- ```typescript
1868
- import { TypeScriptSourceProps } from '@mrgrain/cdk-esbuild'
1869
-
1870
- const typeScriptSourceProps: TypeScriptSourceProps = { ... }
1871
- ```
1872
-
1873
- ##### `buildFn`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.buildFn"></a>
1874
-
1875
- ```typescript
1876
- public readonly buildFn: any;
1877
- ```
1878
-
1879
- - *Type:* `any`
1880
- - *Default:* esbuild.buildSync
1881
-
1882
- Escape hatch to provide the bundler with a custom build function.
1883
-
1884
- 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.
1885
- Must throw a `BuildFailure` on failure to correctly inform the bundler.
1886
-
1887
- ---
1888
-
1889
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.buildOptions"></a>
1890
-
1891
- ```typescript
1892
- public readonly buildOptions: BuildOptions;
1893
- ```
1894
-
1895
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1896
-
1897
- Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1898
-
1899
- * `buildOptions.outdir: string`
1900
- The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
1901
- 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. \
1902
- *Cannot be used together with `outfile`*.
1903
- * `buildOptions.outfile: string`
1904
- Relative path to a file inside the CDK asset output directory.
1905
- 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. \
1906
- *Cannot be used with multiple entryPoints or together with `outdir`.*
1907
- * `buildOptions.absWorkingDir: string`
1908
- 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). \
1909
- 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).
1910
-
1911
- > https://esbuild.github.io/api/#build-api
1912
-
1913
- ---
1914
-
1915
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.copyDir"></a>
1916
-
1917
- ```typescript
1918
- public readonly copyDir: string | string[] | {[ key: string ]: string | string[]};
1919
- ```
1920
-
1921
- - *Type:* `string` | `string`[] | {[ key: string ]: `string` | `string`[]}
1922
-
1923
- Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs. Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1924
-
1925
- * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
1926
- * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
1927
-
1928
- Therefore the following values for `copyDir` are all equivalent:
1929
- ```ts
1930
- { copyDir: "path/to/source" }
1931
- { copyDir: ["path/to/source"] }
1932
- { copyDir: { ".": "path/to/source" } }
1933
- { copyDir: { ".": ["path/to/source"] } }
1934
- ```
1935
- The destination cannot be outside of the asset staging directory.
1936
- If you are receiving the error "Cannot copy files to outside of the asset staging directory."
1937
- you are likely using `..` or an absolute path as key on the `copyDir` map.
1938
- Instead use only relative paths and avoid `..`.
1939
-
1940
- ---
1941
-
1942
- ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.esbuildBinaryPath"></a>
1943
-
1944
- ```typescript
1945
- public readonly esbuildBinaryPath: string;
1946
- ```
1947
-
1948
- - *Type:* `string`
1949
-
1950
- Path to the binary used by esbuild.
1951
-
1952
- This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1953
-
1954
- ---
1955
-
1956
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.assetHash"></a>
1957
-
1958
- ```typescript
1959
- public readonly assetHash: string;
1960
- ```
1961
-
1962
- - *Type:* `string`
1963
-
1964
- A hash of this asset, which is available at construction time.
1965
-
1966
- As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
1967
-
1968
- Defaults to a hash of all files in the resulting bundle.
1969
-
1970
- ---
1971
-
1972
- ## Classes <a name="Classes"></a>
1973
-
1974
- ### EsbuildBundler <a name="@mrgrain/cdk-esbuild.EsbuildBundler"></a>
1975
-
1976
- Low-level construct that can be used where `BundlingOptions` are required.
1977
-
1978
- This class directly interfaces with esbuild and provides almost no configuration safeguards.
1979
-
1980
- #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildBundler.Initializer"></a>
1981
-
1982
- ```typescript
1983
- import { EsbuildBundler } from '@mrgrain/cdk-esbuild'
1984
-
1985
- new EsbuildBundler(entryPoints: string | string[] | {[ key: string ]: string}, props: BundlerProps)
1986
- ```
1987
-
1988
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.parameter.entryPoints"></a>
1989
-
1990
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1991
-
1992
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
1993
-
1994
- E.g. `src/index.ts`.
1995
-
1996
- ---
1997
-
1998
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.parameter.props"></a>
1999
-
2000
- - *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
2001
-
2002
- Props to change the behaviour of the bundler.
2003
-
2004
- ---
2005
-
2006
-
2007
-
2008
- #### Properties <a name="Properties"></a>
2009
-
2010
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.entryPoints"></a>
2011
-
2012
- ```typescript
2013
- public readonly entryPoints: string | string[] | {[ key: string ]: string};
2014
- ```
2015
-
2016
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2017
-
2018
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2019
-
2020
- E.g. `src/index.ts`.
2021
-
2022
- ---
2023
-
2024
- ##### ~~`image`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.image"></a>
2025
-
2026
- - *Deprecated:* This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface.
2027
-
2028
- ```typescript
2029
- public readonly image: DockerImage;
2030
- ```
2031
-
2032
- - *Type:* [`aws-cdk-lib.DockerImage`](#aws-cdk-lib.DockerImage)
2033
-
2034
- ---
2035
-
2036
- ##### `local`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.local"></a>
2037
-
2038
- ```typescript
2039
- public readonly local: ILocalBundling;
2040
- ```
2041
-
2042
- - *Type:* [`aws-cdk-lib.ILocalBundling`](#aws-cdk-lib.ILocalBundling)
2043
-
2044
- Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
2045
-
2046
- ---
2047
-
2048
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.props"></a>
2049
-
2050
- ```typescript
2051
- public readonly props: BundlerProps;
2052
- ```
2053
-
2054
- - *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
2055
-
2056
- Props to change the behaviour of the bundler.
2057
-
2058
- ---
2059
-
2060
-
2061
- ### EsbuildCode <a name="@mrgrain/cdk-esbuild.EsbuildCode"></a>
2062
-
2063
- Represents the a generic Esbuild Code bundle.
2064
-
2065
- #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildCode.Initializer"></a>
2066
-
2067
- ```typescript
2068
- import { EsbuildCode } from '@mrgrain/cdk-esbuild'
2069
-
2070
- new EsbuildCode(entryPoints: string | string[] | {[ key: string ]: string}, props: JavaScriptCodeProps | TypeScriptCodeProps)
2071
- ```
2072
-
2073
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.entryPoints"></a>
2074
-
2075
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2076
-
2077
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2078
-
2079
- E.g. `src/index.ts`.
2080
-
2081
- ---
2082
-
2083
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.props"></a>
2084
-
2085
- - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptCodeProps`](#@mrgrain/cdk-esbuild.JavaScriptCodeProps) | [`@mrgrain/cdk-esbuild.TypeScriptCodeProps`](#@mrgrain/cdk-esbuild.TypeScriptCodeProps)
2086
-
2087
- Props to change the behavior of the bundler.
2088
-
2089
- Default values for `props.buildOptions`:
2090
- - `bundle=true`
2091
- - `platform=node`
2092
- - `target=nodeX` with X being the major node version running locally
2093
-
2094
- ---
2095
-
2096
- #### Methods <a name="Methods"></a>
2097
-
2098
- ##### `bind` <a name="@mrgrain/cdk-esbuild.EsbuildCode.bind"></a>
2099
-
2100
- ```typescript
2101
- public bind(scope: Construct)
2102
- ```
2103
-
2104
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.scope"></a>
2105
-
2106
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2107
-
2108
- ---
2109
-
2110
- ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.EsbuildCode.bindToResource"></a>
2111
-
2112
- ```typescript
2113
- public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2114
- ```
2115
-
2116
- ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.resource"></a>
2117
-
2118
- - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2119
-
2120
- ---
2121
-
2122
- ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.options"></a>
2123
-
2124
- - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2125
-
2126
- ---
2127
-
2128
-
2129
- #### Properties <a name="Properties"></a>
2130
-
2131
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.property.entryPoints"></a>
2132
-
2133
- ```typescript
2134
- public readonly entryPoints: string | string[] | {[ key: string ]: string};
2135
- ```
2136
-
2137
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2138
-
2139
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2140
-
2141
- E.g. `src/index.ts`.
2142
-
2143
- ---
2144
-
2145
- ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.property.isInline"></a>
2146
-
2147
- - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2148
-
2149
- ```typescript
2150
- public readonly isInline: boolean;
2151
- ```
2152
-
2153
- - *Type:* `boolean`
2154
-
2155
- Determines whether this Code is inline code or not.
2156
-
2157
- ---
2158
-
2159
-
2160
- ### InlineJavaScriptCode <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode"></a>
2161
-
2162
- An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
2163
-
2164
- #### Initializers <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.Initializer"></a>
2165
-
2166
- ```typescript
2167
- import { InlineJavaScriptCode } from '@mrgrain/cdk-esbuild'
2168
-
2169
- new InlineJavaScriptCode(code: string, props?: TransformOptions | TransformerProps)
2170
- ```
2171
-
2172
- ##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.code"></a>
2173
-
2174
- - *Type:* `string`
2175
-
2176
- The inline code to be transformed.
2177
-
2178
- ---
2179
-
2180
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.props"></a>
2181
-
2182
- - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
2183
-
2184
- Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
2185
-
2186
- Props to change the behaviour of the transformer.
2187
-
2188
- Default values for `props.transformOptions`:
2189
- - `loader='js'`
2190
-
2191
- > https://esbuild.github.io/api/#transform-api
2192
-
2193
- ---
2194
-
2195
-
2196
-
2197
-
2198
-
2199
- ### InlineJsxCode <a name="@mrgrain/cdk-esbuild.InlineJsxCode"></a>
2200
-
2201
- An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
2202
-
2203
- #### Initializers <a name="@mrgrain/cdk-esbuild.InlineJsxCode.Initializer"></a>
2204
-
2205
- ```typescript
2206
- import { InlineJsxCode } from '@mrgrain/cdk-esbuild'
2207
-
2208
- new InlineJsxCode(code: string, props?: TransformOptions | TransformerProps)
2209
- ```
2210
-
2211
- ##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.code"></a>
2212
-
2213
- - *Type:* `string`
2214
-
2215
- The inline code to be transformed.
2216
-
2217
- ---
2218
-
2219
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.props"></a>
2220
-
2221
- - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
2222
-
2223
- Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
2224
-
2225
- Props to change the behaviour of the transformer.
2226
-
2227
- Default values for `transformOptions`:
2228
- - `loader='jsx'`
2229
-
2230
- > https://esbuild.github.io/api/#transform-api
2231
-
2232
- ---
2233
-
2234
-
2235
-
2236
-
2237
-
2238
- ### InlineTsxCode <a name="@mrgrain/cdk-esbuild.InlineTsxCode"></a>
2239
-
2240
- An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
2241
-
2242
- #### Initializers <a name="@mrgrain/cdk-esbuild.InlineTsxCode.Initializer"></a>
2243
-
2244
- ```typescript
2245
- import { InlineTsxCode } from '@mrgrain/cdk-esbuild'
2246
-
2247
- new InlineTsxCode(code: string, props?: TransformOptions | TransformerProps)
2248
- ```
2249
-
2250
- ##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.code"></a>
2251
-
2252
- - *Type:* `string`
2253
-
2254
- The inline code to be transformed.
2255
-
2256
- ---
2257
-
2258
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.props"></a>
2259
-
2260
- - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
2261
-
2262
- Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
2263
-
2264
- Props to change the behaviour of the transformer.
2265
-
2266
- Default values for `transformOptions`:
2267
- - `loader='tsx'`
2268
-
2269
- > https://esbuild.github.io/api/#transform-api
2270
-
2271
- ---
2272
-
2273
-
2274
-
2275
-
2276
-
2277
- ### InlineTypeScriptCode <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode"></a>
2278
-
2279
- An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
2280
-
2281
- #### Initializers <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.Initializer"></a>
2282
-
2283
- ```typescript
2284
- import { InlineTypeScriptCode } from '@mrgrain/cdk-esbuild'
2285
-
2286
- new InlineTypeScriptCode(code: string, props?: TransformOptions | TransformerProps)
2287
- ```
2288
-
2289
- ##### `code`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.code"></a>
2290
-
2291
- - *Type:* `string`
2292
-
2293
- The inline code to be transformed.
2294
-
2295
- ---
2296
-
2297
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.props"></a>
2298
-
2299
- - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions) | [`@mrgrain/cdk-esbuild.TransformerProps`](#@mrgrain/cdk-esbuild.TransformerProps)
2300
-
2301
- Support for `TransformOptions` is deprecated. Please provide `TransformerProps`!
2302
-
2303
- Props to change the behaviour of the transformer.
2304
-
2305
- Default values for `transformOptions`:
2306
- - `loader='ts'`
2307
-
2308
- > https://esbuild.github.io/api/#transform-api
2309
-
2310
- ---
2311
-
2312
-
2313
-
2314
-
2315
-
2316
- ### JavaScriptCode <a name="@mrgrain/cdk-esbuild.JavaScriptCode"></a>
2317
-
2318
- Represents the deployed JavaScript Code.
2319
-
2320
- #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptCode.Initializer"></a>
2321
-
2322
- ```typescript
2323
- import { JavaScriptCode } from '@mrgrain/cdk-esbuild'
2324
-
2325
- new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?: JavaScriptCodeProps)
2326
- ```
2327
-
2328
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.entryPoints"></a>
2329
-
2330
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2331
-
2332
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2333
-
2334
- E.g. `src/index.ts`.
2335
-
2336
- ---
2337
-
2338
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.props"></a>
2339
-
2340
- - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptCodeProps`](#@mrgrain/cdk-esbuild.JavaScriptCodeProps)
2341
-
2342
- Props to change the behavior of the bundler.
2343
-
2344
- Default values for `props.buildOptions`:
2345
- - `bundle=true`
2346
- - `platform=node`
2347
- - `target=nodeX` with X being the major node version running locally
2348
-
2349
- ---
2350
-
2351
-
2352
-
2353
-
2354
-
2355
- ### JavaScriptSource <a name="@mrgrain/cdk-esbuild.JavaScriptSource"></a>
2356
-
2357
- - *Implements:* [`aws-cdk-lib.aws_s3_deployment.ISource`](#aws-cdk-lib.aws_s3_deployment.ISource)
2358
-
2359
- #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptSource.Initializer"></a>
2360
-
2361
- ```typescript
2362
- import { JavaScriptSource } from '@mrgrain/cdk-esbuild'
2363
-
2364
- new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?: JavaScriptSourceProps)
2365
- ```
2366
-
2367
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.entryPoints"></a>
2368
-
2369
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2370
-
2371
- ---
2372
-
2373
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.props"></a>
2374
-
2375
- - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptSourceProps`](#@mrgrain/cdk-esbuild.JavaScriptSourceProps)
2376
-
2377
- ---
2378
-
2379
- #### Methods <a name="Methods"></a>
2380
-
2381
- ##### `bind` <a name="@mrgrain/cdk-esbuild.JavaScriptSource.bind"></a>
2382
-
2383
- ```typescript
2384
- public bind(scope: Construct, context?: DeploymentSourceContext)
2385
- ```
2386
-
2387
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.scope"></a>
2388
-
2389
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2390
-
2391
- ---
2392
-
2393
- ###### `context`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.context"></a>
2394
-
2395
- - *Type:* [`aws-cdk-lib.aws_s3_deployment.DeploymentSourceContext`](#aws-cdk-lib.aws_s3_deployment.DeploymentSourceContext)
2396
-
2397
- ---
2398
-
2399
-
2400
- #### Properties <a name="Properties"></a>
2401
-
2402
- ##### `assetClass`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.property.assetClass"></a>
2403
-
2404
- ```typescript
2405
- public readonly assetClass: JavaScriptAsset;
2406
- ```
2407
-
2408
- - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptAsset`](#@mrgrain/cdk-esbuild.JavaScriptAsset)
2409
-
2410
- ---
2411
-
2412
-
2413
- ### TypeScriptCode <a name="@mrgrain/cdk-esbuild.TypeScriptCode"></a>
2414
-
2415
- Represents the deployed TypeScript Code.
2416
-
2417
- #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptCode.Initializer"></a>
2418
-
2419
- ```typescript
2420
- import { TypeScriptCode } from '@mrgrain/cdk-esbuild'
2421
-
2422
- new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?: TypeScriptCodeProps)
2423
- ```
2424
-
2425
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.entryPoints"></a>
2426
-
2427
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2428
-
2429
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2430
-
2431
- E.g. `src/index.ts`.
2432
-
2433
- ---
2434
-
2435
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.props"></a>
2436
-
2437
- - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptCodeProps`](#@mrgrain/cdk-esbuild.TypeScriptCodeProps)
2438
-
2439
- Props to change the behavior of the bundler.
2440
-
2441
- Default values for `props.buildOptions`:
2442
- - `bundle=true`
2443
- - `platform=node`
2444
- - `target=nodeX` with X being the major node version running locally
2445
-
2446
- ---
2447
-
2448
-
2449
-
2450
-
2451
-
2452
- ### TypeScriptSource <a name="@mrgrain/cdk-esbuild.TypeScriptSource"></a>
2453
-
2454
- - *Implements:* [`aws-cdk-lib.aws_s3_deployment.ISource`](#aws-cdk-lib.aws_s3_deployment.ISource)
2455
-
2456
- #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptSource.Initializer"></a>
2457
-
2458
- ```typescript
2459
- import { TypeScriptSource } from '@mrgrain/cdk-esbuild'
2460
-
2461
- new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?: TypeScriptSourceProps)
2462
- ```
2463
-
2464
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.entryPoints"></a>
2465
-
2466
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2467
-
2468
- ---
2469
-
2470
- ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.props"></a>
2471
-
2472
- - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptSourceProps`](#@mrgrain/cdk-esbuild.TypeScriptSourceProps)
2473
-
2474
- ---
2475
-
2476
- #### Methods <a name="Methods"></a>
2477
-
2478
- ##### `bind` <a name="@mrgrain/cdk-esbuild.TypeScriptSource.bind"></a>
2479
-
2480
- ```typescript
2481
- public bind(scope: Construct, context?: DeploymentSourceContext)
2482
- ```
2483
-
2484
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.scope"></a>
2485
-
2486
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2487
-
2488
- ---
2489
-
2490
- ###### `context`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.context"></a>
2491
-
2492
- - *Type:* [`aws-cdk-lib.aws_s3_deployment.DeploymentSourceContext`](#aws-cdk-lib.aws_s3_deployment.DeploymentSourceContext)
2493
-
2494
- ---
2495
-
2496
-
2497
- #### Properties <a name="Properties"></a>
2498
-
2499
- ##### `assetClass`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.property.assetClass"></a>
2500
-
2501
- ```typescript
2502
- public readonly assetClass: TypeScriptAsset;
2503
- ```
2504
-
2505
- - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptAsset`](#@mrgrain/cdk-esbuild.TypeScriptAsset)
2506
-
2507
- ---
2508
-
2509
-
2510
-