@mrgrain/cdk-esbuild 3.4.0 → 3.7.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
@@ -1,5 +1,114 @@
1
1
  # API Reference <a name="API Reference"></a>
2
2
 
3
+ ## Constructs <a name="Constructs"></a>
4
+
5
+ ### EsbuildAsset <a name="@mrgrain/cdk-esbuild.EsbuildAsset"></a>
6
+
7
+ Represents a generic esbuild asset.
8
+
9
+ You should always use `TypeScriptAsset` or `JavaScriptAsset`.
10
+
11
+ #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildAsset.Initializer"></a>
12
+
13
+ ```typescript
14
+ import { EsbuildAsset } from '@mrgrain/cdk-esbuild'
15
+
16
+ new EsbuildAsset(scope: Construct, id: string, props: AssetProps)
17
+ ```
18
+
19
+ ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.scope"></a>
20
+
21
+ - *Type:* [`constructs.Construct`](#constructs.Construct)
22
+
23
+ ---
24
+
25
+ ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.id"></a>
26
+
27
+ - *Type:* `string`
28
+
29
+ ---
30
+
31
+ ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildAsset.parameter.props"></a>
32
+
33
+ - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
34
+
35
+ ---
36
+
37
+
38
+
39
+
40
+
41
+ ### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
42
+
43
+ Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
44
+
45
+ The asset can be used by other constructs.
46
+
47
+ #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
48
+
49
+ ```typescript
50
+ import { JavaScriptAsset } from '@mrgrain/cdk-esbuild'
51
+
52
+ new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
53
+ ```
54
+
55
+ ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.scope"></a>
56
+
57
+ - *Type:* [`constructs.Construct`](#constructs.Construct)
58
+
59
+ ---
60
+
61
+ ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.id"></a>
62
+
63
+ - *Type:* `string`
64
+
65
+ ---
66
+
67
+ ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.props"></a>
68
+
69
+ - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
70
+
71
+ ---
72
+
73
+
74
+
75
+
76
+
77
+ ### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
78
+
79
+ Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
80
+
81
+ The asset can be used by other constructs.
82
+
83
+ #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
84
+
85
+ ```typescript
86
+ import { TypeScriptAsset } from '@mrgrain/cdk-esbuild'
87
+
88
+ new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
89
+ ```
90
+
91
+ ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.scope"></a>
92
+
93
+ - *Type:* [`constructs.Construct`](#constructs.Construct)
94
+
95
+ ---
96
+
97
+ ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.id"></a>
98
+
99
+ - *Type:* `string`
100
+
101
+ ---
102
+
103
+ ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.props"></a>
104
+
105
+ - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
106
+
107
+ ---
108
+
109
+
110
+
111
+
3
112
 
4
113
  ## Structs <a name="Structs"></a>
5
114
 
@@ -82,6 +191,20 @@ Instead use only relative paths and avoid `..`.
82
191
 
83
192
  ---
84
193
 
194
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.esbuildBinaryPath"></a>
195
+
196
+ ```typescript
197
+ public readonly esbuildBinaryPath: string;
198
+ ```
199
+
200
+ - *Type:* `string`
201
+
202
+ Path to the binary used by esbuild.
203
+
204
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
205
+
206
+ ---
207
+
85
208
  ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.AssetProps.property.entryPoints"></a>
86
209
 
87
210
  ```typescript
@@ -90,9 +213,18 @@ public readonly entryPoints: string | string[] | {[ key: string ]: string};
90
213
 
91
214
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
92
215
 
93
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
216
+ A path or list or map of paths to the entry points of your code.
94
217
 
95
- E.g. `src/index.ts`.
218
+ Relative paths are by default resolved from the current working directory.
219
+ To change the working directory, see `buildOptions.absWorkingDir`.
220
+
221
+ Absolute paths can be used if files are part of the working directory.
222
+
223
+ Examples:
224
+ - `'src/index.ts'`
225
+ - `require.resolve('./lambda')`
226
+ - `['src/index.ts', 'src/util.ts']`
227
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
96
228
 
97
229
  ---
98
230
 
@@ -446,6 +578,18 @@ Documentation: https://esbuild.github.io/api/#log-limit.
446
578
 
447
579
  ---
448
580
 
581
+ ##### `logOverride`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.logOverride"></a>
582
+
583
+ ```typescript
584
+ public readonly logOverride: {[ key: string ]: string};
585
+ ```
586
+
587
+ - *Type:* {[ key: string ]: `string`}
588
+
589
+ Documentation: https://esbuild.github.io/api/#log-override.
590
+
591
+ ---
592
+
449
593
  ##### `mainFields`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.mainFields"></a>
450
594
 
451
595
  ```typescript
@@ -734,6 +878,18 @@ Documentation: https://esbuild.github.io/api/#splitting.
734
878
 
735
879
  ---
736
880
 
881
+ ##### `supported`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.supported"></a>
882
+
883
+ ```typescript
884
+ public readonly supported: {[ key: string ]: boolean};
885
+ ```
886
+
887
+ - *Type:* {[ key: string ]: `boolean`}
888
+
889
+ Documentation: https://esbuild.github.io/api/#supported.
890
+
891
+ ---
892
+
737
893
  ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.target"></a>
738
894
 
739
895
  ```typescript
@@ -861,8 +1017,24 @@ Instead use only relative paths and avoid `..`.
861
1017
 
862
1018
  ---
863
1019
 
1020
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BundlerProps.property.esbuildBinaryPath"></a>
1021
+
1022
+ ```typescript
1023
+ public readonly esbuildBinaryPath: string;
1024
+ ```
1025
+
1026
+ - *Type:* `string`
1027
+
1028
+ Path to the binary used by esbuild.
1029
+
1030
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1031
+
1032
+ ---
1033
+
864
1034
  ### CodeConfig <a name="@mrgrain/cdk-esbuild.CodeConfig"></a>
865
1035
 
1036
+ Result of binding `Code` into a `Function`.
1037
+
866
1038
  #### Initializer <a name="[object Object].Initializer"></a>
867
1039
 
868
1040
  ```typescript
@@ -871,15 +1043,42 @@ import { CodeConfig } from '@mrgrain/cdk-esbuild'
871
1043
  const codeConfig: CodeConfig = { ... }
872
1044
  ```
873
1045
 
874
- ##### `s3Location`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.s3Location"></a>
1046
+ ##### `image`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.image"></a>
1047
+
1048
+ ```typescript
1049
+ public readonly image: CodeImageConfig;
1050
+ ```
1051
+
1052
+ - *Type:* [`aws-cdk-lib.aws_lambda.CodeImageConfig`](#aws-cdk-lib.aws_lambda.CodeImageConfig)
1053
+ - *Default:* code is not an ECR container image
1054
+
1055
+ Docker image configuration (mutually exclusive with `s3Location` and `inlineCode`).
1056
+
1057
+ ---
1058
+
1059
+ ##### `inlineCode`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.inlineCode"></a>
1060
+
1061
+ ```typescript
1062
+ public readonly inlineCode: string;
1063
+ ```
1064
+
1065
+ - *Type:* `string`
1066
+ - *Default:* code is not inline code
1067
+
1068
+ Inline code (mutually exclusive with `s3Location` and `image`).
1069
+
1070
+ ---
1071
+
1072
+ ##### `s3Location`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.CodeConfig.property.s3Location"></a>
875
1073
 
876
1074
  ```typescript
877
1075
  public readonly s3Location: Location;
878
1076
  ```
879
1077
 
880
1078
  - *Type:* [`aws-cdk-lib.aws_s3.Location`](#aws-cdk-lib.aws_s3.Location)
1079
+ - *Default:* code is not an s3 location
881
1080
 
882
- The location of the code in S3.
1081
+ The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).
883
1082
 
884
1083
  ---
885
1084
 
@@ -962,6 +1161,20 @@ Instead use only relative paths and avoid `..`.
962
1161
 
963
1162
  ---
964
1163
 
1164
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.esbuildBinaryPath"></a>
1165
+
1166
+ ```typescript
1167
+ public readonly esbuildBinaryPath: string;
1168
+ ```
1169
+
1170
+ - *Type:* `string`
1171
+
1172
+ Path to the binary used by esbuild.
1173
+
1174
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1175
+
1176
+ ---
1177
+
965
1178
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.assetHash"></a>
966
1179
 
967
1180
  ```typescript
@@ -1057,6 +1270,20 @@ Instead use only relative paths and avoid `..`.
1057
1270
 
1058
1271
  ---
1059
1272
 
1273
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.esbuildBinaryPath"></a>
1274
+
1275
+ ```typescript
1276
+ public readonly esbuildBinaryPath: string;
1277
+ ```
1278
+
1279
+ - *Type:* `string`
1280
+
1281
+ Path to the binary used by esbuild.
1282
+
1283
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1284
+
1285
+ ---
1286
+
1060
1287
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.assetHash"></a>
1061
1288
 
1062
1289
  ```typescript
@@ -1323,6 +1550,18 @@ Documentation: https://esbuild.github.io/api/#log-limit.
1323
1550
 
1324
1551
  ---
1325
1552
 
1553
+ ##### `logOverride`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.logOverride"></a>
1554
+
1555
+ ```typescript
1556
+ public readonly logOverride: {[ key: string ]: string};
1557
+ ```
1558
+
1559
+ - *Type:* {[ key: string ]: `string`}
1560
+
1561
+ Documentation: https://esbuild.github.io/api/#log-override.
1562
+
1563
+ ---
1564
+
1326
1565
  ##### `mangleCache`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.mangleCache"></a>
1327
1566
 
1328
1567
  ```typescript
@@ -1477,6 +1716,18 @@ Documentation: https://esbuild.github.io/api/#sources-content.
1477
1716
 
1478
1717
  ---
1479
1718
 
1719
+ ##### `supported`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.supported"></a>
1720
+
1721
+ ```typescript
1722
+ public readonly supported: {[ key: string ]: boolean};
1723
+ ```
1724
+
1725
+ - *Type:* {[ key: string ]: `boolean`}
1726
+
1727
+ Documentation: https://esbuild.github.io/api/#supported.
1728
+
1729
+ ---
1730
+
1480
1731
  ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
1481
1732
 
1482
1733
  ```typescript
@@ -1590,6 +1841,20 @@ Instead use only relative paths and avoid `..`.
1590
1841
 
1591
1842
  ---
1592
1843
 
1844
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.esbuildBinaryPath"></a>
1845
+
1846
+ ```typescript
1847
+ public readonly esbuildBinaryPath: string;
1848
+ ```
1849
+
1850
+ - *Type:* `string`
1851
+
1852
+ Path to the binary used by esbuild.
1853
+
1854
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1855
+
1856
+ ---
1857
+
1593
1858
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.assetHash"></a>
1594
1859
 
1595
1860
  ```typescript
@@ -1685,6 +1950,20 @@ Instead use only relative paths and avoid `..`.
1685
1950
 
1686
1951
  ---
1687
1952
 
1953
+ ##### `esbuildBinaryPath`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.esbuildBinaryPath"></a>
1954
+
1955
+ ```typescript
1956
+ public readonly esbuildBinaryPath: string;
1957
+ ```
1958
+
1959
+ - *Type:* `string`
1960
+
1961
+ Path to the binary used by esbuild.
1962
+
1963
+ This is the same as setting the ESBUILD_BINARY_PATH environment variable.
1964
+
1965
+ ---
1966
+
1688
1967
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.assetHash"></a>
1689
1968
 
1690
1969
  ```typescript
@@ -1721,9 +2000,18 @@ new EsbuildBundler(entryPoints: string | string[] | {[ key: string ]: string}, p
1721
2000
 
1722
2001
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1723
2002
 
1724
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2003
+ A path or list or map of paths to the entry points of your code.
1725
2004
 
1726
- E.g. `src/index.ts`.
2005
+ Relative paths are by default resolved from the current working directory.
2006
+ To change the working directory, see `buildOptions.absWorkingDir`.
2007
+
2008
+ Absolute paths can be used if files are part of the working directory.
2009
+
2010
+ Examples:
2011
+ - `'src/index.ts'`
2012
+ - `require.resolve('./lambda')`
2013
+ - `['src/index.ts', 'src/util.ts']`
2014
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
1727
2015
 
1728
2016
  ---
1729
2017
 
@@ -1747,9 +2035,18 @@ public readonly entryPoints: string | string[] | {[ key: string ]: string};
1747
2035
 
1748
2036
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1749
2037
 
1750
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2038
+ A path or list or map of paths to the entry points of your code.
2039
+
2040
+ Relative paths are by default resolved from the current working directory.
2041
+ To change the working directory, see `buildOptions.absWorkingDir`.
2042
+
2043
+ Absolute paths can be used if files are part of the working directory.
1751
2044
 
1752
- E.g. `src/index.ts`.
2045
+ Examples:
2046
+ - `'src/index.ts'`
2047
+ - `require.resolve('./lambda')`
2048
+ - `['src/index.ts', 'src/util.ts']`
2049
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
1753
2050
 
1754
2051
  ---
1755
2052
 
@@ -1790,6 +2087,125 @@ Props to change the behaviour of the bundler.
1790
2087
  ---
1791
2088
 
1792
2089
 
2090
+ ### EsbuildCode <a name="@mrgrain/cdk-esbuild.EsbuildCode"></a>
2091
+
2092
+ Represents a generic esbuild code bundle.
2093
+
2094
+ You should always use `TypeScriptCode` or `JavaScriptCode`.
2095
+
2096
+ #### Initializers <a name="@mrgrain/cdk-esbuild.EsbuildCode.Initializer"></a>
2097
+
2098
+ ```typescript
2099
+ import { EsbuildCode } from '@mrgrain/cdk-esbuild'
2100
+
2101
+ new EsbuildCode(entryPoints: string | string[] | {[ key: string ]: string}, props: JavaScriptCodeProps | TypeScriptCodeProps)
2102
+ ```
2103
+
2104
+ ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.entryPoints"></a>
2105
+
2106
+ - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2107
+
2108
+ A path or list or map of paths to the entry points of your code.
2109
+
2110
+ Relative paths are by default resolved from the current working directory.
2111
+ To change the working directory, see `buildOptions.absWorkingDir`.
2112
+
2113
+ Absolute paths can be used if files are part of the working directory.
2114
+
2115
+ Examples:
2116
+ - `'src/index.ts'`
2117
+ - `require.resolve('./lambda')`
2118
+ - `['src/index.ts', 'src/util.ts']`
2119
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2120
+
2121
+ ---
2122
+
2123
+ ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.props"></a>
2124
+
2125
+ - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptCodeProps`](#@mrgrain/cdk-esbuild.JavaScriptCodeProps) | [`@mrgrain/cdk-esbuild.TypeScriptCodeProps`](#@mrgrain/cdk-esbuild.TypeScriptCodeProps)
2126
+
2127
+ Props to change the behavior of the bundler.
2128
+
2129
+ Default values for `props.buildOptions`:
2130
+ - `bundle=true`
2131
+ - `platform=node`
2132
+ - `target=nodeX` with X being the major node version running locally
2133
+
2134
+ ---
2135
+
2136
+ #### Methods <a name="Methods"></a>
2137
+
2138
+ ##### `bind` <a name="@mrgrain/cdk-esbuild.EsbuildCode.bind"></a>
2139
+
2140
+ ```typescript
2141
+ public bind(scope: Construct)
2142
+ ```
2143
+
2144
+ ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.scope"></a>
2145
+
2146
+ - *Type:* [`constructs.Construct`](#constructs.Construct)
2147
+
2148
+ ---
2149
+
2150
+ ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.EsbuildCode.bindToResource"></a>
2151
+
2152
+ ```typescript
2153
+ public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2154
+ ```
2155
+
2156
+ ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.resource"></a>
2157
+
2158
+ - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2159
+
2160
+ ---
2161
+
2162
+ ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.parameter.options"></a>
2163
+
2164
+ - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2165
+
2166
+ ---
2167
+
2168
+
2169
+ #### Properties <a name="Properties"></a>
2170
+
2171
+ ##### `entryPoints`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.property.entryPoints"></a>
2172
+
2173
+ ```typescript
2174
+ public readonly entryPoints: string | string[] | {[ key: string ]: string};
2175
+ ```
2176
+
2177
+ - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2178
+
2179
+ A path or list or map of paths to the entry points of your code.
2180
+
2181
+ Relative paths are by default resolved from the current working directory.
2182
+ To change the working directory, see `buildOptions.absWorkingDir`.
2183
+
2184
+ Absolute paths can be used if files are part of the working directory.
2185
+
2186
+ Examples:
2187
+ - `'src/index.ts'`
2188
+ - `require.resolve('./lambda')`
2189
+ - `['src/index.ts', 'src/util.ts']`
2190
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2191
+
2192
+ ---
2193
+
2194
+ ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.EsbuildCode.property.isInline"></a>
2195
+
2196
+ - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2197
+
2198
+ ```typescript
2199
+ public readonly isInline: boolean;
2200
+ ```
2201
+
2202
+ - *Type:* `boolean`
2203
+
2204
+ Determines whether this Code is inline code or not.
2205
+
2206
+ ---
2207
+
2208
+
1793
2209
  ### InlineJavaScriptCode <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode"></a>
1794
2210
 
1795
2211
  An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
@@ -1946,42 +2362,6 @@ Default values for `transformOptions`:
1946
2362
 
1947
2363
 
1948
2364
 
1949
- ### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
1950
-
1951
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
1952
-
1953
- The asset can be used by other constructs.
1954
-
1955
- #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
1956
-
1957
- ```typescript
1958
- import { JavaScriptAsset } from '@mrgrain/cdk-esbuild'
1959
-
1960
- new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
1961
- ```
1962
-
1963
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.scope"></a>
1964
-
1965
- - *Type:* [`constructs.Construct`](#constructs.Construct)
1966
-
1967
- ---
1968
-
1969
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.id"></a>
1970
-
1971
- - *Type:* `string`
1972
-
1973
- ---
1974
-
1975
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.props"></a>
1976
-
1977
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
1978
-
1979
- ---
1980
-
1981
-
1982
-
1983
-
1984
-
1985
2365
  ### JavaScriptCode <a name="@mrgrain/cdk-esbuild.JavaScriptCode"></a>
1986
2366
 
1987
2367
  Represents the deployed JavaScript Code.
@@ -1998,9 +2378,18 @@ new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
1998
2378
 
1999
2379
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2000
2380
 
2001
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2381
+ A path or list or map of paths to the entry points of your code.
2382
+
2383
+ Relative paths are by default resolved from the current working directory.
2384
+ To change the working directory, see `buildOptions.absWorkingDir`.
2385
+
2386
+ Absolute paths can be used if files are part of the working directory.
2002
2387
 
2003
- E.g. `src/index.ts`.
2388
+ Examples:
2389
+ - `'src/index.ts'`
2390
+ - `require.resolve('./lambda')`
2391
+ - `['src/index.ts', 'src/util.ts']`
2392
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2004
2393
 
2005
2394
  ---
2006
2395
 
@@ -2017,54 +2406,8 @@ Default values for `props.buildOptions`:
2017
2406
 
2018
2407
  ---
2019
2408
 
2020
- #### Methods <a name="Methods"></a>
2021
-
2022
- ##### `bind` <a name="@mrgrain/cdk-esbuild.JavaScriptCode.bind"></a>
2023
-
2024
- ```typescript
2025
- public bind(scope: Construct)
2026
- ```
2027
-
2028
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.scope"></a>
2029
-
2030
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2031
-
2032
- ---
2033
-
2034
- ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.JavaScriptCode.bindToResource"></a>
2035
-
2036
- ```typescript
2037
- public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2038
- ```
2039
-
2040
- ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.resource"></a>
2041
-
2042
- - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2043
-
2044
- ---
2045
-
2046
- ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.options"></a>
2047
-
2048
- - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2049
-
2050
- ---
2051
-
2052
-
2053
- #### Properties <a name="Properties"></a>
2054
-
2055
- ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.isInline"></a>
2056
-
2057
- - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2058
-
2059
- ```typescript
2060
- public readonly isInline: boolean;
2061
- ```
2062
-
2063
- - *Type:* `boolean`
2064
2409
 
2065
- Determines whether this Code is inline code or not.
2066
2410
 
2067
- ---
2068
2411
 
2069
2412
 
2070
2413
  ### JavaScriptSource <a name="@mrgrain/cdk-esbuild.JavaScriptSource"></a>
@@ -2083,12 +2426,31 @@ new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
2083
2426
 
2084
2427
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2085
2428
 
2429
+ A path or list or map of paths to the entry points of your code.
2430
+
2431
+ Relative paths are by default resolved from the current working directory.
2432
+ To change the working directory, see `buildOptions.absWorkingDir`.
2433
+
2434
+ Absolute paths can be used if files are part of the working directory.
2435
+
2436
+ Examples:
2437
+ - `'src/index.ts'`
2438
+ - `require.resolve('./lambda')`
2439
+ - `['src/index.ts', 'src/util.ts']`
2440
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2441
+
2086
2442
  ---
2087
2443
 
2088
2444
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.props"></a>
2089
2445
 
2090
2446
  - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptSourceProps`](#@mrgrain/cdk-esbuild.JavaScriptSourceProps)
2091
2447
 
2448
+ Props to change the behavior of the bundler.
2449
+
2450
+ Default values for `props.buildOptions`:
2451
+ - `bundle=true`
2452
+ - `platform=browser`
2453
+
2092
2454
  ---
2093
2455
 
2094
2456
  #### Methods <a name="Methods"></a>
@@ -2125,42 +2487,6 @@ public readonly assetClass: JavaScriptAsset;
2125
2487
  ---
2126
2488
 
2127
2489
 
2128
- ### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
2129
-
2130
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
2131
-
2132
- The asset can be used by other constructs.
2133
-
2134
- #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
2135
-
2136
- ```typescript
2137
- import { TypeScriptAsset } from '@mrgrain/cdk-esbuild'
2138
-
2139
- new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
2140
- ```
2141
-
2142
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.scope"></a>
2143
-
2144
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2145
-
2146
- ---
2147
-
2148
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.id"></a>
2149
-
2150
- - *Type:* `string`
2151
-
2152
- ---
2153
-
2154
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.props"></a>
2155
-
2156
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
2157
-
2158
- ---
2159
-
2160
-
2161
-
2162
-
2163
-
2164
2490
  ### TypeScriptCode <a name="@mrgrain/cdk-esbuild.TypeScriptCode"></a>
2165
2491
 
2166
2492
  Represents the deployed TypeScript Code.
@@ -2177,9 +2503,18 @@ new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
2177
2503
 
2178
2504
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2179
2505
 
2180
- A relative path or list or map of relative paths to the entry points of your code from the root of the project.
2506
+ A path or list or map of paths to the entry points of your code.
2181
2507
 
2182
- E.g. `src/index.ts`.
2508
+ Relative paths are by default resolved from the current working directory.
2509
+ To change the working directory, see `buildOptions.absWorkingDir`.
2510
+
2511
+ Absolute paths can be used if files are part of the working directory.
2512
+
2513
+ Examples:
2514
+ - `'src/index.ts'`
2515
+ - `require.resolve('./lambda')`
2516
+ - `['src/index.ts', 'src/util.ts']`
2517
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2183
2518
 
2184
2519
  ---
2185
2520
 
@@ -2196,54 +2531,8 @@ Default values for `props.buildOptions`:
2196
2531
 
2197
2532
  ---
2198
2533
 
2199
- #### Methods <a name="Methods"></a>
2200
-
2201
- ##### `bind` <a name="@mrgrain/cdk-esbuild.TypeScriptCode.bind"></a>
2202
-
2203
- ```typescript
2204
- public bind(scope: Construct)
2205
- ```
2206
-
2207
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.scope"></a>
2208
-
2209
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2210
-
2211
- ---
2212
-
2213
- ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.TypeScriptCode.bindToResource"></a>
2214
2534
 
2215
- ```typescript
2216
- public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2217
- ```
2218
2535
 
2219
- ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.resource"></a>
2220
-
2221
- - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2222
-
2223
- ---
2224
-
2225
- ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.options"></a>
2226
-
2227
- - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2228
-
2229
- ---
2230
-
2231
-
2232
- #### Properties <a name="Properties"></a>
2233
-
2234
- ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.isInline"></a>
2235
-
2236
- - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2237
-
2238
- ```typescript
2239
- public readonly isInline: boolean;
2240
- ```
2241
-
2242
- - *Type:* `boolean`
2243
-
2244
- Determines whether this Code is inline code or not.
2245
-
2246
- ---
2247
2536
 
2248
2537
 
2249
2538
  ### TypeScriptSource <a name="@mrgrain/cdk-esbuild.TypeScriptSource"></a>
@@ -2262,12 +2551,31 @@ new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
2262
2551
 
2263
2552
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2264
2553
 
2554
+ A path or list or map of paths to the entry points of your code.
2555
+
2556
+ Relative paths are by default resolved from the current working directory.
2557
+ To change the working directory, see `buildOptions.absWorkingDir`.
2558
+
2559
+ Absolute paths can be used if files are part of the working directory.
2560
+
2561
+ Examples:
2562
+ - `'src/index.ts'`
2563
+ - `require.resolve('./lambda')`
2564
+ - `['src/index.ts', 'src/util.ts']`
2565
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2566
+
2265
2567
  ---
2266
2568
 
2267
2569
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.props"></a>
2268
2570
 
2269
2571
  - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptSourceProps`](#@mrgrain/cdk-esbuild.TypeScriptSourceProps)
2270
2572
 
2573
+ Props to change the behavior of the bundler.
2574
+
2575
+ Default values for `props.buildOptions`:
2576
+ - `bundle=true`
2577
+ - `platform=browser`
2578
+
2271
2579
  ---
2272
2580
 
2273
2581
  #### Methods <a name="Methods"></a>