@mrgrain/cdk-esbuild 2.0.0-alpha.1 → 2.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/.gitattributes +1 -1
- package/.jsii +378 -219
- package/{.projenrc.mjs → .projenrc.ts} +38 -32
- package/API.md +241 -105
- package/CHANGELOG.md +263 -0
- package/README.md +53 -12
- package/SECURITY.md +5 -5
- package/lib/asset.d.ts +21 -8
- package/lib/asset.js +17 -6
- package/lib/bundler.d.ts +52 -11
- package/lib/bundler.js +20 -6
- package/lib/code.d.ts +58 -5
- package/lib/code.js +57 -6
- package/lib/esbuild-types.js +2 -1
- package/lib/inline-code.d.ts +88 -4
- package/lib/inline-code.js +93 -9
- package/lib/source.js +2 -2
- package/package.json +2 -1
- package/projenrc/TypeScriptSourceFile.ts +50 -0
- package/lib/esbuild-types-raw.d.ts +0 -304
- package/lib/esbuild-types-raw.js +0 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
|
|
2
|
+
## [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)
|
|
3
|
+
|
|
4
|
+
## [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)
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* synthesize esbuild types from source ([#117](https://github.com/mrgrain/cdk-esbuild/issues/117)) ([af44d55](https://github.com/mrgrain/cdk-esbuild/commit/af44d55e97db6fd8fbda916eb0f25dae55513cba))
|
|
10
|
+
|
|
11
|
+
## [2.0.0-alpha.2](https://github.com/mrgrain/cdk-esbuild/compare/v1.128.0...v2.0.0-alpha.2) (2021-10-17)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### ⚠ BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* Alpha release of a jsii version of this package. Aim is
|
|
17
|
+
that migration will be minimal, however probably not avoidable.
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* jsii compatibility ([bdcba25](https://github.com/mrgrain/cdk-esbuild/commit/bdcba25981a3a32d36ba0054bfee5023b69b6497))
|
|
22
|
+
* jsii project with projen ([f0ff7cb](https://github.com/mrgrain/cdk-esbuild/commit/f0ff7cb07e73f4e7b936d218f8aad7a2d8aa21f4))
|
|
23
|
+
* more explict prop types ([680460a](https://github.com/mrgrain/cdk-esbuild/commit/680460a8ceabb5e45567784df8dca53ff974483c))
|
|
24
|
+
* reduce number of exported structs ([c6e0cde](https://github.com/mrgrain/cdk-esbuild/commit/c6e0cdea4a39e5909ab102e15b5c4ba5acd02d14))
|
|
25
|
+
|
|
26
|
+
## [1.128.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.127.0...v1.128.0) (2021-10-16)
|
|
27
|
+
|
|
28
|
+
- works with cdk-1.128.0
|
|
29
|
+
|
|
30
|
+
## [1.127.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0...v1.127.0) (2021-10-09)
|
|
31
|
+
|
|
32
|
+
- works with cdk-1.127.0
|
|
33
|
+
- **example/website:** How to monitor a website with Synthetics ([621d2d4](https://github.com/mrgrain/cdk-esbuild/commit/621d2d4192da63fa385b76b59353ffe77023c38d))
|
|
34
|
+
|
|
35
|
+
## [1.126.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.126.0-beta.0...v1.126.0) (2021-10-09)
|
|
36
|
+
|
|
37
|
+
### Features
|
|
38
|
+
|
|
39
|
+
- works with cdk-1.126.0
|
|
40
|
+
- [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))
|
|
41
|
+
|
|
42
|
+
## [1.125.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.124.0...v1.125.0) (2021-10-01)
|
|
43
|
+
|
|
44
|
+
### ⚠ BREAKING CHANGES
|
|
45
|
+
|
|
46
|
+
- `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.
|
|
47
|
+
|
|
48
|
+
### Features
|
|
49
|
+
|
|
50
|
+
- works with cdk-1.125.0
|
|
51
|
+
|
|
52
|
+
- upgrade `esbuild` minimum version to ^0.13.0 ([3d0b5ee](https://github.com/mrgrain/cdk-esbuild/commit/3d0b5ee5c01b7edcf7042a728932a0e1ce722d3c))
|
|
53
|
+
|
|
54
|
+
## [1.124.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.123.0...v1.124.0) (2021-10-01)
|
|
55
|
+
|
|
56
|
+
- works with cdk-1.124.0
|
|
57
|
+
|
|
58
|
+
## [1.123.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.122.0...v1.123.0) (2021-09-22)
|
|
59
|
+
|
|
60
|
+
- works with cdk-1.123.0
|
|
61
|
+
|
|
62
|
+
## [1.122.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.121.0...v1.122.0) (2021-09-12)
|
|
63
|
+
|
|
64
|
+
- works with cdk-1.122.0
|
|
65
|
+
|
|
66
|
+
## [1.121.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.120.0...v1.121.0) (2021-09-12)
|
|
67
|
+
|
|
68
|
+
- works with cdk-1.121.0
|
|
69
|
+
|
|
70
|
+
## [1.120.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.119.0...v1.120.0) (2021-09-12)
|
|
71
|
+
|
|
72
|
+
- works with cdk-1.120.0
|
|
73
|
+
|
|
74
|
+
## [1.119.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.118.0...v1.119.0) (2021-09-12)
|
|
75
|
+
|
|
76
|
+
- works with cdk-1.119.0
|
|
77
|
+
|
|
78
|
+
## [1.118.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.117.0...v1.118.0) (2021-09-12)
|
|
79
|
+
|
|
80
|
+
- works with cdk-1.118.0
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
- fix error handling type issue in latest tsc version ([b5e36e2](https://github.com/mrgrain/cdk-esbuild/commit/b5e36e27481706ea5a7ac5f8c05d74418b07c125))
|
|
85
|
+
|
|
86
|
+
## [1.117.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.116.0...v1.117.0) (2021-08-08)
|
|
87
|
+
|
|
88
|
+
- works with cdk-1.117.0
|
|
89
|
+
|
|
90
|
+
## [1.116.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.115.0...v1.116.0) (2021-08-08)
|
|
91
|
+
|
|
92
|
+
- works with cdk-1.116.0
|
|
93
|
+
|
|
94
|
+
## [1.115.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.114.0...v1.115.0) (2021-08-08)
|
|
95
|
+
|
|
96
|
+
- works with cdk-1.115.0
|
|
97
|
+
|
|
98
|
+
## [1.114.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.113.0...v1.114.0) (2021-08-08)
|
|
99
|
+
|
|
100
|
+
- works with cdk-1.114.0
|
|
101
|
+
|
|
102
|
+
## [1.113.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.112.0...v1.113.0) (2021-08-08)
|
|
103
|
+
|
|
104
|
+
- works with cdk-1.113.0
|
|
105
|
+
|
|
106
|
+
## [1.112.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.111.0...v1.112.0) (2021-08-08)
|
|
107
|
+
|
|
108
|
+
- works with cdk-1.112.0
|
|
109
|
+
|
|
110
|
+
## [1.111.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.110.0...v1.111.0) (2021-08-08)
|
|
111
|
+
|
|
112
|
+
- works with cdk-1.111.0
|
|
113
|
+
|
|
114
|
+
## [1.110.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.109.0...v1.110.0) (2021-06-24)
|
|
115
|
+
|
|
116
|
+
- works with cdk-1.110.0
|
|
117
|
+
|
|
118
|
+
## [1.109.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.108.0...v1.109.0) (2021-06-24)
|
|
119
|
+
|
|
120
|
+
- works with cdk-1.109.0
|
|
121
|
+
|
|
122
|
+
## [1.108.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.107.0...v1.108.0) (2021-06-09)
|
|
123
|
+
|
|
124
|
+
- works with cdk-1.108.0
|
|
125
|
+
|
|
126
|
+
## [1.107.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.106.0...v1.107.0) (2021-06-03)
|
|
127
|
+
|
|
128
|
+
- works with cdk-1.107.0
|
|
129
|
+
|
|
130
|
+
## [1.106.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.105.0...v1.106.0) (2021-05-31)
|
|
131
|
+
|
|
132
|
+
- works with cdk-1.106.0
|
|
133
|
+
|
|
134
|
+
## [1.105.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.104.0...v1.105.0) (2021-05-19)
|
|
135
|
+
|
|
136
|
+
- works with cdk-1.105.0
|
|
137
|
+
|
|
138
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
139
|
+
|
|
140
|
+
- 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)
|
|
141
|
+
|
|
142
|
+
## [1.104.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.103.0...v1.104.0) (2021-05-19)
|
|
143
|
+
|
|
144
|
+
- works with cdk-1.104.0 ([fb0de78](https://github.com/mrgrain/cdk-esbuild/commit/fb0de78faf29815045822b8e80b2bbb07b8f7cbf))
|
|
145
|
+
|
|
146
|
+
## [1.103.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.102.0...v1.103.0) (2021-05-13)
|
|
147
|
+
|
|
148
|
+
- works with cdk-1.103.0
|
|
149
|
+
|
|
150
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
151
|
+
|
|
152
|
+
- removed deprecated `forceDockerBundling` and `localBundling` ([cc40b90](https://github.com/mrgrain/cdk-esbuild/commit/cc40b900acd8cba725e31db0a79cd3f8b711277e))
|
|
153
|
+
|
|
154
|
+
## [1.102.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.101.0...v1.102.0) (2021-05-04)
|
|
155
|
+
|
|
156
|
+
- works with cdk-1.102.0 ([c616c1b](https://github.com/mrgrain/cdk-esbuild/commit/c616c1ba07a9bdd11f3dc3369b1335918458800f))
|
|
157
|
+
|
|
158
|
+
### Features
|
|
159
|
+
|
|
160
|
+
- new high-level constructs prop `bundlerPriority` to replace deprecated `forceDockerBundling` ([cc4c933](https://github.com/mrgrain/cdk-esbuild/commit/cc4c93376cf3a8628edd696fe9fa8f65a09c7e21))
|
|
161
|
+
- **examples/lambda:** added new complete example for lambda function ([f8ca3c0](https://github.com/mrgrain/cdk-esbuild/commit/f8ca3c093a11f1d56b9f08cd0a4f3b3eaecd5690))
|
|
162
|
+
|
|
163
|
+
### Bug Fixes
|
|
164
|
+
|
|
165
|
+
- **examples/website:** changed start command to work with latest esbuild versions ([45b4c91](https://github.com/mrgrain/cdk-esbuild/commit/45b4c91b454a9520e3aca4ff66ed75abc2ea7d4a))
|
|
166
|
+
|
|
167
|
+
## [1.101.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0...v1.101.0) (2021-05-01)
|
|
168
|
+
|
|
169
|
+
- works with cdk-1.101.0
|
|
170
|
+
|
|
171
|
+
### Features
|
|
172
|
+
|
|
173
|
+
- pretty print esbuild build errors and warnings when using local bundler ([7f15bed](https://github.com/mrgrain/cdk-esbuild/commit/7f15bedbdfb619c2d0767bc37458108e01c3a85e))
|
|
174
|
+
- pretty print esbuild transform errors and warnings ([1eeeb10](https://github.com/mrgrain/cdk-esbuild/commit/1eeeb10ca6b1e46452c55792d28429986eb4b09f))
|
|
175
|
+
- set bundling priority explicitly, deprecating `localBundling` in favour of `priority` ([425665a](https://github.com/mrgrain/cdk-esbuild/commit/425665a2f8f20bb557119e79e3354a4d9d696d24))
|
|
176
|
+
|
|
177
|
+
## [1.100.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.100.0-beta.1...v1.100.0) (2021-05-01)
|
|
178
|
+
|
|
179
|
+
- no changes, cdk version constraints are now less strict
|
|
180
|
+
|
|
181
|
+
## [1.99.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.98.0...v1.99.0) (2021-04-19)
|
|
182
|
+
|
|
183
|
+
- update to cdk-1.99.0 ([cfffb19](https://github.com/mrgrain/cdk-esbuild/commit/cfffb1901f8567ea81de3e7f746d8cffd50b4bcc))
|
|
184
|
+
|
|
185
|
+
## [1.98.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.97.0...v1.98.0) (2021-04-13)
|
|
186
|
+
|
|
187
|
+
- update to cdk-1.98.0 ([0165256](https://github.com/mrgrain/cdk-esbuild/commit/0165256d26a2b24b45b17cb747f63eff26c983d1))
|
|
188
|
+
|
|
189
|
+
## [1.97.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.96.0...v1.97.0) (2021-04-11)
|
|
190
|
+
|
|
191
|
+
- update to cdk-1.97.0 ([fedb40a](https://github.com/mrgrain/cdk-esbuild/commit/fedb40a3098cd3b2de5b113d79a2edd185789fde))
|
|
192
|
+
|
|
193
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
194
|
+
|
|
195
|
+
- 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))
|
|
196
|
+
- 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))
|
|
197
|
+
|
|
198
|
+
### Features
|
|
199
|
+
|
|
200
|
+
- support object maps for entry points ([62a4431](https://github.com/mrgrain/cdk-esbuild/commit/62a4431572a4b32acd45c569405d19244b1aa76a))
|
|
201
|
+
|
|
202
|
+
## [1.96.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.95.0...v1.96.0) (2021-04-11)
|
|
203
|
+
|
|
204
|
+
- update to cdk-1.96.0 ([ae26510](https://github.com/mrgrain/cdk-esbuild/commit/ae2651026617646833303f0b9259d564765273d5))
|
|
205
|
+
|
|
206
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
207
|
+
|
|
208
|
+
- removed deprecated `projectRoot` prop, please use `buildOptions.absWorkingPath` instead ([40e7ab0](https://github.com/mrgrain/cdk-esbuild/commit/40e7ab0ccd6fa52727f548168cbbc05afcfe4b16))
|
|
209
|
+
|
|
210
|
+
## [1.95.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.1...v1.95.0) (2021-03-28)
|
|
211
|
+
|
|
212
|
+
- update to cdk-1.95.0 ([0a98ef3](https://github.com/mrgrain/cdk-esbuild/commit/0a98ef311d92e1366f535bf18d7a5f10ac6ad02a))
|
|
213
|
+
|
|
214
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
215
|
+
|
|
216
|
+
- 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))
|
|
217
|
+
|
|
218
|
+
### Features
|
|
219
|
+
|
|
220
|
+
- added various InlineCode constructs using the transform api ([6ef1c97](https://github.com/mrgrain/cdk-esbuild/commit/6ef1c9756f22256c008e1f9725ea3b5b5a176e3c))
|
|
221
|
+
- support added for `outfile` build option ([90ef5ec](https://github.com/mrgrain/cdk-esbuild/commit/90ef5ecb5906e0f2fc76a933b9f0067f1aae6428))
|
|
222
|
+
|
|
223
|
+
### [1.94.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.94.0...v1.94.1) (2021-03-17)
|
|
224
|
+
|
|
225
|
+
### Bug Fixes
|
|
226
|
+
|
|
227
|
+
- change cdk version constraints to work with patches ([fa0fa5f](https://github.com/mrgrain/cdk-esbuild/commit/fa0fa5fbdf608b14faf7a5e6132016fb6f2e393e))
|
|
228
|
+
|
|
229
|
+
## [1.94.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.1...v1.94.0) (2021-03-16)
|
|
230
|
+
|
|
231
|
+
- update to cdk-1.94.0 ([1623339](https://github.com/mrgrain/cdk-esbuild/commit/162333930a7534277c5ce4318f81df1fc954fe5e))
|
|
232
|
+
|
|
233
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
234
|
+
|
|
235
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
236
|
+
- deprecated ~~`projectRoot`~~ in favour of `buildOptions.absWorkDir` ([ef7ae23](https://github.com/mrgrain/cdk-esbuild/commit/ef7ae237827e381fa2708d67a2d68214a33ab41b)) \
|
|
237
|
+
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. \
|
|
238
|
+
**The automatic project root detection has been removed.**
|
|
239
|
+
- 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))
|
|
240
|
+
|
|
241
|
+
### Features
|
|
242
|
+
|
|
243
|
+
- set sensible defaults for website deployment ([a7a925d](https://github.com/mrgrain/cdk-esbuild/commit/a7a925da367d88184058719a56af55882e7c7aff))
|
|
244
|
+
- new `copyDir` prop to copy additional files into the output ([1dccb25](https://github.com/mrgrain/cdk-esbuild/commit/1dccb254c189500dc48371eeeeed0545c3116863))
|
|
245
|
+
- support for multiple `entryPoints` ([e41757b](https://github.com/mrgrain/cdk-esbuild/commit/e41757bb634d24d4c45ecf98ba981d28df258ce6))
|
|
246
|
+
- `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))
|
|
247
|
+
|
|
248
|
+
## [1.93.1](https://github.com/mrgrain/cdk-esbuild/compare/v1.93.0...v1.93.1) (2021-03-12)
|
|
249
|
+
|
|
250
|
+
Required release to make version available on npm.
|
|
251
|
+
|
|
252
|
+
## [1.93.0](https://github.com/mrgrain/cdk-esbuild/compare/v1.92.0...v1.93.0) (2021-03-12)
|
|
253
|
+
|
|
254
|
+
- update to cdk-1.93.0 ([2dd043b](https://github.com/mrgrain/cdk-esbuild/commit/2dd043b49b606dc6ebcf13c435a5665f5028fce5))
|
|
255
|
+
|
|
256
|
+
### ⚠️ BREAKING CHANGES TO EXPERIMENTAL FEATURES
|
|
257
|
+
|
|
258
|
+
- `projectRoot` auto detection now searches upwards from the entry point, instead of current working directory
|
|
259
|
+
- deprecated ~~`TypeScriptAsset`~~ & ~~`JavaScriptAsset`~~ in favour of `TypeScriptCode` & `JavaScriptCode` ([f31074e](https://github.com/mrgrain/cdk-esbuild/commit/f31074eeeca039dc847f199eeff88313b61605a1))
|
|
260
|
+
|
|
261
|
+
### Features
|
|
262
|
+
|
|
263
|
+
- 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,8 +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
|
-
[Documentation](#documentation) | [API Reference](
|
|
5
|
+
[Getting started](#getting-started) | [Migrating to v2](#migrating-to-v2) |
|
|
6
|
+
[Documentation](#documentation) | [API Reference](#api-reference) | [Versioning](#versioning)
|
|
7
7
|
|
|
8
8
|
## Why?
|
|
9
9
|
|
|
@@ -14,9 +14,9 @@ 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
|
-
**⚠️
|
|
17
|
+
**⚠️ A note on stability**
|
|
18
18
|
|
|
19
|
-
This package is generally stable. 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_ 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
20
|
|
|
21
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
22
|
|
|
@@ -121,23 +121,35 @@ 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_
|
|
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
|
|
133
133
|
|
|
134
|
-
## [API Reference](
|
|
134
|
+
## [API Reference](API.md)
|
|
135
135
|
|
|
136
|
-
Auto-generated reference for
|
|
136
|
+
Auto-generated reference for classes and structs. This information is also available within the code completion of your IDE.
|
|
137
137
|
|
|
138
|
-
##
|
|
138
|
+
## Migrating to v2
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
The main changes in cdk-esbuild v2 are:
|
|
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.
|
|
146
|
+
|
|
147
|
+
### Upgrading
|
|
148
|
+
|
|
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.
|
|
141
153
|
|
|
142
154
|
## Versioning
|
|
143
155
|
|
|
@@ -145,6 +157,20 @@ This package _mostly_ follows [Semantic Versioning](https://semver.org/), with t
|
|
|
145
157
|
|
|
146
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.
|
|
147
159
|
|
|
160
|
+
### Npm Tags
|
|
161
|
+
|
|
162
|
+
Some users prefer to use tags over version ranges. The following stable tags are available for use:
|
|
163
|
+
|
|
164
|
+
- `cdk-v1`, `cdk-v2` are provided for the latest release compatible with each version of the AWS CDK.
|
|
165
|
+
|
|
166
|
+
- `latest` is the most recent stable release.
|
|
167
|
+
|
|
168
|
+
These tags also exist, but usage is strongly not recommended:
|
|
169
|
+
|
|
170
|
+
- `unstable`, `next` are used for pre-release of the current and next major version respectively.
|
|
171
|
+
|
|
172
|
+
- ~~`cdk-1.x.x`~~ tags have been deprecated in favour of `cdk-v1`. Use that one instead.
|
|
173
|
+
|
|
148
174
|
## Future releases
|
|
149
175
|
|
|
150
176
|
### AWS CDK v2
|
|
@@ -154,3 +180,18 @@ The monolithic version 2 of CDK (aka Mono-CDK) is on the horizon. A new major re
|
|
|
154
180
|
### Stable esbuild
|
|
155
181
|
|
|
156
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.
|
|
183
|
+
|
|
184
|
+
## Library authors
|
|
185
|
+
|
|
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):
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
// file: project/src/index.ts
|
|
190
|
+
const props = {
|
|
191
|
+
buildOptions: {
|
|
192
|
+
absWorkingDir: path.resolve(__dirname, ".."), // now: /user/project
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
```
|
|
196
|
+
|
|
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
|
|
package/lib/asset.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { Asset as S3Asset } from '@aws-cdk/aws-s3-assets';
|
|
|
2
2
|
import { Construct } from '@aws-cdk/core';
|
|
3
3
|
import { BundlerProps, EntryPoints } from './bundler';
|
|
4
4
|
/**
|
|
5
|
-
* @
|
|
5
|
+
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export interface AssetBaseProps extends BundlerProps {
|
|
8
8
|
/**
|
|
9
9
|
* A hash of this asset, which is available at construction time.
|
|
10
10
|
*
|
|
11
|
-
* As this is a plain string, it
|
|
12
|
-
*
|
|
13
|
-
* hash
|
|
11
|
+
* As this is a plain string, it can be used in construct IDs in order to enforce creation of a new resource when the content hash has changed.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to a hash of all files in the resulting bundle.
|
|
14
14
|
*
|
|
15
15
|
* @stability stable
|
|
16
16
|
*/
|
|
@@ -21,7 +21,9 @@ export interface AssetBaseProps extends BundlerProps {
|
|
|
21
21
|
*/
|
|
22
22
|
export interface AssetProps extends AssetBaseProps {
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
25
|
+
*
|
|
26
|
+
* E.g. `src/index.ts`.
|
|
25
27
|
*
|
|
26
28
|
* @stability stable
|
|
27
29
|
*/
|
|
@@ -29,19 +31,30 @@ export interface AssetProps extends AssetBaseProps {
|
|
|
29
31
|
}
|
|
30
32
|
declare type JavaScriptAssetProps = AssetProps;
|
|
31
33
|
declare type TypeScriptAssetProps = AssetProps;
|
|
34
|
+
/**
|
|
35
|
+
* @stability stable
|
|
36
|
+
*/
|
|
32
37
|
declare abstract class Asset<Props extends AssetProps> extends S3Asset {
|
|
33
38
|
/**
|
|
34
|
-
* @
|
|
39
|
+
* @stability stable
|
|
35
40
|
*/
|
|
36
41
|
constructor(scope: Construct, id: string, props: Props);
|
|
37
42
|
}
|
|
38
43
|
/**
|
|
39
|
-
*
|
|
44
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
45
|
+
*
|
|
46
|
+
* The asset can be used by other constructs.
|
|
47
|
+
*
|
|
48
|
+
* @stability stable
|
|
40
49
|
*/
|
|
41
50
|
export declare class JavaScriptAsset extends Asset<JavaScriptAssetProps> {
|
|
42
51
|
}
|
|
43
52
|
/**
|
|
44
|
-
*
|
|
53
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
54
|
+
*
|
|
55
|
+
* The asset can be used by other constructs.
|
|
56
|
+
*
|
|
57
|
+
* @stability stable
|
|
45
58
|
*/
|
|
46
59
|
export declare class TypeScriptAsset extends Asset<TypeScriptAssetProps> {
|
|
47
60
|
}
|
package/lib/asset.js
CHANGED
|
@@ -7,9 +7,12 @@ const path_1 = require("path");
|
|
|
7
7
|
const aws_s3_assets_1 = require("@aws-cdk/aws-s3-assets");
|
|
8
8
|
const core_1 = require("@aws-cdk/core");
|
|
9
9
|
const bundler_1 = require("./bundler");
|
|
10
|
+
/**
|
|
11
|
+
* @stability stable
|
|
12
|
+
*/
|
|
10
13
|
class Asset extends aws_s3_assets_1.Asset {
|
|
11
14
|
/**
|
|
12
|
-
* @
|
|
15
|
+
* @stability stable
|
|
13
16
|
*/
|
|
14
17
|
constructor(scope, id, props) {
|
|
15
18
|
var _c;
|
|
@@ -39,19 +42,27 @@ class Asset extends aws_s3_assets_1.Asset {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
42
|
-
*
|
|
45
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
46
|
+
*
|
|
47
|
+
* The asset can be used by other constructs.
|
|
48
|
+
*
|
|
49
|
+
* @stability stable
|
|
43
50
|
*/
|
|
44
51
|
class JavaScriptAsset extends Asset {
|
|
45
52
|
}
|
|
46
53
|
exports.JavaScriptAsset = JavaScriptAsset;
|
|
47
54
|
_a = JSII_RTTI_SYMBOL_1;
|
|
48
|
-
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "2.0.0-
|
|
55
|
+
JavaScriptAsset[_a] = { fqn: "@mrgrain/cdk-esbuild.JavaScriptAsset", version: "2.0.0-rc.0" };
|
|
49
56
|
/**
|
|
50
|
-
*
|
|
57
|
+
* Bundles the entry points and creates a CDK asset which is uploaded to the bootstrapped CDK S3 bucket during deployment.
|
|
58
|
+
*
|
|
59
|
+
* The asset can be used by other constructs.
|
|
60
|
+
*
|
|
61
|
+
* @stability stable
|
|
51
62
|
*/
|
|
52
63
|
class TypeScriptAsset extends Asset {
|
|
53
64
|
}
|
|
54
65
|
exports.TypeScriptAsset = TypeScriptAsset;
|
|
55
66
|
_b = JSII_RTTI_SYMBOL_1;
|
|
56
|
-
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptAsset", version: "2.0.0-
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
67
|
+
TypeScriptAsset[_b] = { fqn: "@mrgrain/cdk-esbuild.TypeScriptA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JvcHMgZXh0ZW5kcyBCdW5kbGVyUHJvcHMge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICByZWFkb25seSBhc3NldEhhc2g/OiBzdHJpbmc7XG59XG5cbmV4cG9ydCBpbnRlcmZhY2UgQXNzZXRQcm9wcyBleHRlbmRzIEFzc2V0QmFzZVByb3BzIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICByZWFkb25seSBlbnRyeVBvaW50czogRW50cnlQb2ludHM7XG59XG5cbnR5cGUgSmF2YVNjcmlwdEFzc2V0UHJvcHMgPSBBc3NldFByb3BzO1xudHlwZSBUeXBlU2NyaXB0QXNzZXRQcm9wcyA9IEFzc2V0UHJvcHM7XG5cbi8qKlxuICogQHN0YWJpbGl0eSBzdGFibGVcbiAqL1xuYWJzdHJhY3QgY2xhc3MgQXNzZXQ8UHJvcHMgZXh0ZW5kcyBBc3NldFByb3BzPiBleHRlbmRzIFMzQXNzZXQge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFxuICBwdWJsaWMgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IENvbn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sXG4gICAgICBhYnNXb3JraW5nRGlyLFxuICAgIH07XG5cbiAgICBzdXBlcihzY29wZSwgaWQsIHtcbiAgICAgIHBhdGg6IGFic1dvcmtpbmdEaXIsXG4gICAgICBhc3NldEhhc2gsXG4gICAgICBhc3NldEhhc2hUeXBlOiBhc3NldEhhc2ggPyBBc3NldEhhc2hUeXBlLkNVU1RPTSA6IEFzc2V0SGFzaFR5cGUuT1VUUFVULFxuICAgICAgYnVuZGxpbmc6IG5ldyBFc2J1aWxkQnVuZGxlcihcbiAgICAgICAgZW50cnlQb2ludHMsXG4gICAgICAgIHtcbiAgICAgICAgICBidWlsZE9wdGlvbnMsXG4gICAgICAgICAgY29weURpcixcbiAgICAgICAgfSxcbiAgICAgICksXG4gICAgfSk7XG4gIH1cbn1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBKYXZhU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxKYXZhU2NyaXB0QXNzZXRQcm9wcz4ge31cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbmV4cG9ydCBjbGFzcyBUeXBlU2NyaXB0QXNzZXQgZXh0ZW5kcyBBc3NldDxUeXBlU2NyaXB0QXNzZXRQcm9wcz4ge31cbiJdfQ==
|
package/lib/bundler.d.ts
CHANGED
|
@@ -1,51 +1,92 @@
|
|
|
1
1
|
import { DockerImage, ILocalBundling } from '@aws-cdk/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`.
|
|
5
|
+
*
|
|
6
|
+
* @stability stable
|
|
5
7
|
*/
|
|
6
8
|
export declare type EntryPoints = string | string[] | Record<string, string>;
|
|
7
9
|
/**
|
|
8
|
-
* @
|
|
10
|
+
* @stability stable
|
|
9
11
|
*/
|
|
10
12
|
export interface BundlerProps {
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Build options passed on to esbuild. Please refer to the esbuild Build API docs for details.
|
|
13
15
|
*
|
|
14
|
-
*
|
|
16
|
+
* - `buildOptions.outdir: string`
|
|
17
|
+
* The actual path for the output directory is defined by CDK. However setting this option allows to write files into a subdirectory. \
|
|
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
|
+
* *Cannot be used together with `outfile`*.
|
|
20
|
+
* - `buildOptions.outfile: string`
|
|
21
|
+
* Relative path to a file inside the CDK asset output directory.
|
|
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
|
+
* *Cannot be used with multiple entryPoints or together with `outdir`.*
|
|
24
|
+
* - `buildOptions.absWorkingDir: string`
|
|
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
|
+
* 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
|
+
*
|
|
28
|
+
* @see https://esbuild.github.io/api/#build-api
|
|
29
|
+
* @stability stable
|
|
15
30
|
*/
|
|
16
31
|
readonly buildOptions?: BuildOptions;
|
|
17
32
|
/**
|
|
18
|
-
*
|
|
33
|
+
* Copy additional files to the output directory, before the build runs.
|
|
19
34
|
*
|
|
20
|
-
*
|
|
35
|
+
* Files copied like this will be overwritten by esbuild if they share the same name as any of the outputs.
|
|
36
|
+
*
|
|
37
|
+
* @stability stable
|
|
21
38
|
*/
|
|
22
39
|
readonly copyDir?: string;
|
|
23
40
|
}
|
|
24
41
|
/**
|
|
42
|
+
* (experimental) Low-level construct that can be used where `BundlingOptions` are required.
|
|
43
|
+
*
|
|
44
|
+
* This class directly interfaces with esbuild and provides almost no configuration safeguards.
|
|
45
|
+
*
|
|
25
46
|
* @experimental
|
|
26
47
|
*/
|
|
27
48
|
export declare class EsbuildBundler {
|
|
28
49
|
/**
|
|
29
|
-
*
|
|
50
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
51
|
+
* E.g. `src/index.ts`.
|
|
52
|
+
*
|
|
53
|
+
* @stability experimental
|
|
30
54
|
*/
|
|
31
55
|
readonly entryPoints: EntryPoints;
|
|
56
|
+
/**
|
|
57
|
+
* Props to change the behaviour of the bundler.
|
|
58
|
+
*
|
|
59
|
+
* @stability experimental
|
|
60
|
+
*/
|
|
32
61
|
readonly props: BundlerProps;
|
|
33
62
|
/**
|
|
63
|
+
* (experimental) Implementation of `ILocalBundling` interface, responsible for calling esbuild functions.
|
|
64
|
+
*
|
|
34
65
|
* @experimental
|
|
35
66
|
*/
|
|
36
67
|
readonly local: ILocalBundling;
|
|
37
68
|
/**
|
|
38
|
-
* @
|
|
69
|
+
* @deprecated This value is ignored since the bundler is always using a locally installed version of esbuild. However the property is required to comply with the `BundlingOptions` interface.
|
|
39
70
|
*/
|
|
40
71
|
readonly image: DockerImage;
|
|
41
72
|
/**
|
|
42
|
-
* @param entryPoints
|
|
73
|
+
* @param entryPoints A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
74
|
+
* @param props Props to change the behaviour of the bundler.
|
|
43
75
|
* @experimental
|
|
44
76
|
*/
|
|
45
77
|
constructor(
|
|
46
78
|
/**
|
|
47
|
-
*
|
|
79
|
+
* A relative path or list or map of relative paths to the entry points of your code from the root of the project.
|
|
80
|
+
* E.g. `src/index.ts`.
|
|
81
|
+
*
|
|
82
|
+
* @stability experimental
|
|
83
|
+
*/
|
|
84
|
+
entryPoints: EntryPoints,
|
|
85
|
+
/**
|
|
86
|
+
* Props to change the behaviour of the bundler.
|
|
87
|
+
*
|
|
88
|
+
* @stability experimental
|
|
48
89
|
*/
|
|
49
|
-
|
|
90
|
+
props: BundlerProps);
|
|
50
91
|
private getOutputOptions;
|
|
51
92
|
}
|