@mrgrain/cdk-esbuild 3.5.0 → 3.7.2

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.
217
+
218
+ Relative paths are by default resolved from the current working directory.
219
+ To change the working directory, see `buildOptions.absWorkingDir`.
94
220
 
95
- E.g. `src/index.ts`.
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
 
@@ -310,7 +442,7 @@ public readonly globalName: string;
310
442
 
311
443
  - *Type:* `string`
312
444
 
313
- Documentation: https://esbuild.github.io/api/#globalName.
445
+ Documentation: https://esbuild.github.io/api/#global-name.
314
446
 
315
447
  ---
316
448
 
@@ -466,7 +598,7 @@ public readonly mainFields: string[];
466
598
 
467
599
  - *Type:* `string`[]
468
600
 
469
- Documentation: https://esbuild.github.io/api/#mainFields.
601
+ Documentation: https://esbuild.github.io/api/#main-fields.
470
602
 
471
603
  ---
472
604
 
@@ -746,6 +878,18 @@ Documentation: https://esbuild.github.io/api/#splitting.
746
878
 
747
879
  ---
748
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
+
749
893
  ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.BuildOptions.property.target"></a>
750
894
 
751
895
  ```typescript
@@ -873,8 +1017,24 @@ Instead use only relative paths and avoid `..`.
873
1017
 
874
1018
  ---
875
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
+
876
1034
  ### CodeConfig <a name="@mrgrain/cdk-esbuild.CodeConfig"></a>
877
1035
 
1036
+ Result of binding `Code` into a `Function`.
1037
+
878
1038
  #### Initializer <a name="[object Object].Initializer"></a>
879
1039
 
880
1040
  ```typescript
@@ -883,15 +1043,42 @@ import { CodeConfig } from '@mrgrain/cdk-esbuild'
883
1043
  const codeConfig: CodeConfig = { ... }
884
1044
  ```
885
1045
 
886
- ##### `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>
887
1073
 
888
1074
  ```typescript
889
1075
  public readonly s3Location: Location;
890
1076
  ```
891
1077
 
