@mrgrain/cdk-esbuild 2.0.0-alpha.1 → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/API.md CHANGED
@@ -3,17 +3,17 @@
3
3
 
4
4
  ## Structs <a name="Structs"></a>
5
5
 
6
- ### AssetBaseProps <a name="@mrgrain/cdk-esbuild.AssetBaseProps"></a>
6
+ ### AssetProps <a name="@mrgrain/cdk-esbuild.AssetProps"></a>
7
7
 
8
8
  #### Initializer <a name="[object Object].Initializer"></a>
9
9
 
10
10
  ```typescript
11
- import { AssetBaseProps } from '@mrgrain/cdk-esbuild'
11
+ import { AssetProps } from '@mrgrain/cdk-esbuild'
12
12
 
13
- const assetBaseProps: AssetBaseProps = { ... }
13
+ const assetProps: AssetProps = { ... }
14
14
  ```
15
15
 
16
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetBaseProps.property.buildOptions"></a>
16
+ ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildOptions"></a>
17
17
 
18
18
  ```typescript
19
19
  public readonly buildOptions: BuildOptions;
@@ -21,69 +21,49 @@ public readonly buildOptions: BuildOptions;
21
21
 
22
22
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
23
23
 
24
- Options passed on to esbuild.
24
+ Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
25
25
 
26
- ---
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).
27
37
 
28
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetBaseProps.property.copyDir"></a>
29
-
30
- ```typescript
31
- public readonly copyDir: string;
32
- ```
33
-
34
- - *Type:* `string`
35
-
36
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
38
+ > https://esbuild.github.io/api/#build-api
37
39
 
38
40
  ---
39
41
 
40
- ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetBaseProps.property.assetHash"></a>
42
+ ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.copyDir"></a>
41
43
 
42
44
  ```typescript
43
- public readonly assetHash: string;
45
+ public readonly copyDir: string;
44
46
  ```
45
47
 
46
48
  - *Type:* `string`
47
49
 
48
- A hash of this asset, which is available at construction time.
50
+ Copy additional files to the output directory, before the build runs.
49
51
 
50
- As this is a plain string, it
51
- can be used in construct IDs in order to enforce creation of a new resource when the content
52
- hash has changed.
52
+ Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
53
53
 
54
54
  ---
55
55
 
56
- ### AssetProps <a name="@mrgrain/cdk-esbuild.AssetProps"></a>
57
-
58
- #### Initializer <a name="[object Object].Initializer"></a>
59
-
60
- ```typescript
61
- import { AssetProps } from '@mrgrain/cdk-esbuild'
62
-
63
- const assetProps: AssetProps = { ... }
64
- ```
65
-
66
- ##### `buildOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.buildOptions"></a>
56
+ ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.entryPoints"></a>
67
57
 
68
58
  ```typescript
69
- public readonly buildOptions: BuildOptions;
59
+ public readonly entryPoints: string | string[] | {[ key: string ]: string};
70
60
  ```
71
61
 
72
- - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
73
-
74
- Options passed on to esbuild.
75
-
76
- ---
77
-
78
- ##### `copyDir`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.copyDir"></a>
79
-
80
- ```typescript
81
- public readonly copyDir: string;
82
- ```
62
+ - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
83
63
 
84
- - *Type:* `string`
64
+ A relative path or list or map of relative paths to the entry points of your code from the root of the project.
85
65
 
86
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
66
+ E.g. `src/index.ts`.
87
67
 
88
68
  ---
89
69
 
@@ -97,21 +77,9 @@ public readonly assetHash: string;
97
77
 
98
78
  A hash of this asset, which is available at construction time.
99
79
 
100
- As this is a plain string, it
101
- can be used in construct IDs in order to enforce creation of a new resource when the content
102
- hash has changed.
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.
103
81
 
104
- ---
105
-
106
- ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.entryPoints"></a>
107
-
108
- ```typescript
109
- public readonly entryPoints: string | string[] | {[ key: string ]: string};
110
- ```
111
-
112
- - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
113
-
114
- Relative paths to the entrypoints of your code, e.g. `src/index.ts`.
82
+ Defaults to a hash of all files in the resulting bundle.
115
83
 
