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