Skip to content

Commit 50d64cc

Browse files
authored
chore: change theming base constant so it is not mistaken for import (#12181)
1 parent 843152e commit 50d64cc

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

packages/base/src/theming/applyTheme.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import type OpenUI5Support from "../features/OpenUI5Support.js";
88
import { DEFAULT_THEME } from "../generated/AssetParameters.js";
99
import { getCurrentRuntimeIndex } from "../Runtimes.js";
1010

11-
const BASE_THEME_PACKAGE = "@ui5/webcomponents-theming";
11+
// eslint-disable-next-line
12+
const BASE_THEME_PACKAGE = "@" + "ui5" + "/" + "webcomponents-theming";
1213

1314
const isThemeBaseRegistered = () => {
1415
const registeredPackages = getRegisteredPackages();

packages/tools/lib/css-processors/shared.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const getDefaultThemeCode = packageName => {
3232
import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
3333
import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
3434
35-
registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", async () => defaultThemeBase);
36-
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);
3737
`;
3838
};
3939

packages/tools/lib/generate-json-imports/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const importAndCheck = async (localeId) => {
2727
const localeIds = [${languagesKeysStringArray}];
2828
2929
localeIds.forEach(localeId => {
30-
registerI18nLoader("${packageName}", localeId, importAndCheck);
30+
registerI18nLoader(${ packageName.split("").map(c => `"${c}"`).join (" + ") }, localeId, importAndCheck);
3131
});
3232
`;
3333
}

packages/tools/lib/generate-json-imports/themes.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ const generate = async () => {
1111
const outputFileDynamicImportJSONAttr = path.normalize(`${process.argv[3]}/Themes-node.${ext}`);
1212
const outputFileFetchMetaResolve = path.normalize(`${process.argv[3]}/Themes-fetch.${ext}`);
1313

14-
// All supported optional themes
14+
// All supported optional themes
1515
const allThemes = assets.themes.all;
1616

17-
// All themes present in the file system
17+
// All themes present in the file system
1818
const dirs = await fs.readdir(inputFolder);
1919
const themesOnFileSystem = dirs.map(dir => {
2020
const matches = dir.match(/sap_.*$/);
@@ -28,7 +28,7 @@ const generate = async () => {
2828
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");
2929
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");
3030

31-
// dynamic imports file content
31+
// dynamic imports file content
3232
const contentDynamic = function (lines) {
3333
return `// @ts-nocheck
3434
import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
@@ -49,7 +49,7 @@ const loadAndCheck = async (themeName) => {
4949
};
5050
5151
${availableThemesArray}
52-
.forEach(themeName => registerThemePropertiesLoader("${packageName}", themeName, loadAndCheck));
52+
.forEach(themeName => registerThemePropertiesLoader(${ packageName.split("").map(c => `"${c}"`).join (" + ") }, themeName, loadAndCheck));
5353
`;
5454
}
5555

0 commit comments

Comments
 (0)