@mrgrain/cdk-esbuild 3.3.0 → 4.0.0-alpha.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/.gitattributes +1 -1
- package/.jsii +137 -53
- package/.projenrc.ts +25 -24
- package/API.md +144 -42
- package/CHANGELOG.md +380 -0
- package/README.md +25 -23
- package/lib/asset.js +4 -5
- package/lib/bundler.d.ts +21 -5
- package/lib/bundler.js +46 -13
- package/lib/code.js +6 -7
- package/lib/esbuild-types.d.ts +11 -0
- package/lib/esbuild-types.js +1 -1
- package/lib/inline-code.js +4 -4
- package/lib/source.js +2 -2
- package/package.json +28 -20
- package/releasetag.txt +0 -1
- package/version.txt +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,387 @@
|
|
|
1
1
|
|
|
2
|
+
## [3.5.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.4.0...v3.5.0) (2022-06-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* support logOverride buildOption ([d1cad61](https://github.com/mrgrain/cdk-esbuild/commit/d1cad614a28f0e07b9646ff62dd47393f5616b99))
|
|
8
|
+
|
|
9
|
+
## [3.4.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.3.0...v3.4.0) (2022-05-26)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* copyDir supports more complex scenarios ([08c59fb](https://github.com/mrgrain/cdk-esbuild/commit/08c59fba7bf1ee68ca103520b3e0b7ea5359a925))
|
|
15
|
+
|
|
2
16
|
## [3.3.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.2.0...v3.3.0) (2022-03-06)
|
|
3
17
|
|
|
4
18
|
|
|
5
19
|
### Features
|
|
6
20
|
|
|
7
21
|
* support mangleQuoted option ([f4d8859](https://github.com/mrgrain/cdk-esbuild/commit/f4d88597c2f93064f7e3f6d4f591630eacfe7b80))
|
|
22
|
+
|
|
23
|
+
## [3.2.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.1.0...v3.2.0) (2022-02-04)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* support esbuild mangle-props ([a2566d1](https://github.com/mrgrain/cdk-esbuild/commit/a2566d1ebdb3ed8fabecdda31de413d64075f441))
|
|
29
|
+
|
|
30
|
+
## [3.1.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.0.0...v3.1.0) (2022-01-28)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* support new build option `drop` from esbuild ([54445ad](https://github.com/mrgrain/cdk-esbuild/commit/54445ad2490e7cba81e54a555a91ba86553ec67f))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
### Bug Fixes
|
|
39
|
+
|
|
40
|
+
* replace mocked with version from jest-mock ([2e9761d](https://github.com/mrgrain/cdk-esbuild/commit/2e9761d5f53293a6a840897e218c2e79a6b71c66))
|
|
41
|
+
* replace removed Node.js type ([e58b268](https://github.com/mrgrain/cdk-esbuild/commit/e58b2685c519cb9c4d7e1a148c4fc9f388d3ff90))
|
|
42
|
+
|
|
43
|
+
## [3.0.0](https://github.com/mrgrain/cdk-esbuild/compare/v3.0.0-rc.1...v3.0.0) (2021-12-09)
|
|
44
|
+
|
|
45
|
+
### Features
|
|
46
|
+
|
|
47
|
+
- upgrade to AWS CDK v2 ([c83b3e4](https://github.com/mrgrain/cdk-esbuild/commit/c83b3e47ad5d6d325a1ca1fa4e450bd92d7276d2))
|
|
48
|
+
|
|
49
|
+
### Bug Fixes
|
|
50
|
+
|
|
51
|
+
- remove imports from aws-cdk-lib/core ([68ee09a](https://github.com/mrgrain/cdk-esbuild/commit/68ee09ab7dbf9cf5d0e8e8ca9eda5ea24fedae69))
|
|
52
|
+
|
|
53
|
+
## [2.2.0](https://github.com/mrgrain/cdk-esbuild/compare/v2.1.0...v2.2.0) (2021-12-04)
|
|
54
|
+
|
|
55
|
+
**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).
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
- 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))
|
|
60
|
+
- **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))
|
|
61
|
+
|
|
62
|
+
## [2.1.0](https://github.com/mrgrain/cdk-esbuild/compare/v2.0.0...v2.1.0) (2021-11-25)
|
|
63
|
+
|
|
64
|
+
### Features
|
|
65
|
+
|
|
66
|
+
- 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))
|
|
67
|
+
- `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))
|
|
68
|
+
|
|
69
|
+
## [2.0.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.129.0...v2.0.0) (2021-11-07)
|
|
70
|
+
|
|
71
|
+
### ⚠ BREAKING CHANGES
|
|
72
|
+
|
|
73
|
+
- 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)
|
|
74
|
+
|
|
75
|
+
- Deprecated features from v1 have been removed. Please see upgrading instructions below.
|
|
76
|
+
|
|
77
|
+
### Upgrading to v2
|
|
78
|
+
|
|
79
|
+
- Update the package dependency to v2: `npm install --save @mrgrain/cdk-esbuild@^2.0.0`
|
|
80
|
+
- `esbuild` is now installed as an optional dependency. If your setup does not automatically install optional dependencies, add it as an explicit dependency.
|
|
81
|
+
- Remove any use of `bundlerPriority`.
|
|
82
|
+
- 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.
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
- 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)
|
|
87
|
+
|
|
88
|
+
- Synthesize `esbuild` types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
|
|
89
|
+
|
|
90
|
+
- 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))
|
|
91
|
+
|
|
92
|
+
## [1.133.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.132.0...v1.133.0) (2021-11-21)
|
|
93
|
+
|
|
94
|
+
- **This is a release on the legacy v1 branch. Please upgrade to v2 as soon as possible.**
|
|
95
|
+
- works with cdk-1.133.0
|
|
96
|
+
|
|
97
|
+
### ⛔ EXTREMELY IMPORTANT NOTICE FOR USERS WHO HAVE NOT UPGRADE TO v2 OF THIS PACKAGE
|
|
98
|
+
|
|
99
|
+
**tl;dr No more "versioned" release on this legacy branch.**
|
|
100
|
+
|
|
101
|
+
Until now, I have release a new version of this package every time a new CDK version was released. Even if no updates where necessary. This practice will stop with this release and I will only release a new version on the legacy v1 branch, if an update is required for compatibility. **Please upgrade to v2 of this package as soon as possible!**
|
|
102
|
+
|
|
103
|
+
[**Upgrading instructions to v2 of this package**](https://github.com/mrgrain/cdk-esbuild#migrating-to-v2)
|
|
104
|
+
|
|
105
|
+
If you're using the tag `cdk-v1`, you will already receive the latest stable v2 release. If you're using a versioned tag (e.g. `cdk-1.29.0`), this tag format is deprecated and release have not been tagged for a while now.
|
|
106
|
+
|
|
107
|
+
## [1.132.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.131.0...v1.132.0) (2021-11-21)
|
|
108
|
+
|
|
109
|
+
- works with cdk-1.132.0
|
|
110
|
+
|
|
111
|
+
### ⚠ IMPORTANT NOTICE
|
|
112
|
+
|
|
113
|
+
This is a release on the legacy v1 branch. Please upgrade to v2 as soon as possible.
|
|
114
|
+
|
|
115
|
+
If you're using the tag `cdk-v1`, you will already receive the latest stable v2 release. If you're using a versioned tag (e.g. `cdk-1.29.0`), this tag format is deprecated and future releases won't be tagged like this.
|
|
116
|
+
|
|
117
|
+
## [1.131.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.130.0...v1.131.0) (2021-11-07)
|
|
118
|
+
|
|
119
|
+
- works with cdk-1.131.0
|
|
120
|
+
|
|
121
|
+
### ⚠ IMPORTANT NOTICE
|
|
122
|
+
|
|
123
|
+
This is a release on the legacy v1 branch. Please upgrade to v2 as soon as possible.
|
|
124
|
+
|
|
125
|
+
If you're using the tag `cdk-v1`, you will already receive the latest stable v2 release. If you're using a versioned tag (e.g. `cdk-1.29.0`), this tag format is deprecated and future releases won't be tagged like this.
|
|
126
|
+
|
|
127
|
+
## [1.130.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.129.0...v1.130.0) (2021-11-07)
|
|
128
|
+
|
|
129
|
+
- works with cdk-1.130.0
|
|
130
|
+
|
|
131
|
+
### ⚠ IMPORTANT NOTICE
|
|
132
|
+
|
|
133
|
+
This is the first release on the legacy v1 branch. Please upgrade to v2 as soon as possible.
|
|
134
|
+
|
|
135
|
+
If you're using the tag `cdk-v1`, you will already receive the latest stable v2 release. If you're using a versioned tag (e.g. `cdk-1.29.0`), this tag format is deprecated and future releases won't be tagged like this.
|
|
136
|
+
|
|
137
|
+
## [1.129.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.128.0...v1.129.0) (2021-10-28)
|
|
138
|
+
|
|
139
|
+
### ⚠ IMPORTANT NOTICE
|
|
140
|
+
|
|
141
|
+
This will be the final release tagged with a specific version of AWS CDK (i.e. `cdk-1.29.0`). From now on, a single tag `cdk-v1` will point to the latest stable release for v1 of AWS CDK.
|
|
142
|
+
|
|
143
|
+
Please also note, that a new major version of this package already has a release candidate. Using the `cdk-v1` will result in BREAKING CHANGES once the new version is stable.
|
|
144
|
+
|
|
145
|
+
### Features
|
|
146
|
+
|
|
147
|
+
- works with cdk-1.129.0 ([d7631d4](https://github.com/mrgrain/cdk-esbuild/commit/d7631d4119e6ef66e0da02a35f9680196e94f124))
|
|
148
|
+
- deprecated Docker bundler ([6715463](https://github.com/mrgrain/cdk-esbuild/commit/6715463ee90f339ac261622597e39b2ee6c46d71))
|
|
149
|
+
|
|
150
|
+
## [1.128.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.127.0...v1.128.0) (2021-10-16)
|
|
151
|
+
|
|
152
|
+
- works with cdk-1.128.0
|
|
153
|
+
|
|
154
|
+
## [1.127.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0...v1.127.0) (2021-10-09)
|
|
155
|
+
|
|
156
|
+
- works with cdk-1.127.0
|
|
157
|
+
- **example/website:** How to monitor a website with Synthetics ([621d2d4](https://github.com/mrgrain/cdk-esbuild/commit/621d2d4192da63fa385b76b59353ffe77023c38d))
|
|
158
|
+
|
|
159
|
+
## [1.126.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0-beta.0...v1.126.0) (2021-10-09)
|
|
160
|
+
|
|
161
|
+
### Features
|
|
162
|
+
|
|
163
|
+
- works with cdk-1.126.0
|
|
164
|
+
- [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))
|
|
165
|
+
|
|
166
|
+
## [1.125.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.124.0...v1.125.0) (2021-10-01)
|
|
167
|
+
|
|
168
|
+
### ⚠ BREAKING CHANGES
|
|
169
|
+
|
|
170
|
+
- `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.
|
|
171
|
+
|
|
172
|
+
### Features
|
|
173
|
+
|
|
174
|
+
- works with cdk-1.125.0
|
|
175
|
+
|
|
176
|
+
- upgrade `esbuild` minimum version to ^0.13.0 ([3d0b5ee](https://github.com/mrgrain/cdk-esbuild/commit/3d0b5ee5c01b7edcf7042a728932a0e1ce722d3c))
|
|
177
|
+
|
|
178
|
+
## [1.124.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.123.0...v1.124.0) (2021-10-01)
|
|
179
|
+
|
|
180
|
+
- works with cdk-1.124.0
|
|
181
|
+
|
|
182
|
+
## [1.123.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.122.0...v1.123.0) (2021-09-22)
|
|
183
|
+
|
|
184
|
+
- works with cdk-1.123.0
|
|
185
|
+
|
|
186
|
+
## [1.122.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.121.0...v1.122.0) (2021-09-12)
|
|
187
|
+
|
|
188
|
+
- works with cdk-1.122.0
|
|
189
|
+
|
|
190
|
+
## [1.121.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.120.0...v1.121.0) (2021-09-12)
|
|
191
|
+
|
|
192
|
+
- works with cdk-1.121.0
|
|
193
|
+
|
|
194
|
+
## [1.120.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.119.0...v1.120.0) (2021-09-12)
|
|
195
|
+
|
|
196
|
+
- works with cdk-1.120.0
|
|
197
|
+
|
|
198
|
+
## [1.119.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.118.0...v1.119.0) (2021-09-12)
|
|
199
|
+
|
|
200
|
+
- works with cdk-1.119.0
|
|
201
|
+
|
|
202
|
+
## [1.118.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.117.0...v1.118.0) (2021-09-12)
|
|
203
|
+
|
|
204
|
+
- works with cdk-1.118.0
|
|
205
|
+
|
|
206
|
+
### Bug Fixes
|
|
207
|
+
|
|
208
|
+
- fix error handling type issue in latest tsc version ([b5e36e2](https://github.com/mrgrain/cdk-esbuild/commit/b5e36e27481706ea5a7ac5f8c05d74418b07c125))
|
|
209
|
+
|
|
210
|
+
## [1.117.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.116.0...v1.117.0) (2021-08-08)
|
|
211
|
+
|
|
212
|
+
- works with cdk-1.117.0
|
|
213
|
+
|
|
214
|
+
## [1.116.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.115.0...v1.116.0) (2021-08-08)
|
|
215
|
+
|
|
216
|
+
- works with cdk-1.116.0
|
|
217
|
+
|
|
218
|
+
## [1.115.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.114.0...v1.115.0) (2021-08-08)
|
|
219
|
+
|
|
220
|
+
- works with cdk-1.115.0
|
|
221
|
+
|
|
222
|
+
## [1.114.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.113.0...v1.114.0) (2021-08-08)
|
|
223
|
+
|
|
224
|
+
- works with cdk-1.114.0
|
|
225
|
+
|
|
226
|
+
## [1.113.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.112.0...v1.113.0) (2021-08-08)
|
|
227
|
+
|
|
228
|
+
- works with cdk-1.113.0
|
|
229
|
+
|
|
230
|
+
## [1.112.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.111.0...v1.112.0) (2021-08-08)
|
|
231
|
+
|
|
232
|
+
- works with cdk-1.112.0
|
|
233
|
+
|
|
234
|
+
## [1.111.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.110.0...v1.111.0) (2021-08-08)
|
|
235
|
+
|
|
236
|
+
- works with cdk-1.111.0
|
|
237
|
+
|
|
238
|
+
## [1.110.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.109.0...v1.110.0) (2021-06-24)
|
|
239
|
+
|
|
240
|
+
- works with cdk-1.110.0
|
|
241
|
+
|
|
242
|
+
## [1.109.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.108.0...v1.109.0) (2021-06-24)
|
|
243
|
+
|
|
244
|
+
- works with cdk-1.109.0
|
|
245
|
+
|
|
246
|
+
## [1.108.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.107.0...v1.108.0) (2021-06-09)
|
|
247
|
+
|
|
248
|
+
- works with cdk-1.108.0
|
|
249
|
+
|
|
250
|
+
## [1.107.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.106.0...v1.107.0) (2021-06-03)
|
|
251
|
+
|
|
252
|
+
- works with cdk-1.107.0
|
|
253
|
+
|
|
254
|
+
## [1.106.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.105.0...v1.106.0) (2021-05-31)
|
|
255
|
+
|
|
256
|
+
- works with cdk-1.106.0
|
|
257
|
+
|
|
258
|
+
## [1.105.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.104.0...v1.105.0) (2021-05-19)
|
|
259
|
+
|
|
260
|
+
- works with cdk-1.105.0
|
|
261
|
+
|
|
262
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
263
|
+
|
|
264
|
+
- 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)
|
|
265
|
+
|
|
266
|
+
## [1.104.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.103.0...v1.104.0) (2021-05-19)
|
|
267
|
+
|
|
268
|
+
- works with cdk-1.104.0 ([fb0de78](https://github.com/mrgrain/cdk-esbuild/commit/fb0de78faf29815045822b8e80b2bbb07b8f7cbf))
|
|
269
|
+
|
|
270
|
+
## [1.103.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.102.0...v1.103.0) (2021-05-13)
|
|
271
|
+
|
|
272
|
+
- works with cdk-1.103.0
|
|
273
|
+
|
|
274
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
275
|
+
|
|
276
|
+
- removed deprecated `forceDockerBundling` and `localBundling` ([cc40b90](https://github.com/mrgrain/cdk-esbuild/commit/cc40b900acd8cba725e31db0a79cd3f8b711277e))
|
|
277
|
+
|
|
278
|
+
## [1.102.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.101.0...v1.102.0) (2021-05-04)
|
|
279
|
+
|
|
280
|
+
- works with cdk-1.102.0 ([c616c1b](https://github.com/mrgrain/cdk-esbuild/commit/c616c1ba07a9bdd11f3dc3369b1335918458800f))
|
|
281
|
+
|
|
282
|
+
### Features
|
|
283
|
+
|
|
284
|
+
- new high-level constructs prop `bundlerPriority` to replace deprecated `forceDockerBundling` ([cc4c933](https://github.com/mrgrain/cdk-esbuild/commit/cc4c93376cf3a8628edd696fe9fa8f65a09c7e21))
|
|
285
|
+
- **examples/lambda:** added new complete example for lambda function ([f8ca3c0](https://github.com/mrgrain/cdk-esbuild/commit/f8ca3c093a11f1d56b9f08cd0a4f3b3eaecd5690))
|
|
286
|
+
|
|
287
|
+
### Bug Fixes
|
|
288
|
+
|
|
289
|
+
- **examples/website:** changed start command to work with latest esbuild versions ([45b4c91](https://github.com/mrgrain/cdk-esbuild/commit/45b4c91b454a9520e3aca4ff66ed75abc2ea7d4a))
|
|
290
|
+
|
|
291
|
+
## [1.101.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0...v1.101.0) (2021-05-01)
|
|
292
|
+
|
|
293
|
+
- works with cdk-1.101.0
|
|
294
|
+
|
|
295
|
+
### Features
|
|
296
|
+
|
|
297
|
+
- pretty print esbuild build errors and warnings when using local bundler ([7f15bed](https://github.com/mrgrain/cdk-esbuild/commit/7f15bedbdfb619c2d0767bc37458108e01c3a85e))
|
|
298
|
+
- pretty print esbuild transform errors and warnings ([1eeeb10](https://github.com/mrgrain/cdk-esbuild/commit/1eeeb10ca6b1e46452c55792d28429986eb4b09f))
|
|
299
|
+
- set bundling priority explicitly, deprecating `localBundling` in favour of `priority` ([425665a](https://github.com/mrgrain/cdk-esbuild/commit/425665a2f8f20bb557119e79e3354a4d9d696d24))
|
|
300
|
+
|
|
301
|
+
## [1.100.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0-beta.1...v1.100.0) (2021-05-01)
|
|
302
|
+
|
|
303
|
+
- no changes, cdk version constraints are now less strict
|
|
304
|
+
|
|
305
|
+
## [1.99.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.98.0...v1.99.0) (2021-04-19)
|
|
306
|
+
|
|
307
|
+
- update to cdk-1.99.0 ([cfffb19](https://github.com/mrgrain/cdk-esbuild/commit/cfffb1901f8567ea81de3e7f746d8cffd50b4bcc))
|
|
308
|
+
|
|
309
|
+
## [1.98.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.97.0...v1.98.0) (2021-04-13)
|
|
310
|
+
|
|
311
|
+
- update to cdk-1.98.0 ([0165256](https://github.com/mrgrain/cdk-esbuild/commit/0165256d26a2b24b45b17cb747f63eff26c983d1))
|
|
312
|
+
|
|
313
|
+
## [1.97.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.96.0...v1.97.0) (2021-04-11)
|
|
314
|
+
|
|
315
|
+
- update to cdk-1.97.0 ([fedb40a](https://github.com/mrgrain/cdk-esbuild/commit/fedb40a3098cd3b2de5b113d79a2edd185789fde))
|
|
316
|
+
|
|
317
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
318
|
+
|
|
319
|
+
- 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))
|
|
320
|
+
- 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))
|
|
321
|
+
|
|
322
|
+
### Features
|
|
323
|
+
|
|
324
|
+
- support object maps for entry points ([62a4431](https://github.com/mrgrain/cdk-esbuild/commit/62a4431572a4b32acd45c569405d19244b1aa76a))
|
|
325
|
+
|
|
326
|
+
## [1.96.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.95.0...v1.96.0) (2021-04-11)
|
|
327
|
+
|
|
328
|
+
- update to cdk-1.96.0 ([ae26510](https://github.com/mrgrain/cdk-esbuild/commit/ae2651026617646833303f0b9259d564765273d5))
|
|
329
|
+
|
|
330
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
331
|
+
|
|
332
|
+
- removed deprecated `projectRoot` prop, please use `buildOptions.absWorkingPath` instead ([40e7ab0](https://github.com/mrgrain/cdk-esbuild/commit/40e7ab0ccd6fa52727f548168cbbc05afcfe4b16))
|
|
333
|
+
|
|
334
|
+
## [1.95.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.1...v1.95.0) (2021-03-28)
|
|
335
|
+
|
|
336
|
+
- update to cdk-1.95.0 ([0a98ef3](https://github.com/mrgrain/cdk-esbuild/commit/0a98ef311d92e1366f535bf18d7a5f10ac6ad02a))
|
|
337
|
+
|
|
338
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
339
|
+
|
|
340
|
+
- 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))
|
|
341
|
+
|
|
342
|
+
### Features
|
|
343
|
+
|
|
344
|
+
- added various InlineCode constructs using the transform api ([6ef1c97](https://github.com/mrgrain/cdk-esbuild/commit/6ef1c9756f22256c008e1f9725ea3b5b5a176e3c))
|
|
345
|
+
- support added for `outfile` build option ([90ef5ec](https://github.com/mrgrain/cdk-esbuild/commit/90ef5ecb5906e0f2fc76a933b9f0067f1aae6428))
|
|
346
|
+
|
|
347
|
+
### [1.94.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.0...v1.94.1) (2021-03-17)
|
|
348
|
+
|
|
349
|
+
### Bug Fixes
|
|
350
|
+
|
|
351
|
+
- change cdk version constraints to work with patches ([fa0fa5f](https://github.com/mrgrain/cdk-esbuild/commit/fa0fa5fbdf608b14faf7a5e6132016fb6f2e393e))
|
|
352
|
+
|
|
353
|
+
## [1.94.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.1...v1.94.0) (2021-03-16)
|
|
354
|
+
|
|
355
|
+
- update to cdk-1.94.0 ([1623339](https://github.com/mrgrain/cdk-esbuild/commit/162333930a7534277c5ce4318f81df1fc954fe5e))
|
|
356
|
+
|
|
357
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
358
|
+
|
|
359
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
360
|
+
- deprecated ~~`projectRoot`~~ in favour of `buildOptions.absWorkDir` ([ef7ae23](https://github.com/mrgrain/cdk-esbuild/commit/ef7ae237827e381fa2708d67a2d68214a33ab41b)) \
|
|
361
|
+
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. \
|
|
362
|
+
**The automatic project root detection has been removed.**
|
|
363
|
+
- 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))
|
|
364
|
+
|
|
365
|
+
### Features
|
|
366
|
+
|
|
367
|
+
- set sensible defaults for website deployment ([a7a925d](https://github.com/mrgrain/cdk-esbuild/commit/a7a925da367d88184058719a56af55882e7c7aff))
|
|
368
|
+
- new `copyDir` prop to copy additional files into the output ([1dccb25](https://github.com/mrgrain/cdk-esbuild/commit/1dccb254c189500dc48371eeeeed0545c3116863))
|
|
369
|
+
- support for multiple `entryPoints` ([e41757b](https://github.com/mrgrain/cdk-esbuild/commit/e41757bb634d24d4c45ecf98ba981d28df258ce6))
|
|
370
|
+
- `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))
|
|
371
|
+
|
|
372
|
+
## [1.93.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.0...v1.93.1) (2021-03-12)
|
|
373
|
+
|
|
374
|
+
Required release to make version available on npm.
|
|
375
|
+
|
|
376
|
+
## [1.93.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.92.0...v1.93.0) (2021-03-12)
|
|
377
|
+
|
|
378
|
+
- update to cdk-1.93.0 ([2dd043b](https://github.com/mrgrain/cdk-esbuild/commit/2dd043b49b606dc6ebcf13c435a5665f5028fce5))
|
|
379
|
+
|
|
380
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
381
|
+
|
|
382
|
+
- `projectRoot` auto detection now searches upwards from the entry point, instead of current working directory
|
|
383
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
384
|
+
|
|
385
|
+
### Features
|
|
386
|
+
|
|
387
|
+
- 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,11 @@
|
|
|
2
2
|
|
|
3
3
|
_CDK constructs for [esbuild](https://github.com/evanw/esbuild), an extremely fast JavaScript bundler_
|
|
4
4
|
|
|
5
|
-
> ⚠️ This version is compatible with AWS CDK v2. For the previous, AWS CDK v1 compatible release, see [cdk-esbuild@v2](https://github.com/mrgrain/cdk-esbuild/tree/v2)
|
|
6
|
-
|
|
7
5
|
[Getting started](#getting-started) | [Migrating to v3](#migrating-to-v3) |
|
|
8
6
|
[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)
|
|
9
7
|
|
|
8
|
+
> This version is compatible with AWS CDK v2. For the previous, AWS CDK v1 compatible release, see [cdk-esbuild@v2](https://github.com/mrgrain/cdk-esbuild/tree/v2).
|
|
9
|
+
|
|
10
10
|
## Why?
|
|
11
11
|
|
|
12
12
|
_esbuild_ is an extremely fast bundler and minifier for Typescript and JavaScript.
|
|
@@ -18,7 +18,7 @@ This package is running _esbuild_ directly in Node.js and bypasses Docker which
|
|
|
18
18
|
|
|
19
19
|
**Production readiness**
|
|
20
20
|
|
|
21
|
-
This package is
|
|
21
|
+
This package is stable and ready to be used in production, as many do. However _esbuild_ has not yet released a version 1.0.0 and its API is still in active development. Please read the guide on [esbuild's production readiness](https://esbuild.github.io/faq/#production-readiness).
|
|
22
22
|
|
|
23
23
|
Notably upgrades of the _esbuild_ minimum version requirement will be introduced in **minor versions** of this package and will inherit breaking changes from _esbuild_.
|
|
24
24
|
|
|
@@ -30,7 +30,7 @@ Install `cdk-esbuild`:
|
|
|
30
30
|
npm install @mrgrain/cdk-esbuild@3
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
If _peer_
|
|
33
|
+
If _peer_ or _optional dependencies_ are not installed automatically (e.g. when using npm v4-6), please use this command to install all of them:
|
|
34
34
|
|
|
35
35
|
```
|
|
36
36
|
npm install @mrgrain/cdk-esbuild@3 esbuild
|
|
@@ -49,7 +49,7 @@ import { TypeScriptCode } from "@mrgrain/cdk-esbuild";
|
|
|
49
49
|
const bundledCode = new TypeScriptCode("src/index.ts");
|
|
50
50
|
|
|
51
51
|
const fn = new lambda.Function(stack, "MyFunction", {
|
|
52
|
-
runtime: lambda.Runtime.
|
|
52
|
+
runtime: lambda.Runtime.NODEJS_16_X,
|
|
53
53
|
handler: "index.handler",
|
|
54
54
|
code: bundledCode,
|
|
55
55
|
});
|
|
@@ -112,7 +112,7 @@ const canary = new synthetics.Canary(stack, "MyCanary", {
|
|
|
112
112
|
});
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
## Documentation
|
|
116
116
|
|
|
117
117
|
The package exports various different constructs for use with existing CDK features. A major guiding design principal for this package is to _extend, don't replace_. Expect constructs that you can provide as props, not complete replacements.
|
|
118
118
|
|
|
@@ -129,9 +129,9 @@ For use with **S3 bucket deployments**, classes implementing `s3deploy.ISource`
|
|
|
129
129
|
|
|
130
130
|
- `TypeScriptSource` & `JavaScriptSource`
|
|
131
131
|
|
|
132
|
-
> _Code and Source constructs seamlessly
|
|
132
|
+
> _Code and Source constructs seamlessly plug-in to other high-level CDK constructs. They share the same set of parameters, props and build options._
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
The following classes power the other features. You normally won't have to use them, but they are there if you need them:
|
|
135
135
|
|
|
136
136
|
- `TypeScriptAsset` & `JavaScriptAsset` implements `s3.Asset` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_s3_assets.Asset.html)) \
|
|
137
137
|
creates an asset uploaded to S3 which can be referenced by other constructs
|
|
@@ -139,21 +139,21 @@ Underlying classes power the other features. You normally won't have to use them
|
|
|
139
139
|
- `EsbuildBundler` implements `core.BundlingOptions` ([reference](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.BundlingOptions.html)) \
|
|
140
140
|
provides an interface for a _esbuild_ bundler wherever needed
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
### [API Reference](API.md)
|
|
143
143
|
|
|
144
|
-
Auto-generated reference for classes and structs. This information is also available
|
|
144
|
+
Auto-generated reference for classes and structs. This information is also available as part of your IDE's code completion.
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
### Escape hatches
|
|
147
147
|
|
|
148
|
-
It's possible that you want to use
|
|
148
|
+
It's possible that you want to use an implementation of esbuild that's different to the default one. Common reasons are:
|
|
149
149
|
|
|
150
150
|
- The current version constraints for esbuild are not suitable
|
|
151
|
-
- To use version of esbuild that is installed by any other means than `npm`, including Docker
|
|
152
|
-
- Plugin support is needed for
|
|
151
|
+
- To use a version of esbuild that is installed by any other means than `npm`, including Docker
|
|
152
|
+
- Plugin support is needed for building
|
|
153
153
|
|
|
154
154
|
For these situations, this package offers an escape hatch to bypass regular the implementation and provide a custom build and transform function.
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
#### Custom build function
|
|
157
157
|
|
|
158
158
|
> 💡 See [Using esbuild with plugins](examples/esbuild-with-plugins) for a complete working example of a custom build function using this escape hatch.
|
|
159
159
|
|
|
@@ -175,7 +175,7 @@ Instead of esbuild, the provided function will be invoked with the calculated bu
|
|
|
175
175
|
|
|
176
176
|
Failures have to cause a `BuildFailure` exception in order to be fully handled.
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
#### Custom transform function
|
|
179
179
|
|
|
180
180
|
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.
|
|
181
181
|
|
|
@@ -195,11 +195,11 @@ Instead of esbuild, the provided function will be invoked with the calculated tr
|
|
|
195
195
|
|
|
196
196
|
Failures have to cause a `TransformFailure` exception in order to be fully handled.
|
|
197
197
|
|
|
198
|
-
|
|
198
|
+
### Migrating to v3
|
|
199
199
|
|
|
200
200
|
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.
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
#### Upgrading
|
|
203
203
|
|
|
204
204
|
- 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.
|
|
205
205
|
- Update the package dependency to v3: `npm install --save @mrgrain/cdk-esbuild@^3.0.0`
|
|
@@ -217,7 +217,7 @@ The release of cdk-esbuild v3 brings compatibility with AWS CDK v2. Furthermore
|
|
|
217
217
|
|
|
218
218
|
## Versioning
|
|
219
219
|
|
|
220
|
-
This package
|
|
220
|
+
This package 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`.
|
|
221
221
|
|
|
222
222
|
### Npm Tags
|
|
223
223
|
|
|
@@ -233,15 +233,15 @@ These tags also exist, but usage is strongly not recommended:
|
|
|
233
233
|
|
|
234
234
|
- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.
|
|
235
235
|
|
|
236
|
-
##
|
|
236
|
+
## Roadmap & Contributions
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
[The project's roadmap is available on GitHub.](https://github.com/mrgrain/cdk-esbuild/projects/1) Please submit any feature requests as issues to the repository.
|
|
239
239
|
|
|
240
|
-
|
|
240
|
+
All contributions are welcome, no matter if they are for already planned or completely new features.
|
|
241
241
|
|
|
242
242
|
## Library authors
|
|
243
243
|
|
|
244
|
-
|
|
244
|
+
Building a library consumed by other packages that relies on `cdk-esbuild` might require you to set `buildOptions.absWorkingDir`. The easiest way to do this, is to resolve based on the directory name of the calling file, and traverse the tree upwards to the root of your library package (that's where `package.json` and `tsconfig.json` are):
|
|
245
245
|
|
|
246
246
|
```ts
|
|
247
247
|
// file: project/src/index.ts
|
|
@@ -253,3 +253,5 @@ const props = {
|
|
|
253
253
|
```
|
|
254
254
|
|
|
255
255
|
This will dynamically resolve to the correct path, wherever the package is installed.
|
|
256
|
+
|
|
257
|
+
Please open an issue if you encounter any difficulties.
|
package/lib/asset.js
CHANGED
|
@@ -16,7 +16,6 @@ class Asset extends aws_s3_assets_1.Asset {
|
|
|
16
16
|
* @stability stable
|
|
17
17
|
*/
|
|
18
18
|
constructor(scope, id, props) {
|
|
19
|
-
var _c;
|
|
20
19
|
const { assetHash, copyDir, buildOptions: options = {}, buildFn, } = props;
|
|
21
20
|
const entryPoints = typeof props.entryPoints === 'string' ? [props.entryPoints] : props.entryPoints;
|
|
22
21
|
const name = scope.node.path + constructs_1.Node.PATH_SEP + id;
|
|
@@ -25,7 +24,7 @@ class Asset extends aws_s3_assets_1.Asset {
|
|
|
25
24
|
throw new Error(`${name}: Entry points must be a relative path. If you need to define an absolute path, please use \`buildOptions.absWorkingDir\` accordingly.`);
|
|
26
25
|
}
|
|
27
26
|
});
|
|
28
|
-
const absWorkingDir =
|
|
27
|
+
const absWorkingDir = options.absWorkingDir ?? process.cwd();
|
|
29
28
|
const buildOptions = {
|
|
30
29
|
bundle: true,
|
|
31
30
|
...options,
|
|
@@ -54,7 +53,7 @@ class JavaScriptAsset extends Asset {
|
|
|
54
53
|
}
|
|
55
54
|
exports.JavaScriptAsset = JavaScriptAsset;
|
|
56
55
|
_a = JSII_RTTI_SYMBOL_1;
|
|
57
|
-
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "
|
|
56
|
+
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "4.0.0-alpha.0" };
|
|
58
57
|
/**
|
|
59
58
|
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
60
59
|
*
|
|
@@ -66,5 +65,5 @@ class TypeScriptAsset extends Asset {
|
|
|
66
65
|
}
|
|
67
66
|
exports.TypeScriptAsset = TypeScriptAsset;
|
|
68
67
|
_b = JSII_RTTI_SYMBOL_1;
|
|
69
|
-
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "
|
|
70
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
68
|
+
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "4.0.0-alpha.0" };
|
|
69
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXNzZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwrQkFBa0M7QUFDbEMsNkNBQTRDO0FBQzVDLDZEQUE2RDtBQUM3RCwyQ0FBNkM7QUFDN0MsdUNBQXNFO0FBOEJ0RTs7R0FFRztBQUNILE1BQWUsS0FBZ0MsU0FBUSxxQkFBTztJQUM1RDs7T0FFRztJQUNILFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLEtBQVk7UUFFWixNQUFNLEVBQ0osU0FBUyxFQUNULE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eXBlLkNVU1RPTSA6IEFzc2V0SGFzaFR5cGUuT1VUUFVULFxuICAgICAgYnVuZGxpbmc6IG5ldyBFc2J1aWxkQnVuZGxlcihcbiAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgIHtcbiAgICAgICAgICBidWlsZE9wdGlvbnMsXG4gICAgICAgICAgY29weURpcixcbiAgICAgICAgICBidWlsZEZuLFxuICAgICAgICB9LFxuICAgICAgKSxcbiAgICB9KTtcbiAgfVxufVxuXG4vKipcbiAqIEJ1bmRsZXMgdGhlIGVudHJ5IHBvaW50cyBhbmQgY3JlYXRlcyBhIENESyBhc3NldCB3aGljaCBpcyB1cGxvYWRlZCB0byB0aGUgYm9vdHN0cmFwcGVkIENESyBTMyBidWNrZXQgZHVyaW5nIGRlcGxveW1lbnQuXG4gKlxuICogVGhlIGFzc2V0IGNhbiBiZSB1c2VkIGJ5IG90aGVyIGNvbnN0cnVjdHMuXG4gKlxuICogQHN0YWJpbGl0eSBzdGFibGVcbiAqL1xuZXhwb3J0IGNsYXNzIEphdmFTY3JpcHRBc3NldCBleHRlbmRzIEFzc2V0PEphdmFTY3JpcHRBc3NldFByb3BzPiB7fVxuXG4vKipcbiAqIEJ1bmRsZXMgdGhlIGVudHJ5IHBvaW50cyBhbmQgY3JlYXRlcyBhIENESyBhc3NldCB3aGljaCBpcyB1cGxvYWRlZCB0byB0aGUgYm9vdHN0cmFwcGVkIENESyBTMyBidWNrZXQgZHVyaW5nIGRlcGxveW1lbnQuXG4gKlxuICogVGhlIGFzc2V0IGNhbiBiZSB1c2VkIGJ5IG90aGVyIGNvbnN0cnVjdHMuXG4gKlxuICogQHN0YWJpbGl0eSBzdGFibGVcbiAqL1xuZXhwb3J0IGNsYXNzIFR5cGVTY3JpcHRBc3NldCBleHRlbmRzIEFzc2V0PFR5cGVTY3JpcHRBc3NldFByb3BzPiB7fVxuIl19
|
package/lib/bundler.d.ts
CHANGED
|
@@ -13,15 +13,15 @@ export interface BundlerProps {
|
|
|
13
13
|
/**
|
|
14
14
|
* Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* * `buildOptions.outdir: string`
|
|
17
17
|
* The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
18
18
|
* 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. \
|
|
19
19
|
* *Cannot be used together with `outfile`*.
|
|
20
|
-
*
|
|
20
|
+
* * `buildOptions.outfile: string`
|
|
21
21
|
* Relative path to a file inside the CDK asset output directory.
|
|
22
22
|
* 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. \
|
|
23
23
|
* *Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
24
|
-
*
|
|
24
|
+
* * `buildOptions.absWorkingDir: string`
|
|
25
25
|
* 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). \
|
|
26
26
|
* If paths cannot be found, a good starting point is to look at the concatenation of `absWorkingDir + entryPoint`. It must always be a valid absolute path pointing to the entry point. When needed, the probably easiest way to set absWorkingDir is to use a combination of `resolve` and `__dirname` (see "Library authors" section in the documentation).
|
|
27
27
|
*
|
|
@@ -30,12 +30,27 @@ export interface BundlerProps {
|
|
|
30
30
|
*/
|
|
31
31
|
readonly buildOptions?: BuildOptions;
|
|
32
32
|
/**
|
|
33
|
-
* Copy additional files to the
|
|
33
|
+
* Copy additional files to the code [asset staging directory](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.AssetStaging.html#absolutestagedpath), before the build runs.
|
|
34
34
|
* Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
35
35
|
*
|
|
36
|
+
* * When provided with a `string` or `array`, all files are copied to the root of asset staging directory.
|
|
37
|
+
* * When given a `map`, the key indicates the destination relative to the asset staging directory and the value is a list of all sources to be copied.
|
|
38
|
+
*
|
|
39
|
+
* Therefore the following values for `copyDir` are all equivalent:
|
|
40
|
+
* ```ts
|
|
41
|
+
* { copyDir: "path/to/source" }
|
|
42
|
+
* { copyDir: ["path/to/source"] }
|
|
43
|
+
* { copyDir: { ".": "path/to/source" } }
|
|
44
|
+
* { copyDir: { ".": ["path/to/source"] } }
|
|
45
|
+
* ```
|
|
46
|
+
* The destination cannot be outside of the asset staging directory.
|
|
47
|
+
* If you are receiving the error "Cannot copy files to outside of the asset staging directory."
|
|
48
|
+
* you are likely using `..` or an absolute path as key on the `copyDir` map.
|
|
49
|
+
* Instead use only relative paths and avoid `..`.
|
|
50
|
+
*
|
|
36
51
|
* @stability stable
|
|
37
52
|
*/
|
|
38
|
-
readonly copyDir?: string
|
|
53
|
+
readonly copyDir?: string | string[] | Record<string, string | string[]>;
|
|
39
54
|
/**
|
|
40
55
|
* Escape hatch to provide the bundler with a custom build function.
|
|
41
56
|
* 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.
|
|
@@ -98,5 +113,6 @@ export declare class EsbuildBundler {
|
|
|
98
113
|
* @stability experimental
|
|
99
114
|
*/
|
|
100
115
|
props: BundlerProps);
|
|
116
|
+
private getCopyDirList;
|
|
101
117
|
private getOutputOptions;
|
|
102
118
|
}
|