@ui5/builder 3.0.0-rc.0 → 3.0.0-rc.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/.reuse/dep5 CHANGED
@@ -25,9 +25,9 @@ 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/processors/jsdoc/lib/*
32
- Copyright: 2009-2022 SAP SE or an SAP affiliate company and OpenUI5 contributors
32
+ Copyright: 2009-2023 SAP SE or an SAP affiliate company and OpenUI5 contributors
33
33
  License: Apache-2.0
package/CHANGELOG.md CHANGED
@@ -2,7 +2,19 @@
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.0.0-rc.0...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-builder/compare/v3.0.0-rc.2...HEAD).
6
+
7
+ <a name="v3.0.0-rc.2"></a>
8
+ ## [v3.0.0-rc.2] - 2023-01-22
9
+ ### Dependency Updates
10
+ - Bump rimraf from 3.0.2 to 4.1.1 ([#873](https://github.com/SAP/ui5-builder/issues/873)) [`ddb9660`](https://github.com/SAP/ui5-builder/commit/ddb96602fea5b96ba37afdebda0993d847462f52)
11
+
12
+
13
+ <a name="v3.0.0-rc.1"></a>
14
+ ## [v3.0.0-rc.1] - 2023-01-11
15
+ ### Breaking Changes
16
+ - **libraryLessGenerator:** Throw error when import can't be inlined [`d2be9bb`](https://github.com/SAP/ui5-builder/commit/d2be9bb68600ec97b9bc007f348f87ad456fb5a3)
17
+
6
18
 
7
19
  <a name="v3.0.0-rc.0"></a>
8
20
  ## [v3.0.0-rc.0] - 2022-12-23
@@ -831,6 +843,8 @@ to load the custom bundle file instead.
831
843
  - Add ability to configure component preloads and custom bundles [`2241e5f`](https://github.com/SAP/ui5-builder/commit/2241e5ff98fd95f1f80cc74959655ae7a9c660e7)
832
844
 
833
845
 
846
+ [v3.0.0-rc.2]: https://github.com/SAP/ui5-builder/compare/v3.0.0-rc.1...v3.0.0-rc.2
847
+ [v3.0.0-rc.1]: https://github.com/SAP/ui5-builder/compare/v3.0.0-rc.0...v3.0.0-rc.1
834
848
  [v3.0.0-rc.0]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.6...v3.0.0-rc.0
835
849
  [v3.0.0-beta.6]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.5...v3.0.0-beta.6
836
850
  [v3.0.0-beta.5]: https://github.com/SAP/ui5-builder/compare/v3.0.0-beta.4...v3.0.0-beta.5
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-builder/badge.svg)](https://coveralls.io/github/SAP/ui5-builder)
11
11
 
12
12
  ## Documentation
13
- Can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/pages/Builder/)
13
+ UI5 Builder documentation can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/v3/pages/Builder/)
14
+
15
+ The UI5 Builder API Reference can be found here: [`@ui5/builder`](https://sap.github.io/ui5-tooling/v3/api/)
14
16
 
15
17
  ## Contributing
16
18
  Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md).
@@ -9,14 +9,6 @@ const IMPORT_PATTERN = /@import .*"(.*)";/g;
9
9
  const BASE_LESS_PATTERN = /^\/resources\/sap\/ui\/core\/themes\/([^/]+)\/base\.less$/;
10
10
  const GLOBAL_LESS_PATTERN = /^\/resources\/sap\/ui\/core\/themes\/([^/]+)\/global\.less$/;
11
11
 
12
- class ImportError extends Error {
13
- constructor(message) {
14
- super();
15
- this.name = "ImportError";
16
- this.message = message;
17
- }
18
- }
19
-
20
12
  class LibraryLessGenerator {
21
13
  constructor({fs}) {
22
14
  const readFile = promisify(fs.readFile);
@@ -42,17 +34,7 @@ class LibraryLessGenerator {
42
34
  const replacements = await Promise.all(imports.map(async (importMatch) => {
43
35
  const baseDir = posixPath.dirname(filePath);
44
36
  const resolvedFilePath = posixPath.resolve(baseDir, importMatch.path);
45
- try {
46
- importMatch.content = await this.resolveLessImport(importMatch.path, resolvedFilePath, baseDir);
47
- } catch (error) {
48
- if (error instanceof ImportError) {
49
- // Add message of import errors after the import statements
50
- // Currently those errors should not break the build (see comments in resolveLessImport)
51
- importMatch.content = importMatch.fullMatch + ` /* ${error} */`;
52
- } else {
53
- throw error;
54
- }
55
- }
37
+ importMatch.content = await this.resolveLessImport(importMatch.path, resolvedFilePath, baseDir);
56
38
  return importMatch;
57
39
  }));
58
40
 
@@ -97,26 +79,19 @@ class LibraryLessGenerator {
97
79
  }
98
80
 
99
81
  /*
100
- * Log error in case of files which are not in the same directory as the current file because
82
+ * Throw error in case of files which are not in the same directory as the current file because
101
83
  * inlining them would break relative URLs.
102
84
  * A possible solution would be to rewrite relative URLs when inlining the content.
103
85
  *
104
86
  * Keeping the import will cause errors since only "library.less" and "global.less" are
105
87
  * configured to be available to the Theme Designer (.theming generated in generateThemeDesignerResources).
106
- * However, the previous implementation did not break the build.
107
- * In many cases the library.less file is currently not relevant so breaking the build would cause
108
- * unnecessary issues.
109
- *
110
88
  */
111
89
  const relativeFilePath = posixPath.relative(baseDir, resolvedFilePath);
112
90
  if (relativeFilePath.includes(posixPath.sep)) {
113
- log.error(
91
+ throw new Error(
114
92
  `Could not inline import '${resolvedFilePath}' outside of theme directory '${baseDir}'. ` +
115
- `Stylesheets must be located in the theme directory (no sub-directories). ` +
116
- `The generated '${baseDir}/library.less' will cause errors when compiled with the Theme Designer.`
93
+ `Stylesheets must be located in the theme directory (no sub-directories).`
117
94
  );
118
- // Throw error to be added as comment to the import statement
119
- throw new ImportError("Could not inline import outside of theme directory");
120
95
  }
121
96
 
122
97
  let importedFileContent;
@@ -145,7 +120,6 @@ class LibraryLessGenerator {
145
120
  while ((match = IMPORT_PATTERN.exec(fileContent)) !== null) {
146
121
  imports.push({
147
122
  path: match[1],
148
- fullMatch: match[0],
149
123
  matchStart: match.index,
150
124
  matchLength: match[0].length
151
125
  });
@@ -1,5 +1,3 @@
1
- import replaceStream from "replacestream";
2
-
3
1
  /**
4
2
  * @public
5
3
  * @module @ui5/builder/processors/stringReplacer
@@ -20,12 +18,12 @@ import replaceStream from "replacestream";
20
18
  * @returns {Promise<@ui5/fs/Resource[]>} Promise resolving with modified resources
21
19
  */
22
20
  export default function({resources, options: {pattern, replacement}}) {
23
- return Promise.all(resources.map((resource) => {
24
- let stream = resource.getStream();
25
- stream.setEncoding("utf8");
26
- stream = stream.pipe(replaceStream(pattern, replacement));
27
-
28
- resource.setStream(stream);
21
+ return Promise.all(resources.map(async (resource) => {
22
+ const content = await resource.getString();
23
+ const newContent = content.replaceAll(pattern, replacement);
24
+ if (content !== newContent) {
25
+ resource.setString(newContent);
26
+ }
29
27
  return resource;
30
28
  }));
31
29
  }
@@ -3,11 +3,10 @@ const log = logger.getLogger("builder:tasks:jsdoc:generateJsdoc");
3
3
  import path from "node:path";
4
4
  import os from "node:os";
5
5
  import fs from "graceful-fs";
6
- import _rimraf from "rimraf";
6
+ import rimraf from "rimraf";
7
7
  import {promisify} from "node:util";
8
8
  const mkdtemp = promisify(fs.mkdtemp);
9
9
  const mkdir = promisify(fs.mkdir);
10
- const rimraf = promisify(_rimraf);
11
10
  import jsdocGenerator from "../../processors/jsdoc/jsdocGenerator.js";
12
11
  import {createAdapter} from "@ui5/fs/resourceFactory";
13
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/builder",
3
- "version": "3.0.0-rc.0",
3
+ "version": "3.0.0-rc.2",
4
4
  "description": "UI5 Tooling - Builder",
5
5
  "author": {
6
6
  "name": "SAP SE",
@@ -38,7 +38,6 @@
38
38
  "unit": "rimraf test/tmp && ava",
39
39
  "unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
40
40
  "unit-watch": "rimraf test/tmp && ava --watch",
41
- "unit-nyan": "rimraf test/tmp && ava --tap | tnyan",
42
41
  "unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap --timeout=1m | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
43
42
  "unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
44
43
  "coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
@@ -119,42 +118,40 @@
119
118
  },
120
119
  "dependencies": {
121
120
  "@jridgewell/sourcemap-codec": "^1.4.14",
122
- "@ui5/fs": "^3.0.0-rc.0",
123
- "@ui5/logger": "^3.0.1-rc.0",
121
+ "@ui5/fs": "^3.0.0-rc.3",
122
+ "@ui5/logger": "^3.0.1-rc.1",
124
123
  "cheerio": "1.0.0-rc.12",
125
124
  "escape-unicode": "^0.2.0",
126
125
  "escope": "^4.0.0",
127
126
  "espree": "^9.4.1",
128
127
  "graceful-fs": "^4.2.10",
129
128
  "jsdoc": "^3.6.11",
130
- "less-openui5": "^0.11.5",
129
+ "less-openui5": "^0.11.6",
131
130
  "pretty-data": "^0.40.0",
132
- "replacestream": "^4.0.3",
133
- "rimraf": "^3.0.2",
131
+ "rimraf": "^4.1.1",
134
132
  "semver": "^7.3.8",
135
133
  "terser": "^5.16.1",
136
134
  "xml2js": "^0.4.23"
137
135
  },
138
136
  "devDependencies": {
139
137
  "@istanbuljs/esm-loader-hook": "^0.2.0",
140
- "@ui5/project": "^3.0.0-beta.5",
141
- "ava": "^5.1.0",
138
+ "@ui5/project": "^3.0.0-rc.3",
139
+ "ava": "^5.1.1",
142
140
  "chai": "^4.3.7",
143
141
  "chai-fs": "^2.0.0",
144
142
  "chokidar-cli": "^3.0.0",
145
143
  "cross-env": "^7.0.3",
146
144
  "depcheck": "^1.4.3",
147
- "docdash": "^2.0.0",
148
- "eslint": "^8.30.0",
145
+ "docdash": "^2.0.1",
146
+ "eslint": "^8.32.0",
149
147
  "eslint-config-google": "^0.14.0",
150
- "eslint-plugin-ava": "^13.2.0",
151
- "eslint-plugin-jsdoc": "^39.6.4",
148
+ "eslint-plugin-ava": "^14.0.0",
149
+ "eslint-plugin-jsdoc": "^39.6.7",
152
150
  "esmock": "^2.1.0",
153
151
  "nyc": "^15.1.0",
154
152
  "open-cli": "^7.1.0",
155
153
  "recursive-readdir": "^2.2.3",
156
154
  "sinon": "^15.0.1",
157
- "tap-nyan": "^1.1.0",
158
155
  "tap-xunit": "^2.4.1"
159
156
  }
160
157
  }