@ui5/webcomponents-tools 2.14.0-rc.2 → 2.14.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 CHANGED
@@ -3,6 +3,17 @@
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.14.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v2.14.0-rc.2...v2.14.0-rc.3) (2025-08-22)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **tools:** correct strip unused theming base content ([#12133](https://github.com/SAP/ui5-webcomponents/issues/12133)) ([a97901d](https://github.com/SAP/ui5-webcomponents/commit/a97901da861836a5567cd4076a34bb07522ef7ba))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.14.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.14.0-rc.1...v2.14.0-rc.2) (2025-08-21)
7
18
 
8
19
 
@@ -5,7 +5,7 @@ import * as path from "path";
5
5
  import { writeFile, mkdir } from "fs/promises";
6
6
  import postcss from "postcss";
7
7
  import combineDuplicatedSelectors from "../postcss-combine-duplicated-selectors/index.js"
8
- import { writeFileIfChanged, stripThemingBaseContent, getFileContent } from "./shared.mjs";
8
+ import { writeFileIfChanged, getFileContent } from "./shared.mjs";
9
9
  import scopeVariables from "./scope-variables.mjs";
10
10
 
11
11
  const tsMode = process.env.UI5_TS === "true";
@@ -13,19 +13,32 @@ const extension = tsMode ? ".css.ts" : ".css.js";
13
13
 
14
14
  const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
15
15
 
16
- let inputFiles = await globby("src/**/parameters-bundle.css");
16
+ const inputFiles = await globby([
17
+ "src/**/parameters-bundle.css",
18
+ ]);
17
19
  const restArgs = process.argv.slice(2);
18
20
 
19
- const removeDuplicateSelectors = async (text) => {
20
- const result = await postcss(combineDuplicatedSelectors).process(text);
21
- return result.css;
22
- }
21
+ const processThemingPackageFile = async (f) => {
22
+ const selector = ':root';
23
+ const result = await postcss().process(f.text);
24
+
25
+ const newRule = postcss.rule({ selector });
23
26
 
24
- const processFontFace = (text) => {
25
- const declarationExpr = /@font-face\s*{[^}]*}/g;
27
+ result.root.walkRules(selector, rule => {
28
+ rule.walkDecls(decl => {
29
+ if (!decl.prop.startsWith('--sapFontUrl')) {
30
+ newRule.append(decl.clone());
31
+ }
32
+ });
33
+ });
34
+
35
+ return newRule.toString();
36
+ };
26
37
 
27
- // remove declarations from source, they are extracted in base package
28
- return text.replaceAll(declarationExpr, '');
38
+ const processComponentPackageFile = async (f) => {
39
+ const result = await postcss(combineDuplicatedSelectors).process(f.text);
40
+
41
+ return scopeVariables(result.css, packageJSON, f.path);
29
42
  }
30
43
 
31
44
  let scopingPlugin = {
@@ -35,23 +48,14 @@ let scopingPlugin = {
35
48
 
36
49
  build.onEnd(result => {
37
50
  result.outputFiles.forEach(async f => {
38
- // remove font-face declarations
39
- let newText = processFontFace(f.text);
40
-
41
- // remove duplicate selectors
42
- newText = await removeDuplicateSelectors(newText);
43
-
44
- // strip unnecessary theming-base-content
45
- newText = stripThemingBaseContent(newText);
51
+ let newText = f.path.includes("packages/theming") ? await processThemingPackageFile(f) : await processComponentPackageFile(f);
46
52
 
47
- // scoping
48
- newText = scopeVariables(newText, packageJSON, f.path);
49
- await mkdir(path.dirname(f.path), {recursive: true});
53
+ await mkdir(path.dirname(f.path), { recursive: true });
50
54
  writeFile(f.path, newText);
51
55
 
52
56
  // JSON
53
57
  const jsonPath = f.path.replace(/dist[\/\\]css/, "dist/generated/assets").replace(".css", ".css.json");
54
- await mkdir(path.dirname(jsonPath), {recursive: true});
58
+ await mkdir(path.dirname(jsonPath), { recursive: true });
55
59
  writeFileIfChanged(jsonPath, JSON.stringify(newText));
56
60
 
57
61
  // JS/TS
@@ -24,16 +24,6 @@ const writeFileIfChanged = async (fileName, content) => {
24
24
  }
25
25
  }
26
26
 
27
- // strips the unnecessary theming data coming from @sap-theming/theming-base-content and leaves only the css parameters
28
- const stripThemingBaseContent = css => {
29
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
30
- css = css.replace(/\.background-image.*{.*}/, "");
31
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
32
- css = css.replace(/--sapFontUrl.*\);?/, "");
33
- return css;
34
- }
35
-
36
-
37
27
  const DEFAULT_THEME = assets.themes.default;
38
28
 
39
29
  const getDefaultThemeCode = packageName => {
@@ -42,8 +32,8 @@ const getDefaultThemeCode = packageName => {
42
32
  import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
43
33
  import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
44
34
 
45
- registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", async () => defaultThemeBase);
46
- registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", async () => defaultTheme);
35
+ registerThemePropertiesLoader("@" + "ui5" + "/" + "webcomponents-theming", "${DEFAULT_THEME}", async () => defaultThemeBase);
36
+ registerThemePropertiesLoader(${ packageName.split("").map(c => `"${c}"`).join (" + ") }, "${DEFAULT_THEME}", async () => defaultTheme);
47
37
  `;
48
38
  };
49
39
 
@@ -53,4 +43,4 @@ const getFileContent = (packageName, css, includeDefaultTheme) => {
53
43
  }
54
44
 
55
45
 
56
- export { writeFileIfChanged, stripThemingBaseContent, getFileContent}
46
+ export { writeFileIfChanged, getFileContent}
@@ -27,7 +27,7 @@ const importAndCheck = async (localeId) => {
27
27
  const localeIds = [${languagesKeysStringArray}];
28
28
 
29
29
  localeIds.forEach(localeId => {
30
- registerI18nLoader("${packageName}", localeId, importAndCheck);
30
+ registerI18nLoader(${ packageName.split("").map(c => `"${c}"`).join (" + ") }, localeId, importAndCheck);
31
31
  });
32
32
  `;
33
33
  }
@@ -11,10 +11,10 @@ const generate = async () => {
11
11
  const outputFileDynamicImportJSONAttr = path.normalize(`${process.argv[3]}/Themes-node.${ext}`);
12
12
  const outputFileFetchMetaResolve = path.normalize(`${process.argv[3]}/Themes-fetch.${ext}`);
13
13
 
14
- // All supported optional themes
14
+ // All supported optional themes
15
15
  const allThemes = assets.themes.all;
16
16
 
17
- // All themes present in the file system
17
+ // All themes present in the file system
18
18
  const dirs = await fs.readdir(inputFolder);
19
19
  const themesOnFileSystem = dirs.map(dir => {
20
20
  const matches = dir.match(/sap_.*$/);
@@ -28,7 +28,7 @@ const generate = async () => {
28
28
  const dynamicImportJSONAttrLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await import(/* webpackChunkName: "${packageName.replace("@", "").replace("/", "-")}-${theme.replace("_", "-")}-parameters-bundle" */"../assets/themes/${theme}/parameters-bundle.css.json", {with: { type: 'json'}})).default;`).join("\n");
29
29
  const fetchMetaResolveLines = themesOnFileSystem.map(theme => `\t\tcase "${theme}": return (await fetch(new URL("../assets/themes/${theme}/parameters-bundle.css.json", import.meta.url))).json();`).join("\n");
30
30
 
31
- // dynamic imports file content
31
+ // dynamic imports file content
32
32
  const contentDynamic = function (lines) {
33
33
  return `// @ts-nocheck
34
34
  import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
@@ -49,7 +49,7 @@ const loadAndCheck = async (themeName) => {
49
49
  };
50
50
 
51
51
  ${availableThemesArray}
52
- .forEach(themeName => registerThemePropertiesLoader("${packageName}", themeName, loadAndCheck));
52
+ .forEach(themeName => registerThemePropertiesLoader(${ packageName.split("").map(c => `"${c}"`).join (" + ") }, themeName, loadAndCheck));
53
53
  `;
54
54
  }
55
55
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "2.14.0-rc.2",
3
+ "version": "2.14.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",
@@ -83,5 +83,5 @@
83
83
  "esbuild": "^0.25.0",
84
84
  "yargs": "^17.5.1"
85
85
  },
86
- "gitHead": "5fe95abc08bc7cfd2d061e31cda5662ad37db4f6"
86
+ "gitHead": "c1c74f2bd283434a0610b3b9bf9ab0bc9eb682b7"
87
87
  }