892
1078
  - *Type:* [`aws-cdk-lib.aws_s3.Location`](#aws-cdk-lib.aws_s3.Location)
1079
+ - *Default:* code is not an s3 location
893
1080
 
894
- The location of the code in S3.
1081
+ The location of the code in S3 (mutually exclusive with `inlineCode` and `image`).
895
1082
 
896
1083
  ---
897
1084
 
@@ -974,6 +1161,20 @@ Instead use only relative paths and avoid `..`.
974
1161
 
975
1162
  ---
976
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
+
977
1178
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCodeProps.property.assetHash"></a>
978
1179
 
979
1180
  ```typescript
@@ -1069,6 +1270,20 @@ Instead use only relative paths and avoid `..`.
1069
1270
 
1070
1271
  ---
1071
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
+
1072
1287
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSourceProps.property.assetHash"></a>
1073
1288
 
1074
1289
  ```typescript
@@ -1225,7 +1440,7 @@ public readonly globalName: string;
1225
1440
 
1226
1441
  - *Type:* `string`
1227
1442
 
1228
- Documentation: https://esbuild.github.io/api/#globalName.
1443
+ Documentation: https://esbuild.github.io/api/#global-name.
1229
1444
 
1230
1445
  ---
1231
1446
 
@@ -1501,6 +1716,18 @@ Documentation: https://esbuild.github.io/api/#sources-content.
1501
1716
 
1502
1717
  ---
1503
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
+
1504
1731
  ##### `target`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TransformOptions.property.target"></a>
1505
1732
 
1506
1733
  ```typescript
@@ -1614,6 +1841,20 @@ Instead use only relative paths and avoid `..`.
1614
1841
 
1615
1842
  ---
1616
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
+
1617
1858
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCodeProps.property.assetHash"></a>
1618
1859
 
1619
1860
  ```typescript
@@ -1709,6 +1950,20 @@ Instead use only relative paths and avoid `..`.
1709
1950
 
1710
1951
  ---
1711
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
+
1712
1967
  ##### `assetHash`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSourceProps.property.assetHash"></a>
1713
1968
 
1714
1969
  ```typescript
@@ -1745,9 +2000,18 @@ new EsbuildBundler(entryPoints: string | string[] | {[ key: string ]: string}, p
1745
2000
 
1746
2001
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1747
2002
 
1748
- 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.
2004
+
2005
+ Relative paths are by default resolved from the current working directory.
2006
+ To change the working directory, see `buildOptions.absWorkingDir`.
1749
2007
 
1750
- E.g. `src/index.ts`.
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'}`
1751
2015
 
1752
2016
  ---
1753
2017
 
@@ -1771,9 +2035,18 @@ public readonly entryPoints: string | string[] | {[ key: string ]: string};
1771
2035
 
1772
2036
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
1773
2037
 
1774
- 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`.
1775
2042
 
1776
- E.g. `src/index.ts`.
2043
+ Absolute paths can be used if files are part of the working directory.
2044
+
2045
+ Examples:
2046
+ - `'src/index.ts'`
2047
+ - `require.resolve('./lambda')`
2048
+ - `['src/index.ts', 'src/util.ts']`
2049
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
1777
2050
 
1778
2051
  ---
1779
2052
 
@@ -1814,6 +2087,125 @@ Props to change the behaviour of the bundler.
1814
2087
  ---
1815
2088
 
1816
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
+
1817
2209
  ### InlineJavaScriptCode <a name="@mrgrain/cdk-esbuild.InlineJavaScriptCode"></a>
1818
2210
 
1819
2211
  An implementation of `lambda.InlineCode` using the esbuild Transform API. Inline function code is limited to 4 KiB after transformation.
@@ -1970,42 +2362,6 @@ Default values for `transformOptions`:
1970
2362
 
1971
2363
 
1972
2364
 
1973
- ### JavaScriptAsset <a name="@mrgrain/cdk-esbuild.JavaScriptAsset"></a>
1974
-
1975
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
1976
-
1977
- The asset can be used by other constructs.
1978
-
1979
- #### Initializers <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.Initializer"></a>
1980
-
1981
- ```typescript
1982
- import { JavaScriptAsset } from '@mrgrain/cdk-esbuild'
1983
-
1984
- new JavaScriptAsset(scope: Construct, id: string, props: AssetProps)
1985
- ```
1986
-
1987
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.scope"></a>
1988
-
1989
- - *Type:* [`constructs.Construct`](#constructs.Construct)
1990
-
1991
- ---
1992
-
1993
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.id"></a>
1994
-
1995
- - *Type:* `string`
1996
-
1997
- ---
1998
-
1999
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptAsset.parameter.props"></a>
2000
-
2001
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
2002
-
2003
- ---
2004
-
2005
-
2006
-
2007
-
2008
-
2009
2365
  ### JavaScriptCode <a name="@mrgrain/cdk-esbuild.JavaScriptCode"></a>
2010
2366
 
2011
2367
  Represents the deployed JavaScript Code.
@@ -2022,9 +2378,18 @@ new JavaScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
2022
2378
 
2023
2379
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2024
2380
 
2025
- 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.
2026
2382
 
2027
- E.g. `src/index.ts`.
2383
+ Relative paths are by default resolved from the current working directory.
2384
+ To change the working directory, see `buildOptions.absWorkingDir`.
2385
+
2386
+ Absolute paths can be used if files are part of the working directory.
2387
+
2388
+ Examples:
2389
+ - `'src/index.ts'`
2390
+ - `require.resolve('./lambda')`
2391
+ - `['src/index.ts', 'src/util.ts']`
2392
+ - `{one: 'src/two.ts', two: 'src/one.ts'}`
2028
2393
 
2029
2394
  ---
2030
2395
 
@@ -2041,54 +2406,8 @@ Default values for `props.buildOptions`:
2041
2406
 
2042
2407
  ---
2043
2408
 
2044
- #### Methods <a name="Methods"></a>
2045
-
2046
- ##### `bind` <a name="@mrgrain/cdk-esbuild.JavaScriptCode.bind"></a>
2047
-
2048
- ```typescript
2049
- public bind(scope: Construct)
2050
- ```
2051
-
2052
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.scope"></a>
2053
-
2054
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2055
-
2056
- ---
2057
-
2058
- ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.JavaScriptCode.bindToResource"></a>
2059
-
2060
- ```typescript
2061
- public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2062
- ```
2063
-
2064
- ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.resource"></a>
2065
2409
 
2066
- - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2067
2410
 
2068
- ---
2069
-
2070
- ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.parameter.options"></a>
2071
-
2072
- - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2073
-
2074
- ---
2075
-
2076
-
2077
- #### Properties <a name="Properties"></a>
2078
-
2079
- ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptCode.property.isInline"></a>
2080
-
2081
- - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2082
-
2083
- ```typescript
2084
- public readonly isInline: boolean;
2085
- ```
2086
-
2087
- - *Type:* `boolean`
2088
-
2089
- Determines whether this Code is inline code or not.
2090
-
2091
- ---
2092
2411
 
2093
2412
 
2094
2413
  ### JavaScriptSource <a name="@mrgrain/cdk-esbuild.JavaScriptSource"></a>
@@ -2107,12 +2426,31 @@ new JavaScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
2107
2426
 
2108
2427
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2109
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
+
2110
2442
  ---
2111
2443
 
2112
2444
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.JavaScriptSource.parameter.props"></a>
2113
2445
 
2114
2446
  - *Type:* [`@mrgrain/cdk-esbuild.JavaScriptSourceProps`](#@mrgrain/cdk-esbuild.JavaScriptSourceProps)
2115
2447
 
2448
+ Props to change the behavior of the bundler.
2449
+
2450
+ Default values for `props.buildOptions`:
2451
+ - `bundle=true`
2452
+ - `platform=browser`
2453
+
2116
2454
  ---
2117
2455
 
2118
2456
  #### Methods <a name="Methods"></a>
@@ -2149,42 +2487,6 @@ public readonly assetClass: JavaScriptAsset;
2149
2487
  ---
2150
2488
 
2151
2489
 
2152
- ### TypeScriptAsset <a name="@mrgrain/cdk-esbuild.TypeScriptAsset"></a>
2153
-
2154
- Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
2155
-
2156
- The asset can be used by other constructs.
2157
-
2158
- #### Initializers <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.Initializer"></a>
2159
-
2160
- ```typescript
2161
- import { TypeScriptAsset } from '@mrgrain/cdk-esbuild'
2162
-
2163
- new TypeScriptAsset(scope: Construct, id: string, props: AssetProps)
2164
- ```
2165
-
2166
- ##### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.scope"></a>
2167
-
2168
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2169
-
2170
- ---
2171
-
2172
- ##### `id`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.id"></a>
2173
-
2174
- - *Type:* `string`
2175
-
2176
- ---
2177
-
2178
- ##### `props`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptAsset.parameter.props"></a>
2179
-
2180
- - *Type:* [`@mrgrain/cdk-esbuild.AssetProps`](#@mrgrain/cdk-esbuild.AssetProps)
2181
-
2182
- ---
2183
-
2184
-
2185
-
2186
-
2187
-
2188
2490
  ### TypeScriptCode <a name="@mrgrain/cdk-esbuild.TypeScriptCode"></a>
2189
2491
 
2190
2492
  Represents the deployed TypeScript Code.
@@ -2201,9 +2503,18 @@ new TypeScriptCode(entryPoints: string | string[] | {[ key: string ]: string}, p
2201
2503
 
2202
2504
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2203
2505
 
2204
- 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.
2507
+
2508
+ Relative paths are by default resolved from the current working directory.
2509
+ To change the working directory, see `buildOptions.absWorkingDir`.
2510
+
2511
+ Absolute paths can be used if files are part of the working directory.
2205
2512
 
2206
- E.g. `src/index.ts`.
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'}`
2207
2518
 
2208
2519
  ---
2209
2520
 
@@ -2220,54 +2531,8 @@ Default values for `props.buildOptions`:
2220
2531
 
2221
2532
  ---
2222
2533
 
2223
- #### Methods <a name="Methods"></a>
2224
2534
 
2225
- ##### `bind` <a name="@mrgrain/cdk-esbuild.TypeScriptCode.bind"></a>
2226
2535
 
2227
- ```typescript
2228
- public bind(scope: Construct)
2229
- ```
2230
-
2231
- ###### `scope`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.scope"></a>
2232
-
2233
- - *Type:* [`constructs.Construct`](#constructs.Construct)
2234
-
2235
- ---
2236
-
2237
- ##### `bindToResource` <a name="@mrgrain/cdk-esbuild.TypeScriptCode.bindToResource"></a>
2238
-
2239
- ```typescript
2240
- public bindToResource(resource: CfnResource, options?: ResourceBindOptions)
2241
- ```
2242
-
2243
- ###### `resource`<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.resource"></a>
2244
-
2245
- - *Type:* [`aws-cdk-lib.CfnResource`](#aws-cdk-lib.CfnResource)
2246
-
2247
- ---
2248
-
2249
- ###### `options`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.parameter.options"></a>
2250
-
2251
- - *Type:* [`aws-cdk-lib.aws_lambda.ResourceBindOptions`](#aws-cdk-lib.aws_lambda.ResourceBindOptions)
2252
-
2253
- ---
2254
-
2255
-
2256
- #### Properties <a name="Properties"></a>
2257
-
2258
- ##### ~~`isInline`~~<sup>Required</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptCode.property.isInline"></a>
2259
-
2260
- - *Deprecated:* this value is ignored since inline is now determined based on the the inlineCode field of CodeConfig returned from bind().
2261
-
2262
- ```typescript
2263
- public readonly isInline: boolean;
2264
- ```
2265
-
2266
- - *Type:* `boolean`
2267
-
2268
- Determines whether this Code is inline code or not.
2269
-
2270
- ---
2271
2536
 
2272
2537
 
2273
2538
  ### TypeScriptSource <a name="@mrgrain/cdk-esbuild.TypeScriptSource"></a>
@@ -2286,12 +2551,31 @@ new TypeScriptSource(entryPoints: string | string[] | {[ key: string ]: string},
2286
2551
 
2287
2552
  - *Type:* `string` | `string`[] | {[ key: string ]: `string`}
2288
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
+
2289
2567
  ---
2290
2568
 
2291
2569
  ##### `props`<sup>Optional</sup> <a name="@mrgrain/cdk-esbuild.TypeScriptSource.parameter.props"></a>
2292
2570
 
2293
2571
  - *Type:* [`@mrgrain/cdk-esbuild.TypeScriptSourceProps`](#@mrgrain/cdk-esbuild.TypeScriptSourceProps)
2294
2572
 
2573
+ Props to change the behavior of the bundler.
2574
+
2575
+ Default values for `props.buildOptions`:
2576
+ - `bundle=true`
2577
+ - `platform=browser`
2578
+
2295
2579
  ---
2296
2580
 
2297
2581
  #### Methods <a name="Methods"></a>