@ui5/server 3.0.0-beta.4 → 3.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,26 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v3.0.0-beta.4...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v3.0.0-rc.0...HEAD).
6
+
7
+ <a name="v3.0.0-rc.0"></a>
8
+ ## [v3.0.0-rc.0] - 2022-12-23
9
+ ### Breaking Changes
10
+ - Remove "/proxy" endpoint ([#550](https://github.com/SAP/ui5-server/issues/550)) [`4bdf839`](https://github.com/SAP/ui5-server/commit/4bdf839e96f67ddbc4cb2a18216921d54df4006e)
11
+
12
+ ### BREAKING CHANGE
13
+
14
+ This removes the "/proxy" endpoint and the corresponding
15
+ "connectUi5Proxy" middleware from the standard ui5-server.
16
+ Internally, this middleware made use of the connect-openui5 proxy
17
+ implementation (https://github.com/SAP/connect-openui5#proxy).
18
+
19
+ More sophisticated proxy solutions for ui5-server are already available
20
+ in the form of custom middleware extensions from the UI5-community.
21
+
22
+ The UI5 Team might provide a dedicated custom middleware extension,
23
+ with similar functionality, in the future.
24
+
6
25
 
7
26
  <a name="v3.0.0-beta.4"></a>
8
27
  ## [v3.0.0-beta.4] - 2022-12-01
@@ -308,6 +327,7 @@ Only Node.js v10 or higher is supported.
308
327
  <a name="v0.0.1"></a>
309
328
  ## v0.0.1 - 2018-06-06
310
329
 
330
+ [v3.0.0-rc.0]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.4...v3.0.0-rc.0
311
331
  [v3.0.0-beta.4]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.3...v3.0.0-beta.4
312
332
  [v3.0.0-beta.3]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.2...v3.0.0-beta.3
313
333
  [v3.0.0-beta.2]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.1...v3.0.0-beta.2
package/jsdoc.json CHANGED
@@ -27,7 +27,7 @@
27
27
  "openGraph": {
28
28
  "title": "UI5 Tooling - API Reference",
29
29
  "type": "website",
30
- "image": "https://sap.github.io/ui5-tooling/docs/images/UI5_logo_wide.png",
30
+ "image": "https://sap.github.io/ui5-tooling/v3/images/UI5_logo_wide.png",
31
31
  "site_name": "UI5 Tooling - API Reference",
32
32
  "url": "https://sap.github.io/ui5-tooling/"
33
33
  },
@@ -96,6 +96,14 @@ class MiddlewareManager {
96
96
  if (beforeMiddleware || afterMiddleware) {
97
97
  const refMiddlewareName = beforeMiddleware || afterMiddleware;
98
98
  let refMiddlewareIdx = this.middlewareExecutionOrder.indexOf(refMiddlewareName);
99
+
100
+ if (refMiddlewareName === "connectUi5Proxy") {
101
+ throw new Error(
102
+ `Standard middleware "connectUi5Proxy", referenced by middleware "${middlewareName}" ` +
103
+ `in project ${this.middlewareUtil.getProject()}, ` +
104
+ `has been removed in this version of UI5 Tooling and can't be referenced anymore. ` +
105
+ `Please see the migration guide at https://sap.github.io/ui5-tooling/updates/migrate-v3/`);
106
+ }
99
107
  if (refMiddlewareIdx === -1) {
100
108
  throw new Error(`Could not find middleware ${refMiddlewareName}, referenced by custom ` +
101
109
  `middleware ${middlewareName}`);
@@ -223,9 +231,6 @@ class MiddlewareManager {
223
231
  };
224
232
  }
225
233
  });
226
- await this.addMiddleware("connectUi5Proxy", {
227
- mountPath: "/proxy"
228
- });
229
234
  // Handle anything but read operations *before* the serveIndex middleware
230
235
  // as it will reject them with a 405 (Method not allowed) instead of 404 like our old tooling
231
236
  await this.addMiddleware("nonReadRequests");
@@ -295,7 +300,7 @@ class MiddlewareManager {
295
300
  const specVersion = customMiddleware.getSpecVersion();
296
301
  if (specVersion.gte("3.0")) {
297
302
  params.options.middlewareName = middlewareName;
298
- params.log = logger.getGroupLogger(`server:custom-middleware:${middlewareDef.name}`);
303
+ params.log = logger.getLogger(`server:custom-middleware:${middlewareDef.name}`);
299
304
  }
300
305
  const middlewareUtilInterface = middlewareUtil.getInterface(specVersion);
301
306
  if (middlewareUtilInterface) {
@@ -119,15 +119,25 @@ class MiddlewareUtil {
119
119
  * This method is only available to custom server middleware extensions defining
120
120
  * <b>Specification Version 3.0 and above</b>.
121
121
  *
122
- * @param {string} [projectName] Name of the project to retrieve. Defaults to the project currently being built
122
+ * @param {string|@ui5/fs/Resource} [projectNameOrResource]
123
+ * Name of the project to retrieve or a Resource instance to retrieve the associated project for.
124
+ * Defaults to the name of the current root project
123
125
  * @returns {@ui5/project/build/helpers/MiddlewareUtill~ProjectInterface|undefined}
124
- * project instance or undefined if the project is unknown to the graph
126
+ * Specification Version-dependent interface to the Project instance or <code>undefined</code>
127
+ * if the project name is unknown or the provided resource is not associated with any project.
125
128
  * @public
126
129
  */
127
- getProject(projectName) {
128
- if (projectName) {
129
- return this._graph.getProject(projectName);
130
+ getProject(projectNameOrResource) {
131
+ if (projectNameOrResource) {
132
+ if (typeof projectNameOrResource === "string" || projectNameOrResource instanceof String) {
133
+ // A project name has been provided
134
+ return this._graph.getProject(projectNameOrResource);
135
+ } else {
136
+ // A Resource instance has been provided
137
+ return projectNameOrResource.getProject();
138
+ }
130
139
  }
140
+ // No parameter has been provided, default to the root project
131
141
  return this._project;
132
142
  }
133
143
 
@@ -139,7 +149,8 @@ class MiddlewareUtil {
139
149
  * This method is only available to custom server middleware extensions defining
140
150
  * <b>Specification Version 3.0 and above</b>.
141
151
  *
142
- * @param {string} [projectName] Name of the project to retrieve. Defaults to the project currently being built
152
+ * @param {string} [projectName] Name of the project to retrieve.
153
+ * Defaults to the name of the current root project
143
154
  * @returns {string[]} Names of all direct dependencies
144
155
  * @throws {Error} If the requested project is unknown to the graph
145
156
  * @public
@@ -6,7 +6,6 @@ const middlewareInfos = {
6
6
  serveIndex: {path: "./serveIndex.js"},
7
7
  discovery: {path: "./discovery.js"},
8
8
  versionInfo: {path: "./versionInfo.js"},
9
- connectUi5Proxy: {path: "./connectUi5Proxy.js"},
10
9
  serveThemes: {path: "./serveThemes.js"},
11
10
  testRunner: {path: "./testRunner.js"},
12
11
  nonReadRequests: {path: "./nonReadRequests.js"}
@@ -84,7 +84,7 @@ function createMiddleware({resources, middlewareUtil}) {
84
84
  stream.setEncoding("utf8");
85
85
  stream = stream.pipe(replaceStream("${version}", resource.getProject().getVersion()));
86
86
  } else {
87
- log.verbose("Project missing from resource %s", pathname);
87
+ log.verbose(`Project missing from resource ${pathname}"`);
88
88
  }
89
89
  }
90
90
 
package/lib/sslUtil.js CHANGED
@@ -1,15 +1,9 @@
1
1
  import os from "node:os";
2
- import fs from "node:fs";
3
- import logger from "@ui5/logger";
4
- const log = logger.getLogger("server:sslUtil");
5
- import {promisify} from "node:util";
6
-
7
- const stat = promisify(fs.stat);
2
+ import {stat, readFile, writeFile, mkdir} from "node:fs/promises";
8
3
  import path from "node:path";
4
+ import logger from "@ui5/logger";
9
5
 
10
- const readFile = promisify(fs.readFile);
11
- const writeFile = promisify(fs.writeFile);
12
-
6
+ const log = logger.getLogger("server:sslUtil");
13
7
 
14
8
  /**
15
9
  * @private
@@ -87,13 +81,11 @@ async function createAndInstallCertificate(keyPath, certPath) {
87
81
 
88
82
  const {key, cert} = await devCert("UI5Tooling");
89
83
 
90
- const {default: makeDir} = await import("make-dir");
91
-
92
84
  await Promise.all([
93
85
  // Write certificates to the ui5 certificate folder
94
86
  // such that they are used by default upon next startup
95
- makeDir(path.dirname(keyPath)).then(() => writeFile(keyPath, key)),
96
- makeDir(path.dirname(certPath)).then(() => writeFile(certPath, cert))
87
+ mkdir(path.dirname(keyPath), {recursive: true}).then(() => writeFile(keyPath, key)),
88
+ mkdir(path.dirname(certPath), {recursive: true}).then(() => writeFile(certPath, cert))
97
89
  ]);
98
90
  return {key, cert};
99
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/server",
3
- "version": "3.0.0-beta.4",
3
+ "version": "3.0.0-rc.0",
4
4
  "description": "UI5 Tooling - Server",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -115,12 +115,11 @@
115
115
  "url": "git@github.com:SAP/ui5-server.git"
116
116
  },
117
117
  "dependencies": {
118
- "@ui5/builder": "^3.0.0-beta.4",
119
- "@ui5/fs": "^3.0.0-beta.4",
120
- "@ui5/logger": "^3.0.1-beta.1",
118
+ "@ui5/builder": "^3.0.0-rc.0",
119
+ "@ui5/fs": "^3.0.0-rc.0",
120
+ "@ui5/logger": "^3.0.1-rc.0",
121
121
  "body-parser": "^1.20.1",
122
122
  "compression": "^1.7.4",
123
- "connect-openui5": "^0.10.3",
124
123
  "cors": "^2.8.5",
125
124
  "devcert-sanscache": "^0.4.8",
126
125
  "escape-html": "^1.0.3",
@@ -128,34 +127,33 @@
128
127
  "express": "^4.18.2",
129
128
  "fresh": "^0.5.2",
130
129
  "graceful-fs": "^4.2.10",
131
- "make-dir": "^3.1.0",
132
130
  "mime-types": "^2.1.35",
133
131
  "parseurl": "^1.3.3",
134
132
  "portscanner": "^2.2.0",
135
133
  "replacestream": "^4.0.3",
136
134
  "router": "^1.3.7",
137
135
  "spdy": "^4.0.2",
138
- "yesno": "^0.3.1"
136
+ "yesno": "^0.4.0"
139
137
  },
140
138
  "devDependencies": {
141
139
  "@istanbuljs/esm-loader-hook": "^0.2.0",
142
- "@ui5/project": "^3.0.0-beta.4",
140
+ "@ui5/project": "^3.0.0-beta.5",
143
141
  "ava": "^5.1.0",
144
142
  "chokidar-cli": "^3.0.0",
145
143
  "cross-env": "^7.0.3",
146
144
  "depcheck": "^1.4.3",
147
145
  "docdash": "^2.0.0",
148
- "eslint": "^8.28.0",
146
+ "eslint": "^8.30.0",
149
147
  "eslint-config-google": "^0.14.0",
150
148
  "eslint-plugin-ava": "^13.2.0",
151
149
  "eslint-plugin-jsdoc": "^39.6.4",
152
- "esmock": "^2.0.9",
150
+ "esmock": "^2.1.0",
153
151
  "jsdoc": "^3.6.11",
154
152
  "nyc": "^15.1.0",
155
153
  "open-cli": "^7.1.0",
156
154
  "rimraf": "^3.0.2",
157
- "sinon": "^14.0.2",
158
- "supertest": "^6.3.1",
155
+ "sinon": "^15.0.1",
156
+ "supertest": "^6.3.3",
159
157
  "tap-nyan": "^1.1.0",
160
158
  "tap-xunit": "^2.4.1"
161
159
  }
@@ -1,9 +0,0 @@
1
- import ui5connect from "connect-openui5";
2
-
3
- function createMiddleware() {
4
- return ui5connect.proxy({
5
- secure: false
6
- });
7
- }
8
-
9
- export default createMiddleware;