@mrgrain/cdk-esbuild 2.0.0-alpha.0 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +1 -1
- package/.jsii +560 -504
- package/{.projenrc.mjs → .projenrc.ts} +38 -31
- package/API.md +432 -698
- package/CHANGELOG.md +261 -0
- package/README.md +51 -172
- package/SECURITY.md +5 -5
- package/lib/asset.d.ts +29 -28
- package/lib/asset.js +23 -13
- package/lib/bundler.d.ts +92 -0
- package/lib/bundler.js +85 -0
- package/lib/code.d.ts +75 -28
- package/lib/code.js +61 -7
- package/lib/esbuild-types.js +2 -1
- package/lib/index.d.ts +5 -6
- package/lib/index.js +3 -5
- package/lib/inline-code.d.ts +88 -4
- package/lib/inline-code.js +93 -9
- package/lib/source.d.ts +18 -9
- package/lib/source.js +5 -3
- package/package.json +4 -1
- package/projenrc/TypeScriptSourceFile.ts +50 -0
- package/esbuild/Dockerfile +0 -13
- package/esbuild/esbuild-js +0 -22
- package/lib/bundlers.d.ts +0 -42
- package/lib/bundlers.js +0 -62
- package/lib/bundling.d.ts +0 -20
- package/lib/bundling.js +0 -30
- package/lib/esbuild-types-raw.d.ts +0 -304
- package/lib/esbuild-types-raw.js +0 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
|
|
2
|
+
## [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)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* synthesize esbuild types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
|
|
8
|
+
|
|
9
|
+
## [2.0.0-alpha.2](https://github.com/mrgrain/cdk-esbuild/compare/v1.128.0...v2.0.0-alpha.2) (2021-10-17)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### ⚠ BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* Alpha release of a jsii version of this package. Aim is
|
|
15
|
+
that migration will be minimal, however probably not avoidable.
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* jsii compatibility ([bdcba25](https://github.com/mrgrain/cdk-esbuild/commit/bdcba25981a3a32d36ba0054bfee5023b69b6497))
|
|
20
|
+
* jsii project with projen ([f0ff7cb](https://github.com/mrgrain/cdk-esbuild/commit/f0ff7cb07e73f4e7b936d218f8aad7a2d8aa21f4))
|
|
21
|
+
* more explict prop types ([680460a](https://github.com/mrgrain/cdk-esbuild/commit/680460a8ceabb5e45567784df8dca53ff974483c))
|
|
22
|
+
* reduce number of exported structs ([c6e0cde](https://github.com/mrgrain/cdk-esbuild/commit/c6e0cdea4a39e5909ab102e15b5c4ba5acd02d14))
|
|
23
|
+
|
|
24
|
+
## [1.128.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.127.0...v1.128.0) (2021-10-16)
|
|
25
|
+
|
|
26
|
+
- works with cdk-1.128.0
|
|
27
|
+
|
|
28
|
+
## [1.127.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0...v1.127.0) (2021-10-09)
|
|
29
|
+
|
|
30
|
+
- works with cdk-1.127.0
|
|
31
|
+
- **example/website:** How to monitor a website with Synthetics ([621d2d4](https://github.com/mrgrain/cdk-esbuild/commit/621d2d4192da63fa385b76b59353ffe77023c38d))
|
|
32
|
+
|
|
33
|
+
## [1.126.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0-beta.0...v1.126.0) (2021-10-09)
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
- works with cdk-1.126.0
|
|
38
|
+
- [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))
|
|
39
|
+
|
|
40
|
+
## [1.125.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.124.0...v1.125.0) (2021-10-01)
|
|
41
|
+
|
|
42
|
+
### ⚠ BREAKING CHANGES
|
|
43
|
+
|
|
44
|
+
- `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.
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
- works with cdk-1.125.0
|
|
49
|
+
|
|
50
|
+
- upgrade `esbuild` minimum version to ^0.13.0 ([3d0b5ee](https://github.com/mrgrain/cdk-esbuild/commit/3d0b5ee5c01b7edcf7042a728932a0e1ce722d3c))
|
|
51
|
+
|
|
52
|
+
## [1.124.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.123.0...v1.124.0) (2021-10-01)
|
|
53
|
+
|
|
54
|
+
- works with cdk-1.124.0
|
|
55
|
+
|
|
56
|
+
## [1.123.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.122.0...v1.123.0) (2021-09-22)
|
|
57
|
+
|
|
58
|
+
- works with cdk-1.123.0
|
|
59
|
+
|
|
60
|
+
## [1.122.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.121.0...v1.122.0) (2021-09-12)
|
|
61
|
+
|
|
62
|
+
- works with cdk-1.122.0
|
|
63
|
+
|
|
64
|
+
## [1.121.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.120.0...v1.121.0) (2021-09-12)
|
|
65
|
+
|
|
66
|
+
- works with cdk-1.121.0
|
|
67
|
+
|
|
68
|
+
## [1.120.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.119.0...v1.120.0) (2021-09-12)
|
|
69
|
+
|
|
70
|
+
- works with cdk-1.120.0
|
|
71
|
+
|
|
72
|
+
## [1.119.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.118.0...v1.119.0) (2021-09-12)
|
|
73
|
+
|
|
74
|
+
- works with cdk-1.119.0
|
|
75
|
+
|
|
76
|
+
## [1.118.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.117.0...v1.118.0) (2021-09-12)
|
|
77
|
+
|
|
78
|
+
- works with cdk-1.118.0
|
|
79
|
+
|
|
80
|
+
### Bug Fixes
|
|
81
|
+
|
|
82
|
+
- fix error handling type issue in latest tsc version ([b5e36e2](https://github.com/mrgrain/cdk-esbuild/commit/b5e36e27481706ea5a7ac5f8c05d74418b07c125))
|
|
83
|
+
|
|
84
|
+
## [1.117.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.116.0...v1.117.0) (2021-08-08)
|
|
85
|
+
|
|
86
|
+
- works with cdk-1.117.0
|
|
87
|
+
|
|
88
|
+
## [1.116.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.115.0...v1.116.0) (2021-08-08)
|
|
89
|
+
|
|
90
|
+
- works with cdk-1.116.0
|
|
91
|
+
|
|
92
|
+
## [1.115.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.114.0...v1.115.0) (2021-08-08)
|
|
93
|
+
|
|
94
|
+
- works with cdk-1.115.0
|
|
95
|
+
|
|
96
|
+
## [1.114.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.113.0...v1.114.0) (2021-08-08)
|
|
97
|
+
|
|
98
|
+
- works with cdk-1.114.0
|
|
99
|
+
|
|
100
|
+
## [1.113.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.112.0...v1.113.0) (2021-08-08)
|
|
101
|
+
|
|
102
|
+
- works with cdk-1.113.0
|
|
103
|
+
|
|
104
|
+
## [1.112.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.111.0...v1.112.0) (2021-08-08)
|
|
105
|
+
|
|
106
|
+
- works with cdk-1.112.0
|
|
107
|
+
|
|
108
|
+
## [1.111.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.110.0...v1.111.0) (2021-08-08)
|
|
109
|
+
|
|
110
|
+
- works with cdk-1.111.0
|
|
111
|
+
|
|
112
|
+
## [1.110.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.109.0...v1.110.0) (2021-06-24)
|
|
113
|
+
|
|
114
|
+
- works with cdk-1.110.0
|
|
115
|
+
|
|
116
|
+
## [1.109.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.108.0...v1.109.0) (2021-06-24)
|
|
117
|
+
|
|
118
|
+
- works with cdk-1.109.0
|
|
119
|
+
|
|
120
|
+
## [1.108.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.107.0...v1.108.0) (2021-06-09)
|
|
121
|
+
|
|
122
|
+
- works with cdk-1.108.0
|
|
123
|
+
|
|
124
|
+
## [1.107.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.106.0...v1.107.0) (2021-06-03)
|
|
125
|
+
|
|
126
|
+
- works with cdk-1.107.0
|
|
127
|
+
|
|
128
|
+
## [1.106.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.105.0...v1.106.0) (2021-05-31)
|
|
129
|
+
|
|
130
|
+
- works with cdk-1.106.0
|
|
131
|
+
|
|
132
|
+
## [1.105.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.104.0...v1.105.0) (2021-05-19)
|
|
133
|
+
|
|
134
|
+
- works with cdk-1.105.0
|
|
135
|
+
|
|
136
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
137
|
+
|
|
138
|
+
- 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)
|
|
139
|
+
|
|
140
|
+
## [1.104.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.103.0...v1.104.0) (2021-05-19)
|
|
141
|
+
|
|
142
|
+
- works with cdk-1.104.0 ([fb0de78](https://github.com/mrgrain/cdk-esbuild/commit/fb0de78faf29815045822b8e80b2bbb07b8f7cbf))
|
|
143
|
+
|
|
144
|
+
## [1.103.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.102.0...v1.103.0) (2021-05-13)
|
|
145
|
+
|
|
146
|
+
- works with cdk-1.103.0
|
|
147
|
+
|
|
148
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
149
|
+
|
|
150
|
+
- removed deprecated `forceDockerBundling` and `localBundling` ([cc40b90](https://github.com/mrgrain/cdk-esbuild/commit/cc40b900acd8cba725e31db0a79cd3f8b711277e))
|
|
151
|
+
|
|
152
|
+
## [1.102.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.101.0...v1.102.0) (2021-05-04)
|
|
153
|
+
|
|
154
|
+
- works with cdk-1.102.0 ([c616c1b](https://github.com/mrgrain/cdk-esbuild/commit/c616c1ba07a9bdd11f3dc3369b1335918458800f))
|
|
155
|
+
|
|
156
|
+
### Features
|
|
157
|
+
|
|
158
|
+
- new high-level constructs prop `bundlerPriority` to replace deprecated `forceDockerBundling` ([cc4c933](https://github.com/mrgrain/cdk-esbuild/commit/cc4c93376cf3a8628edd696fe9fa8f65a09c7e21))
|
|
159
|
+
- **examples/lambda:** added new complete example for lambda function ([f8ca3c0](https://github.com/mrgrain/cdk-esbuild/commit/f8ca3c093a11f1d56b9f08cd0a4f3b3eaecd5690))
|
|
160
|
+
|
|
161
|
+
### Bug Fixes
|
|
162
|
+
|
|
163
|
+
- **examples/website:** changed start command to work with latest esbuild versions ([45b4c91](https://github.com/mrgrain/cdk-esbuild/commit/45b4c91b454a9520e3aca4ff66ed75abc2ea7d4a))
|
|
164
|
+
|
|
165
|
+
## [1.101.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0...v1.101.0) (2021-05-01)
|
|
166
|
+
|
|
167
|
+
- works with cdk-1.101.0
|
|
168
|
+
|
|
169
|
+
### Features
|
|
170
|
+
|
|
171
|
+
- pretty print esbuild build errors and warnings when using local bundler ([7f15bed](https://github.com/mrgrain/cdk-esbuild/commit/7f15bedbdfb619c2d0767bc37458108e01c3a85e))
|
|
172
|
+
- pretty print esbuild transform errors and warnings ([1eeeb10](https://github.com/mrgrain/cdk-esbuild/commit/1eeeb10ca6b1e46452c55792d28429986eb4b09f))
|
|
173
|
+
- set bundling priority explicitly, deprecating `localBundling` in favour of `priority` ([425665a](https://github.com/mrgrain/cdk-esbuild/commit/425665a2f8f20bb557119e79e3354a4d9d696d24))
|
|
174
|
+
|
|
175
|
+
## [1.100.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0-beta.1...v1.100.0) (2021-05-01)
|
|
176
|
+
|
|
177
|
+
- no changes, cdk version constraints are now less strict
|
|
178
|
+
|
|
179
|
+
## [1.99.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.98.0...v1.99.0) (2021-04-19)
|
|
180
|
+
|
|
181
|
+
- update to cdk-1.99.0 ([cfffb19](https://github.com/mrgrain/cdk-esbuild/commit/cfffb1901f8567ea81de3e7f746d8cffd50b4bcc))
|
|
182
|
+
|
|
183
|
+
## [1.98.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.97.0...v1.98.0) (2021-04-13)
|
|
184
|
+
|
|
185
|
+
- update to cdk-1.98.0 ([0165256](https://github.com/mrgrain/cdk-esbuild/commit/0165256d26a2b24b45b17cb747f63eff26c983d1))
|
|
186
|
+
|
|
187
|
+
## [1.97.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.96.0...v1.97.0) (2021-04-11)
|
|
188
|
+
|
|
189
|
+
- update to cdk-1.97.0 ([fedb40a](https://github.com/mrgrain/cdk-esbuild/commit/fedb40a3098cd3b2de5b113d79a2edd185789fde))
|
|
190
|
+
|
|
191
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
192
|
+
|
|
193
|
+
- 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))
|
|
194
|
+
- 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))
|
|
195
|
+
|
|
196
|
+
### Features
|
|
197
|
+
|
|
198
|
+
- support object maps for entry points ([62a4431](https://github.com/mrgrain/cdk-esbuild/commit/62a4431572a4b32acd45c569405d19244b1aa76a))
|
|
199
|
+
|
|
200
|
+
## [1.96.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.95.0...v1.96.0) (2021-04-11)
|
|
201
|
+
|
|
202
|
+
- update to cdk-1.96.0 ([ae26510](https://github.com/mrgrain/cdk-esbuild/commit/ae2651026617646833303f0b9259d564765273d5))
|
|
203
|
+
|
|
204
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
205
|
+
|
|
206
|
+
- removed deprecated `projectRoot` prop, please use `buildOptions.absWorkingPath` instead ([40e7ab0](https://github.com/mrgrain/cdk-esbuild/commit/40e7ab0ccd6fa52727f548168cbbc05afcfe4b16))
|
|
207
|
+
|
|
208
|
+
## [1.95.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.1...v1.95.0) (2021-03-28)
|
|
209
|
+
|
|
210
|
+
- update to cdk-1.95.0 ([0a98ef3](https://github.com/mrgrain/cdk-esbuild/commit/0a98ef311d92e1366f535bf18d7a5f10ac6ad02a))
|
|
211
|
+
|
|
212
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
213
|
+
|
|
214
|
+
- 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))
|
|
215
|
+
|
|
216
|
+
### Features
|
|
217
|
+
|
|
218
|
+
- added various InlineCode constructs using the transform api ([6ef1c97](https://github.com/mrgrain/cdk-esbuild/commit/6ef1c9756f22256c008e1f9725ea3b5b5a176e3c))
|
|
219
|
+
- support added for `outfile` build option ([90ef5ec](https://github.com/mrgrain/cdk-esbuild/commit/90ef5ecb5906e0f2fc76a933b9f0067f1aae6428))
|
|
220
|
+
|
|
221
|
+
### [1.94.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.0...v1.94.1) (2021-03-17)
|
|
222
|
+
|
|
223
|
+
### Bug Fixes
|
|
224
|
+
|
|
225
|
+
- change cdk version constraints to work with patches ([fa0fa5f](https://github.com/mrgrain/cdk-esbuild/commit/fa0fa5fbdf608b14faf7a5e6132016fb6f2e393e))
|
|
226
|
+
|
|
227
|
+
## [1.94.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.1...v1.94.0) (2021-03-16)
|
|
228
|
+
|
|
229
|
+
- update to cdk-1.94.0 ([1623339](https://github.com/mrgrain/cdk-esbuild/commit/162333930a7534277c5ce4318f81df1fc954fe5e))
|
|
230
|
+
|
|
231
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
232
|
+
|
|
233
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
234
|
+
- deprecated ~~`projectRoot`~~ in favour of `buildOptions.absWorkDir` ([ef7ae23](https://github.com/mrgrain/cdk-esbuild/commit/ef7ae237827e381fa2708d67a2d68214a33ab41b)) \
|
|
235
|
+
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. \
|
|
236
|
+
**The automatic project root detection has been removed.**
|
|
237
|
+
- 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))
|
|
238
|
+
|
|
239
|
+
### Features
|
|
240
|
+
|
|
241
|
+
- set sensible defaults for website deployment ([a7a925d](https://github.com/mrgrain/cdk-esbuild/commit/a7a925da367d88184058719a56af55882e7c7aff))
|
|
242
|
+
- new `copyDir` prop to copy additional files into the output ([1dccb25](https://github.com/mrgrain/cdk-esbuild/commit/1dccb254c189500dc48371eeeeed0545c3116863))
|
|
243
|
+
- support for multiple `entryPoints` ([e41757b](https://github.com/mrgrain/cdk-esbuild/commit/e41757bb634d24d4c45ecf98ba981d28df258ce6))
|
|
244
|
+
- `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))
|
|
245
|
+
|
|
246
|
+
## [1.93.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.0...v1.93.1) (2021-03-12)
|
|
247
|
+
|
|
248
|
+
Required release to make version available on npm.
|
|
249
|
+
|
|
250
|
+
## [1.93.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.92.0...v1.93.0) (2021-03-12)
|
|
251
|
+
|
|
252
|
+
- update to cdk-1.93.0 ([2dd043b](https://github.com/mrgrain/cdk-esbuild/commit/2dd043b49b606dc6ebcf13c435a5665f5028fce5))
|
|
253
|
+
|
|
254
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
255
|
+
|
|
256
|
+
- `projectRoot` auto detection now searches upwards from the entry point, instead of current working directory
|
|
257
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
258
|
+
|
|
259
|
+
### Features
|
|
260
|
+
|
|
261
|
+
- added implementation of S3 deployment source which can be used for static website deployment ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
package/README.md
CHANGED
|
@@ -2,11 +2,8 @@
|
|
|
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) | [
|
|
6
|
-
|
|
7
|
-
## ⚠️ Alpha Version of `jsii` compatible package
|
|
8
|
-
|
|
9
|
-
Documentation has not yet been updated.
|
|
5
|
+
[Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |
|
|
6
|
+
[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)
|
|
10
7
|
|
|
11
8
|
## Why?
|
|
12
9
|
|
|
@@ -17,6 +14,12 @@ AWS CDK [supports _esbuild_ with Lambda Functions](https://docs.aws.amazon.com/c
|
|
|
17
14
|
|
|
18
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.
|
|
19
16
|
|
|
17
|
+
**⚠️ A note on stability**
|
|
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).
|
|
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_.
|
|
22
|
+
|
|
20
23
|
## Getting started
|
|
21
24
|
|
|
22
25
|
Install `cdk-esbuild`:
|
|
@@ -25,10 +28,10 @@ Install `cdk-esbuild`:
|
|
|
25
28
|
npm install @mrgrain/cdk-esbuild
|
|
26
29
|
```
|
|
27
30
|
|
|
28
|
-
|
|
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:
|
|
29
32
|
|
|
30
33
|
```
|
|
31
|
-
npm install @mrgrain/cdk-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 esbuild @aws-cdk/core @aws-cdk/aws-lambda @aws-cdk/aws-s3-assets @aws-cdk/aws-s3-deployment @aws-cdk/aws-synthetics
|
|
32
35
|
```
|
|
33
36
|
|
|
34
37
|
### AWS Lambda: Serverless function
|
|
@@ -78,9 +81,6 @@ new s3deploy.BucketDeployment(stack, "DeployWebsite", {
|
|
|
78
81
|
|
|
79
82
|
### Amazon CloudWatch Synthetics: Canary monitoring
|
|
80
83
|
|
|
81
|
-
> ⚠️ **Status: Experimental** \
|
|
82
|
-
> Expect the interface to change. Please report any issues!
|
|
83
|
-
|
|
84
84
|
> 💡 See [Monitored Website](examples/website) for a complete working example of a deployed and monitored website.
|
|
85
85
|
|
|
86
86
|
Synthetics runs a canary to produce traffic to an application for monitoring purposes. Use `TypeScriptCode` as the `code` of a Canary test:
|
|
@@ -121,198 +121,77 @@ For use with **S3 bucket deployments**, classes implementing `s3deploy.ISource`
|
|
|
121
121
|
|
|
122
122
|
- 🧺 `TypeScriptSource` & `JavaScriptSource`
|
|
123
123
|
|
|
124
|
-
> _Code and Source constructs seamlessly plugin to high-level CDK features. They share the same set of parameters, props and build options
|
|
124
|
+
> _Code and Source constructs seamlessly plugin to high-level CDK features. They share the same set of parameters, props and build options._
|
|
125
125
|
|
|
126
|
-
Underlying classes
|
|
126
|
+
Underlying classes power the other features. You normally won't have to use them, but they are there if you need them:
|
|
127
127
|
|
|
128
128
|
- `TypeScriptAsset` & `JavaScriptAsset` implements `s3.Asset` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-s3-assets.Asset.html)) \
|
|
129
129
|
creates an asset uploaded to S3 which can be referenced by other constructs
|
|
130
130
|
|
|
131
|
-
- `
|
|
132
|
-
provides a _esbuild_
|
|
133
|
-
|
|
134
|
-
## `TypeScriptCode`, `JavaScriptCode`
|
|
135
|
-
|
|
136
|
-
> ℹ️ _Although these classes are currently identical, please use the appropriate class as functionality might diverge in future releases._
|
|
137
|
-
|
|
138
|
-
**Default build options:**
|
|
139
|
-
|
|
140
|
-
- `bundle=true`
|
|
141
|
-
- `platform=node`
|
|
142
|
-
- `target=nodeX` with `X` being the major node version running the code
|
|
143
|
-
|
|
144
|
-
### Parameters
|
|
145
|
-
|
|
146
|
-
- `entryPoints: string | string[] | Record<string, string>` \
|
|
147
|
-
A single or list of relative paths to the entry points of your code from the root of the project.
|
|
148
|
-
|
|
149
|
-
### Props
|
|
150
|
-
|
|
151
|
-
- `props.buildOptions?` as per esbuild [(reference)](https://esbuild.github.io/getting-started/#build-scripts) \
|
|
152
|
-
**All build options are optional.** \
|
|
153
|
-
Same defaults and functionalities apply, with a few changes as noted below. Generally speaking usage of entry and output options are different, as these are inferred by CDK.
|
|
154
|
-
|
|
155
|
-
- ❌ `buildOptions.entryPoints` \
|
|
156
|
-
_Not available. Option is exposed as parameter._
|
|
157
|
-
|
|
158
|
-
- `buildOptions.outdir: string` \
|
|
159
|
-
The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
160
|
-
For example `{ outdir: 'js' }` will create an asset with a single directory called `js`, which contains all built files. This approach can be useful for static website deployments, where JavaScript code should be placed into a subdirectory. \
|
|
161
|
-
_Cannot be used together with `outfile`._
|
|
162
|
-
|
|
163
|
-
- `buildOptions.outfile: string` \
|
|
164
|
-
Relative path to a file inside the CDK asset output directory. \
|
|
165
|
-
For example `{ outfile: 'js/index.js' }` will create an asset with a single directory called `js`, which contains a single file `index.js`. This can be useful to rename the entry point.\
|
|
166
|
-
_Cannot be used with multiple `entryPoints` or together with `outdir`._
|
|
167
|
-
|
|
168
|
-
- `buildOptions.absWorkingDir: string` \
|
|
169
|
-
Absolute path to the [esbuild working directory](https://esbuild.github.io/api/#working-directory) and defaults to the [current working directory](https://en.wikipedia.org/wiki/Working_directory).\
|
|
170
|
-
Docker-based builds also use this path to mount local files into the container. A large `absWorkingDir` can slow down the Docker build. \
|
|
171
|
-
If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set `absWorkingDir` is to use a combination of `resolve` and `__dirname` (see "A note for library authors" below).
|
|
172
|
-
|
|
173
|
-
> **⚠️ A note for library authors**
|
|
174
|
-
>
|
|
175
|
-
> When developing a library consumed by other packages, you'll most likely have to set `absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the file, and traverse the tree upwards to the root of your library package (that's where `package.json` and `tsconfig.json` are):
|
|
176
|
-
>
|
|
177
|
-
> ```ts
|
|
178
|
-
> // file: project/src/index.ts
|
|
179
|
-
> const props = {
|
|
180
|
-
> buildOptions: {
|
|
181
|
-
> absWorkingDir: path.resolve(__dirname, ".."), // now: /user/project
|
|
182
|
-
> },
|
|
183
|
-
> };
|
|
184
|
-
> ```
|
|
185
|
-
>
|
|
186
|
-
> This will dynamically resolve to the correct path, wherever the package is installed.
|
|
187
|
-
|
|
188
|
-
- `props.copyDir?: string` \
|
|
189
|
-
**⚠️ Experimental** - _Likely to change once esbuild supports this natively_ \
|
|
190
|
-
Relative path to a directory copied to the output before the build is run (i.e esbuild will overwrite existing files).
|
|
191
|
-
|
|
192
|
-
- `props.bundlerPriority?: BundlerPriority (BundlerPriority.AttemptLocal)` \
|
|
193
|
-
Set the priority order of available bundlers. It can be useful to limit use to one of the bundlers. For Docker, the `absWorkingDir` path (or current working directory) will be mounted into the container as context. By default bundling with a locally installed binary is attempted first and Docker will only be used if the local bundling fails.
|
|
194
|
-
|
|
195
|
-
## `TypeScriptSource`, `JavaScriptSource`
|
|
196
|
-
|
|
197
|
-
> ℹ️ _Although these classes are currently identical, please use the appropriate class as functionality might diverge in future releases._
|
|
198
|
-
|
|
199
|
-
**Default build options:**
|
|
200
|
-
|
|
201
|
-
- `bundle=true`
|
|
202
|
-
- `platform=browser`
|
|
203
|
-
|
|
204
|
-
> 💡 See [Static Website with React](examples/website) for a complete working example of a how to deploy a React app to S3.
|
|
205
|
-
|
|
206
|
-
### Parameters & Props
|
|
131
|
+
- `EsbuildBundler` implements `core.BundlingOptions` ([reference](https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_core.BundlingOptions.html)) \
|
|
132
|
+
provides an interface for a _esbuild_ bundler wherever needed
|
|
207
133
|
|
|
208
|
-
|
|
134
|
+
## [API Reference](API.md)
|
|
209
135
|
|
|
210
|
-
|
|
136
|
+
Auto-generated reference for classes and structs. This information is also available within the code completion of your IDE.
|
|
211
137
|
|
|
212
|
-
|
|
138
|
+
## Migrating to v2
|
|
213
139
|
|
|
214
|
-
|
|
215
|
-
Inline function code is limited to 4 KiB _after_ transformation.
|
|
140
|
+
The main changes in cdk-esbuild v2 are:
|
|
216
141
|
|
|
217
|
-
|
|
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.
|
|
218
146
|
|
|
219
|
-
|
|
220
|
-
The inline code to be transformed.
|
|
147
|
+
### Upgrading
|
|
221
148
|
|
|
222
|
-
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
• `loader=ts|js|tsx|jsx` (one of `ts,js,tsx,jsx` depending on the used class)
|
|
227
|
-
|
|
228
|
-
## `TypeScriptAsset`, `JavaScriptAsset`
|
|
229
|
-
|
|
230
|
-
Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment. The asset can be used by other constructs.
|
|
231
|
-
|
|
232
|
-
> ℹ️ _The high-level constructs for `TypeScriptSource` and `TypeScriptCode` (and respective JavaScript classes) actually just use this asset._
|
|
233
|
-
|
|
234
|
-
**Default build options:**
|
|
235
|
-
|
|
236
|
-
- `bundle=true`
|
|
237
|
-
|
|
238
|
-
### Parameters
|
|
239
|
-
|
|
240
|
-
- `scope: cdk.Construct`
|
|
241
|
-
- `id: string`
|
|
242
|
-
- `props: TypeScriptAssetProps|JavaScriptAssetProps`
|
|
243
|
-
|
|
244
|
-
### Props
|
|
245
|
-
|
|
246
|
-
- `props.entryPoints: string | string[] | Record<string, string>` \
|
|
247
|
-
A single or list of relative paths to the entry points of your code from the root of the project.
|
|
248
|
-
|
|
249
|
-
- `props.copyDir?: string` \
|
|
250
|
-
**⚠️ Experimental** - _Likely to change once esbuild supports this natively_ \
|
|
251
|
-
Relative path to a directory copied to the output before the build is run (i.e esbuild will overwrite existing files).
|
|
252
|
-
|
|
253
|
-
- `props.bundlerPriority?: BundlerPriority (BundlerPriority.AttemptLocal)` \
|
|
254
|
-
Set the priority order of available bundlers. It can be useful to limit use to one of the bundlers. For Docker, the `absWorkingDir` path (or current working directory) will be mounted into the container as context. By default bundling with a locally installed binary is attempted first and Docker will only be used if the local bundling fails.
|
|
255
|
-
|
|
256
|
-
- `props.buildOptions?` as per esbuild [(reference)](https://esbuild.github.io/getting-started/#build-scripts) \
|
|
257
|
-
**All build options are optional.** \
|
|
258
|
-
➡️ See `TypeScriptCode` for detailed explanation on options.
|
|
259
|
-
|
|
260
|
-
## `EsbuildBundling`
|
|
261
|
-
|
|
262
|
-
**⚠️ Status: Unstable**
|
|
263
|
-
|
|
264
|
-
Low-level class that can be used where a `BundlingOptions` are required. This class provides the local und Docker-based bundling but doesn't come with any kind of safeguards.
|
|
265
|
-
|
|
266
|
-
### Parameters
|
|
267
|
-
|
|
268
|
-
- `buildOptions?` \
|
|
269
|
-
All esbuild options are available, with adapted functionality as described above.
|
|
270
|
-
|
|
271
|
-
- `props.priority?: BundlerPriority (BundlerPriority.AttemptLocal)` \
|
|
272
|
-
Priority order of available bundlers. Default `BundlerPriority.AttemptLocal` is to attempt using a locally installed binary first, retrying with Docker in case of failure. Can be set to only use either the local or Docker bundler.
|
|
273
|
-
|
|
274
|
-
- `props.copyDir?: string` \
|
|
275
|
-
Copy additional files to the output directory, before the build runs.
|
|
276
|
-
|
|
277
|
-
- `props.esbuildVersion?: string` \
|
|
278
|
-
_Docker build only._ A npm compatible version constraint. If not provided will attempt to read from a `package-lock.json` or `package.json` in the `absWorkingDir`. Otherwise uses the constraint provided by this package (usually `^0.x.0`).
|
|
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.
|
|
279
153
|
|
|
280
154
|
## Versioning
|
|
281
155
|
|
|
282
|
-
|
|
156
|
+
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`.
|
|
283
157
|
|
|
284
|
-
|
|
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.
|
|
285
159
|
|
|
286
|
-
|
|
160
|
+
### Npm Tags
|
|
287
161
|
|
|
288
|
-
|
|
162
|
+
Some users prefer to use tags over version ranges. The following stable tags are available for use:
|
|
289
163
|
|
|
290
|
-
|
|
164
|
+
- `cdk-v1`, `cdk-v2` are provided for the latest release compatible with each version of the AWS CDK.
|
|
291
165
|
|
|
292
|
-
|
|
166
|
+
- `latest` is the most recent stable release.
|
|
293
167
|
|
|
294
|
-
|
|
168
|
+
These tags also exist, but usage is strongly not recommended:
|
|
295
169
|
|
|
296
|
-
|
|
170
|
+
- `unstable`, `next` are used for pre-release of the current and next major version respectively.
|
|
297
171
|
|
|
298
|
-
|
|
172
|
+
- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.
|
|
299
173
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
**Most of the package will remain the same** and migration will be easy. However some interfaces need to be updated for `jsii` and deprecated features will be removed.
|
|
174
|
+
## Future releases
|
|
303
175
|
|
|
304
176
|
### AWS CDK v2
|
|
305
177
|
|
|
306
|
-
|
|
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.
|
|
307
179
|
|
|
308
|
-
|
|
180
|
+
### Stable esbuild
|
|
309
181
|
|
|
310
|
-
|
|
182
|
+
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.
|
|
311
183
|
|
|
312
|
-
|
|
184
|
+
## Library authors
|
|
313
185
|
|
|
314
|
-
|
|
186
|
+
When developing a library consumed by other packages, you'll most likely have to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the file, and traverse the tree upwards to the root of your library package (that's where `package.json` and `tsconfig.json` are):
|
|
315
187
|
|
|
316
|
-
|
|
188
|
+
```ts
|
|
189
|
+
// file: project/src/index.ts
|
|
190
|
+
const props = {
|
|
191
|
+
buildOptions: {
|
|
192
|
+
absWorkingDir: path.resolve(__dirname, ".."), // now: /user/project
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
```
|
|
317
196
|
|
|
318
|
-
|
|
197
|
+
This will dynamically resolve to the correct path, wherever the package is installed.
|
package/SECURITY.md
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported Versions
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
currently being supported with security updates.
|
|
5
|
+
Only the latest release of each major version is supported.
|
|
7
6
|
|
|
8
|
-
| Plugin Version | CDK Version | Supported
|
|
9
|
-
| -------------- | ----------- |
|
|
10
|
-
|
|
|
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: |
|
|
11
11
|
|
|
12
12
|
## Reporting a Vulnerability
|
|
13
13
|
|