@ui5/server 3.0.0-alpha.1 → 3.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +316 -0
- package/lib/middleware/MiddlewareManager.js +35 -32
- package/lib/middleware/middlewareRepository.js +2 -14
- package/lib/middleware/serveIndex.js +2 -3
- package/lib/middleware/serveResources.js +5 -6
- package/lib/middleware/versionInfo.js +12 -9
- package/lib/server.js +22 -8
- package/package.json +7 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
4
|
+
|
|
5
|
+
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v3.0.0-alpha.2...HEAD).
|
|
6
|
+
|
|
7
|
+
<a name="v3.0.0-alpha.2"></a>
|
|
8
|
+
## [v3.0.0-alpha.2] - 2022-06-14
|
|
9
|
+
### Breaking Changes
|
|
10
|
+
- Require Project Graph ([#479](https://github.com/SAP/ui5-server/issues/479)) [`d62f85a`](https://github.com/SAP/ui5-server/commit/d62f85a193115a587dbf58225e8130318a475023)
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGE
|
|
13
|
+
|
|
14
|
+
* Server now requires a Project Graph instance instead.
|
|
15
|
+
* Standard middleware now rely on Project instances being available on Resources (see https://github.com/SAP/ui5-fs/pull/381)
|
|
16
|
+
* MiddlewareRepository#addMiddleware has been removed. Custom middleware need to be added to the project graph instead
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<a name="v3.0.0-alpha.1"></a>
|
|
20
|
+
## [v3.0.0-alpha.1] - 2022-01-25
|
|
21
|
+
### Breaking Changes
|
|
22
|
+
- Require Node.js >= 16.13.2 / npm >= 8 [`63d216a`](https://github.com/SAP/ui5-server/commit/63d216a3ba34e8e50acc6621d43a78c3a0804d67)
|
|
23
|
+
|
|
24
|
+
### BREAKING CHANGE
|
|
25
|
+
|
|
26
|
+
Support for older Node.js and npm releases has been dropped.
|
|
27
|
+
Only Node.js v16.13.2 and npm v8 or higher are supported.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<a name="v3.0.0-alpha.0"></a>
|
|
31
|
+
## [v3.0.0-alpha.0] - 2021-12-14
|
|
32
|
+
|
|
33
|
+
<a name="v2.4.0"></a>
|
|
34
|
+
## [v2.4.0] - 2021-10-19
|
|
35
|
+
### Features
|
|
36
|
+
- Enhance versionInfo middleware to serve sap-ui-version.json ([#420](https://github.com/SAP/ui5-server/issues/420)) [`c6f83f5`](https://github.com/SAP/ui5-server/commit/c6f83f5472eb2fe6a8d4eca10ecdc5f4b522bc3c)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<a name="v2.3.1"></a>
|
|
40
|
+
## [v2.3.1] - 2021-07-23
|
|
41
|
+
|
|
42
|
+
<a name="v2.3.0"></a>
|
|
43
|
+
## [v2.3.0] - 2021-07-01
|
|
44
|
+
### Features
|
|
45
|
+
- **server:** Expose configuration options for SAP CSP policies [`55d6a96`](https://github.com/SAP/ui5-server/commit/55d6a96cc1a3c762af8173d9fb9588fe742a302d)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<a name="v2.2.10"></a>
|
|
49
|
+
## [v2.2.10] - 2021-06-01
|
|
50
|
+
|
|
51
|
+
<a name="v2.2.9"></a>
|
|
52
|
+
## [v2.2.9] - 2021-03-11
|
|
53
|
+
### Dependency Updates
|
|
54
|
+
- Bump connect-openui5 from 0.10.1 to 0.10.2 [`849957d`](https://github.com/SAP/ui5-server/commit/849957d39a45c22c5c94f787d66eeccc58eb4d2d)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<a name="v2.2.8"></a>
|
|
58
|
+
## [v2.2.8] - 2021-02-09
|
|
59
|
+
|
|
60
|
+
<a name="v2.2.7"></a>
|
|
61
|
+
## [v2.2.7] - 2020-11-06
|
|
62
|
+
|
|
63
|
+
<a name="v2.2.6"></a>
|
|
64
|
+
## [v2.2.6] - 2020-10-22
|
|
65
|
+
### Bug Fixes
|
|
66
|
+
- Improve parallel theme request handling [`88bc0d6`](https://github.com/SAP/ui5-server/commit/88bc0d6d4e5ca8bb191029335451713579360e1c)
|
|
67
|
+
- **nonReadRequests middleware:** Use native response API [`2d2325f`](https://github.com/SAP/ui5-server/commit/2d2325f638820d25738ddbd56afe0d104e37f2e0)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
<a name="v2.2.5"></a>
|
|
71
|
+
## [v2.2.5] - 2020-10-06
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
- Discovery middleware shouldn't fail when lib names overlap ([#362](https://github.com/SAP/ui5-server/issues/362)) [`f5067ce`](https://github.com/SAP/ui5-server/commit/f5067ce38b89442948ce096e5d89651e8970bdb9)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<a name="v2.2.4"></a>
|
|
77
|
+
## [v2.2.4] - 2020-09-10
|
|
78
|
+
|
|
79
|
+
<a name="v2.2.3"></a>
|
|
80
|
+
## [v2.2.3] - 2020-09-02
|
|
81
|
+
### Bug Fixes
|
|
82
|
+
- **middleware/testRunner:** Update resources from OpenUI5 [`55b1fe7`](https://github.com/SAP/ui5-server/commit/55b1fe742be29b176e55985a0315dcead684d257)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<a name="v2.2.2"></a>
|
|
86
|
+
## [v2.2.2] - 2020-08-11
|
|
87
|
+
|
|
88
|
+
<a name="v2.2.1"></a>
|
|
89
|
+
## [v2.2.1] - 2020-07-14
|
|
90
|
+
### Bug Fixes
|
|
91
|
+
- **MiddlewareManager:** Provide MiddlewareUtil to custom middleware using specVersion 2.1 [`3e249fa`](https://github.com/SAP/ui5-server/commit/3e249fa4333fb6afa0e512201959bfcbcee196d0)
|
|
92
|
+
- **Node.js API:** TypeScript type definition support ([#334](https://github.com/SAP/ui5-server/issues/334)) [`b66f9cc`](https://github.com/SAP/ui5-server/commit/b66f9cc10b35b2997f5e9b3840ef92dd504c8a33)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
<a name="v2.2.0"></a>
|
|
96
|
+
## [v2.2.0] - 2020-07-01
|
|
97
|
+
### Bug Fixes
|
|
98
|
+
- **MiddlewareManager:** Update SAP Target CSP Policies [`269c22c`](https://github.com/SAP/ui5-server/commit/269c22c80a6682a3d680c47e768f69a20ecabcd0)
|
|
99
|
+
|
|
100
|
+
### Features
|
|
101
|
+
- **CSP:** Add ignorePaths option ([#331](https://github.com/SAP/ui5-server/issues/331)) [`27a962e`](https://github.com/SAP/ui5-server/commit/27a962eb80fd7de95c6076f7d307e0dd06dac057)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
<a name="v2.1.0"></a>
|
|
105
|
+
## [v2.1.0] - 2020-06-15
|
|
106
|
+
### Features
|
|
107
|
+
- **csp:** enable tracking and serving of csp reports ([#323](https://github.com/SAP/ui5-server/issues/323)) [`e0a0c5e`](https://github.com/SAP/ui5-server/commit/e0a0c5e022c2c0041c6cf52631ef834cafe1f873)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<a name="v2.0.3"></a>
|
|
111
|
+
## [v2.0.3] - 2020-05-14
|
|
112
|
+
|
|
113
|
+
<a name="v2.0.2"></a>
|
|
114
|
+
## [v2.0.2] - 2020-04-30
|
|
115
|
+
### Bug Fixes
|
|
116
|
+
- **CSP Middleware:** Use native res.getHeader/setHeader methods ([#312](https://github.com/SAP/ui5-server/issues/312)) [`c53525c`](https://github.com/SAP/ui5-server/commit/c53525ca4bb5825d241d0f137ce3912d681e6548)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
<a name="v2.0.1"></a>
|
|
120
|
+
## [v2.0.1] - 2020-04-15
|
|
121
|
+
### Dependency Updates
|
|
122
|
+
- Bump devcert-sanscache from 0.4.6 to 0.4.8 ([#306](https://github.com/SAP/ui5-server/issues/306)) [`2a9d517`](https://github.com/SAP/ui5-server/commit/2a9d51776e967362d959eef45ce9533a9a27650c)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
<a name="v2.0.0"></a>
|
|
126
|
+
## [v2.0.0] - 2020-03-31
|
|
127
|
+
### Breaking Changes
|
|
128
|
+
- Require Node.js >= 10 [`a8c7a13`](https://github.com/SAP/ui5-server/commit/a8c7a13f68426012e5ff9cfddb365bb32c46f9dc)
|
|
129
|
+
- **serveResources middleware:** Expect *.properties files in UTF-8 by default [`af7f9ad`](https://github.com/SAP/ui5-server/commit/af7f9ad52aa834f63c163b99eb4fbc8d1bb05079)
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
- Handle encoding in request paths correctly [`256b3f0`](https://github.com/SAP/ui5-server/commit/256b3f037880aad077b0158e3551e10ce8a3dbc7)
|
|
133
|
+
|
|
134
|
+
### Features
|
|
135
|
+
- Add MiddlewareUtil providing convenience functions to all middleware [`b8ab775`](https://github.com/SAP/ui5-server/commit/b8ab775039635a25109797b92fe34358057ea5e8)
|
|
136
|
+
- Add test runner middleware [`ea77e20`](https://github.com/SAP/ui5-server/commit/ea77e201e20545fca7494fc581aa42adbcb2c1d7)
|
|
137
|
+
|
|
138
|
+
### BREAKING CHANGE
|
|
139
|
+
|
|
140
|
+
If the project a "*.properties" resource originates from cannot be
|
|
141
|
+
determined, or if the project does not define a
|
|
142
|
+
propertiesFileSourceEncoding configuration or uses a legacy specVersion
|
|
143
|
+
(<2.0), the serveResources middleware assumes that the resource is UTF-8
|
|
144
|
+
encoded instead of ISO-8859-1.
|
|
145
|
+
|
|
146
|
+
Support for older Node.js releases has been dropped.
|
|
147
|
+
Only Node.js v10 or higher is supported.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
<a name="v1.6.0"></a>
|
|
151
|
+
## [v1.6.0] - 2020-02-24
|
|
152
|
+
### Bug Fixes
|
|
153
|
+
- **versionInfo:** Fix pattern to glob for .library files [`3621f78`](https://github.com/SAP/ui5-server/commit/3621f7868dec891f8746ca4b66cf43c4d5d9782b)
|
|
154
|
+
|
|
155
|
+
### Features
|
|
156
|
+
- **serveThemes:** Support experimental CSS variables and skeleton build ([#278](https://github.com/SAP/ui5-server/issues/278)) [`47d4b55`](https://github.com/SAP/ui5-server/commit/47d4b55986fd84ef85f4b42e9c91f16017183c16)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
<a name="v1.5.4"></a>
|
|
160
|
+
## [v1.5.4] - 2020-02-10
|
|
161
|
+
### Bug Fixes
|
|
162
|
+
- Ensure proper handling of multi-byte characters in streams ([#280](https://github.com/SAP/ui5-server/issues/280)) [`fe652e4`](https://github.com/SAP/ui5-server/commit/fe652e410bd0eab506fc42036ad2cfa374fa5a6c)
|
|
163
|
+
- **serveIndex:** Add missing dependency to "graceful-fs" [`e09c472`](https://github.com/SAP/ui5-server/commit/e09c472eb20ed3d0b914c8b2e1d5f22bb8476dca)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<a name="v1.5.3"></a>
|
|
167
|
+
## [v1.5.3] - 2020-01-24
|
|
168
|
+
### Bug Fixes
|
|
169
|
+
- **sslUtils:** Fix Invalid Common Name error [`db06db7`](https://github.com/SAP/ui5-server/commit/db06db7a371ea7254c408f01cf231de9367c8b0d)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<a name="v1.5.2"></a>
|
|
173
|
+
## [v1.5.2] - 2019-12-16
|
|
174
|
+
### Bug Fixes
|
|
175
|
+
- Resolve ERR_CERT_REVOKED error for newly generated SSL certs [`f2e1522`](https://github.com/SAP/ui5-server/commit/f2e15229569e68990f63cd38849eb937d2ad9cb8)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
<a name="v1.5.1"></a>
|
|
179
|
+
## [v1.5.1] - 2019-11-19
|
|
180
|
+
### Dependency Updates
|
|
181
|
+
- Bump connect-openui5 from 0.8.0 to 0.9.0 [`0c6d502`](https://github.com/SAP/ui5-server/commit/0c6d50263c4828f5070404ac9dfa337667b24371)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<a name="v1.5.0"></a>
|
|
185
|
+
## [v1.5.0] - 2019-11-07
|
|
186
|
+
### Features
|
|
187
|
+
- **serveIndex:** use serve-index for serving the application index [`d6ea507`](https://github.com/SAP/ui5-server/commit/d6ea507bdd649653a865f01d4e076caa4313639f)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<a name="v1.4.0"></a>
|
|
191
|
+
## [v1.4.0] - 2019-10-24
|
|
192
|
+
### Features
|
|
193
|
+
- **Custom Middleware Extensibility:** Allow multiple definitions of the same custom middleware ([#246](https://github.com/SAP/ui5-server/issues/246)) [`55a24ef`](https://github.com/SAP/ui5-server/commit/55a24ef134b01b43683bc21fb24b46d4e472232d)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
<a name="v1.3.0"></a>
|
|
197
|
+
## [v1.3.0] - 2019-07-31
|
|
198
|
+
### Features
|
|
199
|
+
- Properties File Escaping ([#214](https://github.com/SAP/ui5-server/issues/214)) [`dd4844d`](https://github.com/SAP/ui5-server/commit/dd4844d53b787dc14bc5eecae2bc5674425200b7)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
<a name="v1.2.0"></a>
|
|
203
|
+
## [v1.2.0] - 2019-07-10
|
|
204
|
+
### Features
|
|
205
|
+
- **Server:** Add handling for custom middleware ([#200](https://github.com/SAP/ui5-server/issues/200)) [`037b3bc`](https://github.com/SAP/ui5-server/commit/037b3bc001b86061c807e78584e69c53e89d8b96)
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<a name="v1.1.3"></a>
|
|
209
|
+
## [v1.1.3] - 2019-06-24
|
|
210
|
+
### Bug Fixes
|
|
211
|
+
- **serveResources:** Correctly encode non UTF-8 resources [`1ee6723`](https://github.com/SAP/ui5-server/commit/1ee6723b5e5dac653c76a5078ee4afd6af96f8ac)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<a name="v1.1.2"></a>
|
|
215
|
+
## [v1.1.2] - 2019-06-03
|
|
216
|
+
### Bug Fixes
|
|
217
|
+
- **Middleware:** Allow usage without express server [`4d971b4`](https://github.com/SAP/ui5-server/commit/4d971b4babade56fef154dc4a7a524d6ffa8ad1b)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<a name="v1.1.1"></a>
|
|
221
|
+
## [v1.1.1] - 2019-05-13
|
|
222
|
+
### Bug Fixes
|
|
223
|
+
- Makes CSP middleware work in an environment without express server ([#184](https://github.com/SAP/ui5-server/issues/184)) [`c3089ad`](https://github.com/SAP/ui5-server/commit/c3089adeee030f4ace899c01944006583146e32e)
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
<a name="v1.1.0"></a>
|
|
227
|
+
## [v1.1.0] - 2019-04-25
|
|
228
|
+
### Dependency Updates
|
|
229
|
+
- Bump [@ui5](https://github.com/ui5)/fs from 1.0.1 to 1.0.2 ([#166](https://github.com/SAP/ui5-server/issues/166)) [`5ff4765`](https://github.com/SAP/ui5-server/commit/5ff476504254baf304c2cb9db83746438a10be92)
|
|
230
|
+
- Bump [@ui5](https://github.com/ui5)/logger from 1.0.0 to 1.0.1 ([#165](https://github.com/SAP/ui5-server/issues/165)) [`21be52a`](https://github.com/SAP/ui5-server/commit/21be52a109abd5096daefc54ce038a95bd437f6f)
|
|
231
|
+
- Bump [@ui5](https://github.com/ui5)/builder from 1.0.0 to 1.0.1 ([#126](https://github.com/SAP/ui5-server/issues/126)) [`e22c118`](https://github.com/SAP/ui5-server/commit/e22c1185e2e5fc718b50704b6a64a121413b3f93)
|
|
232
|
+
- Bump [@ui5](https://github.com/ui5)/fs from 1.0.0 to 1.0.1 [`255766a`](https://github.com/SAP/ui5-server/commit/255766a62981af2e5ef584015d2951d39189ef3a)
|
|
233
|
+
|
|
234
|
+
### Features
|
|
235
|
+
- Add Server Option to Send SAP's Target CSPs by default ([#179](https://github.com/SAP/ui5-server/issues/179)) [`4f05967`](https://github.com/SAP/ui5-server/commit/4f059670306c97ab5f34d82bb335f5ee21d73c72)
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<a name="v1.0.0"></a>
|
|
239
|
+
## [v1.0.0] - 2019-01-10
|
|
240
|
+
### Dependency Updates
|
|
241
|
+
- Bump [@ui5](https://github.com/ui5)/project from 0.2.5 to 1.0.0 ([#109](https://github.com/SAP/ui5-server/issues/109)) [`84d31a5`](https://github.com/SAP/ui5-server/commit/84d31a5340f77fc6ec54e9c5829c8ad656b2adb1)
|
|
242
|
+
- Bump [@ui5](https://github.com/ui5)/builder from 0.2.9 to 1.0.0 ([#108](https://github.com/SAP/ui5-server/issues/108)) [`8e39375`](https://github.com/SAP/ui5-server/commit/8e393754f71efe14e9cd5daf345012f2b1d7926d)
|
|
243
|
+
- Bump [@ui5](https://github.com/ui5)/fs from 0.2.0 to 1.0.0 ([#107](https://github.com/SAP/ui5-server/issues/107)) [`93e39af`](https://github.com/SAP/ui5-server/commit/93e39afc3e728ff2e829865d7de3c635a43241f0)
|
|
244
|
+
- Bump [@ui5](https://github.com/ui5)/logger from 0.2.2 to 1.0.0 ([#106](https://github.com/SAP/ui5-server/issues/106)) [`3687ad6`](https://github.com/SAP/ui5-server/commit/3687ad6b224cf9c37359de30917bc711fe7b239a)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
<a name="v0.2.2"></a>
|
|
248
|
+
## [v0.2.2] - 2018-10-29
|
|
249
|
+
|
|
250
|
+
<a name="v0.2.1"></a>
|
|
251
|
+
## [v0.2.1] - 2018-07-17
|
|
252
|
+
|
|
253
|
+
<a name="v0.2.0"></a>
|
|
254
|
+
## [v0.2.0] - 2018-07-12
|
|
255
|
+
|
|
256
|
+
<a name="v0.1.2"></a>
|
|
257
|
+
## [v0.1.2] - 2018-07-10
|
|
258
|
+
### Bug Fixes
|
|
259
|
+
- **CSP Middleware:** Export middleware, add report-uri [`2091c0c`](https://github.com/SAP/ui5-server/commit/2091c0cc093f9997c582e301ad52bbe74d4651d6)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
<a name="v0.1.1"></a>
|
|
263
|
+
## [v0.1.1] - 2018-07-10
|
|
264
|
+
### Features
|
|
265
|
+
- simplistic serveIndex with additional properties [`fa04ee2`](https://github.com/SAP/ui5-server/commit/fa04ee227cf5d4af4a8ba5d4d3fa594cee417da0)
|
|
266
|
+
- Add CSP middleware ([#3](https://github.com/SAP/ui5-server/issues/3)) [`f9ec3ee`](https://github.com/SAP/ui5-server/commit/f9ec3eeb43708462c2d683a80beb1816beeddc92)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
<a name="v0.1.0"></a>
|
|
270
|
+
## [v0.1.0] - 2018-06-26
|
|
271
|
+
|
|
272
|
+
<a name="v0.0.1"></a>
|
|
273
|
+
## v0.0.1 - 2018-06-06
|
|
274
|
+
|
|
275
|
+
[v3.0.0-alpha.2]: https://github.com/SAP/ui5-server/compare/v3.0.0-alpha.1...v3.0.0-alpha.2
|
|
276
|
+
[v3.0.0-alpha.1]: https://github.com/SAP/ui5-server/compare/v3.0.0-alpha.0...v3.0.0-alpha.1
|
|
277
|
+
[v3.0.0-alpha.0]: https://github.com/SAP/ui5-server/compare/v2.4.0...v3.0.0-alpha.0
|
|
278
|
+
[v2.4.0]: https://github.com/SAP/ui5-server/compare/v2.3.1...v2.4.0
|
|
279
|
+
[v2.3.1]: https://github.com/SAP/ui5-server/compare/v2.3.0...v2.3.1
|
|
280
|
+
[v2.3.0]: https://github.com/SAP/ui5-server/compare/v2.2.10...v2.3.0
|
|
281
|
+
[v2.2.10]: https://github.com/SAP/ui5-server/compare/v2.2.9...v2.2.10
|
|
282
|
+
[v2.2.9]: https://github.com/SAP/ui5-server/compare/v2.2.8...v2.2.9
|
|
283
|
+
[v2.2.8]: https://github.com/SAP/ui5-server/compare/v2.2.7...v2.2.8
|
|
284
|
+
[v2.2.7]: https://github.com/SAP/ui5-server/compare/v2.2.6...v2.2.7
|
|
285
|
+
[v2.2.6]: https://github.com/SAP/ui5-server/compare/v2.2.5...v2.2.6
|
|
286
|
+
[v2.2.5]: https://github.com/SAP/ui5-server/compare/v2.2.4...v2.2.5
|
|
287
|
+
[v2.2.4]: https://github.com/SAP/ui5-server/compare/v2.2.3...v2.2.4
|
|
288
|
+
[v2.2.3]: https://github.com/SAP/ui5-server/compare/v2.2.2...v2.2.3
|
|
289
|
+
[v2.2.2]: https://github.com/SAP/ui5-server/compare/v2.2.1...v2.2.2
|
|
290
|
+
[v2.2.1]: https://github.com/SAP/ui5-server/compare/v2.2.0...v2.2.1
|
|
291
|
+
[v2.2.0]: https://github.com/SAP/ui5-server/compare/v2.1.0...v2.2.0
|
|
292
|
+
[v2.1.0]: https://github.com/SAP/ui5-server/compare/v2.0.3...v2.1.0
|
|
293
|
+
[v2.0.3]: https://github.com/SAP/ui5-server/compare/v2.0.2...v2.0.3
|
|
294
|
+
[v2.0.2]: https://github.com/SAP/ui5-server/compare/v2.0.1...v2.0.2
|
|
295
|
+
[v2.0.1]: https://github.com/SAP/ui5-server/compare/v2.0.0...v2.0.1
|
|
296
|
+
[v2.0.0]: https://github.com/SAP/ui5-server/compare/v1.6.0...v2.0.0
|
|
297
|
+
[v1.6.0]: https://github.com/SAP/ui5-server/compare/v1.5.4...v1.6.0
|
|
298
|
+
[v1.5.4]: https://github.com/SAP/ui5-server/compare/v1.5.3...v1.5.4
|
|
299
|
+
[v1.5.3]: https://github.com/SAP/ui5-server/compare/v1.5.2...v1.5.3
|
|
300
|
+
[v1.5.2]: https://github.com/SAP/ui5-server/compare/v1.5.1...v1.5.2
|
|
301
|
+
[v1.5.1]: https://github.com/SAP/ui5-server/compare/v1.5.0...v1.5.1
|
|
302
|
+
[v1.5.0]: https://github.com/SAP/ui5-server/compare/v1.4.0...v1.5.0
|
|
303
|
+
[v1.4.0]: https://github.com/SAP/ui5-server/compare/v1.3.0...v1.4.0
|
|
304
|
+
[v1.3.0]: https://github.com/SAP/ui5-server/compare/v1.2.0...v1.3.0
|
|
305
|
+
[v1.2.0]: https://github.com/SAP/ui5-server/compare/v1.1.3...v1.2.0
|
|
306
|
+
[v1.1.3]: https://github.com/SAP/ui5-server/compare/v1.1.2...v1.1.3
|
|
307
|
+
[v1.1.2]: https://github.com/SAP/ui5-server/compare/v1.1.1...v1.1.2
|
|
308
|
+
[v1.1.1]: https://github.com/SAP/ui5-server/compare/v1.1.0...v1.1.1
|
|
309
|
+
[v1.1.0]: https://github.com/SAP/ui5-server/compare/v1.0.0...v1.1.0
|
|
310
|
+
[v1.0.0]: https://github.com/SAP/ui5-server/compare/v0.2.2...v1.0.0
|
|
311
|
+
[v0.2.2]: https://github.com/SAP/ui5-server/compare/v0.2.1...v0.2.2
|
|
312
|
+
[v0.2.1]: https://github.com/SAP/ui5-server/compare/v0.2.0...v0.2.1
|
|
313
|
+
[v0.2.0]: https://github.com/SAP/ui5-server/compare/v0.1.2...v0.2.0
|
|
314
|
+
[v0.1.2]: https://github.com/SAP/ui5-server/compare/v0.1.1...v0.1.2
|
|
315
|
+
[v0.1.1]: https://github.com/SAP/ui5-server/compare/v0.1.0...v0.1.1
|
|
316
|
+
[v0.1.0]: https://github.com/SAP/ui5-server/compare/v0.0.1...v0.1.0
|
|
@@ -17,14 +17,14 @@ const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
|
|
|
17
17
|
* @memberof module:@ui5/server.middleware
|
|
18
18
|
*/
|
|
19
19
|
class MiddlewareManager {
|
|
20
|
-
constructor({
|
|
20
|
+
constructor({graph, resources, options = {
|
|
21
21
|
sendSAPTargetCSP: false,
|
|
22
22
|
serveCSPReports: false
|
|
23
23
|
}}) {
|
|
24
|
-
if (!
|
|
24
|
+
if (!graph || !resources || !resources.all || !resources.rootProject || !resources.dependencies) {
|
|
25
25
|
throw new Error("[MiddlewareManager]: One or more mandatory parameters not provided");
|
|
26
26
|
}
|
|
27
|
-
this.
|
|
27
|
+
this.graph = graph;
|
|
28
28
|
this.resources = resources;
|
|
29
29
|
this.options = options;
|
|
30
30
|
|
|
@@ -44,15 +44,19 @@ class MiddlewareManager {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async addMiddleware(configuredMiddlewareName, {
|
|
47
|
-
wrapperCallback, mountPath = "/",
|
|
47
|
+
customMiddleware, wrapperCallback, mountPath = "/",
|
|
48
48
|
beforeMiddleware, afterMiddleware
|
|
49
49
|
} = {}) {
|
|
50
|
-
const middlewareInfo = middlewareRepository.getMiddleware(configuredMiddlewareName);
|
|
51
50
|
let middlewareCallback;
|
|
52
|
-
if (
|
|
53
|
-
middlewareCallback =
|
|
51
|
+
if (customMiddleware) {
|
|
52
|
+
middlewareCallback = customMiddleware;
|
|
54
53
|
} else {
|
|
55
|
-
|
|
54
|
+
const middlewareInfo = middlewareRepository.getMiddleware(configuredMiddlewareName);
|
|
55
|
+
if (wrapperCallback) {
|
|
56
|
+
middlewareCallback = wrapperCallback(middlewareInfo);
|
|
57
|
+
} else {
|
|
58
|
+
middlewareCallback = middlewareInfo.middleware;
|
|
59
|
+
}
|
|
56
60
|
}
|
|
57
61
|
|
|
58
62
|
let middlewareName = configuredMiddlewareName;
|
|
@@ -188,7 +192,7 @@ class MiddlewareManager {
|
|
|
188
192
|
return versionInfoModule({
|
|
189
193
|
resources,
|
|
190
194
|
middlewareUtil,
|
|
191
|
-
|
|
195
|
+
graph: this.graph
|
|
192
196
|
});
|
|
193
197
|
};
|
|
194
198
|
}
|
|
@@ -211,47 +215,46 @@ class MiddlewareManager {
|
|
|
211
215
|
}
|
|
212
216
|
|
|
213
217
|
async addCustomMiddleware() {
|
|
214
|
-
const project = this.
|
|
215
|
-
const projectCustomMiddleware = project.
|
|
216
|
-
if (!projectCustomMiddleware
|
|
218
|
+
const project = this.graph.getRoot();
|
|
219
|
+
const projectCustomMiddleware = project.getCustomMiddleware();
|
|
220
|
+
if (!projectCustomMiddleware.length === 0) {
|
|
217
221
|
return; // No custom middleware defined
|
|
218
222
|
}
|
|
219
223
|
|
|
220
224
|
for (let i = 0; i < projectCustomMiddleware.length; i++) {
|
|
221
225
|
const middlewareDef = projectCustomMiddleware[i];
|
|
222
226
|
if (!middlewareDef.name) {
|
|
223
|
-
throw new Error(`Missing name for custom middleware definition of project ${project.
|
|
227
|
+
throw new Error(`Missing name for custom middleware definition of project ${project.getName()} ` +
|
|
224
228
|
`at index ${i}`);
|
|
225
229
|
}
|
|
226
230
|
if (middlewareDef.beforeMiddleware && middlewareDef.afterMiddleware) {
|
|
227
231
|
throw new Error(
|
|
228
|
-
`Custom middleware definition ${middlewareDef.name} of project ${project.
|
|
232
|
+
`Custom middleware definition ${middlewareDef.name} of project ${project.getName()} ` +
|
|
229
233
|
`defines both "beforeMiddleware" and "afterMiddleware" parameters. Only one must be defined.`);
|
|
230
234
|
}
|
|
231
235
|
if (!middlewareDef.beforeMiddleware && !middlewareDef.afterMiddleware) {
|
|
232
236
|
throw new Error(
|
|
233
|
-
`Custom middleware definition ${middlewareDef.name} of project ${project.
|
|
237
|
+
`Custom middleware definition ${middlewareDef.name} of project ${project.getName()} ` +
|
|
234
238
|
`defines neither a "beforeMiddleware" nor an "afterMiddleware" parameter. One must be defined.`);
|
|
235
239
|
}
|
|
236
|
-
|
|
237
240
|
await this.addMiddleware(middlewareDef.name, {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const params = {resources, options};
|
|
244
|
-
if (
|
|
245
|
-
specVersion === "2.0" || specVersion === "2.1" ||
|
|
246
|
-
specVersion === "2.2" || specVersion === "2.3" ||
|
|
247
|
-
specVersion === "2.4" || specVersion === "2.5" ||
|
|
248
|
-
specVersion === "2.6"
|
|
249
|
-
) {
|
|
250
|
-
// Supply interface to MiddlewareUtil instance starting with specVersion 2.0
|
|
251
|
-
params.middlewareUtil = middlewareUtil.getInterface(specVersion);
|
|
252
|
-
}
|
|
253
|
-
return middleware(params);
|
|
241
|
+
customMiddleware: ({resources, middlewareUtil}) => {
|
|
242
|
+
const customMiddleware = this.graph.getExtension(middlewareDef.name);
|
|
243
|
+
const specVersion = customMiddleware.getSpecVersion();
|
|
244
|
+
const options = {
|
|
245
|
+
configuration: middlewareDef.configuration
|
|
254
246
|
};
|
|
247
|
+
const params = {resources, options};
|
|
248
|
+
if (
|
|
249
|
+
specVersion === "2.0" || specVersion === "2.1" ||
|
|
250
|
+
specVersion === "2.2" || specVersion === "2.3" ||
|
|
251
|
+
specVersion === "2.4" || specVersion === "2.5" ||
|
|
252
|
+
specVersion === "2.6"
|
|
253
|
+
) {
|
|
254
|
+
// Supply interface to MiddlewareUtil instance starting with specVersion 2.0
|
|
255
|
+
params.middlewareUtil = middlewareUtil.getInterface(specVersion);
|
|
256
|
+
}
|
|
257
|
+
return customMiddleware.getMiddleware()(params);
|
|
255
258
|
},
|
|
256
259
|
mountPath: middlewareDef.mountPath,
|
|
257
260
|
beforeMiddleware: middlewareDef.beforeMiddleware,
|
|
@@ -21,8 +21,7 @@ function getMiddleware(middlewareName) {
|
|
|
21
21
|
try {
|
|
22
22
|
const middleware = require(middlewareInfo.path);
|
|
23
23
|
return {
|
|
24
|
-
middleware
|
|
25
|
-
specVersion: middlewareInfo.specVersion
|
|
24
|
+
middleware
|
|
26
25
|
};
|
|
27
26
|
} catch (err) {
|
|
28
27
|
throw new Error(
|
|
@@ -30,17 +29,6 @@ function getMiddleware(middlewareName) {
|
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
function addMiddleware({name, specVersion, middlewarePath}) {
|
|
34
|
-
if (middlewareInfos[name]) {
|
|
35
|
-
throw new Error(`middlewareRepository: A middleware with the name ${name} has already been registered`);
|
|
36
|
-
}
|
|
37
|
-
middlewareInfos[name] = {
|
|
38
|
-
path: middlewarePath,
|
|
39
|
-
specVersion
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
32
|
module.exports = {
|
|
44
|
-
getMiddleware: getMiddleware
|
|
45
|
-
addMiddleware: addMiddleware
|
|
33
|
+
getMiddleware: getMiddleware
|
|
46
34
|
};
|
|
@@ -54,9 +54,8 @@ function createResourceInfo(resource) {
|
|
|
54
54
|
lastModified: new Date(stat.mtime).toLocaleString(),
|
|
55
55
|
size: formatSize(stat.size),
|
|
56
56
|
sizeInBytes: stat.size,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
projectPath: resource._project ? resource._project.path : "<unknown>"
|
|
57
|
+
project: resource.getProject()?.getName() || "<unknown>",
|
|
58
|
+
projectPath: resource.getProject()?.getPath() || "<unknown>"
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
61
|
|
|
@@ -41,12 +41,11 @@ function createMiddleware({resources, middlewareUtil}) {
|
|
|
41
41
|
if (rProperties.test(resourcePath)) {
|
|
42
42
|
// Special handling for *.properties files escape non ascii characters.
|
|
43
43
|
const nonAsciiEscaper = require("@ui5/builder").processors.nonAsciiEscaper;
|
|
44
|
-
const project = resource.
|
|
45
|
-
let propertiesFileSourceEncoding = project
|
|
46
|
-
project.resources.configuration && project.resources.configuration.propertiesFileSourceEncoding;
|
|
44
|
+
const project = resource.getProject();
|
|
45
|
+
let propertiesFileSourceEncoding = project?.getPropertiesFileSourceEncoding();
|
|
47
46
|
|
|
48
47
|
if (!propertiesFileSourceEncoding) {
|
|
49
|
-
if (project && ["0.1", "1.0", "1.1"].includes(project.
|
|
48
|
+
if (project && ["0.1", "1.0", "1.1"].includes(project.getSpecVersion())) {
|
|
50
49
|
// default encoding to "ISO-8859-1" for old specVersions
|
|
51
50
|
propertiesFileSourceEncoding = "ISO-8859-1";
|
|
52
51
|
} else {
|
|
@@ -84,9 +83,9 @@ function createMiddleware({resources, middlewareUtil}) {
|
|
|
84
83
|
// Also, only process .library, *.js and *.json files. Just like it's done in Application-
|
|
85
84
|
// and LibraryBuilder
|
|
86
85
|
if ((!charset || charset === "UTF-8") && rReplaceVersion.test(resourcePath)) {
|
|
87
|
-
if (resource.
|
|
86
|
+
if (resource.getProject()) {
|
|
88
87
|
stream.setEncoding("utf8");
|
|
89
|
-
stream = stream.pipe(replaceStream("${version}", resource.
|
|
88
|
+
stream = stream.pipe(replaceStream("${version}", resource.getProject().getVersion()));
|
|
90
89
|
} else {
|
|
91
90
|
log.verbose("Project missing from resource %s", pathname);
|
|
92
91
|
}
|
|
@@ -9,21 +9,21 @@ const MANIFEST_JSON = "manifest.json";
|
|
|
9
9
|
* @module @ui5/server/middleware/versionInfo
|
|
10
10
|
* @param {object} parameters Parameters
|
|
11
11
|
* @param {module:@ui5/server.middleware.MiddlewareManager.middlewareResources} parameters.resources Parameters
|
|
12
|
-
* @param {
|
|
12
|
+
* @param {module:@ui5/project.graph.ProjectGraph} parameters.graph Project graph
|
|
13
13
|
* @returns {Function} Returns a server middleware closure.
|
|
14
14
|
*/
|
|
15
|
-
function createMiddleware({resources,
|
|
15
|
+
function createMiddleware({resources, graph}) {
|
|
16
16
|
return async function versionInfo(req, res, next) {
|
|
17
17
|
try {
|
|
18
18
|
const dependencies = resources.dependencies;
|
|
19
19
|
const dotLibResources = await dependencies.byGlob("/resources/**/.library");
|
|
20
20
|
|
|
21
21
|
dotLibResources.sort((a, b) => {
|
|
22
|
-
return a.
|
|
22
|
+
return a.getProject().getName().localeCompare(b.getProject().getName());
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
const libraryInfosPromises = dotLibResources.map(async (dotLibResource) => {
|
|
26
|
-
const namespace = dotLibResource.
|
|
26
|
+
const namespace = dotLibResource.getProject().getNamespace();
|
|
27
27
|
const manifestResources = await dependencies.byGlob(`/resources/${namespace}/**/${MANIFEST_JSON}`);
|
|
28
28
|
let libraryManifest = manifestResources.find((manifestResource) => {
|
|
29
29
|
return manifestResource.getPath() === `/resources/${namespace}/${MANIFEST_JSON}`;
|
|
@@ -40,22 +40,25 @@ function createMiddleware({resources, tree: project}) {
|
|
|
40
40
|
resources: libResources,
|
|
41
41
|
options: {
|
|
42
42
|
omitMinVersions: true
|
|
43
|
+
},
|
|
44
|
+
getProjectVersion: (projectName) => {
|
|
45
|
+
return graph.getProject(projectName)?.getVersion();
|
|
43
46
|
}
|
|
44
47
|
});
|
|
45
48
|
}
|
|
46
49
|
return {
|
|
47
50
|
libraryManifest,
|
|
48
51
|
embeddedManifests,
|
|
49
|
-
name: dotLibResource.
|
|
50
|
-
version: dotLibResource.
|
|
52
|
+
name: dotLibResource.getProject().getName(),
|
|
53
|
+
version: dotLibResource.getProject().getVersion()
|
|
51
54
|
};
|
|
52
55
|
});
|
|
56
|
+
const rootProject = graph.getRoot();
|
|
53
57
|
const libraryInfos = await Promise.all(libraryInfosPromises);
|
|
54
|
-
|
|
55
58
|
const [versionInfoResource] = await createVersionInfoProcessor({
|
|
56
59
|
options: {
|
|
57
|
-
rootProjectName:
|
|
58
|
-
rootProjectVersion:
|
|
60
|
+
rootProjectName: rootProject.getName(),
|
|
61
|
+
rootProjectVersion: rootProject.getVersion(),
|
|
59
62
|
libraryInfos
|
|
60
63
|
}
|
|
61
64
|
});
|
package/lib/server.js
CHANGED
|
@@ -112,7 +112,7 @@ module.exports = {
|
|
|
112
112
|
* Start a server for the given project (sub-)tree.
|
|
113
113
|
*
|
|
114
114
|
* @public
|
|
115
|
-
* @param {
|
|
115
|
+
* @param {module:@ui5/project.graph.ProjectGraph} graph Project graph
|
|
116
116
|
* @param {object} options Options
|
|
117
117
|
* @param {number} options.port Port to listen to
|
|
118
118
|
* @param {boolean} [options.changePortIfInUse=false] If true, change the port if it is already in use
|
|
@@ -133,27 +133,41 @@ module.exports = {
|
|
|
133
133
|
* <code>h2</code>-flag and a <code>close</code> function,
|
|
134
134
|
* which can be used to stop the server.
|
|
135
135
|
*/
|
|
136
|
-
async serve(
|
|
136
|
+
async serve(graph, {
|
|
137
137
|
port: requestedPort, changePortIfInUse = false, h2 = false, key, cert,
|
|
138
138
|
acceptRemoteConnections = false, sendSAPTargetCSP = false, simpleIndex = false, serveCSPReports = false
|
|
139
139
|
}) {
|
|
140
|
-
const
|
|
140
|
+
const rootProject = graph.getRoot();
|
|
141
141
|
|
|
142
|
+
const readers = [];
|
|
143
|
+
await graph.traverseBreadthFirst(async function({project: dep}) {
|
|
144
|
+
if (dep.getName() === rootProject.getName()) {
|
|
145
|
+
// Ignore root project
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
readers.push(dep.getReader({style: "runtime"}));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
const dependencies = resourceFactory.createReaderCollection({
|
|
152
|
+
name: `Dependency reader collection for project ${rootProject.getName()}`,
|
|
153
|
+
readers
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
const rootReader = rootProject.getReader({style: "runtime"});
|
|
142
157
|
|
|
143
158
|
// TODO change to ReaderCollection once duplicates are sorted out
|
|
144
159
|
const combo = new ReaderCollectionPrioritized({
|
|
145
160
|
name: "server - prioritize workspace over dependencies",
|
|
146
|
-
readers: [
|
|
161
|
+
readers: [rootReader, dependencies]
|
|
147
162
|
});
|
|
148
|
-
|
|
149
163
|
const resources = {
|
|
150
|
-
rootProject:
|
|
151
|
-
dependencies:
|
|
164
|
+
rootProject: rootReader,
|
|
165
|
+
dependencies: dependencies,
|
|
152
166
|
all: combo
|
|
153
167
|
};
|
|
154
168
|
|
|
155
169
|
const middlewareManager = new MiddlewareManager({
|
|
156
|
-
|
|
170
|
+
graph,
|
|
157
171
|
resources,
|
|
158
172
|
options: {
|
|
159
173
|
sendSAPTargetCSP,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/server",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.2",
|
|
4
4
|
"description": "UI5 Tooling - Server",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -37,13 +37,14 @@
|
|
|
37
37
|
"jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
|
|
38
38
|
"jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
|
|
39
39
|
"preversion": "npm test",
|
|
40
|
-
"version": "git-chglog --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
|
|
40
|
+
"version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md && git add CHANGELOG.md",
|
|
41
41
|
"postversion": "git push --follow-tags",
|
|
42
|
-
"release-note": "git-chglog -c .chglog/release-config.yml v$npm_package_version",
|
|
42
|
+
"release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
|
|
43
43
|
"depcheck": "depcheck --ignores docdash,compression,cors"
|
|
44
44
|
},
|
|
45
45
|
"files": [
|
|
46
46
|
"index.js",
|
|
47
|
+
"CHANGELOG.md",
|
|
47
48
|
"CONTRIBUTING.md",
|
|
48
49
|
"jsdoc.json",
|
|
49
50
|
"lib/**",
|
|
@@ -104,8 +105,8 @@
|
|
|
104
105
|
"url": "git@github.com:SAP/ui5-server.git"
|
|
105
106
|
},
|
|
106
107
|
"dependencies": {
|
|
107
|
-
"@ui5/builder": "^3.0.0-alpha.
|
|
108
|
-
"@ui5/fs": "^3.0.0-alpha.
|
|
108
|
+
"@ui5/builder": "^3.0.0-alpha.7",
|
|
109
|
+
"@ui5/fs": "^3.0.0-alpha.4",
|
|
109
110
|
"@ui5/logger": "^3.0.1-alpha.1",
|
|
110
111
|
"body-parser": "^1.19.1",
|
|
111
112
|
"compression": "^1.7.4",
|
|
@@ -128,7 +129,7 @@
|
|
|
128
129
|
"yesno": "^0.3.1"
|
|
129
130
|
},
|
|
130
131
|
"devDependencies": {
|
|
131
|
-
"@ui5/project": "^3.0.0-alpha.
|
|
132
|
+
"@ui5/project": "^3.0.0-alpha.3",
|
|
132
133
|
"ava": "^3.15.0",
|
|
133
134
|
"chokidar-cli": "^3.0.0",
|
|
134
135
|
"cross-env": "^7.0.3",
|