116
84
  ---
117
85
 
@@ -643,7 +611,21 @@ public readonly buildOptions: BuildOptions;
643
611
 
644
612
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
645
613
 
646
- Options passed on to esbuild.
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
647
629
 
648
630
  ---
649
631
 
@@ -655,7 +637,9 @@ public readonly copyDir: string;
655
637
 
656
638
  - *Type:* `string`
657
639
 
658
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
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.
659
643
 
660
644
  ---
661
645
 
@@ -677,6 +661,8 @@ public readonly s3Location: Location;
677
661
 
678
662
  - *Type:* [`@aws-cdk/aws-s3.Location`](#@aws-cdk/aws-s3.Location)
679
663
 
664
+ The location of the code in S3.
665
+
680
666
  ---
681
667
 
682
668
  ### JavaScriptCodeProps <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps"></a>
@@ -697,7 +683,21 @@ public readonly buildOptions: BuildOptions;
697
683
 
698
684
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
699
685
 
700
- Options passed on to esbuild.
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
701
701
 
702
702
  ---
703
703
 
@@ -709,7 +709,9 @@ public readonly copyDir: string;
709
709
 
710
710
  - *Type:* `string`
711
711
 
712
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
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.
713
715
 
714
716
  ---
715
717
 
@@ -723,9 +725,9 @@ public readonly assetHash: string;
723
725
 
724
726
  A hash of this asset, which is available at construction time.
725
727
 
726
- As this is a plain string, it
727
- can be used in construct IDs in order to enforce creation of a new resource when the content
728
- hash has changed.
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.
729
731
 
730
732
  ---
731
733
 
@@ -747,7 +749,21 @@ public readonly buildOptions: BuildOptions;
747
749
 
748
750
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
749
751
 
750
- Options passed on to esbuild.
752
+ Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
753
+
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).
765
+
766
+ > https://esbuild.github.io/api/#build-api
751
767
 
752
768
  ---
753
769
 
@@ -759,7 +775,9 @@ public readonly copyDir: string;
759
775
 
760
776
  - *Type:* `string`
761
777
 
762
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
778
+ Copy additional files to the output directory, before the build runs.
779
+
780
+ Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
763
781
 
764
782
  ---
765
783
 
@@ -773,9 +791,9 @@ public readonly assetHash: string;
773
791
 
774
792
  A hash of this asset, which is available at construction time.
775
793
 
776
- As this is a plain string, it
777
- can be used in construct IDs in order to enforce creation of a new resource when the content
778
- hash has changed.
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.
795
+
796
+ Defaults to a hash of all files in the resulting bundle.
779
797
 
780
798
  ---
781
799
 
@@ -1087,7 +1105,21 @@ public readonly buildOptions: BuildOptions;
1087
1105
 
1088
1106
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1089
1107
 
1090
- Options passed on to esbuild.
1108
+ Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1109
+
1110
+ `buildOptions.outdir: string`
1111
+ The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
1112
+ For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
1113
+ *Cannot be used together with `outfile`*.
1114
+ - `buildOptions.outfile: string`
1115
+ Relative path to a file inside the CDK asset output directory.
1116
+ For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point. \
1117
+ *Cannot be used with multiple entryPoints or together with `outdir`.*
1118
+ - `buildOptions.absWorkingDir: string`
1119
+ Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory). \
1120
+ If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
1121
+
1122
+ > https://esbuild.github.io/api/#build-api
1091
1123
 
1092
1124
  ---
1093
1125
 
@@ -1099,7 +1131,9 @@ public readonly copyDir: string;
1099
1131
 
1100
1132
  - *Type:* `string`
1101
1133
 
1102
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
1134
+ Copy additional files to the output directory, before the build runs.
1135
+
1136
+ Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1103
1137
 
1104
1138
  ---
1105
1139
 
@@ -1113,9 +1147,9 @@ public readonly assetHash: string;
1113
1147
 
1114
1148
  A hash of this asset, which is available at construction time.
1115
1149
 
1116
- As this is a plain string, it
1117
- can be used in construct IDs in order to enforce creation of a new resource when the content
1118
- hash has changed.
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.
1151
+
1152
+ Defaults to a hash of all files in the resulting bundle.
1119
1153
 
