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

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/.reuse/dep5 CHANGED
@@ -25,7 +25,7 @@ Disclaimer: The code in this project may include calls to APIs (“API Calls”)
25
25
  parties the right to use of access any SAP External Product, through API Calls.
26
26
 
27
27
  Files: *
28
- Copyright: 2018-2022 SAP SE or an SAP affiliate company and UI5 Tooling contributors
28
+ Copyright: 2018-2023 SAP SE or an SAP affiliate company and UI5 Tooling contributors
29
29
  License: Apache-2.0
30
30
 
31
31
  Files: lib/middleware/serveIndex/*
@@ -36,5 +36,5 @@ Copyright: 2010 Sencha Inc.
36
36
  License: MIT
37
37
 
38
38
  Files: lib/middleware/testRunner/*
39
- Copyright: 2009-2022 SAP SE or an SAP affiliate company and OpenUI5 contributors
39
+ Copyright: 2009-2023 SAP SE or an SAP affiliate company and OpenUI5 contributors
40
40
  License: Apache-2.0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,29 @@
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.1...HEAD).
6
+
7
+ <a name="v3.0.0-rc.1"></a>
8
+ ## [v3.0.0-rc.1] - 2023-01-23
9
+
10
+ <a name="v3.0.0-rc.0"></a>
11
+ ## [v3.0.0-rc.0] - 2022-12-23
12
+ ### Breaking Changes
13
+ - Remove "/proxy" endpoint ([#550](https://github.com/SAP/ui5-server/issues/550)) [`4bdf839`](https://github.com/SAP/ui5-server/commit/4bdf839e96f67ddbc4cb2a18216921d54df4006e)
14
+
15
+ ### BREAKING CHANGE
16
+
17
+ This removes the "/proxy" endpoint and the corresponding
18
+ "connectUi5Proxy" middleware from the standard ui5-server.
19
+ Internally, this middleware made use of the connect-openui5 proxy
20
+ implementation (https://github.com/SAP/connect-openui5#proxy).
21
+
22
+ More sophisticated proxy solutions for ui5-server are already available
23
+ in the form of custom middleware extensions from the UI5-community.
24
+
25
+ The UI5 Team might provide a dedicated custom middleware extension,
26
+ with similar functionality, in the future.
27
+
6
28
 
7
29
  <a name="v3.0.0-beta.4"></a>
8
30
  ## [v3.0.0-beta.4] - 2022-12-01
@@ -308,6 +330,8 @@ Only Node.js v10 or higher is supported.
308
330
  <a name="v0.0.1"></a>
309
331
  ## v0.0.1 - 2018-06-06
310
332
 
333
+ [v3.0.0-rc.1]: https://github.com/SAP/ui5-server/compare/v3.0.0-rc.0...v3.0.0-rc.1
334
+ [v3.0.0-rc.0]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.4...v3.0.0-rc.0
311
335
  [v3.0.0-beta.4]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.3...v3.0.0-beta.4
312
336
  [v3.0.0-beta.3]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.2...v3.0.0-beta.3
313
337
  [v3.0.0-beta.2]: https://github.com/SAP/ui5-server/compare/v3.0.0-beta.1...v3.0.0-beta.2
package/LICENSE.txt CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2018-2021 SAP SE or an SAP affiliate company and UI5 Tooling contributors
189
+ Copyright 2018-2023 SAP SE or an SAP affiliate company and UI5 Tooling contributors
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -10,7 +10,9 @@
10
10
  [![Coverage Status](https://coveralls.io/repos/github/SAP/ui5-server/badge.svg)](https://coveralls.io/github/SAP/ui5-server)
11
11
 
12
12
  ## Documentation
13
- Can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/pages/Server/)
13
+ UI5 Server documentation can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/v3/pages/Server/)
14
+
15
+ The UI5 Server API Reference can be found here: [`@ui5/server`](https://sap.github.io/ui5-tooling/v3/api/module-@ui5_server.html)
14
16
 
15
17
  ## Contributing
16
18
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md).
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) {
@@ -108,6 +108,7 @@ class MiddlewareUtil {
108
108
  * @property {Function} getNamespace Get the project namespace
109
109
  * @property {Function} getRootReader Get the project rootReader
110
110
  * @property {Function} getReader Get the project reader
111
+ * @property {Function} getSourcePath Get the local File System path of the project's source directory
111
112
  * @property {Function} getCustomConfiguration Get the project Custom Configuration
112
113
  * @property {Function} isFrameworkProject Check whether the project is a UI5-Framework project
113
114
  */
