@mrgrain/cdk-esbuild 4.0.0-alpha.8 → 4.0.0-beta.1

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