1120
1154
  ---
1121
1155
 
@@ -1137,7 +1171,21 @@ public readonly buildOptions: BuildOptions;
1137
1171
 
1138
1172
  - *Type:* [`@mrgrain/cdk-esbuild.BuildOptions`](#@mrgrain/cdk-esbuild.BuildOptions)
1139
1173
 
1140
- Options passed on to esbuild.
1174
+ Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
1175
+
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).
1187
+
1188
+ > https://esbuild.github.io/api/#build-api
1141
1189
 
1142
1190
  ---
1143
1191
 
@@ -1149,7 +1197,9 @@ public readonly copyDir: string;
1149
1197
 
1150
1198
  - *Type:* `string`
1151
1199
 
1152
- Relative path to a directory copied to the output BEFORE esbuild is run (i.e esbuild will overwrite existing files).
1200
+ Copy additional files to the output directory, before the build runs.
1201
+
1202
+ Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
1153
1203
 
1154
1204
  ---
1155
1205
 
@@ -1163,9 +1213,9 @@ public readonly assetHash: string;
1163
1213
 
1164
1214
  A hash of this asset, which is available at construction time.
1165
1215
 
1166
- As this is a plain string, it
1167
- can be used in construct IDs in order to enforce creation of a new resource when the content
1168
- hash has changed.
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.
1217
+
1218
+ Defaults to a hash of all files in the resulting bundle.
1169
1219
 
1170
1220
  ---
1171
1221
 
@@ -1173,6 +1223,10 @@ hash has changed.
1173
1223
 
1174
1224
  ### EsbuildBundler <a name="@mrgrain/cdk-esbuild.EsbuildBundler"></a>
1175
1225
 
1226
+ Low-level construct that can be used where `BundlingOptions` are required.
1227
+
1228
+ This class directly interfaces with esbuild and provides almost no configuration safeguards.
1229
+
1176
1230
  #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildBundler.Initializer"></a>
1177
1231
 
1178
1232
  ```typescript
@@ -1185,7 +1239,9 @@ new EsbuildBundler(entryPoints: string | string[] | {[ key: string ]: string}, p
1185
1239
 
1186
1240
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1187
1241
 
1188
- Relative paths to the entrypoints of your code, e.g. `src/index.ts`.
1242
+ A relative path or list or map of relative paths to the entry points of your code from the root of the project.
1243
+
1244
+ E.g. `src/index.ts`.
1189
1245
 
1190
1246
  ---
1191
1247
 
@@ -1193,6 +1249,8 @@ Relative paths to the entrypoints of your code, e.g. `src/index.ts`.
1193
1249
 
1194
1250
  - *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
1195
1251
 
1252
+ Props to change the behaviour of the bundler.
1253
+
1196
1254
  ---
1197
1255
 
1198
1256
 
@@ -1207,11 +1265,15 @@ public readonly entryPoints: string | string[] | {[ key: string ]: string};
1207
1265
 
1208
1266
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1209
1267
 
1210
- Relative paths to the entrypoints of your code, e.g. `src/index.ts`.
1268
+ A relative path or list or map of relative paths to the entry points of your code from the root of the project.
1269
+
1270
+ E.g. `src/index.ts`.
1211
1271
 
1212
1272
  ---
1213
1273
 
1214
- ##### `image`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.image"></a>
1274
+ ##### ~~`image`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.image"></a>
1275
+
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.
1215
1277
 
1216
1278
  ```typescript
1217
1279
  public readonly image: DockerImage;
@@ -1229,6 +1291,8 @@ public readonly local: ILocalBundling;
1229
1291
 