@@ -119,15 +120,25 @@ class MiddlewareUtil {
119
120
  * This method is only available to custom server middleware extensions defining
120
121
  * <b>Specification Version 3.0 and above</b>.
121
122
  *
122
- * @param {string} [projectName] Name of the project to retrieve. Defaults to the project currently being built
123
+ * @param {string|@ui5/fs/Resource} [projectNameOrResource]
124
+ * Name of the project to retrieve or a Resource instance to retrieve the associated project for.
125
+ * Defaults to the name of the current root project
123
126
  * @returns {@ui5/project/build/helpers/MiddlewareUtill~ProjectInterface|undefined}
124
- * project instance or undefined if the project is unknown to the graph
127
+ * Specification Version-dependent interface to the Project instance or <code>undefined</code>
128
+ * if the project name is unknown or the provided resource is not associated with any project.
125
129
  * @public
126
130
  */
127
- getProject(projectName) {
128
- if (projectName) {
129
- return this._graph.getProject(projectName);
131
+ getProject(projectNameOrResource) {
132
+ if (projectNameOrResource) {
133
+ if (typeof projectNameOrResource === "string" || projectNameOrResource instanceof String) {
134
+ // A project name has been provided
135
+ return this._graph.getProject(projectNameOrResource);
136
+ } else {
137
+ // A Resource instance has been provided
138
+ return projectNameOrResource.getProject();
139
+ }
130
140
  }
141
+ // No parameter has been provided, default to the root project
131
142
  return this._project;
132
143
  }
133
144
 
@@ -139,7 +150,8 @@ class MiddlewareUtil {
139
150
  * This method is only available to custom server middleware extensions defining
140
151
  * <b>Specification Version 3.0 and above</b>.
141
152
  *
142
- * @param {string} [projectName] Name of the project to retrieve. Defaults to the project currently being built
153
+ * @param {string} [projectName] Name of the project to retrieve.
154
+ * Defaults to the name of the current root project
143
155
  * @returns {string[]} Names of all direct dependencies
144
156
  * @throws {Error} If the requested project is unknown to the graph
145
157
  * @public
@@ -214,7 +226,8 @@ class MiddlewareUtil {
214
226
  const baseProjectInterface = {};
215
227
  bindFunctions(project, baseProjectInterface, [
216
228
  "getType", "getName", "getVersion", "getNamespace",
217
- "getRootReader", "getReader", "getCustomConfiguration", "isFrameworkProject"
229
+ "getRootReader", "getReader", "getSourcePath",
230
+ "getCustomConfiguration", "isFrameworkProject"
218
231
  ]);
219
232
  return baseProjectInterface;
220
233
  };
@@ -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"}
@@ -49,7 +49,7 @@ function createResourceInfo(resource) {
49
49
  const isDir = stat.isDirectory();
50
50
  return {
51
51
  path: resource.getPath() + (isDir ? "/" : ""),
52
- name: resource._name + (isDir ? "/" : ""),
52
+ name: resource.getName() + (isDir ? "/" : ""),
53
53
  isDir: isDir,
54
54
  mimetype: isDir ? "" : getMimeType(resource),
55
55
  lastModified: new Date(stat.mtime).toLocaleString(),
@@ -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.1",
4
4
  "description": "UI5 Tooling - Server",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -35,7 +35,6 @@
35
35
  "unit": "rimraf test/tmp && ava",
36
36
  "unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
37
37
  "unit-watch": "npm run unit -- --watch",
38
- "unit-nyan": "npm run unit -- --tap | tnyan",
39
38
  "unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
40
39
  "unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
41
40
  "coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
@@ -115,12 +114,11 @@
115
114
  "url": "git@github.com:SAP/ui5-server.git"
116
115
  },
117
116
  "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",
117
+ "@ui5/builder": "^3.0.0-rc.2",
118
+ "@ui5/fs": "^3.0.0-rc.3",
119
+ "@ui5/logger": "^3.0.1-rc.1",
121
120
  "body-parser": "^1.20.1",
122
121
  "compression": "^1.7.4",
123
- "connect-openui5": "^0.10.3",
124
122
  "cors": "^2.8.5",
125
123
  "devcert-sanscache": "^0.4.8",
126
124
  "escape-html": "^1.0.3",
@@ -128,35 +126,33 @@
128
126
  "express": "^4.18.2",
129
127
  "fresh": "^0.5.2",
130
128
  "graceful-fs": "^4.2.10",
131
- "make-dir": "^3.1.0",
132
129
  "mime-types": "^2.1.35",
133
130
  "parseurl": "^1.3.3",
134
131
  "portscanner": "^2.2.0",
135
132
  "replacestream": "^4.0.3",
136
133
  "router": "^1.3.7",
137
134
  "spdy": "^4.0.2",
138
- "yesno": "^0.3.1"
135
+ "yesno": "^0.4.0"
139
136
  },
140
137
  "devDependencies": {
141
138
  "@istanbuljs/esm-loader-hook": "^0.2.0",
142
- "@ui5/project": "^3.0.0-beta.4",
143
- "ava": "^5.1.0",
139
+ "@ui5/project": "^3.0.0-rc.3",
140
+ "ava": "^5.1.1",
144
141
  "chokidar-cli": "^3.0.0",
145
142
  "cross-env": "^7.0.3",
146
143
  "depcheck": "^1.4.3",
147
- "docdash": "^2.0.0",
148
- "eslint": "^8.28.0",
144
+ "docdash": "^2.0.1",
145
+ "eslint": "^8.32.0",
149
146
  "eslint-config-google": "^0.14.0",
150
- "eslint-plugin-ava": "^13.2.0",
151
- "eslint-plugin-jsdoc": "^39.6.4",
152
- "esmock": "^2.0.9",
147
+ "eslint-plugin-ava": "^14.0.0",
148
+ "eslint-plugin-jsdoc": "^39.6.7",
149
+ "esmock": "^2.1.0",
153
150
  "jsdoc": "^3.6.11",
154
151
  "nyc": "^15.1.0",
155
152
  "open-cli": "^7.1.0",
156
- "rimraf": "^3.0.2",
157
- "sinon": "^14.0.2",
158
- "supertest": "^6.3.1",
159
- "tap-nyan": "^1.1.0",
153
+ "rimraf": "^4.1.1",
154
+ "sinon": "^15.0.1",
155
+ "supertest": "^6.3.3",
160
156
  "tap-xunit": "^2.4.1"
161
157
  }
162
158
  }
@@ -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;