@ui5/webcomponents-tools 2.17.0-rc.1 → 2.17.0-rc.3
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 +27 -0
- package/lib/cem/custom-elements-manifest.config.mjs +16 -0
- package/lib/create-illustrations/index.js +2 -1
- package/lib/css-processors/css-processor-components.mjs +2 -2
- package/lib/css-processors/css-processor-themes.mjs +42 -26
- package/lib/css-processors/scope-variables.mjs +17 -9
- package/lib/test-runner/test-runner.js +56 -48
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.17.0-rc.3](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.2...v2.17.0-rc.3) (2025-11-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **cem:** alias references ([#12682](https://github.com/UI5/webcomponents/issues/12682)) ([4ce5617](https://github.com/UI5/webcomponents/commit/4ce5617ff580c869640996545fa618ff90447ba4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* **framework:** scope theming css variables with component packages ([#12491](https://github.com/UI5/webcomponents/issues/12491)) ([43ff5de](https://github.com/UI5/webcomponents/commit/43ff5defaf6e08bac848df3d2d34943de15bee83))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
# [2.17.0-rc.2](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.1...v2.17.0-rc.2) (2025-11-13)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **tools:** fix wc-dev test command ([#12662](https://github.com/UI5/webcomponents/issues/12662)) ([7dd11fb](https://github.com/UI5/webcomponents/commit/7dd11fbb88711a74d3602328a492a923552fd4ef))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
# [2.17.0-rc.1](https://github.com/UI5/webcomponents/compare/v2.17.0-rc.0...v2.17.0-rc.1) (2025-11-07)
|
|
7
34
|
|
|
8
35
|
|
|
@@ -27,7 +27,17 @@ import { generateCustomData } from "cem-plugin-vs-code-custom-data-generator";
|
|
|
27
27
|
import { customElementJetBrainsPlugin } from "custom-element-jet-brains-integration";
|
|
28
28
|
|
|
29
29
|
const packageJSON = JSON.parse(fs.readFileSync("./package.json"));
|
|
30
|
+
let aliasMap = {};
|
|
31
|
+
|
|
30
32
|
const devMode = process.env.UI5_CEM_MODE === "dev";
|
|
33
|
+
try {
|
|
34
|
+
aliasMap = JSON.parse(fs.readFileSync("./.ui5-cem-aliases.json"));
|
|
35
|
+
} catch (e) {
|
|
36
|
+
if (devMode) {
|
|
37
|
+
console.warn("No .ui5-cem-aliases.json file found. Continuing without aliases.");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
|
|
32
42
|
const extractClassNodeJSDoc = node => {
|
|
33
43
|
const fileContent = node.getFullText();
|
|
@@ -486,6 +496,12 @@ export default {
|
|
|
486
496
|
}
|
|
487
497
|
}
|
|
488
498
|
|
|
499
|
+
moduleDoc.declarations.forEach(declaration => {
|
|
500
|
+
if (declaration.superclass?.name && aliasMap[declaration.superclass.name]) {
|
|
501
|
+
declaration.superclass.name = aliasMap[declaration.superclass.name];
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
|
|
489
505
|
const typeReferences = new Set();
|
|
490
506
|
const registerTypeReference = reference => typeReferences.add(JSON.stringify(reference))
|
|
491
507
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require("fs").promises;
|
|
2
2
|
const path = require("path");
|
|
3
|
+
const { scopeThemingVariables } = require("../css-processors/scope-variables.mjs");
|
|
3
4
|
|
|
4
5
|
const generate = async (argv) => {
|
|
5
6
|
if (argv.length < 7) {
|
|
@@ -91,7 +92,7 @@ const generate = async (argv) => {
|
|
|
91
92
|
console.log(`Generating illustrations from ${srcPath} to ${destPath}`)
|
|
92
93
|
|
|
93
94
|
const svgImportTemplate = svgContent => {
|
|
94
|
-
return `export default \`${svgContent}\`;`
|
|
95
|
+
return `export default \`${scopeThemingVariables(svgContent)}\`;`
|
|
95
96
|
};
|
|
96
97
|
const svgToJs = async fileName => {
|
|
97
98
|
const svg = await fs.readFile(path.join(srcPath, fileName), { encoding: "utf-8" });
|
|
@@ -4,7 +4,7 @@ import * as fs from "fs";
|
|
|
4
4
|
import * as path from "path";
|
|
5
5
|
import { writeFile, mkdir } from "fs/promises";
|
|
6
6
|
import chokidar from "chokidar";
|
|
7
|
-
import
|
|
7
|
+
import {scopeUi5Variables} from "./scope-variables.mjs";
|
|
8
8
|
import { writeFileIfChanged, getFileContent } from "./shared.mjs";
|
|
9
9
|
import { pathToFileURL } from "url";
|
|
10
10
|
|
|
@@ -24,7 +24,7 @@ const generate = async (argv) => {
|
|
|
24
24
|
build.onEnd(result => {
|
|
25
25
|
result.outputFiles.forEach(async f => {
|
|
26
26
|
// scoping
|
|
27
|
-
let newText =
|
|
27
|
+
let newText = scopeUi5Variables(f.text, packageJSON);
|
|
28
28
|
newText = newText.replaceAll(/\\/g, "\\\\"); // Escape backslashes as they might appear in css rules
|
|
29
29
|
await mkdir(path.dirname(f.path), { recursive: true });
|
|
30
30
|
writeFile(f.path, newText);
|
|
@@ -6,10 +6,45 @@ import { writeFile, mkdir } from "fs/promises";
|
|
|
6
6
|
import postcss from "postcss";
|
|
7
7
|
import combineDuplicatedSelectors from "../postcss-combine-duplicated-selectors/index.js"
|
|
8
8
|
import { writeFileIfChanged, getFileContent } from "./shared.mjs";
|
|
9
|
-
import
|
|
9
|
+
import { scopeUi5Variables, scopeThemingVariables } from "./scope-variables.mjs";
|
|
10
10
|
import { pathToFileURL } from "url";
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
async function processThemingPackageFile(f) {
|
|
13
|
+
const selector = ':root';
|
|
14
|
+
const newRule = postcss.rule({ selector });
|
|
15
|
+
const result = await postcss().process(f.text);
|
|
16
|
+
|
|
17
|
+
result.root.walkRules(selector, rule => {
|
|
18
|
+
for (const decl of rule.nodes) {
|
|
19
|
+
if (decl.type !== 'decl' ) {
|
|
20
|
+
continue;
|
|
21
|
+
} else if (decl.prop.startsWith('--sapFontUrl')) {
|
|
22
|
+
continue;
|
|
23
|
+
} else if (!decl.prop.startsWith('--sap')) {
|
|
24
|
+
newRule.append(decl.clone());
|
|
25
|
+
} else {
|
|
26
|
+
const originalProp = decl.prop;
|
|
27
|
+
const originalValue = decl.value;
|
|
28
|
+
|
|
29
|
+
newRule.append(decl.clone({ prop: originalProp.replace("--sap", "--ui5-sap"), value: `var(${originalProp}, ${originalValue})` }));
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return newRule.toString();
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
async function processComponentPackageFile(f, packageJSON) {
|
|
38
|
+
let result = await postcss(combineDuplicatedSelectors).process(f.text);
|
|
39
|
+
|
|
40
|
+
result = scopeUi5Variables(result.css, packageJSON, f.path);
|
|
41
|
+
|
|
42
|
+
result = scopeThemingVariables(result);
|
|
43
|
+
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function generate(argv) {
|
|
13
48
|
const tsMode = process.env.UI5_TS === "true";
|
|
14
49
|
const extension = tsMode ? ".css.ts" : ".css.js";
|
|
15
50
|
|
|
@@ -20,29 +55,6 @@ const generate = async (argv) => {
|
|
|
20
55
|
]);
|
|
21
56
|
const restArgs = argv.slice(2);
|
|
22
57
|
|
|
23
|
-
const processThemingPackageFile = async (f) => {
|
|
24
|
-
const selector = ':root';
|
|
25
|
-
const result = await postcss().process(f.text);
|
|
26
|
-
|
|
27
|
-
const newRule = postcss.rule({ selector });
|
|
28
|
-
|
|
29
|
-
result.root.walkRules(selector, rule => {
|
|
30
|
-
rule.walkDecls(decl => {
|
|
31
|
-
if (!decl.prop.startsWith('--sapFontUrl')) {
|
|
32
|
-
newRule.append(decl.clone());
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
return newRule.toString();
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const processComponentPackageFile = async (f) => {
|
|
41
|
-
const result = await postcss(combineDuplicatedSelectors).process(f.text);
|
|
42
|
-
|
|
43
|
-
return scopeVariables(result.css, packageJSON, f.path);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
58
|
let scopingPlugin = {
|
|
47
59
|
name: 'scoping',
|
|
48
60
|
setup(build) {
|
|
@@ -50,7 +62,7 @@ const generate = async (argv) => {
|
|
|
50
62
|
|
|
51
63
|
build.onEnd(result => {
|
|
52
64
|
result.outputFiles.forEach(async f => {
|
|
53
|
-
let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f);
|
|
65
|
+
let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f, packageJSON);
|
|
54
66
|
|
|
55
67
|
await mkdir(path.dirname(f.path), { recursive: true });
|
|
56
68
|
writeFile(f.path, newText);
|
|
@@ -99,4 +111,8 @@ if (import.meta.url === fileUrl) {
|
|
|
99
111
|
|
|
100
112
|
export default {
|
|
101
113
|
_ui5mainFn: generate
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export {
|
|
117
|
+
processComponentPackageFile
|
|
102
118
|
}
|
|
@@ -9,9 +9,9 @@ const require = createRequire(import.meta.url);
|
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
11
|
const getOverrideVersion = filePath => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
if (!filePath) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
15
|
|
|
16
16
|
if (!filePath.includes(`overrides${path.sep}`)) {
|
|
17
17
|
return; // The "overrides/" directory is the marker
|
|
@@ -36,14 +36,22 @@ const getOverrideVersion = filePath => {
|
|
|
36
36
|
return overrideVersion;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const scopeUi5Variables = (cssText, packageJSON, inputFile) => {
|
|
40
|
+
const escapeVersion = version => "v" + version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
|
|
41
|
+
const versionStr = escapeVersion(getOverrideVersion(inputFile) || packageJSON.version);
|
|
42
|
+
const expr = /(--_?ui5)([^\,\:\)\s]+)/g;
|
|
43
|
+
let newText = cssText.replaceAll(expr, `$1-${versionStr}$2`);
|
|
42
44
|
|
|
43
|
-
|
|
45
|
+
return newText.replaceAll("--sap", `--ui5-sap`);
|
|
46
|
+
}
|
|
44
47
|
|
|
45
|
-
|
|
48
|
+
// Used with CSS text and SVG file content (illustrations)
|
|
49
|
+
const scopeThemingVariables = (cssText) => {
|
|
50
|
+
return cssText.replaceAll("--sap", `--ui5-sap`);
|
|
46
51
|
}
|
|
47
52
|
|
|
48
|
-
export
|
|
53
|
+
export {
|
|
54
|
+
scopeUi5Variables,
|
|
55
|
+
scopeThemingVariables,
|
|
56
|
+
};
|
|
49
57
|
|
|
@@ -3,69 +3,77 @@ const { readFileSync } = require("fs");
|
|
|
3
3
|
const path = require("path");
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
function testFn() {
|
|
7
|
+
// search for dev-server port
|
|
7
8
|
// start in current folder
|
|
8
9
|
// traversing upwards in case of mono repo tests and dev-server running in root folder of repository
|
|
9
|
-
let devServerFolder = process.cwd();
|
|
10
|
-
let devServerPort;
|
|
11
|
-
while (true) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
10
|
+
let devServerFolder = process.cwd();
|
|
11
|
+
let devServerPort;
|
|
12
|
+
while (true) {
|
|
13
|
+
try {
|
|
14
|
+
devServerPort = readFileSync(path.join(devServerFolder, ".dev-server-port")).toString();
|
|
15
|
+
break; // found
|
|
16
|
+
} catch (e) {
|
|
17
|
+
// file not found
|
|
18
|
+
if (devServerFolder === path.dirname(devServerFolder)) {
|
|
19
|
+
break; // reached root folder "/"
|
|
20
|
+
}
|
|
21
|
+
devServerFolder = path.dirname(devServerFolder);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
23
24
|
|
|
24
25
|
// check if we are in a monorepo and extract path from package.json
|
|
25
|
-
let packageRepositoryPath = "";
|
|
26
|
-
const pkg = require(path.join(process.cwd(), "package.json"));
|
|
27
|
-
packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
|
|
26
|
+
let packageRepositoryPath = "";
|
|
27
|
+
const pkg = require(path.join(process.cwd(), "package.json"));
|
|
28
|
+
packageRepositoryPath = pkg.repository ? pkg.repository.directory : "";
|
|
28
29
|
|
|
29
30
|
// construct base url
|
|
30
31
|
// use devServerPort if a dev server is running, otherwise let the baseUrl in the wdio config be used
|
|
31
32
|
// if a dev server is running in the root of a mono repo, append tha package path like this
|
|
32
33
|
// http://localhost:${devServerPort}/packages/main/
|
|
33
|
-
let baseUrl = "";
|
|
34
|
-
if (devServerPort) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
34
|
+
let baseUrl = "";
|
|
35
|
+
if (devServerPort) {
|
|
36
|
+
console.log(`Found port ${devServerPort} from '${path.join(devServerFolder, ".dev-server-port")}'`);
|
|
37
|
+
const devServerInRoot = !devServerFolder.includes(packageRepositoryPath);
|
|
38
|
+
if (devServerInRoot) {
|
|
39
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/${packageRepositoryPath}/`;
|
|
40
|
+
} else {
|
|
41
|
+
baseUrl = `--base-url http://localhost:${devServerPort}/`;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
43
44
|
|
|
44
|
-
if (!baseUrl) {
|
|
45
|
-
|
|
46
|
-
}
|
|
45
|
+
if (!baseUrl) {
|
|
46
|
+
console.log("No dev server running, running tests served from `dist`, make sure it is up to date");
|
|
47
|
+
}
|
|
47
48
|
|
|
48
49
|
// add single spec parameter if passed
|
|
49
|
-
let spec = "";
|
|
50
|
-
if (process.argv.length === 3) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
50
|
+
let spec = "";
|
|
51
|
+
if (process.argv.length === 3) {
|
|
52
|
+
const specFile = process.argv[2];
|
|
53
|
+
spec = `--spec ${specFile}`;
|
|
54
|
+
}
|
|
54
55
|
|
|
55
56
|
// more parameters - pass them to wdio
|
|
56
|
-
let restParams = "";
|
|
57
|
-
if (process.argv.length > 3) {
|
|
58
|
-
|
|
57
|
+
let restParams = "";
|
|
58
|
+
if (process.argv.length > 3) {
|
|
59
|
+
restParams = process.argv.slice(2).join(" ");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let wdioConfig = "";
|
|
63
|
+
if (fs.existsSync("config/wdio.conf.cjs")) {
|
|
64
|
+
wdioConfig = "config/wdio.conf.cjs";
|
|
65
|
+
} else if (fs.existsSync("config/wdio.conf.js")) {
|
|
66
|
+
wdioConfig = "config/wdio.conf.js";
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// run wdio with calculated parameters
|
|
70
|
+
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
|
|
71
|
+
console.log(`executing: ${cmd}`);
|
|
72
|
+
child_process.execSync(cmd, {stdio: 'inherit'});
|
|
59
73
|
}
|
|
60
74
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
wdioConfig = "config/wdio.conf.cjs";
|
|
64
|
-
} else if (fs.existsSync("config/wdio.conf.js")) {
|
|
65
|
-
wdioConfig = "config/wdio.conf.js";
|
|
75
|
+
if (require.main === module) {
|
|
76
|
+
testFn(process.argv)
|
|
66
77
|
}
|
|
67
78
|
|
|
68
|
-
|
|
69
|
-
const cmd = `yarn cross-env WDIO_LOG_LEVEL=error wdio ${wdioConfig} ${spec} ${baseUrl} ${restParams}`;
|
|
70
|
-
console.log(`executing: ${cmd}`);
|
|
71
|
-
child_process.execSync(cmd, {stdio: 'inherit'});
|
|
79
|
+
exports._ui5mainFn = testFn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
|
3
|
-
"version": "2.17.0-rc.
|
|
3
|
+
"version": "2.17.0-rc.3",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"esbuild": "^0.25.0",
|
|
85
85
|
"yargs": "^17.5.1"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "45ac45d27dd4c95cc840c51c95fef9d38e7586f0"
|
|
88
88
|
}
|