1230
1292
  - *Type:* [`@aws-cdk/core.ILocalBundling`](#@aws-cdk/core.ILocalBundling)
1231
1293
 
1294
+ Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
1295
+
1232
1296
  ---
1233
1297
 
1234
1298
  ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildBundler.property.props"></a>
@@ -1239,11 +1303,15 @@ public readonly props: BundlerProps;
1239
1303
 
1240
1304
  - *Type:* [`@mrgrain/cdk-esbuild.BundlerProps`](#@mrgrain/cdk-esbuild.BundlerProps)
1241
1305
 
1306
+ Props to change the behaviour of the bundler.
1307
+
1242
1308
  ---
1243
1309
 
1244
1310
 
1245
1311
  ### InlineJavaScriptCode <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode"></a>
1246
1312
 
1313
+ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
1314
+
1247
1315
  #### Initializers <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.Initializer"></a>
1248
1316
 
1249
1317
  ```typescript
@@ -1256,12 +1324,22 @@ new InlineJavaScriptCode(code: string, transformOptions?: TransformOptions)
1256
1324
 
1257
1325
  - *Type:* `string`
1258
1326
 
1327
+ The inline code to be transformed.
1328
+
1259
1329
  ---
1260
1330
 
1261
1331
  ##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode.parameter.transformOptions"></a>
1262
1332
 
1263
1333
  - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
1264
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
+
1265
1343
  ---
1266
1344
 
1267
1345
 
@@ -1270,6 +1348,8 @@ new InlineJavaScriptCode(code: string, transformOptions?: TransformOptions)
1270
1348
 
1271
1349
  ### InlineJsxCode <a name="@mrgrain/cdk-esbuild.InlineJsxCode"></a>
1272
1350
 
1351
+ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
1352
+
1273
1353
  #### Initializers <a name="@mrgrain/cdk-esbuild.InlineJsxCode.Initializer"></a>
1274
1354
 
1275
1355
  ```typescript
@@ -1282,12 +1362,22 @@ new InlineJsxCode(code: string, transformOptions?: TransformOptions)
1282
1362
 
1283
1363
  - *Type:* `string`
1284
1364
 
1365
+ The inline code to be transformed.
1366
+
1285
1367
  ---
1286
1368
 
1287
1369
  ##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineJsxCode.parameter.transformOptions"></a>
1288
1370
 
1289
1371
  - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
1290
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
+
1291
1381
  ---
1292
1382
 
1293
1383
 
@@ -1296,6 +1386,8 @@ new InlineJsxCode(code: string, transformOptions?: TransformOptions)
1296
1386
 
1297
1387
  ### InlineTsxCode <a name="@mrgrain/cdk-esbuild.InlineTsxCode"></a>
1298
1388
 
1389
+ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
1390
+
1299
1391
  #### Initializers <a name="@mrgrain/cdk-esbuild.InlineTsxCode.Initializer"></a>
1300
1392
 
1301
1393
  ```typescript
@@ -1308,12 +1400,22 @@ new InlineTsxCode(code: string, transformOptions?: TransformOptions)
1308
1400
 
1309
1401
  - *Type:* `string`
1310
1402
 
1403
+ The inline code to be transformed.
1404
+
1311
1405
  ---
1312
1406
 
1313
1407
  ##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTsxCode.parameter.transformOptions"></a>
1314
1408
 
1315
1409
  - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
1316
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
+
1317
1419
  ---
1318
1420
 
1319
1421
 
@@ -1322,6 +1424,8 @@ new InlineTsxCode(code: string, transformOptions?: TransformOptions)
1322
1424
 
1323
1425
  ### InlineTypeScriptCode <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode"></a>
1324
1426
 
1427
+ An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
1428
+
1325
1429
  #### Initializers <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.Initializer"></a>
1326
1430
 
1327
1431
  ```typescript
@@ -1334,12 +1438,22 @@ new InlineTypeScriptCode(code: string, transformOptions?: TransformOptions)
1334
1438
 
1335
1439
  - *Type:* `string`
1336
1440
 
1441
+ The inline code to be transformed.
1442
+
1337
1443
  ---
1338
1444
 
1339
1445
  ##### `transformOptions`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.InlineTypeScriptCode.parameter.transformOptions"></a>
1340
1446
 
1341
1447
  - *Type:* [`@mrgrain/cdk-esbuild.TransformOptions`](#@mrgrain/cdk-esbuild.TransformOptions)
1342
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
+
1343
1457
  ---
1344
1458
 
1345
1459
 
@@ -1348,6 +1462,10 @@ new InlineTypeScriptCode(code: string, transformOptions?: TransformOptions)
1348
1462
 
1349
1463
  ### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
1350
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
+
1351
1469
  #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
1352
1470
 
1353
1471
  ```typescript
@@ -1380,6 +1498,8 @@ new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
1380
1498
 
1381
1499
  ### JavaScriptCode <a name="@mrgrain/cdk-esbuild.JavaScriptCode"></a>
1382
1500
 
1501
+ Represents the deployed JavaScript Code.
1502
+
1383
1503
  #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptCode.Initializer"></a>
1384
1504
 
1385
1505
  ```typescript
@@ -1392,12 +1512,23 @@ new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
1392
1512
 
1393
1513
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1394
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
+
1395
1519
  ---
1396
1520
 
1397
1521
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.props"></a>
1398
1522
 
1399
1523
  - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptCodeProps`](#@mrgrain/cdk-esbuild.JavaScriptCodeProps)
1400
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
1531
+
1401
1532
  ---
1402
1533
 
1403
1534
  #### Methods <a name="Methods"></a>
@@ -1435,17 +1566,9 @@ public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
1435
1566
 
1436
1567
  #### Properties <a name="Properties"></a>
1437
1568
 
1438
- ##### `assetClass`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.assetClass"></a>
1569
+ ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.isInline"></a>
1439
1570
 
1440
- ```typescript
1441
- public readonly assetClass: JavaScriptAsset;
1442
- ```
1443
-
1444
- - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptAsset`](#@mrgrain/cdk-esbuild.JavaScriptAsset)
1445
-
1446
- ---
1447
-
1448
- ##### `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().
1449
1572
 
1450
1573
  ```typescript
1451
1574
  public readonly isInline: boolean;
@@ -1453,6 +1576,8 @@ public readonly isInline: boolean;
1453
1576
 
1454
1577
  - *Type:* `boolean`
1455
1578
 
1579
+ Determines whether this Code is inline code or not.
1580
+
1456
1581
  ---
1457
1582
 
1458
1583
 
@@ -1516,6 +1641,10 @@ public readonly assetClass: JavaScriptAsset;
1516
1641
 
1517
1642
  ### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
1518
1643
 
1644
+ Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
1645
+
1646
+ The asset can be used by other constructs.
1647
+
1519
1648
  #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
1520
1649
 
1521
1650
  ```typescript
@@ -1548,6 +1677,8 @@ new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
1548
1677
 
1549
1678
  ### TypeScriptCode <a name="@mrgrain/cdk-esbuild.TypeScriptCode"></a>
1550
1679
 
1680
+ Represents the deployed TypeScript Code.
1681
+
1551
1682
  #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptCode.Initializer"></a>
1552
1683
 
1553
1684
  ```typescript
@@ -1560,12 +1691,23 @@ new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
1560
1691
 
1561
1692
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1562
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
+
1563
1698
  ---
1564
1699
 
1565
1700
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.props"></a>
1566
1701
 
1567
1702
  - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptCodeProps`](#@mrgrain/cdk-esbuild.TypeScriptCodeProps)
1568
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
1710
+
1569
1711
  ---
1570
1712
 
1571
1713
  #### Methods <a name="Methods"></a>
@@ -1603,17 +1745,9 @@ public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
1603
1745
 
1604
1746
  #### Properties <a name="Properties"></a>
1605
1747
 
1606
- ##### `assetClass`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.assetClass"></a>
1607
-
1608
- ```typescript
1609
- public readonly assetClass: TypeScriptAsset;
1610
- ```
1611
-
1612
- - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptAsset`](#@mrgrain/cdk-esbuild.TypeScriptAsset)
1613
-
1614
- ---
1748
+ ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.isInline"></a>
1615
1749
 
1616
- ##### `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().
1617
1751
 
1618
1752
  ```typescript
1619
1753
  public readonly isInline: boolean;
@@ -1621,6 +1755,8 @@ public readonly isInline: boolean;
1621
1755
 
1622
1756
  - *Type:* `boolean`
1623
1757
 
1758
+ Determines whether this Code is inline code or not.
1759
+
1624
1760
  ---
1625
1761
 
1626
1762