@mrgrain/cdk-esbuild 2.0.0-alpha.0 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +1 -1
- package/.jsii +560 -504
- package/{.projenrc.mjs → .projenrc.ts} +38 -31
- package/API.md +432 -698
- package/CHANGELOG.md +261 -0
- package/README.md +51 -172
- package/SECURITY.md +5 -5
- package/lib/asset.d.ts +29 -28
- package/lib/asset.js +23 -13
- package/lib/bundler.d.ts +92 -0
- package/lib/bundler.js +85 -0
- package/lib/code.d.ts +75 -28
- package/lib/code.js +61 -7
- package/lib/esbuild-types.js +2 -1
- package/lib/index.d.ts +5 -6
- package/lib/index.js +3 -5
- package/lib/inline-code.d.ts +88 -4
- package/lib/inline-code.js +93 -9
- package/lib/source.d.ts +18 -9
- package/lib/source.js +5 -3
- package/package.json +4 -1
- package/projenrc/TypeScriptSourceFile.ts +50 -0
- package/esbuild/Dockerfile +0 -13
- package/esbuild/esbuild-js +0 -22
- package/lib/bundlers.d.ts +0 -42
- package/lib/bundlers.js +0 -62
- package/lib/bundling.d.ts +0 -20
- package/lib/bundling.js +0 -30
- package/lib/esbuild-types-raw.d.ts +0 -304
- package/lib/esbuild-types-raw.js +0 -4
package/API.md
CHANGED
|
@@ -3,6 +3,86 @@
|
|
|
3
3
|
|
|
4
4
|
## Structs <a name="Structs"></a>
|
|
5
5
|
|
|
6
|
+
### AssetProps <a name="@mrgrain/cdk-esbuild.AssetProps"></a>
|
|
7
|
+
|
|
8
|
+
#### Initializer <a name="[object Object].Initializer"></a>
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
import { AssetProps } from '@mrgrain/cdk-esbuild'
|
|
12
|
+
|
|
13
|
+
const assetProps: AssetProps = { ... }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildOptions"></a>
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
public readonly buildOptions: BuildOptions;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
23
|
+
|
|
24
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
25
|
+
|
|
26
|
+
`buildOptions.outdir: string` \
|
|
27
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
28
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
29
|
+
*Cannot be used together with `outfile`*.
|
|
30
|
+
- `buildOptions.outfile: string` \
|
|
31
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
32
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
33
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
34
|
+
- `buildOptions.absWorkingDir: string` \
|
|
35
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
36
|
+
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
37
|
+
|
|
38
|
+
> https://esbuild.github.io/api/#build-api
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.copyDir"></a>
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
public readonly copyDir: string;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- *Type:* `string`
|
|
49
|
+
|
|
50
|
+
Copy additional files to the output directory, before the build runs.
|
|
51
|
+
|
|
52
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.entryPoints"></a>
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
public readonly entryPoints: string | string[] | {[ key: string ]: string};
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- *Type:* `string` | `string`[] | {[ key: string ]: `string`}
|
|
63
|
+
|
|
64
|
+
A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
65
|
+
|
|
66
|
+
E.g. `src/index.ts`.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.assetHash"></a>
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
public readonly assetHash: string;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
- *Type:* `string`
|
|
77
|
+
|
|
78
|
+
A hash of this asset, which is available at construction time.
|
|
79
|
+
|
|
80
|
+
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.
|
|
81
|
+
|
|
82
|
+
Defaults to a hash of all files in the resulting bundle.
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
6
86
|
### BuildOptions <a name="@mrgrain/cdk-esbuild.BuildOptions"></a>
|
|
7
87
|
|
|
8
88
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
@@ -513,63 +593,89 @@ public readonly write: boolean;
|
|
|
513
593
|
|
|
514
594
|
---
|
|
515
595
|
|
|
516
|
-
###
|
|
596
|
+
### BundlerProps <a name="@mrgrain/cdk-esbuild.BundlerProps"></a>
|
|
517
597
|
|
|
518
598
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
519
599
|
|
|
520
600
|
```typescript
|
|
521
|
-
import {
|
|
601
|
+
import { BundlerProps } from '@mrgrain/cdk-esbuild'
|
|
522
602
|
|
|
523
|
-
const
|
|
603
|
+
const bundlerProps: BundlerProps = { ... }
|
|
524
604
|
```
|
|
525
605
|
|
|
526
|
-
##### `
|
|
606
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.buildOptions"></a>
|
|
527
607
|
|
|
528
608
|
```typescript
|
|
529
|
-
public readonly
|
|
609
|
+
public readonly buildOptions: BuildOptions;
|
|
530
610
|
```
|
|
531
611
|
|
|
532
|
-
- *Type:* `
|
|
612
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
613
|
+
|
|
614
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
615
|
+
|
|
616
|
+
`buildOptions.outdir: string` \
|
|
617
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
618
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
619
|
+
*Cannot be used together with `outfile`*.
|
|
620
|
+
- `buildOptions.outfile: string` \
|
|
621
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
622
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
623
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
624
|
+
- `buildOptions.absWorkingDir: string` \
|
|
625
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
626
|
+
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
627
|
+
|
|
628
|
+
> https://esbuild.github.io/api/#build-api
|
|
533
629
|
|
|
534
630
|
---
|
|
535
631
|
|
|
536
|
-
##### `
|
|
632
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.copyDir"></a>
|
|
537
633
|
|
|
538
634
|
```typescript
|
|
539
|
-
public readonly
|
|
635
|
+
public readonly copyDir: string;
|
|
540
636
|
```
|
|
541
637
|
|
|
542
|
-
- *Type:*
|
|
638
|
+
- *Type:* `string`
|
|
639
|
+
|
|
640
|
+
Copy additional files to the output directory, before the build runs.
|
|
641
|
+
|
|
642
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
543
643
|
|
|
544
644
|
---
|
|
545
645
|
|
|
546
|
-
###
|
|
646
|
+
### CodeConfig <a name="@mrgrain/cdk-esbuild.CodeConfig"></a>
|
|
547
647
|
|
|
548
648
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
549
649
|
|
|
550
650
|
```typescript
|
|
551
|
-
import {
|
|
651
|
+
import { CodeConfig } from '@mrgrain/cdk-esbuild'
|
|
552
652
|
|
|
553
|
-
const
|
|
653
|
+
const codeConfig: CodeConfig = { ... }
|
|
554
654
|
```
|
|
555
655
|
|
|
556
|
-
##### `
|
|
656
|
+
##### `s3Location`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.s3Location"></a>
|
|
557
657
|
|
|
558
658
|
```typescript
|
|
559
|
-
public readonly
|
|
659
|
+
public readonly s3Location: Location;
|
|
560
660
|
```
|
|
561
661
|
|
|
562
|
-
- *Type:* `
|
|
563
|
-
|
|
564
|
-
A hash of this asset, which is available at construction time.
|
|
662
|
+
- *Type:* [`@aws-cdk/aws-s3.Location`](#@aws-cdk/aws-s3.Location)
|
|
565
663
|
|
|
566
|
-
|
|
567
|
-
can be used in construct IDs in order to enforce creation of a new resource when the content
|
|
568
|
-
hash has changed.
|
|
664
|
+
The location of the code in S3.
|
|
569
665
|
|
|
570
666
|
---
|
|
571
667
|
|
|
572
|
-
|
|
668
|
+
### JavaScriptCodeProps <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps"></a>
|
|
669
|
+
|
|
670
|
+
#### Initializer <a name="[object Object].Initializer"></a>
|
|
671
|
+
|
|
672
|
+
```typescript
|
|
673
|
+
import { JavaScriptCodeProps } from '@mrgrain/cdk-esbuild'
|
|
674
|
+
|
|
675
|
+
const javaScriptCodeProps: JavaScriptCodeProps = { ... }
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.buildOptions"></a>
|
|
573
679
|
|
|
574
680
|
```typescript
|
|
575
681
|
public readonly buildOptions: BuildOptions;
|
|
@@ -577,11 +683,25 @@ public readonly buildOptions: BuildOptions;
|
|
|
577
683
|
|
|
578
684
|
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
579
685
|
|
|
580
|
-
|
|
686
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
687
|
+
|
|
688
|
+
`buildOptions.outdir: string` \
|
|
689
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
690
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
691
|
+
*Cannot be used together with `outfile`*.
|
|
692
|
+
- `buildOptions.outfile: string` \
|
|
693
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
694
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
695
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
696
|
+
- `buildOptions.absWorkingDir: string` \
|
|
697
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
698
|
+
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
699
|
+
|
|
700
|
+
> https://esbuild.github.io/api/#build-api
|
|
581
701
|
|
|
582
702
|
---
|
|
583
703
|
|
|
584
|
-
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
704
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.copyDir"></a>
|
|
585
705
|
|
|
586
706
|
```typescript
|
|
587
707
|
public readonly copyDir: string;
|
|
@@ -589,125 +709,125 @@ public readonly copyDir: string;
|
|
|
589
709
|
|
|
590
710
|
- *Type:* `string`
|
|
591
711
|
|
|
592
|
-
|
|
712
|
+
Copy additional files to the output directory, before the build runs.
|
|
713
|
+
|
|
714
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
593
715
|
|
|
594
716
|
---
|
|
595
717
|
|
|
596
|
-
##### `
|
|
718
|
+
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.assetHash"></a>
|
|
597
719
|
|
|
598
720
|
```typescript
|
|
599
|
-
public readonly
|
|
721
|
+
public readonly assetHash: string;
|
|
600
722
|
```
|
|
601
723
|
|
|
602
|
-
- *Type:* `string`
|
|
724
|
+
- *Type:* `string`
|
|
725
|
+
|
|
726
|
+
A hash of this asset, which is available at construction time.
|
|
603
727
|
|
|
604
|
-
|
|
728
|
+
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.
|
|
729
|
+
|
|
730
|
+
Defaults to a hash of all files in the resulting bundle.
|
|
605
731
|
|
|
606
732
|
---
|
|
607
733
|
|
|
608
|
-
###
|
|
734
|
+
### JavaScriptSourceProps <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps"></a>
|
|
609
735
|
|
|
610
736
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
611
737
|
|
|
612
738
|
```typescript
|
|
613
|
-
import {
|
|
739
|
+
import { JavaScriptSourceProps } from '@mrgrain/cdk-esbuild'
|
|
614
740
|
|
|
615
|
-
const
|
|
741
|
+
const javaScriptSourceProps: JavaScriptSourceProps = { ... }
|
|
616
742
|
```
|
|
617
743
|
|
|
618
|
-
##### `
|
|
744
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.buildOptions"></a>
|
|
619
745
|
|
|
620
746
|
```typescript
|
|
621
|
-
public readonly
|
|
747
|
+
public readonly buildOptions: BuildOptions;
|
|
622
748
|
```
|
|
623
749
|
|
|
624
|
-
- *Type:* `
|
|
625
|
-
|
|
626
|
-
Relative path to a directory copied to the output before esbuild is run (i.e esbuild will overwrite existing files).
|
|
627
|
-
|
|
628
|
-
---
|
|
750
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
629
751
|
|
|
630
|
-
|
|
752
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
631
753
|
|
|
632
|
-
|
|
754
|
+
`buildOptions.outdir: string` \
|
|
755
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
756
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
757
|
+
*Cannot be used together with `outfile`*.
|
|
758
|
+
- `buildOptions.outfile: string` \
|
|
759
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
760
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
761
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
762
|
+
- `buildOptions.absWorkingDir: string` \
|
|
763
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
764
|
+
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).
|
|
633
765
|
|
|
634
|
-
|
|
635
|
-
import { EsbuildOptions } from '@mrgrain/cdk-esbuild'
|
|
766
|
+
> https://esbuild.github.io/api/#build-api
|
|
636
767
|
|
|
637
|
-
|
|
638
|
-
```
|
|
768
|
+
---
|
|
639
769
|
|
|
640
|
-
##### `
|
|
770
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.copyDir"></a>
|
|
641
771
|
|
|
642
772
|
```typescript
|
|
643
|
-
public readonly
|
|
773
|
+
public readonly copyDir: string;
|
|
644
774
|
```
|
|
645
775
|
|
|
646
776
|
- *Type:* `string`
|
|
647
777
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
##### `allowOverwrite`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.allowOverwrite"></a>
|
|
651
|
-
|
|
652
|
-
```typescript
|
|
653
|
-
public readonly allowOverwrite: boolean;
|
|
654
|
-
```
|
|
778
|
+
Copy additional files to the output directory, before the build runs.
|
|
655
779
|
|
|
656
|
-
|
|
780
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
657
781
|
|
|
658
782
|
---
|
|
659
783
|
|
|
660
|
-
##### `
|
|
784
|
+
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.assetHash"></a>
|
|
661
785
|
|
|
662
786
|
```typescript
|
|
663
|
-
public readonly
|
|
787
|
+
public readonly assetHash: string;
|
|
664
788
|
```
|
|
665
789
|
|
|
666
790
|
- *Type:* `string`
|
|
667
791
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.banner"></a>
|
|
792
|
+
A hash of this asset, which is available at construction time.
|
|
671
793
|
|
|
672
|
-
|
|
673
|
-
public readonly banner: {[ key: string ]: string};
|
|
674
|
-
```
|
|
794
|
+
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.
|
|
675
795
|
|
|
676
|
-
|
|
796
|
+
Defaults to a hash of all files in the resulting bundle.
|
|
677
797
|
|
|
678
798
|
---
|
|
679
799
|
|
|
680
|
-
|
|
800
|
+
### TransformOptions <a name="@mrgrain/cdk-esbuild.TransformOptions"></a>
|
|
681
801
|
|
|
682
|
-
|
|
683
|
-
public readonly bundle: boolean;
|
|
684
|
-
```
|
|
802
|
+
#### Initializer <a name="[object Object].Initializer"></a>
|
|
685
803
|
|
|
686
|
-
|
|
804
|
+
```typescript
|
|
805
|
+
import { TransformOptions } from '@mrgrain/cdk-esbuild'
|
|
687
806
|
|
|
688
|
-
|
|
807
|
+
const transformOptions: TransformOptions = { ... }
|
|
808
|
+
```
|
|
689
809
|
|
|
690
|
-
##### `
|
|
810
|
+
##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.banner"></a>
|
|
691
811
|
|
|
692
812
|
```typescript
|
|
693
|
-
public readonly
|
|
813
|
+
public readonly banner: string;
|
|
694
814
|
```
|
|
695
815
|
|
|
696
816
|
- *Type:* `string`
|
|
697
817
|
|
|
698
818
|
---
|
|
699
819
|
|
|
700
|
-
##### `
|
|
820
|
+
##### `charset`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.charset"></a>
|
|
701
821
|
|
|
702
822
|
```typescript
|
|
703
|
-
public readonly
|
|
823
|
+
public readonly charset: string;
|
|
704
824
|
```
|
|
705
825
|
|
|
706
826
|
- *Type:* `string`
|
|
707
827
|
|
|
708
828
|
---
|
|
709
829
|
|
|
710
|
-
##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
830
|
+
##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.color"></a>
|
|
711
831
|
|
|
712
832
|
```typescript
|
|
713
833
|
public readonly color: boolean;
|
|
@@ -717,17 +837,7 @@ public readonly color: boolean;
|
|
|
717
837
|
|
|
718
838
|
---
|
|
719
839
|
|
|
720
|
-
##### `
|
|
721
|
-
|
|
722
|
-
```typescript
|
|
723
|
-
public readonly conditions: string[];
|
|
724
|
-
```
|
|
725
|
-
|
|
726
|
-
- *Type:* `string`[]
|
|
727
|
-
|
|
728
|
-
---
|
|
729
|
-
|
|
730
|
-
##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.define"></a>
|
|
840
|
+
##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.define"></a>
|
|
731
841
|
|
|
732
842
|
```typescript
|
|
733
843
|
public readonly define: {[ key: string ]: string};
|
|
@@ -737,37 +847,17 @@ public readonly define: {[ key: string ]: string};
|
|
|
737
847
|
|
|
738
848
|
---
|
|
739
849
|
|
|
740
|
-
##### `
|
|
850
|
+
##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.footer"></a>
|
|
741
851
|
|
|
742
852
|
```typescript
|
|
743
|
-
public readonly
|
|
853
|
+
public readonly footer: string;
|
|
744
854
|
```
|
|
745
855
|
|
|
746
856
|
- *Type:* `string`
|
|
747
857
|
|
|
748
858
|
---
|
|
749
859
|
|
|
750
|
-
##### `
|
|
751
|
-
|
|
752
|
-
```typescript
|
|
753
|
-
public readonly external: string[];
|
|
754
|
-
```
|
|
755
|
-
|
|
756
|
-
- *Type:* `string`[]
|
|
757
|
-
|
|
758
|
-
---
|
|
759
|
-
|
|
760
|
-
##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.footer"></a>
|
|
761
|
-
|
|
762
|
-
```typescript
|
|
763
|
-
public readonly footer: {[ key: string ]: string};
|
|
764
|
-
```
|
|
765
|
-
|
|
766
|
-
- *Type:* {[ key: string ]: `string`}
|
|
767
|
-
|
|
768
|
-
---
|
|
769
|
-
|
|
770
|
-
##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.format"></a>
|
|
860
|
+
##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.format"></a>
|
|
771
861
|
|
|
772
862
|
```typescript
|
|
773
863
|
public readonly format: string;
|
|
@@ -777,7 +867,7 @@ public readonly format: string;
|
|
|
777
867
|
|
|
778
868
|
---
|
|
779
869
|
|
|
780
|
-
##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
870
|
+
##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.globalName"></a>
|
|
781
871
|
|
|
782
872
|
```typescript
|
|
783
873
|
public readonly globalName: string;
|
|
@@ -787,7 +877,7 @@ public readonly globalName: string;
|
|
|
787
877
|
|
|
788
878
|
---
|
|
789
879
|
|
|
790
|
-
##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
880
|
+
##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.ignoreAnnotations"></a>
|
|
791
881
|
|
|
792
882
|
```typescript
|
|
793
883
|
public readonly ignoreAnnotations: boolean;
|
|
@@ -797,27 +887,7 @@ public readonly ignoreAnnotations: boolean;
|
|
|
797
887
|
|
|
798
888
|
---
|
|
799
889
|
|
|
800
|
-
##### `
|
|
801
|
-
|
|
802
|
-
```typescript
|
|
803
|
-
public readonly incremental: boolean;
|
|
804
|
-
```
|
|
805
|
-
|
|
806
|
-
- *Type:* `boolean`
|
|
807
|
-
|
|
808
|
-
---
|
|
809
|
-
|
|
810
|
-
##### `inject`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.inject"></a>
|
|
811
|
-
|
|
812
|
-
```typescript
|
|
813
|
-
public readonly inject: string[];
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
- *Type:* `string`[]
|
|
817
|
-
|
|
818
|
-
---
|
|
819
|
-
|
|
820
|
-
##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.jsx"></a>
|
|
890
|
+
##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsx"></a>
|
|
821
891
|
|
|
822
892
|
```typescript
|
|
823
893
|
public readonly jsx: string;
|
|
@@ -827,7 +897,7 @@ public readonly jsx: string;
|
|
|
827
897
|
|
|
828
898
|
---
|
|
829
899
|
|
|
830
|
-
##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
900
|
+
##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFactory"></a>
|
|
831
901
|
|
|
832
902
|
```typescript
|
|
833
903
|
public readonly jsxFactory: string;
|
|
@@ -837,7 +907,7 @@ public readonly jsxFactory: string;
|
|
|
837
907
|
|
|
838
908
|
---
|
|
839
909
|
|
|
840
|
-
##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
910
|
+
##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFragment"></a>
|
|
841
911
|
|
|
842
912
|
```typescript
|
|
843
913
|
public readonly jsxFragment: string;
|
|
@@ -847,7 +917,7 @@ public readonly jsxFragment: string;
|
|
|
847
917
|
|
|
848
918
|
---
|
|
849
919
|
|
|
850
|
-
##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
920
|
+
##### `keepNames`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.keepNames"></a>
|
|
851
921
|
|
|
852
922
|
```typescript
|
|
853
923
|
public readonly keepNames: boolean;
|
|
@@ -857,7 +927,7 @@ public readonly keepNames: boolean;
|
|
|
857
927
|
|
|
858
928
|
---
|
|
859
929
|
|
|
860
|
-
##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
930
|
+
##### `legalComments`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.legalComments"></a>
|
|
861
931
|
|
|
862
932
|
```typescript
|
|
863
933
|
public readonly legalComments: string;
|
|
@@ -867,17 +937,17 @@ public readonly legalComments: string;
|
|
|
867
937
|
|
|
868
938
|
---
|
|
869
939
|
|
|
870
|
-
##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
940
|
+
##### `loader`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.loader"></a>
|
|
871
941
|
|
|
872
942
|
```typescript
|
|
873
|
-
public readonly loader:
|
|
943
|
+
public readonly loader: string;
|
|
874
944
|
```
|
|
875
945
|
|
|
876
|
-
- *Type:*
|
|
946
|
+
- *Type:* `string`
|
|
877
947
|
|
|
878
948
|
---
|
|
879
949
|
|
|
880
|
-
##### `logLevel`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
950
|
+
##### `logLevel`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLevel"></a>
|
|
881
951
|
|
|
882
952
|
```typescript
|
|
883
953
|
public readonly logLevel: string;
|
|
@@ -887,7 +957,7 @@ public readonly logLevel: string;
|
|
|
887
957
|
|
|
888
958
|
---
|
|
889
959
|
|
|
890
|
-
##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.
|
|
960
|
+
##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLimit"></a>
|
|
891
961
|
|
|
892
962
|
```typescript
|
|
893
963
|
public readonly logLimit: number;
|
|
@@ -897,267 +967,177 @@ public readonly logLimit: number;
|
|
|
897
967
|
|
|
898
968
|
---
|
|
899
969
|
|
|
900
|
-
##### `
|
|
970
|
+
##### `minify`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minify"></a>
|
|
901
971
|
|
|
902
972
|
```typescript
|
|
903
|
-
public readonly
|
|
973
|
+
public readonly minify: boolean;
|
|
904
974
|
```
|
|
905
975
|
|
|
906
|
-
- *Type:* `
|
|
976
|
+
- *Type:* `boolean`
|
|
907
977
|
|
|
908
978
|
---
|
|
909
979
|
|
|
910
|
-
##### `
|
|
980
|
+
##### `minifyIdentifiers`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyIdentifiers"></a>
|
|
911
981
|
|
|
912
982
|
```typescript
|
|
913
|
-
public readonly
|
|
983
|
+
public readonly minifyIdentifiers: boolean;
|
|
914
984
|
```
|
|
915
985
|
|
|
916
986
|
- *Type:* `boolean`
|
|
917
987
|
|
|
918
988
|
---
|
|
919
989
|
|
|
920
|
-
##### `
|
|
990
|
+
##### `minifySyntax`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifySyntax"></a>
|
|
921
991
|
|
|
922
992
|
```typescript
|
|
923
|
-
public readonly
|
|
993
|
+
public readonly minifySyntax: boolean;
|
|
924
994
|
```
|
|
925
995
|
|
|
926
996
|
- *Type:* `boolean`
|
|
927
997
|
|
|
928
998
|
---
|
|
929
999
|
|
|
930
|
-
##### `
|
|
1000
|
+
##### `minifyWhitespace`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.minifyWhitespace"></a>
|
|
931
1001
|
|
|
932
1002
|
```typescript
|
|
933
|
-
public readonly
|
|
1003
|
+
public readonly minifyWhitespace: boolean;
|
|
934
1004
|
```
|
|
935
1005
|
|
|
936
1006
|
- *Type:* `boolean`
|
|
937
1007
|
|
|
938
1008
|
---
|
|
939
1009
|
|
|
940
|
-
##### `
|
|
1010
|
+
##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.pure"></a>
|
|
941
1011
|
|
|
942
1012
|
```typescript
|
|
943
|
-
public readonly
|
|
1013
|
+
public readonly pure: string[];
|
|
944
1014
|
```
|
|
945
1015
|
|
|
946
|
-
- *Type:* `
|
|
1016
|
+
- *Type:* `string`[]
|
|
947
1017
|
|
|
948
1018
|
---
|
|
949
1019
|
|
|
950
|
-
##### `
|
|
1020
|
+
##### `sourcefile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcefile"></a>
|
|
951
1021
|
|
|
952
1022
|
```typescript
|
|
953
|
-
public readonly
|
|
1023
|
+
public readonly sourcefile: string;
|
|
954
1024
|
```
|
|
955
1025
|
|
|
956
|
-
- *Type:* `
|
|
1026
|
+
- *Type:* `string`
|
|
957
1027
|
|
|
958
1028
|
---
|
|
959
1029
|
|
|
960
|
-
##### `
|
|
1030
|
+
##### `sourcemap`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcemap"></a>
|
|
961
1031
|
|
|
962
1032
|
```typescript
|
|
963
|
-
public readonly
|
|
1033
|
+
public readonly sourcemap: boolean | string;
|
|
964
1034
|
```
|
|
965
1035
|
|
|
966
|
-
- *Type:* `string`
|
|
1036
|
+
- *Type:* `boolean` | `string`
|
|
967
1037
|
|
|
968
1038
|
---
|
|
969
1039
|
|
|
970
|
-
##### `
|
|
1040
|
+
##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourceRoot"></a>
|
|
971
1041
|
|
|
972
1042
|
```typescript
|
|
973
|
-
public readonly
|
|
1043
|
+
public readonly sourceRoot: string;
|
|
974
1044
|
```
|
|
975
1045
|
|
|
976
1046
|
- *Type:* `string`
|
|
977
1047
|
|
|
978
1048
|
---
|
|
979
1049
|
|
|
980
|
-
##### `
|
|
1050
|
+
##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcesContent"></a>
|
|
981
1051
|
|
|
982
1052
|
```typescript
|
|
983
|
-
public readonly
|
|
1053
|
+
public readonly sourcesContent: boolean;
|
|
984
1054
|
```
|
|
985
1055
|
|
|
986
|
-
- *Type:* `
|
|
1056
|
+
- *Type:* `boolean`
|
|
987
1057
|
|
|
988
1058
|
---
|
|
989
1059
|
|
|
990
|
-
##### `
|
|
1060
|
+
##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
|
|
991
1061
|
|
|
992
1062
|
```typescript
|
|
993
|
-
public readonly
|
|
1063
|
+
public readonly target: string | string[];
|
|
994
1064
|
```
|
|
995
1065
|
|
|
996
|
-
- *Type:*
|
|
1066
|
+
- *Type:* `string` | `string`[]
|
|
997
1067
|
|
|
998
1068
|
---
|
|
999
1069
|
|
|
1000
|
-
##### `
|
|
1070
|
+
##### `treeShaking`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.treeShaking"></a>
|
|
1001
1071
|
|
|
1002
1072
|
```typescript
|
|
1003
|
-
public readonly
|
|
1073
|
+
public readonly treeShaking: boolean;
|
|
1004
1074
|
```
|
|
1005
1075
|
|
|
1006
|
-
- *Type:* `
|
|
1076
|
+
- *Type:* `boolean`
|
|
1007
1077
|
|
|
1008
1078
|
---
|
|
1009
1079
|
|
|
1010
|
-
##### `
|
|
1080
|
+
##### `tsconfigRaw`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.tsconfigRaw"></a>
|
|
1011
1081
|
|
|
1012
1082
|
```typescript
|
|
1013
|
-
public readonly
|
|
1083
|
+
public readonly tsconfigRaw: string;
|
|
1014
1084
|
```
|
|
1015
1085
|
|
|
1016
1086
|
- *Type:* `string`
|
|
1017
1087
|
|
|
1018
1088
|
---
|
|
1019
1089
|
|
|
1020
|
-
|
|
1090
|
+
### TypeScriptCodeProps <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps"></a>
|
|
1091
|
+
|
|
1092
|
+
#### Initializer <a name="[object Object].Initializer"></a>
|
|
1021
1093
|
|
|
1022
1094
|
```typescript
|
|
1023
|
-
|
|
1024
|
-
```
|
|
1025
|
-
|
|
1026
|
-
- *Type:* `boolean`
|
|
1027
|
-
|
|
1028
|
-
---
|
|
1029
|
-
|
|
1030
|
-
##### `publicPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.publicPath"></a>
|
|
1031
|
-
|
|
1032
|
-
```typescript
|
|
1033
|
-
public readonly publicPath: string;
|
|
1034
|
-
```
|
|
1035
|
-
|
|
1036
|
-
- *Type:* `string`
|
|
1037
|
-
|
|
1038
|
-
---
|
|
1039
|
-
|
|
1040
|
-
##### `pure`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.pure"></a>
|
|
1041
|
-
|
|
1042
|
-
```typescript
|
|
1043
|
-
public readonly pure: string[];
|
|
1044
|
-
```
|
|
1045
|
-
|
|
1046
|
-
- *Type:* `string`[]
|
|
1047
|
-
|
|
1048
|
-
---
|
|
1049
|
-
|
|
1050
|
-
##### `resolveExtensions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.resolveExtensions"></a>
|
|
1051
|
-
|
|
1052
|
-
```typescript
|
|
1053
|
-
public readonly resolveExtensions: string[];
|
|
1054
|
-
```
|
|
1055
|
-
|
|
1056
|
-
- *Type:* `string`[]
|
|
1095
|
+
import { TypeScriptCodeProps } from '@mrgrain/cdk-esbuild'
|
|
1057
1096
|
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
##### `sourcemap`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.sourcemap"></a>
|
|
1061
|
-
|
|
1062
|
-
```typescript
|
|
1063
|
-
public readonly sourcemap: boolean | string;
|
|
1097
|
+
const typeScriptCodeProps: TypeScriptCodeProps = { ... }
|
|
1064
1098
|
```
|
|
1065
1099
|
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
---
|
|
1069
|
-
|
|
1070
|
-
##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.sourceRoot"></a>
|
|
1100
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.buildOptions"></a>
|
|
1071
1101
|
|
|
1072
1102
|
```typescript
|
|
1073
|
-
public readonly
|
|
1074
|
-
```
|
|
1075
|
-
|
|
1076
|
-
- *Type:* `string`
|
|
1077
|
-
|
|
1078
|
-
---
|
|
1079
|
-
|
|
1080
|
-
##### `sourcesContent`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.sourcesContent"></a>
|
|
1081
|
-
|
|
1082
|
-
```typescript
|
|
1083
|
-
public readonly sourcesContent: boolean;
|
|
1084
|
-
```
|
|
1085
|
-
|
|
1086
|
-
- *Type:* `boolean`
|
|
1087
|
-
|
|
1088
|
-
---
|
|
1089
|
-
|
|
1090
|
-
##### `splitting`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.splitting"></a>
|
|
1091
|
-
|
|
1092
|
-
```typescript
|
|
1093
|
-
public readonly splitting: boolean;
|
|
1094
|
-
```
|
|
1095
|
-
|
|
1096
|
-
- *Type:* `boolean`
|
|
1097
|
-
|
|
1098
|
-
---
|
|
1099
|
-
|
|
1100
|
-
##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.target"></a>
|
|
1101
|
-
|
|
1102
|
-
```typescript
|
|
1103
|
-
public readonly target: string | string[];
|
|
1103
|
+
public readonly buildOptions: BuildOptions;
|
|
1104
1104
|
```
|
|
1105
1105
|
|
|
1106
|
-
- *Type:* `
|
|
1107
|
-
|
|
1108
|
-
---
|
|
1106
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
1109
1107
|
|
|
1110
|
-
|
|
1108
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
1111
1109
|
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1110
|
+
`buildOptions.outdir: string` \
|
|
1111
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
1112
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
1113
|
+
*Cannot be used together with `outfile`*.
|
|
1114
|
+
- `buildOptions.outfile: string` \
|
|
1115
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
1116
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
1117
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
1118
|
+
- `buildOptions.absWorkingDir: string` \
|
|
1119
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
1120
|
+
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
1115
1121
|
|
|
1116
|
-
-
|
|
1122
|
+
> https://esbuild.github.io/api/#build-api
|
|
1117
1123
|
|
|
1118
1124
|
---
|
|
1119
1125
|
|
|
1120
|
-
##### `
|
|
1126
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.copyDir"></a>
|
|
1121
1127
|
|
|
1122
1128
|
```typescript
|
|
1123
|
-
public readonly
|
|
1129
|
+
public readonly copyDir: string;
|
|
1124
1130
|
```
|
|
1125
1131
|
|
|
1126
1132
|
- *Type:* `string`
|
|
1127
1133
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
##### `write`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildOptions.property.write"></a>
|
|
1131
|
-
|
|
1132
|
-
```typescript
|
|
1133
|
-
public readonly write: boolean;
|
|
1134
|
-
```
|
|
1134
|
+
Copy additional files to the output directory, before the build runs.
|
|
1135
1135
|
|
|
1136
|
-
|
|
1136
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
1137
1137
|
|
|
1138
1138
|
---
|
|
1139
1139
|
|
|
1140
|
-
##### `
|
|
1141
|
-
|
|
1142
|
-
```typescript
|
|
1143
|
-
public readonly entryPoints: string[] | {[ key: string ]: string};
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
- *Type:* `string`[] | {[ key: string ]: `string`}
|
|
1147
|
-
|
|
1148
|
-
---
|
|
1149
|
-
|
|
1150
|
-
### EsbuildProps <a name="@mrgrain/cdk-esbuild.EsbuildProps"></a>
|
|
1151
|
-
|
|
1152
|
-
#### Initializer <a name="[object Object].Initializer"></a>
|
|
1153
|
-
|
|
1154
|
-
```typescript
|
|
1155
|
-
import { EsbuildProps } from '@mrgrain/cdk-esbuild'
|
|
1156
|
-
|
|
1157
|
-
const esbuildProps: EsbuildProps = { ... }
|
|
1158
|
-
```
|
|
1159
|
-
|
|
1160
|
-
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildProps.property.assetHash"></a>
|
|
1140
|
+
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.assetHash"></a>
|
|
1161
1141
|
|
|
1162
1142
|
```typescript
|
|
1163
1143
|
public readonly assetHash: string;
|
|
@@ -1167,417 +1147,171 @@ public readonly assetHash: string;
|
|
|
1167
1147
|
|
|
1168
1148
|
A hash of this asset, which is available at construction time.
|
|
1169
1149
|
|
|
1170
|
-
As this is a plain string, it
|
|
1171
|
-
can be used in construct IDs in order to enforce creation of a new resource when the content
|
|
1172
|
-
hash has changed.
|
|
1173
|
-
|
|
1174
|
-
---
|
|
1175
|
-
|
|
1176
|
-
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildProps.property.buildOptions"></a>
|
|
1177
|
-
|
|
1178
|
-
```typescript
|
|
1179
|
-
public readonly buildOptions: BuildOptions;
|
|
1180
|
-
```
|
|
1181
|
-
|
|
1182
|
-
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
1183
|
-
|
|
1184
|
-
Options passed on to esbuild.
|
|
1185
|
-
|
|
1186
|
-
---
|
|
1187
|
-
|
|
1188
|
-
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildProps.property.copyDir"></a>
|
|
1189
|
-
|
|
1190
|
-
```typescript
|
|
1191
|
-
public readonly copyDir: string;
|
|
1192
|
-
```
|
|
1193
|
-
|
|
1194
|
-
- *Type:* `string`
|
|
1195
|
-
|
|
1196
|
-
Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
|
|
1197
|
-
|
|
1198
|
-
---
|
|
1199
|
-
|
|
1200
|
-
### Location <a name="@mrgrain/cdk-esbuild.Location"></a>
|
|
1150
|
+
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.
|
|
1201
1151
|
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
```typescript
|
|
1205
|
-
import { Location } from '@mrgrain/cdk-esbuild'
|
|
1206
|
-
|
|
1207
|
-
const location: Location = { ... }
|
|
1208
|
-
```
|
|
1209
|
-
|
|
1210
|
-
##### `bucketName`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.Location.property.bucketName"></a>
|
|
1211
|
-
|
|
1212
|
-
```typescript
|
|
1213
|
-
public readonly bucketName: string;
|
|
1214
|
-
```
|
|
1215
|
-
|
|
1216
|
-
- *Type:* `string`
|
|
1152
|
+
Defaults to a hash of all files in the resulting bundle.
|
|
1217
1153
|
|
|
1218
1154
|
---
|
|
1219
1155
|
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
```typescript
|
|
1223
|
-
public readonly objectKey: string;
|
|
1224
|
-
```
|
|
1225
|
-
|
|
1226
|
-
- *Type:* `string`
|
|
1227
|
-
|
|
1228
|
-
---
|
|
1229
|
-
|
|
1230
|
-
### TransformOptions <a name="@mrgrain/cdk-esbuild.TransformOptions"></a>
|
|
1156
|
+
### TypeScriptSourceProps <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps"></a>
|
|
1231
1157
|
|
|
1232
1158
|
#### Initializer <a name="[object Object].Initializer"></a>
|
|
1233
1159
|
|
|
1234
1160
|
```typescript
|
|
1235
|
-
import {
|
|
1236
|
-
|
|
1237
|
-
const transformOptions: TransformOptions = { ... }
|
|
1238
|
-
```
|
|
1239
|
-
|
|
1240
|
-
##### `banner`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.banner"></a>
|
|
1241
|
-
|
|
1242
|
-
```typescript
|
|
1243
|
-
public readonly banner: string;
|
|
1244
|
-
```
|
|
1245
|
-
|
|
1246
|
-
- *Type:* `string`
|
|
1247
|
-
|
|
1248
|
-
---
|
|
1249
|
-
|
|
1250
|
-
##### `charset`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.charset"></a>
|
|
1251
|
-
|
|
1252
|
-
```typescript
|
|
1253
|
-
public readonly charset: string;
|
|
1254
|
-
```
|
|
1255
|
-
|
|
1256
|
-
- *Type:* `string`
|
|
1257
|
-
|
|
1258
|
-
---
|
|
1259
|
-
|
|
1260
|
-
##### `color`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.color"></a>
|
|
1161
|
+
import { TypeScriptSourceProps } from '@mrgrain/cdk-esbuild'
|
|
1261
1162
|
|
|
1262
|
-
|
|
1263
|
-
public readonly color: boolean;
|
|
1163
|
+
const typeScriptSourceProps: TypeScriptSourceProps = { ... }
|
|
1264
1164
|
```
|
|
1265
1165
|
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
---
|
|
1269
|
-
|
|
1270
|
-
##### `define`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.define"></a>
|
|
1271
|
-
|
|
1272
|
-
```typescript
|
|
1273
|
-
public readonly define: {[ key: string ]: string};
|
|
1274
|
-
```
|
|
1275
|
-
|
|
1276
|
-
- *Type:* {[ key: string ]: `string`}
|
|
1277
|
-
|
|
1278
|
-
---
|
|
1279
|
-
|
|
1280
|
-
##### `footer`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.footer"></a>
|
|
1281
|
-
|
|
1282
|
-
```typescript
|
|
1283
|
-
public readonly footer: string;
|
|
1284
|
-
```
|
|
1285
|
-
|
|
1286
|
-
- *Type:* `string`
|
|
1287
|
-
|
|
1288
|
-
---
|
|
1289
|
-
|
|
1290
|
-
##### `format`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.format"></a>
|
|
1291
|
-
|
|
1292
|
-
```typescript
|
|
1293
|
-
public readonly format: string;
|
|
1294
|
-
```
|
|
1295
|
-
|
|
1296
|
-
- *Type:* `string`
|
|
1297
|
-
|
|
1298
|
-
---
|
|
1299
|
-
|
|
1300
|
-
##### `globalName`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.globalName"></a>
|
|
1301
|
-
|
|
1302
|
-
```typescript
|
|
1303
|
-
public readonly globalName: string;
|
|
1304
|
-
```
|
|
1305
|
-
|
|
1306
|
-
- *Type:* `string`
|
|
1307
|
-
|
|
1308
|
-
---
|
|
1309
|
-
|
|
1310
|
-
##### `ignoreAnnotations`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.ignoreAnnotations"></a>
|
|
1311
|
-
|
|
1312
|
-
```typescript
|
|
1313
|
-
public readonly ignoreAnnotations: boolean;
|
|
1314
|
-
```
|
|
1315
|
-
|
|
1316
|
-
- *Type:* `boolean`
|
|
1317
|
-
|
|
1318
|
-
---
|
|
1319
|
-
|
|
1320
|
-
##### `jsx`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsx"></a>
|
|
1321
|
-
|
|
1322
|
-
```typescript
|
|
1323
|
-
public readonly jsx: string;
|
|
1324
|
-
```
|
|
1325
|
-
|
|
1326
|
-
- *Type:* `string`
|
|
1327
|
-
|
|
1328
|
-
---
|
|
1329
|
-
|
|
1330
|
-
##### `jsxFactory`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFactory"></a>
|
|
1331
|
-
|
|
1332
|
-
```typescript
|
|
1333
|
-
public readonly jsxFactory: string;
|
|
1334
|
-
```
|
|
1335
|
-
|
|
1336
|
-
- *Type:* `string`
|
|
1337
|
-
|
|
1338
|
-
---
|
|
1339
|
-
|
|
1340
|
-
##### `jsxFragment`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.jsxFragment"></a>
|
|
1166
|
+
##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.buildOptions"></a>
|
|
1341
1167
|
|
|
1342
1168
|
```typescript
|
|
1343
|
-
public readonly
|
|
1169
|
+
public readonly buildOptions: BuildOptions;
|
|
1344
1170
|
```
|
|
1345
1171
|
|
|
1346
|
-
- *Type:* `
|
|
1347
|
-
|
|
1348
|
-
---
|
|
1172
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
|
|
1349
1173
|
|
|
1350
|
-
|
|
1174
|
+
Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
1351
1175
|
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1176
|
+
`buildOptions.outdir: string` \
|
|
1177
|
+
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
1178
|
+
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
1179
|
+
*Cannot be used together with `outfile`*.
|
|
1180
|
+
- `buildOptions.outfile: string` \
|
|
1181
|
+
Relative path to a file inside the CDK asset output directory. \
|
|
1182
|
+
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
|
|
1183
|
+
*Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
1184
|
+
- `buildOptions.absWorkingDir: string` \
|
|
1185
|
+
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
|
|
1186
|
+
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).
|
|
1355
1187
|
|
|
1356
|
-
-
|
|
1188
|
+
> https://esbuild.github.io/api/#build-api
|
|
1357
1189
|
|
|
1358
1190
|
---
|
|
1359
1191
|
|
|
1360
|
-
##### `
|
|
1192
|
+
##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.copyDir"></a>
|
|
1361
1193
|
|
|
1362
1194
|
```typescript
|
|
1363
|
-
public readonly
|
|
1195
|
+
public readonly copyDir: string;
|
|
1364
1196
|
```
|
|
1365
1197
|
|
|
1366
1198
|
- *Type:* `string`
|
|
1367
1199
|
|
|
1368
|
-
|
|
1200
|
+
Copy additional files to the output directory, before the build runs.
|
|
1369
1201
|
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
```typescript
|
|
1373
|
-
public readonly loader: string;
|
|
1374
|
-
```
|
|
1375
|
-
|
|
1376
|
-
- *Type:* `string`
|
|
1202
|
+
Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
1377
1203
|
|
|
1378
1204
|
---
|
|
1379
1205
|
|
|
1380
|
-
##### `
|
|
1206
|
+
##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.assetHash"></a>
|
|
1381
1207
|
|
|
1382
1208
|
```typescript
|
|
1383
|
-
public readonly
|
|
1209
|
+
public readonly assetHash: string;
|
|
1384
1210
|
```
|
|
1385
1211
|
|
|
1386
1212
|
- *Type:* `string`
|
|
1387
1213
|
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
##### `logLimit`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logLimit"></a>
|
|
1214
|
+
A hash of this asset, which is available at construction time.
|
|
1391
1215
|
|
|
1392
|
-
|
|
1393
|
-
public readonly logLimit: number;
|
|
1394
|
-
```
|
|
1216
|
+
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.
|
|
1395
1217
|
|
|
1396
|
-
|
|
1218
|
+
Defaults to a hash of all files in the resulting bundle.
|
|
1397
1219
|
|
|
1398
1220
|
---
|
|
1399
1221
|
|
|
1400
|
-
|
|
1222
|
+
## Classes <a name="Classes"></a>
|
|
1401
1223
|
|
|
1402
|
-
|
|
1403
|
-
public readonly minify: boolean;
|
|
1404
|
-
```
|
|
1224
|
+
### EsbuildBundler <a name="@mrgrain/cdk-esbuild.EsbuildBundler"></a>
|
|
1405
1225
|
|
|
1406
|
-
-
|
|
1226
|
+
Low-level construct that can be used where `BundlingOptions` are required.
|
|
1407
1227
|
|
|
1408
|
-
|
|
1228
|
+
This class directly interfaces with esbuild and provides almost no configuration safeguards.
|
|
1409
1229
|
|
|
1410
|
-
|
|
1230
|
+
#### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildBundler.Initializer"></a>
|
|
1411
1231
|
|
|
1412
1232
|
```typescript
|
|
1413
|
-
|
|
1414
|
-
```
|
|
1415
|
-
|
|
1416
|
-
- *Type:* `boolean`
|
|
1417
|
-
|
|
1418
|
-
---
|
|
1233
|
+
import { EsbuildBundler } from '@mrgrain/cdk-esbuild'
|
|
1419
1234
|
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
```typescript
|
|
1423
|
-
public readonly minifySyntax: boolean;
|
|
1235
|
+
new EsbuildBundler(entryPoints: string | string[] | {[ key: string ]: string}, props: BundlerProps)
|
|
1424
1236
|
```
|
|
1425
1237
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
---
|
|
1238
|
+
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.parameter.entryPoints"></a>
|
|
1429
1239
|
|
|
1430
|
-
|
|
1240
|
+
- *Type:* `string` | `string`[] | {[ key: string ]: `string`}
|
|
1431
1241
|
|
|
1432
|
-
|
|
1433
|
-
public readonly minifyWhitespace: boolean;
|
|
1434
|
-
```
|
|
1242
|
+
A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
1435
1243
|
|
|
1436
|
-
|
|
1244
|
+
E.g. `src/index.ts`.
|
|
1437
1245
|
|
|
1438
1246
|
---
|
|
1439
1247
|
|
|
1440
|
-
##### `
|
|
1248
|
+
##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.parameter.props"></a>
|
|
1441
1249
|
|
|
1442
|
-
|
|
1443
|
-
public readonly pure: string[];
|
|
1444
|
-
```
|
|
1250
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
|
|
1445
1251
|
|
|
1446
|
-
|
|
1252
|
+
Props to change the behaviour of the bundler.
|
|
1447
1253
|
|
|
1448
1254
|
---
|
|
1449
1255
|
|
|
1450
|
-
##### `sourcefile`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourcefile"></a>
|
|
1451
|
-
|
|
1452
|
-
```typescript
|
|
1453
|
-
public readonly sourcefile: string;
|
|
1454
|
-
```
|
|
1455
1256
|
|
|
1456
|
-
- *Type:* `string`
|
|
1457
1257
|
|
|
1458
|
-
|
|
1258
|
+
#### Properties <a name="Properties"></a>
|
|
1459
1259
|
|
|
1460
|
-
##### `
|
|
1260
|
+
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.entryPoints"></a>
|
|
1461
1261
|
|
|
1462
1262
|
```typescript
|
|
1463
|
-
public readonly
|
|
1263
|
+
public readonly entryPoints: string | string[] | {[ key: string ]: string};
|
|
1464
1264
|
```
|
|
1465
1265
|
|
|
1466
|
-
- *Type:* `
|
|
1467
|
-
|
|
1468
|
-
---
|
|
1469
|
-
|
|
1470
|
-
##### `sourceRoot`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.sourceRoot"></a>
|
|
1266
|
+
- *Type:* `string` | `string`[] | {[ key: string ]: `string`}
|
|
1471
1267
|
|
|
1472
|
-
|
|
1473
|
-
public readonly sourceRoot: string;
|
|
1474
|
-
```
|
|
1268
|
+
A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
1475
1269
|
|
|
1476
|
-
|
|
1270
|
+
E.g. `src/index.ts`.
|
|
1477
1271
|
|
|
1478
1272
|
---
|
|
1479
1273
|
|
|
1480
|
-
#####
|
|
1274
|
+
##### ~~`image`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.image"></a>
|
|
1481
1275
|
|
|
1482
|
-
|
|
1483
|
-
public readonly sourcesContent: boolean;
|
|
1484
|
-
```
|
|
1485
|
-
|
|
1486
|
-
- *Type:* `boolean`
|
|
1487
|
-
|
|
1488
|
-
---
|
|
1489
|
-
|
|
1490
|
-
##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
|
|
1276
|
+
- *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.
|
|
1491
1277
|
|
|
1492
1278
|
```typescript
|
|
1493
|
-
public readonly
|
|
1279
|
+
public readonly image: DockerImage;
|
|
1494
1280
|
```
|
|
1495
1281
|
|
|
1496
|
-
- *Type:* `
|
|
1282
|
+
- *Type:* [`@aws-cdk/core.DockerImage`](#@aws-cdk/core.DockerImage)
|
|
1497
1283
|
|
|
1498
1284
|
---
|
|
1499
1285
|
|
|
1500
|
-
##### `
|
|
1286
|
+
##### `local`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.local"></a>
|
|
1501
1287
|
|
|
1502
1288
|
```typescript
|
|
1503
|
-
public readonly
|
|
1289
|
+
public readonly local: ILocalBundling;
|
|
1504
1290
|
```
|
|
1505
1291
|
|
|
1506
|
-
- *Type:* `
|
|
1507
|
-
|
|
1508
|
-
---
|
|
1509
|
-
|
|
1510
|
-
##### `tsconfigRaw`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.tsconfigRaw"></a>
|
|
1511
|
-
|
|
1512
|
-
```typescript
|
|
1513
|
-
public readonly tsconfigRaw: string;
|
|
1514
|
-
```
|
|
1292
|
+
- *Type:* [`@aws-cdk/core.ILocalBundling`](#@aws-cdk/core.ILocalBundling)
|
|
1515
1293
|
|
|
1516
|
-
|
|
1294
|
+
Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
|
|
1517
1295
|
|
|
1518
1296
|
---
|
|
1519
1297
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
### EsbuildBundling <a name="@mrgrain/cdk-esbuild.EsbuildBundling"></a>
|
|
1523
|
-
|
|
1524
|
-
#### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildBundling.Initializer"></a>
|
|
1298
|
+
##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.props"></a>
|
|
1525
1299
|
|
|
1526
1300
|
```typescript
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
new EsbuildBundling(buildOptions: EsbuildOptions, bundlerProps?: EsbuildBundlingProps)
|
|
1301
|
+
public readonly props: BundlerProps;
|
|
1530
1302
|
```
|
|
1531
1303
|
|
|
1532
|
-
|
|
1304
|
+
- *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
|
|
1533
1305
|
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
---
|
|
1537
|
-
|
|
1538
|
-
##### `bundlerProps`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundling.parameter.bundlerProps"></a>
|
|
1539
|
-
|
|
1540
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildBundlingProps`](#@mrgrain/cdk-esbuild.EsbuildBundlingProps)
|
|
1541
|
-
|
|
1542
|
-
---
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
#### Properties <a name="Properties"></a>
|
|
1547
|
-
|
|
1548
|
-
##### `buildOptions`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundling.property.buildOptions"></a>
|
|
1549
|
-
|
|
1550
|
-
```typescript
|
|
1551
|
-
public readonly buildOptions: EsbuildOptions;
|
|
1552
|
-
```
|
|
1553
|
-
|
|
1554
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildOptions`](#@mrgrain/cdk-esbuild.EsbuildOptions)
|
|
1555
|
-
|
|
1556
|
-
---
|
|
1557
|
-
|
|
1558
|
-
##### `image`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundling.property.image"></a>
|
|
1559
|
-
|
|
1560
|
-
```typescript
|
|
1561
|
-
public readonly image: DockerImage;
|
|
1562
|
-
```
|
|
1563
|
-
|
|
1564
|
-
- *Type:* [`@aws-cdk/core.DockerImage`](#@aws-cdk/core.DockerImage)
|
|
1565
|
-
|
|
1566
|
-
---
|
|
1567
|
-
|
|
1568
|
-
##### `local`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundling.property.local"></a>
|
|
1569
|
-
|
|
1570
|
-
```typescript
|
|
1571
|
-
public readonly local: LocalBundler;
|
|
1572
|
-
```
|
|
1573
|
-
|
|
1574
|
-
- *Type:* [`@mrgrain/cdk-esbuild.LocalBundler`](#@mrgrain/cdk-esbuild.LocalBundler)
|
|
1306
|
+
Props to change the behaviour of the bundler.
|
|
1575
1307
|
|
|
1576
1308
|
---
|
|
1577
1309
|
|
|
1578
1310
|
|
|
1579
1311
|
### InlineJavaScriptCode <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode"></a>
|
|
1580
1312
|
|
|
1313
|
+
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
|
|
1314
|
+
|
|
1581
1315
|
#### Initializers <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.Initializer"></a>
|
|
1582
1316
|
|
|
1583
1317
|
```typescript
|
|
@@ -1590,12 +1324,22 @@ new InlineJavaScriptCode(code: string, transformOptions?: TransformOptions)
|
|
|
1590
1324
|
|
|
1591
1325
|
- *Type:* `string`
|
|
1592
1326
|
|
|
1327
|
+
The inline code to be transformed.
|
|
1328
|
+
|
|
1593
1329
|
---
|
|
1594
1330
|
|
|
1595
1331
|
##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.transformOptions"></a>
|
|
1596
1332
|
|
|
1597
1333
|
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1598
1334
|
|
|
1335
|
+
Transform options passed on to esbuild.
|
|
1336
|
+
|
|
1337
|
+
Please refer to the esbuild Transform API docs for details. \
|
|
1338
|
+
Default values for `transformOptions`:
|
|
1339
|
+
- `loader='js'`
|
|
1340
|
+
|
|
1341
|
+
> https://esbuild.github.io/api/#transform-api
|
|
1342
|
+
|
|
1599
1343
|
---
|
|
1600
1344
|
|
|
1601
1345
|
|
|
@@ -1604,6 +1348,8 @@ new InlineJavaScriptCode(code: string, transformOptions?: TransformOptions)
|
|
|
1604
1348
|
|
|
1605
1349
|
### InlineJsxCode <a name="@mrgrain/cdk-esbuild.InlineJsxCode"></a>
|
|
1606
1350
|
|
|
1351
|
+
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
|
|
1352
|
+
|
|
1607
1353
|
#### Initializers <a name="@mrgrain/cdk-esbuild.InlineJsxCode.Initializer"></a>
|
|
1608
1354
|
|
|
1609
1355
|
```typescript
|
|
@@ -1616,12 +1362,22 @@ new InlineJsxCode(code: string, transformOptions?: TransformOptions)
|
|
|
1616
1362
|
|
|
1617
1363
|
- *Type:* `string`
|
|
1618
1364
|
|
|
1365
|
+
The inline code to be transformed.
|
|
1366
|
+
|
|
1619
1367
|
---
|
|
1620
1368
|
|
|
1621
1369
|
##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.transformOptions"></a>
|
|
1622
1370
|
|
|
1623
1371
|
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1624
1372
|
|
|
1373
|
+
Transform options passed on to esbuild.
|
|
1374
|
+
|
|
1375
|
+
Please refer to the esbuild Transform API docs for details. \
|
|
1376
|
+
Default values for `transformOptions`:
|
|
1377
|
+
- `loader='jsx'`
|
|
1378
|
+
|
|
1379
|
+
> https://esbuild.github.io/api/#transform-api
|
|
1380
|
+
|
|
1625
1381
|
---
|
|
1626
1382
|
|
|
1627
1383
|
|
|
@@ -1630,6 +1386,8 @@ new InlineJsxCode(code: string, transformOptions?: TransformOptions)
|
|
|
1630
1386
|
|
|
1631
1387
|
### InlineTsxCode <a name="@mrgrain/cdk-esbuild.InlineTsxCode"></a>
|
|
1632
1388
|
|
|
1389
|
+
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
|
|
1390
|
+
|
|
1633
1391
|
#### Initializers <a name="@mrgrain/cdk-esbuild.InlineTsxCode.Initializer"></a>
|
|
1634
1392
|
|
|
1635
1393
|
```typescript
|
|
@@ -1642,12 +1400,22 @@ new InlineTsxCode(code: string, transformOptions?: TransformOptions)
|
|
|
1642
1400
|
|
|
1643
1401
|
- *Type:* `string`
|
|
1644
1402
|
|
|
1403
|
+
The inline code to be transformed.
|
|
1404
|
+
|
|
1645
1405
|
---
|
|
1646
1406
|
|
|
1647
1407
|
##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.transformOptions"></a>
|
|
1648
1408
|
|
|
1649
1409
|
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1650
1410
|
|
|
1411
|
+
Transform options passed on to esbuild.
|
|
1412
|
+
|
|
1413
|
+
Please refer to the esbuild Transform API docs for details. \
|
|
1414
|
+
Default values for `transformOptions`:
|
|
1415
|
+
- `loader='tsx'`
|
|
1416
|
+
|
|
1417
|
+
> https://esbuild.github.io/api/#transform-api
|
|
1418
|
+
|
|
1651
1419
|
---
|
|
1652
1420
|
|
|
1653
1421
|
|
|
@@ -1656,6 +1424,8 @@ new InlineTsxCode(code: string, transformOptions?: TransformOptions)
|
|
|
1656
1424
|
|
|
1657
1425
|
### InlineTypeScriptCode <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode"></a>
|
|
1658
1426
|
|
|
1427
|
+
An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
|
|
1428
|
+
|
|
1659
1429
|
#### Initializers <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.Initializer"></a>
|
|
1660
1430
|
|
|
1661
1431
|
```typescript
|
|
@@ -1668,12 +1438,22 @@ new InlineTypeScriptCode(code: string, transformOptions?: TransformOptions)
|
|
|
1668
1438
|
|
|
1669
1439
|
- *Type:* `string`
|
|
1670
1440
|
|
|
1441
|
+
The inline code to be transformed.
|
|
1442
|
+
|
|
1671
1443
|
---
|
|
1672
1444
|
|
|
1673
1445
|
##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.transformOptions"></a>
|
|
1674
1446
|
|
|
1675
1447
|
- *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
|
|
1676
1448
|
|
|
1449
|
+
Transform options passed on to esbuild.
|
|
1450
|
+
|
|
1451
|
+
Please refer to the esbuild Transform API docs for details. \
|
|
1452
|
+
Default values for `transformOptions`:
|
|
1453
|
+
- `loader='ts'`
|
|
1454
|
+
|
|
1455
|
+
> https://esbuild.github.io/api/#transform-api
|
|
1456
|
+
|
|
1677
1457
|
---
|
|
1678
1458
|
|
|
1679
1459
|
|
|
@@ -1682,12 +1462,16 @@ new InlineTypeScriptCode(code: string, transformOptions?: TransformOptions)
|
|
|
1682
1462
|
|
|
1683
1463
|
### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
|
|
1684
1464
|
|
|
1465
|
+
Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
1466
|
+
|
|
1467
|
+
The asset can be used by other constructs.
|
|
1468
|
+
|
|
1685
1469
|
#### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
|
|
1686
1470
|
|
|
1687
1471
|
```typescript
|
|
1688
1472
|
import { JavaScriptAsset } from '@mrgrain/cdk-esbuild'
|
|
1689
1473
|
|
|
1690
|
-
new JavaScriptAsset(scope: Construct, id: string,
|
|
1474
|
+
new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
|
|
1691
1475
|
```
|
|
1692
1476
|
|
|
1693
1477
|
##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.scope"></a>
|
|
@@ -1702,9 +1486,9 @@ new JavaScriptAsset(scope: Construct, id: string, __2: EsbuildAssetProps)
|
|
|
1702
1486
|
|
|
1703
1487
|
---
|
|
1704
1488
|
|
|
1705
|
-
##### `
|
|
1489
|
+
##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.props"></a>
|
|
1706
1490
|
|
|
1707
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1491
|
+
- *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
|
|
1708
1492
|
|
|
1709
1493
|
---
|
|
1710
1494
|
|
|
@@ -1714,23 +1498,36 @@ new JavaScriptAsset(scope: Construct, id: string, __2: EsbuildAssetProps)
|
|
|
1714
1498
|
|
|
1715
1499
|
### JavaScriptCode <a name="@mrgrain/cdk-esbuild.JavaScriptCode"></a>
|
|
1716
1500
|
|
|
1501
|
+
Represents the deployed JavaScript Code.
|
|
1502
|
+
|
|
1717
1503
|
#### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptCode.Initializer"></a>
|
|
1718
1504
|
|
|
1719
1505
|
```typescript
|
|
1720
1506
|
import { JavaScriptCode } from '@mrgrain/cdk-esbuild'
|
|
1721
1507
|
|
|
1722
|
-
new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?:
|
|
1508
|
+
new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?: JavaScriptCodeProps)
|
|
1723
1509
|
```
|
|
1724
1510
|
|
|
1725
1511
|
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.entryPoints"></a>
|
|
1726
1512
|
|
|
1727
1513
|
- *Type:* `string` | `string`[] | {[ key: string ]: `string`}
|
|
1728
1514
|
|
|
1515
|
+
A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
1516
|
+
|
|
1517
|
+
E.g. `src/index.ts`.
|
|
1518
|
+
|
|
1729
1519
|
---
|
|
1730
1520
|
|
|
1731
1521
|
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.props"></a>
|
|
1732
1522
|
|
|
1733
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1523
|
+
- *Type:* [`@mrgrain/cdk-esbuild.JavaScriptCodeProps`](#@mrgrain/cdk-esbuild.JavaScriptCodeProps)
|
|
1524
|
+
|
|
1525
|
+
Props to change the behavior of the bundler.
|
|
1526
|
+
|
|
1527
|
+
Default values for `props.buildOptions`:
|
|
1528
|
+
- `bundle=true`
|
|
1529
|
+
- `platform=node`
|
|
1530
|
+
- `target=nodeX` with X being the major node version running locally
|
|
1734
1531
|
|
|
1735
1532
|
---
|
|
1736
1533
|
|
|
@@ -1769,17 +1566,9 @@ public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
|
|
|
1769
1566
|
|
|
1770
1567
|
#### Properties <a name="Properties"></a>
|
|
1771
1568
|
|
|
1772
|
-
#####
|
|
1569
|
+
##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.isInline"></a>
|
|
1773
1570
|
|
|
1774
|
-
|
|
1775
|
-
public readonly assetClass: JavaScriptAsset;
|
|
1776
|
-
```
|
|
1777
|
-
|
|
1778
|
-
- *Type:* [`@mrgrain/cdk-esbuild.JavaScriptAsset`](#@mrgrain/cdk-esbuild.JavaScriptAsset)
|
|
1779
|
-
|
|
1780
|
-
---
|
|
1781
|
-
|
|
1782
|
-
##### `isInline`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.isInline"></a>
|
|
1571
|
+
- *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
|
|
1783
1572
|
|
|
1784
1573
|
```typescript
|
|
1785
1574
|
public readonly isInline: boolean;
|
|
@@ -1787,6 +1576,8 @@ public readonly isInline: boolean;
|
|
|
1787
1576
|
|
|
1788
1577
|
- *Type:* `boolean`
|
|
1789
1578
|
|
|
1579
|
+
Determines whether this Code is inline code or not.
|
|
1580
|
+
|
|
1790
1581
|
---
|
|
1791
1582
|
|
|
1792
1583
|
|
|
@@ -1799,7 +1590,7 @@ public readonly isInline: boolean;
|
|
|
1799
1590
|
```typescript
|
|
1800
1591
|
import { JavaScriptSource } from '@mrgrain/cdk-esbuild'
|
|
1801
1592
|
|
|
1802
|
-
new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?:
|
|
1593
|
+
new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?: JavaScriptSourceProps)
|
|
1803
1594
|
```
|
|
1804
1595
|
|
|
1805
1596
|
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.entryPoints"></a>
|
|
@@ -1810,7 +1601,7 @@ new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
|
|
|
1810
1601
|
|
|
1811
1602
|
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.props"></a>
|
|
1812
1603
|
|
|
1813
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1604
|
+
- *Type:* [`@mrgrain/cdk-esbuild.JavaScriptSourceProps`](#@mrgrain/cdk-esbuild.JavaScriptSourceProps)
|
|
1814
1605
|
|
|
1815
1606
|
---
|
|
1816
1607
|
|
|
@@ -1848,82 +1639,18 @@ public readonly assetClass: JavaScriptAsset;
|
|
|
1848
1639
|
---
|
|
1849
1640
|
|
|
1850
1641
|
|
|
1851
|
-
###
|
|
1852
|
-
|
|
1853
|
-
- *Implements:* [`@aws-cdk/core.ILocalBundling`](#@aws-cdk/core.ILocalBundling)
|
|
1854
|
-
|
|
1855
|
-
#### Initializers <a name="@mrgrain/cdk-esbuild.LocalBundler.Initializer"></a>
|
|
1856
|
-
|
|
1857
|
-
```typescript
|
|
1858
|
-
import { LocalBundler } from '@mrgrain/cdk-esbuild'
|
|
1859
|
-
|
|
1860
|
-
new LocalBundler(buildOptions: EsbuildOptions, props?: EsbuildBundlingProps)
|
|
1861
|
-
```
|
|
1862
|
-
|
|
1863
|
-
##### `buildOptions`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.parameter.buildOptions"></a>
|
|
1864
|
-
|
|
1865
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildOptions`](#@mrgrain/cdk-esbuild.EsbuildOptions)
|
|
1866
|
-
|
|
1867
|
-
---
|
|
1868
|
-
|
|
1869
|
-
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.parameter.props"></a>
|
|
1870
|
-
|
|
1871
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildBundlingProps`](#@mrgrain/cdk-esbuild.EsbuildBundlingProps)
|
|
1872
|
-
|
|
1873
|
-
---
|
|
1874
|
-
|
|
1875
|
-
#### Methods <a name="Methods"></a>
|
|
1876
|
-
|
|
1877
|
-
##### `tryBundle` <a name="@mrgrain/cdk-esbuild.LocalBundler.tryBundle"></a>
|
|
1878
|
-
|
|
1879
|
-
```typescript
|
|
1880
|
-
public tryBundle(outputDir: string, _options: BundlingOptions)
|
|
1881
|
-
```
|
|
1882
|
-
|
|
1883
|
-
###### `outputDir`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.parameter.outputDir"></a>
|
|
1884
|
-
|
|
1885
|
-
- *Type:* `string`
|
|
1886
|
-
|
|
1887
|
-
---
|
|
1888
|
-
|
|
1889
|
-
###### `_options`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.parameter._options"></a>
|
|
1890
|
-
|
|
1891
|
-
- *Type:* [`@aws-cdk/core.BundlingOptions`](#@aws-cdk/core.BundlingOptions)
|
|
1892
|
-
|
|
1893
|
-
---
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
#### Properties <a name="Properties"></a>
|
|
1897
|
-
|
|
1898
|
-
##### `buildOptions`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.property.buildOptions"></a>
|
|
1899
|
-
|
|
1900
|
-
```typescript
|
|
1901
|
-
public readonly buildOptions: EsbuildOptions;
|
|
1902
|
-
```
|
|
1903
|
-
|
|
1904
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildOptions`](#@mrgrain/cdk-esbuild.EsbuildOptions)
|
|
1905
|
-
|
|
1906
|
-
---
|
|
1907
|
-
|
|
1908
|
-
##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.LocalBundler.property.props"></a>
|
|
1909
|
-
|
|
1910
|
-
```typescript
|
|
1911
|
-
public readonly props: EsbuildBundlingProps;
|
|
1912
|
-
```
|
|
1913
|
-
|
|
1914
|
-
- *Type:* [`@mrgrain/cdk-esbuild.EsbuildBundlingProps`](#@mrgrain/cdk-esbuild.EsbuildBundlingProps)
|
|
1915
|
-
|
|
1916
|
-
---
|
|
1642
|
+
### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
|
|
1917
1643
|
|
|
1644
|
+
Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
1918
1645
|
|
|
1919
|
-
|
|
1646
|
+
The asset can be used by other constructs.
|
|
1920
1647
|
|
|
1921
1648
|
#### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
|
|
1922
1649
|
|
|
1923
1650
|
```typescript
|
|
1924
1651
|
import { TypeScriptAsset } from '@mrgrain/cdk-esbuild'
|
|
1925
1652
|
|
|
1926
|
-
new TypeScriptAsset(scope: Construct, id: string,
|
|
1653
|
+
new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
|
|
1927
1654
|
```
|
|
1928
1655
|
|
|
1929
1656
|
##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.scope"></a>
|
|
@@ -1938,9 +1665,9 @@ new TypeScriptAsset(scope: Construct, id: string, __2: EsbuildAssetProps)
|
|
|
1938
1665
|
|
|
1939
1666
|
---
|
|
1940
1667
|
|
|
1941
|
-
##### `
|
|
1668
|
+
##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.props"></a>
|
|
1942
1669
|
|
|
1943
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1670
|
+
- *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
|
|
1944
1671
|
|
|
1945
1672
|
---
|
|
1946
1673
|
|
|
@@ -1950,23 +1677,36 @@ new TypeScriptAsset(scope: Construct, id: string, __2: EsbuildAssetProps)
|
|
|
1950
1677
|
|
|
1951
1678
|
### TypeScriptCode <a name="@mrgrain/cdk-esbuild.TypeScriptCode"></a>
|
|
1952
1679
|
|
|
1680
|
+
Represents the deployed TypeScript Code.
|
|
1681
|
+
|
|
1953
1682
|
#### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptCode.Initializer"></a>
|
|
1954
1683
|
|
|
1955
1684
|
```typescript
|
|
1956
1685
|
import { TypeScriptCode } from '@mrgrain/cdk-esbuild'
|
|
1957
1686
|
|
|
1958
|
-
new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?:
|
|
1687
|
+
new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, props?: TypeScriptCodeProps)
|
|
1959
1688
|
```
|
|
1960
1689
|
|
|
1961
1690
|
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.entryPoints"></a>
|
|
1962
1691
|
|
|
1963
1692
|
- *Type:* `string` | `string`[] | {[ key: string ]: `string`}
|
|
1964
1693
|
|
|
1694
|
+
A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
1695
|
+
|
|
1696
|
+
E.g. `src/index.ts`.
|
|
1697
|
+
|
|
1965
1698
|
---
|
|
1966
1699
|
|
|
1967
1700
|
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.props"></a>
|
|
1968
1701
|
|
|
1969
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1702
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TypeScriptCodeProps`](#@mrgrain/cdk-esbuild.TypeScriptCodeProps)
|
|
1703
|
+
|
|
1704
|
+
Props to change the behavior of the bundler.
|
|
1705
|
+
|
|
1706
|
+
Default values for `props.buildOptions`:
|
|
1707
|
+
- `bundle=true`
|
|
1708
|
+
- `platform=node`
|
|
1709
|
+
- `target=nodeX` with X being the major node version running locally
|
|
1970
1710
|
|
|
1971
1711
|
---
|
|
1972
1712
|
|
|
@@ -2005,17 +1745,9 @@ public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
|
|
|
2005
1745
|
|
|
2006
1746
|
#### Properties <a name="Properties"></a>
|
|
2007
1747
|
|
|
2008
|
-
#####
|
|
1748
|
+
##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.isInline"></a>
|
|
2009
1749
|
|
|
2010
|
-
|
|
2011
|
-
public readonly assetClass: TypeScriptAsset;
|
|
2012
|
-
```
|
|
2013
|
-
|
|
2014
|
-
- *Type:* [`@mrgrain/cdk-esbuild.TypeScriptAsset`](#@mrgrain/cdk-esbuild.TypeScriptAsset)
|
|
2015
|
-
|
|
2016
|
-
---
|
|
2017
|
-
|
|
2018
|
-
##### `isInline`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.isInline"></a>
|
|
1750
|
+
- *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
|
|
2019
1751
|
|
|
2020
1752
|
```typescript
|
|
2021
1753
|
public readonly isInline: boolean;
|
|
@@ -2023,6 +1755,8 @@ public readonly isInline: boolean;
|
|
|
2023
1755
|
|
|
2024
1756
|
- *Type:* `boolean`
|
|
2025
1757
|
|
|
1758
|
+
Determines whether this Code is inline code or not.
|
|
1759
|
+
|
|
2026
1760
|
---
|
|
2027
1761
|
|
|
2028
1762
|
|
|
@@ -2035,7 +1769,7 @@ public readonly isInline: boolean;
|
|
|
2035
1769
|
```typescript
|
|
2036
1770
|
import { TypeScriptSource } from '@mrgrain/cdk-esbuild'
|
|
2037
1771
|
|
|
2038
|
-
new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?:
|
|
1772
|
+
new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string}, props?: TypeScriptSourceProps)
|
|
2039
1773
|
```
|
|
2040
1774
|
|
|
2041
1775
|
##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.entryPoints"></a>
|
|
@@ -2046,7 +1780,7 @@ new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
|
|
|
2046
1780
|
|
|
2047
1781
|
##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.props"></a>
|
|
2048
1782
|
|
|
2049
|
-
- *Type:* [`@mrgrain/cdk-esbuild.
|
|
1783
|
+
- *Type:* [`@mrgrain/cdk-esbuild.TypeScriptSourceProps`](#@mrgrain/cdk-esbuild.TypeScriptSourceProps)
|
|
2050
1784
|
|
|
2051
1785
|
---
|
|
2052
1786
|
|