@mrgrain/cdk-esbuild 2.0.0-rc.1 → 3.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/CHANGELOG.md CHANGED
@@ -1,265 +1,38 @@
1
+ ## [2.2.0](https://github.com/mrgrain/cdk-esbuild/compare/v2.1.0...v2.2.0) (2021-12-04)
1
2
 
2
- ## [2.0.0-rc.0](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0-alpha.5...v2.0.0-rc.0) (2021-10-24)
3
-
4
- ## [2.0.0-alpha.5](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2021-10-23)
5
-
6
- ## [2.0.0-alpha.4](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0-alpha.2...v2.0.0-alpha.4) (2021-10-22)
7
-
3
+ **This release contains an upgrade of esbuild with backwards-incompatible changes.** This is inline with the versioning strategy for this package, which is to release esbuild upgrades with minor versions as long as esbuild has not reached version 1.0.0. The backwards-incompatible changes are fairly obscure this time around, but please make sure to read the [0.14.0 release notes](https://github.com/evanw/esbuild/releases/tag/v0.14.0).
8
4
 
9
5
  ### Features
10
6
 
11
- * synthesize esbuild types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
12
-
13
- ## [2.0.0-alpha.2](https://github.com/mrgrain/cdk-esbuild/compare/v1.128.0...v2.0.0-alpha.2) (2021-10-17)
14
-
15
-
16
- ### ⚠ BREAKING CHANGES
17
-
18
- * Alpha release of a jsii version of this package. Aim is
19
- that migration will be minimal, however probably not avoidable.
20
-
21
- ### Features
22
-
23
- * jsii compatibility ([bdcba25](https://github.com/mrgrain/cdk-esbuild/commit/bdcba25981a3a32d36ba0054bfee5023b69b6497))
24
- * jsii project with projen ([f0ff7cb](https://github.com/mrgrain/cdk-esbuild/commit/f0ff7cb07e73f4e7b936d218f8aad7a2d8aa21f4))
25
- * more explict prop types ([680460a](https://github.com/mrgrain/cdk-esbuild/commit/680460a8ceabb5e45567784df8dca53ff974483c))
26
- * reduce number of exported structs ([c6e0cde](https://github.com/mrgrain/cdk-esbuild/commit/c6e0cdea4a39e5909ab102e15b5c4ba5acd02d14))
27
-
28
- ## [1.128.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.127.0...v1.128.0) (2021-10-16)
29
-
30
- - works with cdk-1.128.0
31
-
32
- ## [1.127.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0...v1.127.0) (2021-10-09)
33
-
34
- - works with cdk-1.127.0
35
- - **example/website:** How to monitor a website with Synthetics ([621d2d4](https://github.com/mrgrain/cdk-esbuild/commit/621d2d4192da63fa385b76b59353ffe77023c38d))
7
+ - upgrade esbuild to [^0.14.0](https://github.com/evanw/esbuild/releases/tag/v0.14.0) ([#143](https://github.com/mrgrain/cdk-esbuild/issues/143)) ([4568b92](https://github.com/mrgrain/cdk-esbuild/commit/4568b92011a3e38f23d85998dcbbca1afa06918e))
8
+ - **examples/esbuild-with-plugins:** example of how to use the escape hatch to run esbuild with plugins ([#142](https://github.com/mrgrain/cdk-esbuild/issues/142)) ([0876f0e](https://github.com/mrgrain/cdk-esbuild/commit/0876f0e4d4bd65a792deef8adf43229568ab899b))
36
9
 
37
- ## [1.126.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0-beta.0...v1.126.0) (2021-10-09)
10
+ ## [2.1.0](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0...v2.1.0) (2021-11-25)
38
11
 
39
12
  ### Features
40
13
 
41
- - works with cdk-1.126.0
42
- - [Experimental] `Code` is now compatible with `@aws-cdk/aws-synthetics` ([#99](https://github.com/mrgrain/cdk-esbuild/issues/99)) ([f840300](https://github.com/mrgrain/cdk-esbuild/commit/f840300439f7175c46d173378d8e941b7dd80483))
14
+ - escape hatch to provide a custom build or transform function ([#141](https://github.com/mrgrain/cdk-esbuild/issues/141)) ([aacfac1](https://github.com/mrgrain/cdk-esbuild/commit/aacfac1b71f1de78fbfdc1161c6e8cf32fd0629e))
15
+ - `Inline*Code` now takes `TransformerProps` as second parameter, passing in `TransformOptions` is still supported but deprecated ([#141](https://github.com/mrgrain/cdk-esbuild/issues/141)) ([aacfac1](https://github.com/mrgrain/cdk-esbuild/commit/aacfac1b71f1de78fbfdc1161c6e8cf32fd0629e))
43
16
 
44
- ## [1.125.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.124.0...v1.125.0) (2021-10-01)
17
+ ## [2.0.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.129.0...v2.0.0) (2021-11-07)
45
18
 
46
19
  ### ⚠ BREAKING CHANGES
47
20
 
48
- - `esbuild` released a breaking change to the tree shaking options and introduced a new way how platform-specific binaries are installed. Please check the esbuild v0.13.0 [release notes](https://github.com/evanw/esbuild/releases/tag/v0.12.0) for details.
49
-
50
- ### Features
51
-
52
- - works with cdk-1.125.0
53
-
54
- - upgrade `esbuild` minimum version to ^0.13.0 ([3d0b5ee](https://github.com/mrgrain/cdk-esbuild/commit/3d0b5ee5c01b7edcf7042a728932a0e1ce722d3c))
55
-
56
- ## [1.124.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.123.0...v1.124.0) (2021-10-01)
57
-
58
- - works with cdk-1.124.0
59
-
60
- ## [1.123.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.122.0...v1.123.0) (2021-09-22)
61
-
62
- - works with cdk-1.123.0
63
-
64
- ## [1.122.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.121.0...v1.122.0) (2021-09-12)
65
-
66
- - works with cdk-1.122.0
67
-
68
- ## [1.121.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.120.0...v1.121.0) (2021-09-12)
69
-
70
- - works with cdk-1.121.0
71
-
72
- ## [1.120.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.119.0...v1.120.0) (2021-09-12)
73
-
74
- - works with cdk-1.120.0
75
-
76
- ## [1.119.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.118.0...v1.119.0) (2021-09-12)
77
-
78
- - works with cdk-1.119.0
79
-
80
- ## [1.118.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.117.0...v1.118.0) (2021-09-12)
81
-
82
- - works with cdk-1.118.0
83
-
84
- ### Bug Fixes
85
-
86
- - fix error handling type issue in latest tsc version ([b5e36e2](https://github.com/mrgrain/cdk-esbuild/commit/b5e36e27481706ea5a7ac5f8c05d74418b07c125))
87
-
88
- ## [1.117.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.116.0...v1.117.0) (2021-08-08)
89
-
90
- - works with cdk-1.117.0
91
-
92
- ## [1.116.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.115.0...v1.116.0) (2021-08-08)
93
-
94
- - works with cdk-1.116.0
95
-
96
- ## [1.115.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.114.0...v1.115.0) (2021-08-08)
97
-
98
- - works with cdk-1.115.0
99
-
100
- ## [1.114.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.113.0...v1.114.0) (2021-08-08)
101
-
102
- - works with cdk-1.114.0
103
-
104
- ## [1.113.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.112.0...v1.113.0) (2021-08-08)
105
-
106
- - works with cdk-1.113.0
107
-
108
- ## [1.112.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.111.0...v1.112.0) (2021-08-08)
109
-
110
- - works with cdk-1.112.0
111
-
112
- ## [1.111.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.110.0...v1.111.0) (2021-08-08)
113
-
114
- - works with cdk-1.111.0
115
-
116
- ## [1.110.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.109.0...v1.110.0) (2021-06-24)
117
-
118
- - works with cdk-1.110.0
119
-
120
- ## [1.109.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.108.0...v1.109.0) (2021-06-24)
121
-
122
- - works with cdk-1.109.0
123
-
124
- ## [1.108.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.107.0...v1.108.0) (2021-06-09)
125
-
126
- - works with cdk-1.108.0
127
-
128
- ## [1.107.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.106.0...v1.107.0) (2021-06-03)
129
-
130
- - works with cdk-1.107.0
131
-
132
- ## [1.106.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.105.0...v1.106.0) (2021-05-31)
21
+ - Major release of this package to make it JSII compatible (#114) ([727c78a](https://github.com/mrgrain/cdk-esbuild/commit/727c78aefa2079d0f561b8b664d75eb6c669e46b)), closes [#114](https://github.com/mrgrain/cdk-esbuild/issues/114) [#117](https://github.com/mrgrain/cdk-esbuild/issues/117) [#119](https://github.com/mrgrain/cdk-esbuild/issues/119) [#120](https://github.com/mrgrain/cdk-esbuild/issues/120) [#123](https://github.com/mrgrain/cdk-esbuild/issues/123)
133
22
 
134
- - works with cdk-1.106.0
23
+ - Deprecated features from v1 have been removed. Please see upgrading instructions below.
135
24
 
136
- ## [1.105.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.104.0...v1.105.0) (2021-05-19)
25
+ ### Upgrading to v2
137
26
 
138
- - works with cdk-1.105.0
139
-
140
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
141
-
142
- - upgraded esbuild to [v0.12.0](https://github.com/evanw/esbuild/releases/tag/v0.12.0) which contains backwards-incompatible changes (mostly related to CSS bundling)
143
-
144
- ## [1.104.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.103.0...v1.104.0) (2021-05-19)
145
-
146
- - works with cdk-1.104.0 ([fb0de78](https://github.com/mrgrain/cdk-esbuild/commit/fb0de78faf29815045822b8e80b2bbb07b8f7cbf))
147
-
148
- ## [1.103.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.102.0...v1.103.0) (2021-05-13)
149
-
150
- - works with cdk-1.103.0
151
-
152
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
153
-
154
- - removed deprecated `forceDockerBundling` and `localBundling` ([cc40b90](https://github.com/mrgrain/cdk-esbuild/commit/cc40b900acd8cba725e31db0a79cd3f8b711277e))
155
-
156
- ## [1.102.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.101.0...v1.102.0) (2021-05-04)
157
-
158
- - works with cdk-1.102.0 ([c616c1b](https://github.com/mrgrain/cdk-esbuild/commit/c616c1ba07a9bdd11f3dc3369b1335918458800f))
159
-
160
- ### Features
161
-
162
- - new high-level constructs prop `bundlerPriority` to replace deprecated `forceDockerBundling` ([cc4c933](https://github.com/mrgrain/cdk-esbuild/commit/cc4c93376cf3a8628edd696fe9fa8f65a09c7e21))
163
- - **examples/lambda:** added new complete example for lambda function ([f8ca3c0](https://github.com/mrgrain/cdk-esbuild/commit/f8ca3c093a11f1d56b9f08cd0a4f3b3eaecd5690))
164
-
165
- ### Bug Fixes
166
-
167
- - **examples/website:** changed start command to work with latest esbuild versions ([45b4c91](https://github.com/mrgrain/cdk-esbuild/commit/45b4c91b454a9520e3aca4ff66ed75abc2ea7d4a))
168
-
169
- ## [1.101.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0...v1.101.0) (2021-05-01)
170
-
171
- - works with cdk-1.101.0
172
-
173
- ### Features
174
-
175
- - pretty print esbuild build errors and warnings when using local bundler ([7f15bed](https://github.com/mrgrain/cdk-esbuild/commit/7f15bedbdfb619c2d0767bc37458108e01c3a85e))
176
- - pretty print esbuild transform errors and warnings ([1eeeb10](https://github.com/mrgrain/cdk-esbuild/commit/1eeeb10ca6b1e46452c55792d28429986eb4b09f))
177
- - set bundling priority explicitly, deprecating `localBundling` in favour of `priority` ([425665a](https://github.com/mrgrain/cdk-esbuild/commit/425665a2f8f20bb557119e79e3354a4d9d696d24))
178
-
179
- ## [1.100.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0-beta.1...v1.100.0) (2021-05-01)
180
-
181
- - no changes, cdk version constraints are now less strict
182
-
183
- ## [1.99.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.98.0...v1.99.0) (2021-04-19)
184
-
185
- - update to cdk-1.99.0 ([cfffb19](https://github.com/mrgrain/cdk-esbuild/commit/cfffb1901f8567ea81de3e7f746d8cffd50b4bcc))
186
-
187
- ## [1.98.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.97.0...v1.98.0) (2021-04-13)
188
-
189
- - update to cdk-1.98.0 ([0165256](https://github.com/mrgrain/cdk-esbuild/commit/0165256d26a2b24b45b17cb747f63eff26c983d1))
190
-
191
- ## [1.97.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.96.0...v1.97.0) (2021-04-11)
192
-
193
- - update to cdk-1.97.0 ([fedb40a](https://github.com/mrgrain/cdk-esbuild/commit/fedb40a3098cd3b2de5b113d79a2edd185789fde))
194
-
195
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
196
-
197
- - esbuild minimum version updated to `^0.11.0` which includes [breaking changes re how some files are interpreted](https://github.com/evanw/esbuild/releases/tag/v0.10.0) as well as [updated behaviour for entry points](https://github.com/evanw/esbuild/releases/tag/v0.11.0); please check esbuild's change log ([35c9046](https://github.com/mrgrain/cdk-esbuild/commit/35c904666415797eb5e5f09add47edfe2979303e))
198
- - use esbuild's handling of `process.env.NODE_ENV`, notably the value will now be set to `development` unless [minification](https://esbuild.github.io/api/#minify) is enabled ([04bc5ed](https://github.com/mrgrain/cdk-esbuild/commit/04bc5edb1eb40b42499ffb9dfd78dac28fea7602))
27
+ - Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`
28
+ - `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.
29
+ - Remove any use of `bundlerPriority`.
30
+ - Unstable construct `EsbuildBundling` has been renamed to `EsbuildBundler` and its interface has slightly changed. Like most other constructs, it now takes `entryPoints` as first parameter, with an optional `props` object as the second.
199
31
 
200
32
  ### Features
201
33
 
202
- - support object maps for entry points ([62a4431](https://github.com/mrgrain/cdk-esbuild/commit/62a4431572a4b32acd45c569405d19244b1aa76a))
203
-
204
- ## [1.96.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.95.0...v1.96.0) (2021-04-11)
205
-
206
- - update to cdk-1.96.0 ([ae26510](https://github.com/mrgrain/cdk-esbuild/commit/ae2651026617646833303f0b9259d564765273d5))
207
-
208
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
209
-
210
- - removed deprecated `projectRoot` prop, please use `buildOptions.absWorkingPath` instead ([40e7ab0](https://github.com/mrgrain/cdk-esbuild/commit/40e7ab0ccd6fa52727f548168cbbc05afcfe4b16))
211
-
212
- ## [1.95.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.1...v1.95.0) (2021-03-28)
213
-
214
- - update to cdk-1.95.0 ([0a98ef3](https://github.com/mrgrain/cdk-esbuild/commit/0a98ef311d92e1366f535bf18d7a5f10ac6ad02a))
215
-
216
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
217
-
218
- - exported `TypeScriptAsset` & `JavaScriptAsset` are now implementing `s3.Asset` and replace the previously deprecated aliases for code classes of the same name; replace any previous use with `TypeScriptCode` & `JavaScriptCode` for lambda functions ([9b86eab](https://github.com/mrgrain/cdk-esbuild/commit/9b86eab91f82e66088a25248d7a4c754dbe73d85))
219
-
220
- ### Features
221
-
222
- - added various InlineCode constructs using the transform api ([6ef1c97](https://github.com/mrgrain/cdk-esbuild/commit/6ef1c9756f22256c008e1f9725ea3b5b5a176e3c))
223
- - support added for `outfile` build option ([90ef5ec](https://github.com/mrgrain/cdk-esbuild/commit/90ef5ecb5906e0f2fc76a933b9f0067f1aae6428))
224
-
225
- ### [1.94.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.0...v1.94.1) (2021-03-17)
226
-
227
- ### Bug Fixes
228
-
229
- - change cdk version constraints to work with patches ([fa0fa5f](https://github.com/mrgrain/cdk-esbuild/commit/fa0fa5fbdf608b14faf7a5e6132016fb6f2e393e))
34
+ - JSII compatibility & v2 GA (#114) ([727c78a](https://github.com/mrgrain/cdk-esbuild/commit/727c78aefa2079d0f561b8b664d75eb6c669e46b)), closes [#114](https://github.com/mrgrain/cdk-esbuild/issues/114) [#117](https://github.com/mrgrain/cdk-esbuild/issues/117) [#119](https://github.com/mrgrain/cdk-esbuild/issues/119) [#120](https://github.com/mrgrain/cdk-esbuild/issues/120) [#123](https://github.com/mrgrain/cdk-esbuild/issues/123)
230
35
 
231
- ## [1.94.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.1...v1.94.0) (2021-03-16)
232
-
233
- - update to cdk-1.94.0 ([1623339](https://github.com/mrgrain/cdk-esbuild/commit/162333930a7534277c5ce4318f81df1fc954fe5e))
234
-
235
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
236
-
237
- - deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
238
- - deprecated ~~`projectRoot`~~ in favour of `buildOptions.absWorkDir` ([ef7ae23](https://github.com/mrgrain/cdk-esbuild/commit/ef7ae237827e381fa2708d67a2d68214a33ab41b)) \
239
- Now `absWorkDir` will take priority, then `projectRoot`. If neither are provided it falls back to the current working directory, which is esbuild's default behaviour. \
240
- **The automatic project root detection has been removed.**
241
- - upgraded esbuild dependency requirement to `^0.9.0` which [contains breaking changes](https://github.com/evanw/esbuild/releases/tag/v0.9.0) ([f27d987](https://github.com/mrgrain/cdk-esbuild/commit/f27d987183034d4fbf88905769d8cd7d3f93db4a))
242
-
243
- ### Features
244
-
245
- - set sensible defaults for website deployment ([a7a925d](https://github.com/mrgrain/cdk-esbuild/commit/a7a925da367d88184058719a56af55882e7c7aff))
246
- - new `copyDir` prop to copy additional files into the output ([1dccb25](https://github.com/mrgrain/cdk-esbuild/commit/1dccb254c189500dc48371eeeeed0545c3116863))
247
- - support for multiple `entryPoints` ([e41757b](https://github.com/mrgrain/cdk-esbuild/commit/e41757bb634d24d4c45ecf98ba981d28df258ce6))
248
- - `bundleOptions.outdir` can now be provided as an additional path prefix for rendered files in the auto-generated cdk output directory ([9be0f62](https://github.com/mrgrain/cdk-esbuild/commit/9be0f626460b5fd1c4bfa131a5f57124bbdb4129))
249
-
250
- ## [1.93.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.0...v1.93.1) (2021-03-12)
251
-
252
- Required release to make version available on npm.
253
-
254
- ## [1.93.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.92.0...v1.93.0) (2021-03-12)
255
-
256
- - update to cdk-1.93.0 ([2dd043b](https://github.com/mrgrain/cdk-esbuild/commit/2dd043b49b606dc6ebcf13c435a5665f5028fce5))
257
-
258
- ### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
259
-
260
- - `projectRoot` auto detection now searches upwards from the entry point, instead of current working directory
261
- - deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
262
-
263
- ### Features
36
+ - Synthesize `esbuild` types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
264
37
 
265
- - added implementation of S3 deployment source which can be used for static website deployment ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
38
+ - Generated docs now contain links to esbuild documentation ([#123](https://github.com/mrgrain/cdk-esbuild/issues/123)) ([95f2fd0](https://github.com/mrgrain/cdk-esbuild/commit/95f2fd07330cf9624dd05f23345bfe0f5754fc57))
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  _CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_
4
4
 
5
- [Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |
5
+ [Getting started](#getting-started) | [Migrating to v3](#migrating-to-v3) |
6
6
  [Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)
7
7
 
8
8
  ## Why?
@@ -14,24 +14,24 @@ AWS CDK [supports _esbuild_ with Lambda Functions](https://docs.aws.amazon.com/c
14
14
 
15
15
  This package is running _esbuild_ directly in Node.js and bypasses Docker which the AWS CDK implementation uses. The approach is quicker and easier to use for Node.js users, but incompatible with other languages.
16
16
 
17
- **⚠️ A note on stability**
17
+ **Production readiness**
18
18
 
19
- This package is generally stable and ready to be used in production as many do. However _esbuild_ is still on major version zero, which you should consider. Please check their guide on [production readiness](https://esbuild.github.io/faq/#production-readiness).
19
+ This package is generally stable and ready to be used in production, as many do. However _esbuild_ not yet released a version 1.0.0 yet and its API is still in active development. Please check their guide on [production readiness](https://esbuild.github.io/faq/#production-readiness).
20
20
 
21
- Notably upgrades of the _esbuild_ version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.
21
+ Notably upgrades of the _esbuild_ minimum version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.
22
22
 
23
23
  ## Getting started
24
24
 
25
25
  Install `cdk-esbuild`:
26
26
 
27
27
  ```
28
- npm install @mrgrain/cdk-esbuild
28
+ npm install @mrgrain/cdk-esbuild@^3.0.0
29
29
  ```
30
30
 
31
31
  If _peer_ and _optional dependencies_ are not installed automatically (e.g. when using npm v4-6), please use this command to install all of them:
32
32
 
33
33
  ```
34
- npm install @mrgrain/cdk-esbuild esbuild @aws-cdk/core @aws-cdk/aws-lambda @aws-cdk/aws-s3-assets @aws-cdk/aws-s3-deployment @aws-cdk/aws-synthetics
34
+ npm install @mrgrain/cdk-esbuild@^3.0.0 esbuild
35
35
  ```
36
36
 
37
37
  ### AWS Lambda: Serverless function
@@ -135,28 +135,82 @@ Underlying classes power the other features. You normally won't have to use them
135
135
 
136
136
  Auto-generated reference for classes and structs. This information is also available within the code completion of your IDE.
137
137
 
138
- ## Migrating to v2
138
+ ## Escape hatches
139
139
 
140
- The main changes in cdk-esbuild v2 are:
140
+ It's possible that you want to use a implementation of esbuild that's different to the default one. Common reasons are:
141
141
 
142
- - The package is now `jsii` compliant and published in the [Construct Hub](https://constructs.dev/). This will also enable a possible feature release for other languages.
143
- - Deprecated properties and classes have been removed, most notably the previous support for bundling via a Docker container. The implementation had a few issues that cannot be easily resolved. However more generic support for custom executables might arrive in later versions.
144
- - `esbuild` is now installed as an optional dependency. It's not optional at all, but this is a ramification of using `jsii`. In practice this will have no impact on most people.
145
- - Interfaces have been streamlined and the names and setup of internal types have been changed. In the unlikely case that someone was relying on these, upgrading will be straight forward.
142
+ - The current version constraints for esbuild are not suitable
143
+ - To use version of esbuild that is installed by any other means than `npm`, including Docker
144
+ - Plugin support is needed for the building
145
+
146
+ For these situations, this package offers an escape hatch to bypass regular the implementation and provide a custom build and transform function.
147
+
148
+ ### Custom build function
149
+
150
+ > 💡 See [Using esbuild with plugins](examples/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.
151
+
152
+ Constructs that result in starting a build, take a `buildFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `buildSync` function.
153
+
154
+ ```ts
155
+ new TypeScriptCode("fixtures/handlers/ts-handler.ts", {
156
+ buildFn: (options: BuildOptions): BuildResult => {
157
+ try {
158
+ // custom implementation returning BuildResult
159
+ } catch (error) {
160
+ // throw BuildFailure exception here
161
+ }
162
+ },
163
+ });
164
+ ```
165
+
166
+ Instead of esbuild, the provided function will be invoked with the calculated build options. The custom build function can amend, change or discard any of these. However integration with CDK relies heavily on the values `outdir`/`outfile` are set to and it's usually required to use them unchanged.
167
+
168
+ Failures have to cause a `BuildFailure` exception in order to be fully handled.
169
+
170
+ ### Custom transform function
171
+
172
+ Constructs that result in starting a transformation, take a `transformFn` as optional prop. While the defined type for this function is `any`, it must implement the same signature as esbuild's `transformSync` function.
173
+
174
+ ```ts
175
+ new InlineTypeScriptCode("let x: number = 1", {
176
+ transformFn: (options: TransformOptions): TransformResult => {
177
+ try {
178
+ // custom implementation returning TransformResult
179
+ } catch (error) {
180
+ // throw TransformFailure exception here
181
+ }
182
+ },,
183
+ });
184
+ ```
185
+
186
+ Instead of esbuild, the provided function will be invoked with the calculated transform options. The custom transform function can amend, change or discard any of these.
187
+
188
+ Failures have to cause a `TransformFailure` exception in order to be fully handled.
189
+
190
+ ## Migrating to v3
191
+
192
+ The release of cdk-esbuild v3 brings compatibility with AWS CDK v2. Furthermore all deprecated properties and classes have been removed. In particular `InlineCode` classes now take `TransformerProps` as second parameter instead of transform options.
146
193
 
147
194
  ### Upgrading
148
195
 
149
- - Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`
150
- - `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.
151
- - Remove any use of `bundlerPriority`.
152
- - Unstable construct `EsbuildBundling` has been renamed to `EsbuildBundler` and its interface has slightly changed. Like most other constructs, it now takes `entryPoints` as first parameter, with an optional `props` object as the second.
196
+ - This version requires AWS CDK v2. Follow the [official migration guide](https://docs.aws.amazon.com/cdk/latest/guide/work-with-cdk-v2.html) to upgrade.
197
+ - Update the package dependency to v3: `npm install --save @mrgrain/cdk-esbuild@^3.0.0`
198
+ - `esbuild` is installed as an optional dependency. If your setup does not automatically install optional dependencies, make sure to add it as an explicit dependency.
199
+ - Any use of `InlineCode` variations has to be updated. Previously the second parameter was either of type `TransformerProps` or `TransformOptions`. Now it must be `TransformerProps`.\
200
+ If the passed value is of type `TransformOptions`, turn it into the correct type like this:
201
+
202
+ ```ts
203
+ const oldOptions: TransformOptions = {...}
204
+
205
+ new InlineTypeScriptCode('// inline code', {
206
+ transformOptions: oldOptions
207
+ });
208
+ ```
153
209
 
154
210
  ## Versioning
155
211
 
156
212
  This package _mostly_ follows [Semantic Versioning](https://semver.org/), with the exception of upgrades to `esbuild`. These will be released as **minor versions** and often include breaking changes from `esbuild`.
157
213
 
158
- Although great care is taken to avoid this, all features marked as `@unstable` may change with minor versions. Please note that the unstable flag is applied to all new or experimental features and internal classes.
159
-
160
214
  ### Npm Tags
161
215
 
162
216
  Some users prefer to use tags over version ranges. The following stable tags are available for use:
@@ -173,10 +227,6 @@ These tags also exist, but usage is strongly not recommended:
173
227
 
174
228
  ## Future releases
175
229
 
176
- ### AWS CDK v2
177
-
178
- The monolithic version 2 of CDK (aka Mono-CDK) is on the horizon. A new major release of this package will be marked alongside CDK. Support for AWS CDK v1.x.x will be continued, however no new features will be added.
179
-
180
230
  ### Stable esbuild
181
231
 
182
232
  Once `esbuild` has reached a stable version 1.0, a new major version will be released for _all_ breaking changes, including updates to minimum (peer) dependencies.
package/SECURITY.md CHANGED
@@ -4,10 +4,11 @@
4
4
 
5
5
  Only the latest release of each major version is supported.
6
6
 
7
- | Plugin Version | CDK Version | Supported |
8
- | -------------- | ----------- | --------------------------- |
9
- | v1 | ^1.99.0 | until release of AWS CDK v2 |
10
- | v2 | ^1.99.0 | :white_check_mark: |
7
+ | Plugin Version | CDK Version | Supported |
8
+ | -------------- | ----------- | ---------------------------------------------------------- |
9
+ | v1 | ^1.99.0 | :x: |
10
+ | v2 | ^1.99.0 | Security updates and critical bug fixes until June 1, 2023 |
11
+ | v3 | ^2.00.0 | :white_check_mark: |
11
12
 
12
13
  ## Reporting a Vulnerability
13
14
 
@@ -15,4 +16,4 @@ Please raise an [issue](https://github.com/mrgrain/cdk-esbuild/issues) and add t
15
16
 
16
17
  I strive to respond to security issues within 48h. However this is an open source project with a single maintainer and life can get in the way.
17
18
 
18
- Contributions of secrurity fixes are most welcome!
19
+ Contributions of security fixes are most welcome!
package/lib/asset.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { Asset as S3Asset } from '@aws-cdk/aws-s3-assets';
2
- import { Construct } from '@aws-cdk/core';
1
+ import { Asset as S3Asset } from 'aws-cdk-lib/aws-s3-assets';
2
+ import { Construct } from 'constructs';
3
3
  import { BundlerProps, EntryPoints } from './bundler';
4
4
  /**
5
5
  * @internal
package/lib/asset.js CHANGED
@@ -4,8 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.TypeScriptAsset = exports.JavaScriptAsset = void 0;
5
5
  const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
6
6
  const path_1 = require("path");
7
- const aws_s3_assets_1 = require("@aws-cdk/aws-s3-assets");
8
- const core_1 = require("@aws-cdk/core");
7
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
8
+ const aws_s3_assets_1 = require("aws-cdk-lib/aws-s3-assets");
9
+ const constructs_1 = require("constructs");
9
10
  const bundler_1 = require("./bundler");
10
11
  /**
11
12
  * @stability stable
@@ -16,9 +17,9 @@ class Asset extends aws_s3_assets_1.Asset {
16
17
  */
17
18
  constructor(scope, id, props) {
18
19
  var _c;
19
- const { assetHash, copyDir, buildOptions: options = {}, } = props;
20
+ const { assetHash, copyDir, buildOptions: options = {}, buildFn, } = props;
20
21
  const entryPoints = typeof props.entryPoints === 'string' ? [props.entryPoints] : props.entryPoints;
21
- const name = scope.node.path + core_1.ConstructNode.PATH_SEP + id;
22
+ const name = scope.node.path + constructs_1.Node.PATH_SEP + id;
22
23
  Object.values(entryPoints).forEach((entryPoint) => {
23
24
  if (path_1.isAbsolute(entryPoint)) {
24
25
  throw new Error(`${name}: Entry points must be a relative path. If you need to define an absolute path, please use \`buildOptions.absWorkingDir\` accordingly.`);
@@ -33,10 +34,11 @@ class Asset extends aws_s3_assets_1.Asset {
33
34
  super(scope, id, {
34
35
  path: absWorkingDir,
35
36
  assetHash,
36
- assetHashType: assetHash ? core_1.AssetHashType.CUSTOM : core_1.AssetHashType.OUTPUT,
37
+ assetHashType: assetHash ? aws_cdk_lib_1.AssetHashType.CUSTOM : aws_cdk_lib_1.AssetHashType.OUTPUT,
37
38
  bundling: new bundler_1.EsbuildBundler(entryPoints, {
38
39
  buildOptions,
39
40
  copyDir,
41
+ buildFn,
40
42
  }),
41
43
  });
42
44
  }
@@ -52,7 +54,7 @@ class JavaScriptAsset extends Asset {
52
54
  }
53
55
  exports.JavaScriptAsset = JavaScriptAsset;
54
56
  _a = JSII_RTTI_SYMBOL_1;
55
- JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "2.0.0-rc.1" };
57
+ JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "3.0.0-rc.0" };
56
58
  /**
57
59
  * Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
58
60
  *
@@ -64,5 +66,5 @@ class TypeScriptAsset extends Asset {
64
66
  }
65
67
  exports.TypeScriptAsset = TypeScriptAsset;
66
68
  _b = JSII_RTTI_SYMBOL_1;
67
- TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "2.0.0-rc.1" };
68
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXNzZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwrQkFBa0M7QUFDbEMsMERBQTBEO0FBQzFELHdDQUF3RTtBQUN4RSx1Q0FBc0U7QUFrQnRFOztHQUVHO0FBQ0gsTUFBZSxLQUFnQyxTQUFRLHFCQUFPOzs7O0lBRTVELFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLEtBQVk7O1FBRVosTUFBTSxFQUNKLFNBQVMsRUFDVCxPQUFPLEVBQ1AsWUFBWSxFQUFFLE9BQU8sR0FBRyxFQUFFLEdBQzNCLEdBQUcsS0FBSyxDQUFDO1FBQ1YsTUFBTSxXQUFXLEdBQ2YsT0FBTyxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUMsQ0FBQyxDQUF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EUsMENBQW1FIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgaXNBYnNvbHV0ZSB9IGZyb20gJ3BhdGgnO1xuaW1wb3J0IHsgQXNzZXQgYXMgUzNBc3NldCB9IGZyb20gJ0Bhd3MtY2RrL2F3cy1zMy1hc3NldHMnO1xuaW1wb3J0IHsgQXNzZXRIYXNoVHlwZSwgQ29uc3RydWN0LCBDb25zdHJ1Y3ROb2RlIH0gZnJvbSAnQGF3cy1jZGsvY29yZSc7XG5pbXBvcnQgeyBFc2J1aWxkQnVuZGxlciwgQnVuZGxlclByb3BzLCBFbnRyeVBvaW50cyB9IGZyb20gJy4vYnVuZGxlcic7XG5cbi8qKlxuICogQGludGVybmFsXG4gKi9cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXRCYXNlUHJvcHMgZXh0ZW5kcyBCdW5kbGVyUHJvcHMge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICByZWFkb25seSBhc3NldEhhc2g/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXRQcm9wcyBleHRlbmRzIEFzc2V0QmFzZVByb3BzIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA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oXG4gICAgICAgICAgYCR7bmFtZX06IEVudHJ5IHBvaW50cyBtdXN0IGJlIGEgcmVsYXRpdmUgcGF0aC4gSWYgeW91IG5lZWQgdG8gZGVmaW5lIGFuIGFic29sdXRlIHBhdGgsIHBsZWFzZSB1c2UgXFxgYnVpbGRPcHRpb25zLmFic1dvcmtpbmdEaXJcXGAgYWNjb3JkaW5nbHkuYCxcbiAgICAgICAgKTtcbiAgICAgIH1cbiAgICB9KTtcblxuICAgIGNvbnN0IGFic1dvcmtpbmdEaXIgPSBvcHRpb25zLmFic1dvcmtpbmdEaXIgPz8gcHJvY2Vzcy5jd2QoKTtcblxuICAgIGNvbnN0IGJ1aWxkT3B0aW9ucyA9IHtcbiAgICAgIGJ1bmRsZTogdHJ1ZSxcbiAgICAgIC4uLm9wdGlvbnMsXG4gICAgICBhYnNXb3JraW5nRGlyLFxuICAgIH07XG5cbiAgICBzdXBlcihzY29wZSwgaWQsIHtcbiAgICAgIHBhdGg6IGFic1dvcmtpbmdEaXIsXG4gICAgICBhc3NldEhhc2gsXG4gICAgICBhc3NldEhhc2hUeXBlOiBhc3NldEhhc2ggPyBBc3NldEhhc2hUeXBlLkNVU1RPTSA6IEFzc2V0SGFzaFR5cGUuT1VUUFVULFxuICAgICAgYnVuZGxpbmc6IG5ldyBFc2J1aWxkQnVuZGxlcihcbiAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgIHtcbiAgICAgICAgICBidWlsZE9wdGlvbnMsXG4gICAgICAgICAgY29weURpcixcbiAgICAgICAgfSxcbiAgICAgICksXG4gICAgfSk7XG4gIH1cbn1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBKYXZhU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxKYXZhU2NyaXB0QXNzZXRQcm9wcz4ge31cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBUeXBlU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxUeXBlU2NyaXB0QXNzZXRQcm9wcz4ge31cbiJdfQ==
69
+ TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "3.0.0-rc.0" };
70
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXNzZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwrQkFBa0M7QUFDbEMsNkNBQTRDO0FBQzVDLDZEQUE2RDtBQUM3RCwyQ0FBNkM7QUFDN0MsdUNBQXNFO0FBa0J0RTs7R0FFRztBQUNILE1BQWUsS0FBZ0MsU0FBUSxxQkFBTzs7OztJQUU1RCxZQUNFLEtBQWdCLEVBQ2hCLEVBQVUsRUFDVixLQUFZOztRQUVaLE1BQU0sRUFDSixTQUFTLEVBQ1QsT0FBTyxFQUNQLFlBQVksRUFBRSxPQUFPLEdBQUcsRUFBRSxFQUMxQixPQUFPLEdBQ1IsR0FBRyxLQUFLLENBQUM7UUFDVixNQUFNLFdBQVcsR0FDZixPQUFPLEtBQUssQ0FBQyxXQUFXLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQyxDQ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UFtRTs7Ozs7Ozs7OztBQUduRSxNQUFhLGVBQWdCLFNBQVEsS0FBMkI7O0FBQWhFLDBDQUFtRSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGlzQWJzb2x1dGUgfSBmcm9tICdwYXRoJztcbmltcG9ydCB7IEFzc2V0SGFzaFR5cGUgfSBmcm9tICdhd3MtY2RrLWxpYic7XG5pbXBvcnQgeyBBc3NldCBhcyBTM0Fzc2V0IH0gZnJvbSAnYXdzLWNkay1saWIvYXdzLXMzLWFzc2V0cyc7XG5pbXBvcnQgeyBDb25zdHJ1Y3QsIE5vZGUgfSBmcm9tICdjb25zdHJ1Y3RzJztcbmltcG9ydCB7IEVzYnVpbGRCdW5kbGVyLCBCdW5kbGVyUHJvcHMsIEVudHJ5UG9pbnRzIH0gZnJvbSAnLi9idW5kbGVyJztcblxuLyoqXG4gKiBAaW50ZXJuYWxcbiAqL1xuZXhwb3J0IGludGVyZmFjZSBBc3NldEJhc2VQcm9wcyBleHRlbmRzIEJ1bmRsZXJQcm9wcyB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHJlYWRvbmx5IGFzc2V0SGFzaD86IHN0cmluZztcbn1cblxuZXhwb3J0IGludGVyZmFjZSBBc3NldFByb3BzIGV4dGVuZHMgQXNzZXRCYXNlUHJvcHMge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHJlYWRvbmx5IGVudHJ5UG9pbnRzOiBFbnRyeVBvaW50cztcbn1cblxudHlwZSBKYXZhU2NyaXB0QXNzZXRQcm9wcyA9IEFzc2V0UHJvcHM7XG50eXBlIFR5cGVTY3JpcHRBc3NldFByb3BzID0gQXNzZXRQcm9wcztcblxuLyoqXG4gKiBAc3RhYmlsaXR5IHN0YWJsZVxuICovXG5hYnN0cmFjdCBjbGFzcyBBc3NldDxQcm9wcyBleHRlbmRzIEFzc2V0UHJvcHM+IGV4dGVuZHMgUzNBc3NldCB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHB1YmxpYyBjb25zdHJ1Y3RvcihcbiAgICBzY29wZTogQ29uc3RydWN0LFxuICAgIGlkOiBzdHJpbmcsXG4gICAgcHJvcHM6IFByb3BzLFxuICApIHtcbiAgICBjb25zdCB7XG4gICAgICBhc3NldEhhc2gsXG4gICAgICBjb3B5RGlyLFxuICAgICAgYnVpbGRPcHRpb25zOiBvcHRpb25zID0ge30sXG4gICAgICBidWlsZEZuLFxuICAgIH0gPSBwcm9wcztcbiAgICBjb25zdCBlbnRyeVBvaW50czogc3RyaW5nW10gfCBSZWNvcmQ8c3RyaW5nLCBzdHJpbmc+ID1cbiAgICAgIHR5cGVvZiBwcm9wcy5lbnRyeVBvaW50cyA9PT0gJ3N0cmluZycgPyBbcHJvcHMuZW50cnlQb2ludHNdIDogcHJvcHMuZW50cnlQb2ludHM7XG5cbiAgICBjb25zdCBuYW1lID0gc2NvcGUubm9kZS5wYXRoICsgTm9kZS5QQVRIX1NFUCArIGlkO1xuXG4gICAgT2JqZWN0LnZhbHVlcyhlbnRyeVBvaW50cykuZm9yRWFjaCgoZW50cnlQb2ludDogc3RyaW5nKSA9PiB7XG4gICAgICBpZiAoaXNBYnNvbHV0ZShlbnRyeVBvaW50KSkge1xuICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICAgYCR7bmFtZX06IEVudHJ5IHBvaW50cyBtdXN0IGJlIGEgcmVsYXRpdmUgcGF0aC4gSWYgeW91IG5lZWQgdG8gZGVmaW5lIGFuIGFic29sdXRlIHBhdGgsIHBsZWFzZSB1c2UgXFxgYnVpbGRPcHRpb25zLmFic1dvcmtpbmdEaXJcXGAgYWNjb3JkaW5nbHkuYCxcbiAgICAgICAgKTtcbiAgICAgIH1cbiAgICB9KTtcblxuICAgIGNvbnN0IGFic1dvcmtpbmdEaXIgPSBvcHRpb25zLmFic1dvcmtpbmdEaXIgPz8gcHJvY2Vzcy5jd2QoKTtcblxuICAgIGNvbnN0IGJ1aWxkT3B0aW9ucyA9IHtcbiAgICAgIGJ1bmRsZTogdHJ1ZSxcbiAgICAgIC4uLm9wdGlvbnMsXG4gICAgICBhYnNXb3JraW5nRGlyLFxuICAgIH07XG5cbiAgICBzdXBlcihzY29wZSwgaWQsIHtcbiAgICAgIHBhdGg6IGFic1dvcmtpbmdEaXIsXG4gICAgICBhc3NldEhhc2gsXG4gICAgICBhc3NldEhhc2hUeXBlOiBhc3NldEhhc2ggPyBBc3NldEhhc2hUeXBlLkNVU1RPTSA6IEFzc2V0SGFzaFR5cGUuT1VUUFVULFxuICAgICAgYnVuZGxpbmc6IG5ldyBFc2J1aWxkQnVuZGxlcihcbiAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgIHtcbiAgICAgICAgICBidWlsZE9wdGlvbnMsXG4gICAgICAgICAgY29weURpcixcbiAgICAgICAgICBidWlsZEZuLFxuICAgICAgICB9LFxuICAgICAgKSxcbiAgICB9KTtcbiAgfVxufVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuZXhwb3J0IGNsYXNzIEphdmFTY3JpcHRBc3NldCBleHRlbmRzIEFzc2V0PEphdmFTY3JpcHRBc3NldFByb3BzPiB7fVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuZXhwb3J0IGNsYXNzIFR5cGVTY3JpcHRBc3NldCBleHRlbmRzIEFzc2V0PFR5cGVTY3JpcHRBc3NldFByb3BzPiB7fVxuIl19
package/lib/bundler.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DockerImage, ILocalBundling } from '@aws-cdk/core';
1
+ import { DockerImage, ILocalBundling } from 'aws-cdk-lib/core';
2
2
  import { BuildOptions } from './esbuild-types';
3
3
  /**
4
4
  * A relative path or list or map of relative paths to the entry points of your code from the root of the project. E.g. `src/index.ts`.
@@ -37,6 +37,19 @@ export interface BundlerProps {
37
37
  * @stability stable
38
38
  */
39
39
  readonly copyDir?: string;
40
+ /**
41
+ * (experimental) Escape hatch to provide the bundler with a custom build function.
42
+ *
43
+ * The function will receive the computed options from the bundler. It can use with these options as it wishes, however `outdir`/`outfile` must be respected to integrate with CDK.
44
+ * Must throw a `BuildFailure` on failure to correctly inform the bundler.
45
+ *
46
+ * @returns esbuild.BuildResult
47
+ * @default esbuild.buildSync
48
+ * @experimental
49
+ * @type esbuild.buildSync
50
+ * @throws esbuild.BuildFailure
51
+ */
52
+ readonly buildFn?: any;
40
53
  }
41
54
  /**
42
55
  * (experimental) Low-level construct that can be used where `BundlingOptions` are required.