@ui5/builder 3.1.0 → 3.1.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,14 @@
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-builder/compare/v3.1.0...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.1.1...HEAD).
6
+
7
+ <a name="v3.1.1"></a>
8
+ ## [v3.1.1] - 2023-11-19
9
+ ### Bug Fixes
10
+ - Handle graceful termination of workerpool for parallel builds ([#953](https://github.com/SAP/ui5-builder/issues/953)) [`f7b9f27`](https://github.com/SAP/ui5-builder/commit/f7b9f27ac5966bd89e52e4c2d5b03482a0f3dbb7)
11
+ - **Bundling:** Detect manifest.json dependency of libraries [`6f9995f`](https://github.com/SAP/ui5-builder/commit/6f9995f5b47a6094fa93b5d433be849b1d3cdc7e)
12
+
6
13
 
7
14
  <a name="v3.1.0"></a>
8
15
  ## [v3.1.0] - 2023-10-11
@@ -832,6 +839,7 @@ to load the custom bundle file instead.
832
839
 
833
840
  ### Features
834
841
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
842
+ [v3.1.1]: https://github.com/SAP/ui5-builder/compare/v3.1.0...v3.1.1
835
843
  [v3.1.0]: https://github.com/SAP/ui5-builder/compare/v3.0.9...v3.1.0
836
844
  [v3.0.9]: https://github.com/SAP/ui5-builder/compare/v3.0.8...v3.0.9
837
845
  [v3.0.8]: https://github.com/SAP/ui5-builder/compare/v3.0.7...v3.0.8
@@ -95,6 +95,16 @@ async function determineDependencyInfo(resource, rawInfo, pool) {
95
95
  new ComponentAnalyzer(pool).analyze(resource, info),
96
96
  new SmartTemplateAnalyzer(pool).analyze(resource, info)
97
97
  );
98
+ } else if ( /(?:^|\/)library\.js/.test(resource.name) ) {
99
+ promises.push(
100
+ (async () => {
101
+ const manifestName = resource.name.replace(/library\.js$/, "manifest.json");
102
+ const manifestResource = await pool.findResource(manifestName).catch(() => null);
103
+ if (manifestResource) {
104
+ info.addDependency(manifestName);
105
+ }
106
+ })()
107
+ );
98
108
  }
99
109
 
100
110
  await Promise.all(promises);
@@ -6,6 +6,7 @@ import workerpool from "workerpool";
6
6
  import Resource from "@ui5/fs/Resource";
7
7
  import {getLogger} from "@ui5/logger";
8
8
  const log = getLogger("builder:processors:minifier");
9
+ import {setTimeout as setTimeoutPromise} from "node:timers/promises";
9
10
 
10
11
  const debugFileRegex = /((?:\.view|\.fragment|\.controller|\.designtime|\.support)?\.js)$/;
11
12
 
@@ -28,11 +29,28 @@ function getPool(taskUtil) {
28
29
  workerType: "auto",
29
30
  maxWorkers
30
31
  });
31
- taskUtil.registerCleanupTask(() => {
32
- log.verbose(`Terminating workerpool`);
33
- const poolToBeTerminated = pool;
34
- pool = null;
35
- poolToBeTerminated.terminate();
32
+ taskUtil.registerCleanupTask((force) => {
33
+ const attemptPoolTermination = async () => {
34
+ log.verbose(`Attempt to terminate the workerpool...`);
35
+
36
+ if (!pool) {
37
+ return;
38
+ }
39
+
40
+ // There are many stats that could be used, but these ones seem the most
41
+ // convenient. When all the (available) workers are idle, then it's safe to terminate.
42
+ let {idleWorkers, totalWorkers} = pool.stats();
43
+ while (idleWorkers !== totalWorkers && !force) {
44
+ await setTimeoutPromise(100); // Wait a bit workers to finish and try again
45
+ ({idleWorkers, totalWorkers} = pool.stats());
46
+ }
47
+
48
+ const poolToBeTerminated = pool;
49
+ pool = null;
50
+ return poolToBeTerminated.terminate(force);
51
+ };
52
+
53
+ return attemptPoolTermination();
36
54
  });
37
55
  }
38
56
  return pool;
@@ -7,6 +7,7 @@ import {fileURLToPath} from "node:url";
7
7
  import os from "node:os";
8
8
  import workerpool from "workerpool";
9
9
  import {deserializeResources, serializeResources, FsMainThreadInterface} from "../processors/themeBuilderWorker.js";
10
+ import {setTimeout as setTimeoutPromise} from "node:timers/promises";
10
11
 
11
12
  let pool;
12
13
 
@@ -23,11 +24,28 @@ function getPool(taskUtil) {
23
24
  workerType: "thread",
24
25
  maxWorkers
25
26
  });
26
- taskUtil.registerCleanupTask(() => {
27
- log.verbose(`Terminating workerpool`);
28
- const poolToBeTerminated = pool;
29
- pool = null;
30
- poolToBeTerminated.terminate();
27
+ taskUtil.registerCleanupTask((force) => {
28
+ const attemptPoolTermination = async () => {
29
+ log.verbose(`Attempt to terminate the workerpool...`);
30
+
31
+ if (!pool) {
32
+ return;
33
+ }
34
+
35
+ // There are many stats that could be used, but these ones seem the most
36
+ // convenient. When all the (available) workers are idle, then it's safe to terminate.
37
+ let {idleWorkers, totalWorkers} = pool.stats();
38
+ while (idleWorkers !== totalWorkers && !force) {
39
+ await setTimeoutPromise(100); // Wait a bit workers to finish and try again
40
+ ({idleWorkers, totalWorkers} = pool.stats());
41
+ }
42
+
43
+ const poolToBeTerminated = pool;
44
+ pool = null;
45
+ return poolToBeTerminated.terminate(force);
46
+ };
47
+
48
+ return attemptPoolTermination();
31
49
  });
32
50
  }
33
51
  return pool;
@@ -32,7 +32,11 @@ function getDefaultLibraryPreloadFilters(namespace, excludes) {
32
32
  }
33
33
 
34
34
  function getBundleDefinition(namespace, excludes) {
35
- // TODO: move to config of actual core project
35
+ // Note: This configuration is only used when no bundle definition in ui5.yaml exists (see "skipBundles" parameter)
36
+
37
+ // TODO: Remove this hardcoded bundle definition.
38
+ // sap.ui.core ui5.yaml contains a configuration since UI5 1.103.0 (specVersion 2.4)
39
+ // so this is still required to build UI5 versions <= 1.102.0.
36
40
  if (namespace === "sap/ui/core") {
37
41
  return {
38
42
  name: `${namespace}/library-preload.js`,
@@ -51,8 +55,6 @@ function getBundleDefinition(namespace, excludes) {
51
55
  filters: [
52
56
  // Note: Don't pass configured preload excludes for sap.ui.core
53
57
  // as they are already hardcoded below.
54
- // In future the sap/ui/core/library-preload should be configured
55
- // as a custom bundle in the ui5.yaml.
56
58
  ...getDefaultLibraryPreloadFilters(namespace),
57
59
 
58
60
  `!${namespace}/cldr/`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -131,31 +131,31 @@
131
131
  "pretty-data": "^0.40.0",
132
132
  "rimraf": "^5.0.5",
133
133
  "semver": "^7.5.4",
134
- "terser": "^5.21.0",
135
- "workerpool": "^6.5.0",
134
+ "terser": "^5.24.0",
135
+ "workerpool": "^6.5.1",
136
136
  "xml2js": "^0.6.2"
137
137
  },
138
138
  "devDependencies": {
139
139
  "@istanbuljs/esm-loader-hook": "^0.2.0",
140
- "@jridgewell/trace-mapping": "^0.3.19",
141
- "@ui5/project": "^3.7.1",
140
+ "@jridgewell/trace-mapping": "^0.3.20",
141
+ "@ui5/project": "^3.7.3",
142
142
  "ava": "^5.3.1",
143
143
  "chai": "^4.3.10",
144
144
  "chai-fs": "^2.0.0",
145
145
  "chokidar-cli": "^3.0.0",
146
146
  "cross-env": "^7.0.3",
147
- "depcheck": "^1.4.6",
147
+ "depcheck": "^1.4.7",
148
148
  "docdash": "^2.0.2",
149
- "eslint": "^8.51.0",
149
+ "eslint": "^8.54.0",
150
150
  "eslint-config-google": "^0.14.0",
151
151
  "eslint-plugin-ava": "^14.0.0",
152
- "eslint-plugin-jsdoc": "^46.8.2",
153
- "esmock": "^2.5.2",
152
+ "eslint-plugin-jsdoc": "^46.9.0",
153
+ "esmock": "^2.6.0",
154
154
  "line-column": "^1.0.2",
155
155
  "nyc": "^15.1.0",
156
156
  "open-cli": "^7.2.0",
157
157
  "recursive-readdir": "^2.2.3",
158
- "sinon": "^16.1.0",
158
+ "sinon": "^16.1.3",
159
159
  "tap-xunit": "^2.4.1"
160
160
  }
161
161
  }