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