@ui5/server 3.2.1 → 4.0.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/CHANGELOG.md CHANGED
@@ -2,7 +2,35 @@
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.2.1...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-server/compare/v4.0.1...HEAD).
6
+
7
+ <a name="v4.0.1"></a>
8
+ ## [v4.0.1] - 2024-07-31
9
+ ### Bug Fixes
10
+ - **serveResources:** Improve cache invalidation ([#688](https://github.com/SAP/ui5-server/issues/688)) [`777afa5`](https://github.com/SAP/ui5-server/commit/777afa52e459f988e0799ae63b8a9b024db0c398)
11
+
12
+
13
+ <a name="v4.0.0"></a>
14
+ ## [v4.0.0] - 2024-07-23
15
+ ### Breaking Changes
16
+ - Drop node v21 support [`2af0d4f`](https://github.com/SAP/ui5-server/commit/2af0d4fd94c720899bc5978d27ca176c7b2feecb)
17
+ - Replace console.log with process.stderr ([#643](https://github.com/SAP/ui5-server/issues/643)) [`d42c79f`](https://github.com/SAP/ui5-server/commit/d42c79f0a6e6fa5e685f736dd0ae79b353767051)
18
+ - Require Node.js 20.11.x/>=21.2.0 and npm >=10 [`39cc1a2`](https://github.com/SAP/ui5-server/commit/39cc1a2dea8e081888ae1f5f2c47a74bb7efe693)
19
+
20
+ ### Features
21
+ - **manifest.json:** Auto-fill supportedLocales [`a39c8de`](https://github.com/SAP/ui5-server/commit/a39c8debaabe259800ed8f861071b00817c10350)
22
+
23
+ ### BREAKING CHANGE
24
+
25
+ Messages will now be written to stderr instead of stdout.
26
+
27
+ JIRA: CPOUI5FOUNDATION-802
28
+ Related to: https://github.com/SAP/ui5-tooling/issues/701
29
+ Sibling of: https://github.com/SAP/ui5-tooling/pull/930,
30
+ https://github.com/SAP/ui5-cli/pull/686
31
+
32
+ Support for older Node.js and npm releases has been dropped.
33
+ Only Node.js 20.11.x and >=21.2.0 as well as npm v10 or higher are supported.
6
34
 
7
35
  <a name="v3.2.1"></a>
8
36
  ## [v3.2.1] - 2024-05-15
@@ -341,6 +369,8 @@ Only Node.js v10 or higher is supported.
341
369
 
342
370
  <a name="v0.0.1"></a>
343
371
  ## v0.0.1 - 2018-06-06
372
+ [v4.0.1]: https://github.com/SAP/ui5-server/compare/v4.0.0...v4.0.1
373
+ [v4.0.0]: https://github.com/SAP/ui5-server/compare/v3.1.5...v4.0.0
344
374
  [v3.2.1]: https://github.com/SAP/ui5-server/compare/v3.2.0...v3.2.1
345
375
  [v3.2.0]: https://github.com/SAP/ui5-server/compare/v3.1.5...v3.2.0
346
376
  [v3.1.5]: https://github.com/SAP/ui5-server/compare/v3.1.4...v3.1.5
package/CONTRIBUTING.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Contributing to the UI5 Tooling
2
2
 
3
- See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/v3/CONTRIBUTING.md) repository.
3
+ See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md) repository.
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/v3/docs/images/UI5_logo_wide.png)
1
+ ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/main/docs/images/UI5_logo_wide.png)
2
2
 
3
3
  # ui5-server
4
4
  > Modules for running a UI5 development server
5
5
  > Part of the [UI5 Tooling](https://github.com/SAP/ui5-tooling)
6
6
 
7
7
  [![REUSE status](https://api.reuse.software/badge/github.com/SAP/ui5-server)](https://api.reuse.software/info/github.com/SAP/ui5-server)
8
- [![Build Status](https://dev.azure.com/sap/opensource/_apis/build/status/SAP.ui5-server?branchName=v3)](https://dev.azure.com/sap/opensource/_build/latest?definitionId=34&branchName=v3)
8
+ [![Build Status](https://dev.azure.com/sap/opensource/_apis/build/status/SAP.ui5-server?branchName=main)](https://dev.azure.com/sap/opensource/_build/latest?definitionId=34&branchName=main)
9
9
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fserver.svg)](https://www.npmjs.com/package/@ui5/server)
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
- UI5 Server documentation can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/v3/pages/Server/)
13
+ UI5 Server documentation can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/v4/pages/Server/)
14
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)
15
+ The UI5 Server API Reference can be found here: [`@ui5/server`](https://sap.github.io/ui5-tooling/v4/api/module-@ui5_server.html)
16
16
 
17
17
  ## Contributing
18
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/v3/CONTRIBUTING.md).
18
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md).
19
19
 
20
20
  ## Support
21
- Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/v3/CONTRIBUTING.md#report-an-issue) on how to report an issue.
21
+ Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue.
22
22
 
23
23
  Please report issues in the main [UI5 Tooling](https://github.com/SAP/ui5-tooling) repository.
24
24
 
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/v3/images/UI5_logo_wide.png",
30
+ "image": "https://sap.github.io/ui5-tooling/v4/images/UI5_logo_wide.png",
31
31
  "site_name": "UI5 Tooling - API Reference",
32
32
  "url": "https://sap.github.io/ui5-tooling/"
33
33
  },
@@ -3,10 +3,11 @@ const log = getLogger("server:middleware:serveResources");
3
3
  import replaceStream from "replacestream";
4
4
  import etag from "etag";
5
5
  import fresh from "fresh";
6
+ import fsInterface from "@ui5/fs/fsInterface";
6
7
 
7
8
  const rProperties = /\.properties$/i;
8
9
  const rReplaceVersion = /\.(library|js|json)$/i;
9
- const rManifest = /\/manifest.json$/i;
10
+ const rManifest = /\/manifest\.json$/i;
10
11
  const rResourcesPrefix = /^\/resources\//i;
11
12
 
12
13
  function isFresh(req, res) {
@@ -15,7 +16,6 @@ function isFresh(req, res) {
15
16
  });
16
17
  }
17
18
 
18
-
19
19
  /**
20
20
  * Creates and returns the middleware to serve application resources.
21
21
  *
@@ -49,6 +49,19 @@ function createMiddleware({resources, middlewareUtil}) {
49
49
  next();
50
50
  return;
51
51
  }
52
+ } else if (rManifest.test(resource.getPath()) && resource.getProject()?.getNamespace()) {
53
+ // Special handling for manifest.json file by adding additional content to the served manifest.json
54
+ // NOTE: This should only be done for manifest.json files that exist in the sources.
55
+ // Files created by generateLibraryManifest (see above) should not be handled in here.
56
+ // Only manifest.json files in library / application projects should be handled.
57
+ // resource.getProject.getNamespace() returns null for all other kind of projects.
58
+ const {default: manifestEnhancer} = await import("@ui5/builder/processors/manifestEnhancer");
59
+ await manifestEnhancer({
60
+ resources: [resource],
61
+ // Ensure that only files within the manifest's project are accessible
62
+ // Using the "runtime" style to match the style used by the UI5 server
63
+ fs: fsInterface(resource.getProject().getReader({style: "runtime"}))
64
+ });
52
65
  }
53
66
 
54
67
  const resourcePath = resource.getPath();
@@ -82,10 +95,18 @@ function createMiddleware({resources, middlewareUtil}) {
82
95
 
83
96
  // Enable ETag caching
84
97
  const statInfo = resource.getStatInfo();
85
- if (statInfo?.size !== undefined) {
86
- res.setHeader("ETag", etag(statInfo));
98
+ if (statInfo?.size !== undefined && !resource.isModified()) {
99
+ let etagHeader = etag(statInfo);
100
+ if (resource.getProject()) {
101
+ // Add project version to ETag to invalidate cache when project version changes.
102
+ // This is necessary to invalidate files with ${version} placeholders.
103
+ etagHeader = etagHeader.slice(0, -1) + `-${resource.getProject().getVersion()}"`;
104
+ }
105
+ res.setHeader("ETag", etagHeader);
87
106
  } else {
88
- // Fallback to buffer if stats are not available or insufficient
107
+ // Fallback to buffer if stats are not available or insufficient or resource is modified.
108
+ // Modified resources must use the buffer for cache invalidation so that UI5 Tooling changes
109
+ // invalidate the cache even when the original resource is not modified.
89
110
  res.setHeader("ETag", etag(await resource.getBuffer()));
90
111
  }
91
112
 
package/lib/sslUtil.js CHANGED
@@ -70,13 +70,13 @@ async function createAndInstallCertificate(keyPath, certPath) {
70
70
  // the created certificate into the system)
71
71
  // TODO: Prompt and logging should happen in CLI module rather than server
72
72
  if (process.platform === "win32") {
73
- /* eslint-disable-next-line no-console */
74
- console.log("Please press allow in the opened dialog to confirm importing the newly created " +
73
+ process.stderr.write("Please press allow in the opened dialog to confirm importing the newly created " +
75
74
  "SSL certificate into the operating system and browsers.");
75
+ process.stderr.write("\n");
76
76
  } else {
77
- /* eslint-disable-next-line no-console */
78
- console.log("Please enter your root password to allow importing the newly created " +
77
+ process.stderr.write("Please enter your root password to allow importing the newly created " +
79
78
  "SSL certificate into the operating system and browsers.");
79
+ process.stderr.write("\n");
80
80
  }
81
81
 
82
82
  const {key, cert} = await devCert("UI5Tooling");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/server",
3
- "version": "3.2.1",
3
+ "version": "4.0.1",
4
4
  "description": "UI5 Tooling - Server",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -25,7 +25,7 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "engines": {
28
- "node": "^16.18.0 || >=18.12.0",
28
+ "node": "^20.11.0 || >=22.0.0",
29
29
  "npm": ">= 8"
30
30
  },
31
31
  "scripts": {
@@ -43,7 +43,7 @@
43
43
  "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
44
44
  "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
45
45
  "preversion": "npm test",
46
- "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md v3.0.0.. && git add CHANGELOG.md",
46
+ "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md v4.0.0.. && git add CHANGELOG.md",
47
47
  "prepublishOnly": "git push --follow-tags",
48
48
  "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
49
49
  "depcheck": "depcheck --ignores @ui5/server,docdash,compression,cors,@istanbuljs/esm-loader-hook --parsers='**/*.js:es6,**/*.cjs:es6'"
@@ -60,9 +60,11 @@
60
60
  "files": [
61
61
  "test/lib/**/*.js"
62
62
  ],
63
- "ignoredByWatcher": [
64
- "test/tmp/**"
65
- ],
63
+ "watchMode": {
64
+ "ignoreChanges": [
65
+ "test/tmp/**"
66
+ ]
67
+ },
66
68
  "workerThreads": false,
67
69
  "nodeArguments": [
68
70
  "--loader=esmock",
@@ -115,9 +117,9 @@
115
117
  "url": "git@github.com:SAP/ui5-server.git"
116
118
  },
117
119
  "dependencies": {
118
- "@ui5/builder": "^3.4.1",
119
- "@ui5/fs": "^3.0.5",
120
- "@ui5/logger": "^3.0.0",
120
+ "@ui5/builder": "^4.0.1",
121
+ "@ui5/fs": "^4.0.0",
122
+ "@ui5/logger": "^4.0.1",
121
123
  "body-parser": "^1.20.2",
122
124
  "compression": "^1.7.4",
123
125
  "cors": "^2.8.5",
@@ -137,8 +139,8 @@
137
139
  },
138
140
  "devDependencies": {
139
141
  "@istanbuljs/esm-loader-hook": "^0.2.0",
140
- "@ui5/project": "^3.9.1",
141
- "ava": "^5.3.1",
142
+ "@ui5/project": "^4.0.1",
143
+ "ava": "^6.1.3",
142
144
  "chokidar-cli": "^3.0.0",
143
145
  "cross-env": "^7.0.3",
144
146
  "depcheck": "^1.4.7",
@@ -146,14 +148,14 @@
146
148
  "eslint": "^8.57.0",
147
149
  "eslint-config-google": "^0.14.0",
148
150
  "eslint-plugin-ava": "^14.0.0",
149
- "eslint-plugin-jsdoc": "^46.10.1",
150
- "esmock": "^2.6.5",
151
+ "eslint-plugin-jsdoc": "^48.10.2",
152
+ "esmock": "^2.6.7",
151
153
  "jsdoc": "^4.0.3",
152
- "nyc": "^15.1.0",
153
- "open-cli": "^7.2.0",
154
- "rimraf": "^5.0.7",
155
- "sinon": "^16.1.3",
156
- "supertest": "^6.3.4",
154
+ "nyc": "^17.0.0",
155
+ "open-cli": "^8.0.0",
156
+ "rimraf": "^6.0.1",
157
+ "sinon": "^18.0.0",
158
+ "supertest": "^7.0.0",
157
159
  "tap-xunit": "^2.4.1"
158
160
  }
159
161
  }