@ui5/webcomponents-tools 1.23.0-rc.4 → 1.23.0

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,28 @@
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
+ # [1.23.0](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.5...v1.23.0) (2024-03-06)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui5-illustrated-message:** introduced "Dot" size ([#8343](https://github.com/SAP/ui5-webcomponents/issues/8343)) ([9c88f36](https://github.com/SAP/ui5-webcomponents/commit/9c88f36112888c1a766875611eb2a0aecbbc6f23)), closes [#8328](https://github.com/SAP/ui5-webcomponents/issues/8328)
12
+
13
+
14
+
15
+
16
+
17
+ # [1.23.0-rc.5](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.4...v1.23.0-rc.5) (2024-02-29)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * remove sap.ui.require call from unused openui5 module ([#8359](https://github.com/SAP/ui5-webcomponents/issues/8359)) ([50219ac](https://github.com/SAP/ui5-webcomponents/commit/50219ac23add7b86fe26d8ca51e2181f01404992))
23
+
24
+
25
+
26
+
27
+
6
28
  # [1.23.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.23.0-rc.3...v1.23.0-rc.4) (2024-02-26)
7
29
 
8
30
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -16,8 +16,6 @@ const convertSAPUIDefineToDefine = async (filePath) => {
16
16
  }
17
17
 
18
18
  const convertAmdToEs6 = async (code) => {
19
- code = code.replace(/sap\.ui\.require/g, "require");
20
-
21
19
  return (await babelCore.transformAsync(code, {
22
20
  plugins: [['babel-plugin-amd-to-esm', {}]]
23
21
  })).code;
@@ -75,8 +73,8 @@ const replaceGlobalCoreUsage = (filePath, code) => {
75
73
  const replaced = code.replace(/sap\.ui\.getCore\(\)/g, `Core`);
76
74
  return code !== replaced ? `import Core from 'sap/ui/core/Core';${replaced}` : code;
77
75
  }
78
-
79
- return code;
76
+
77
+ return code;
80
78
  };
81
79
 
82
80
  const transformAmdToES6Module = async (filePath) => {
@@ -0,0 +1,33 @@
1
+ const fs = require("fs").promises;
2
+ const path = require("path");
3
+ const basePath = process.argv[2];
4
+ const babelCore = require("@babel/core");
5
+ const babelParser = require("@babel/parser");
6
+ const babelGenerator = require("@babel/generator").default;
7
+ const walk = require("estree-walk");
8
+
9
+ const checkHasRequire = (filePath, code) => {
10
+ code = code.replace(/sap\.ui\.require/g, "unhandledRequire");
11
+
12
+ const tree = babelParser.parse(code, { sourceType: "module" });
13
+ walk(tree, {
14
+ CallExpression: function (node) {
15
+ if (node.type === "CallExpression" && node?.callee?.name === "unhandledRequire") {
16
+ throw new Error(`sap.ui.require found in ${filePath}`);
17
+ }
18
+ }
19
+ });
20
+ }
21
+
22
+ const checkFile = async (filePath) => {
23
+ let code = (await fs.readFile(filePath)).toString();
24
+ checkHasRequire(filePath, code);
25
+ }
26
+
27
+ const checkAll = async () => {
28
+ const { globby } = await import("globby");
29
+ const fileNames = await globby(basePath.replace(/\\/g, "/") + "**/*.js");
30
+ return Promise.all(fileNames.map(checkFile).filter(x => !!x));
31
+ };
32
+
33
+ checkAll();
@@ -62,6 +62,8 @@ const generate = async () => {
62
62
  // collect each illustration name because each one should have Sample.js file
63
63
  const fileNames = new Set();
64
64
 
65
+ let dotIllustrationNames = [];
66
+
65
67
  try {
66
68
  await fs.access(srcPath);
67
69
  } catch (error) {
@@ -77,8 +79,14 @@ const generate = async () => {
77
79
  const svgToJs = async fileName => {
78
80
  const svg = await fs.readFile(path.join(srcPath, fileName), { encoding: "utf-8" });
79
81
  const fileContent = svgImportTemplate(svg);
82
+ const fileNameSplitArr = fileName.split('-');
80
83
  fileName = fileName.replace(/\.svg$/, ".js");
81
84
 
85
+ if (fileNameSplitArr[1] === 'Dot') {
86
+ // we keep the Dot illustration names to import them later. If no Dot is present, Spot will be used
87
+ dotIllustrationNames.push(fileNameSplitArr[2].split('.')[0]);
88
+ }
89
+
82
90
  return fs.writeFile(path.join(destPath, fileName), fileContent);
83
91
  };
84
92
  const illustrationImportTemplate = illustrationName => {
@@ -93,11 +101,14 @@ const generate = async () => {
93
101
  }
94
102
 
95
103
  const illustrationNameUpperCase = illustrationNameForTranslation.toUpperCase();
104
+ // If no Dot is present, Spot will be imported as Dot
105
+ const hasDot = dotIllustrationNames.indexOf(illustrationName) !== -1 ? 'Dot' : 'Spot';
96
106
 
97
107
  return `import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
98
108
  import dialogSvg from "./${illustrationsPrefix}-Dialog-${illustrationName}.js";
99
109
  import sceneSvg from "./${illustrationsPrefix}-Scene-${illustrationName}.js";
100
- import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";${
110
+ import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";
111
+ import dotSvg from "./${illustrationsPrefix}-${hasDot}-${illustrationName}.js";${
101
112
  defaultText ? `import {
102
113
  IM_TITLE_${illustrationNameUpperCase},
103
114
  IM_SUBTITLE_${illustrationNameUpperCase},
@@ -112,7 +123,8 @@ const subtitle = IM_SUBTITLE_${illustrationNameUpperCase};` : ``}
112
123
  registerIllustration(name, {
113
124
  dialogSvg,
114
125
  sceneSvg,
115
- spotSvg,${defaultText ? `
126
+ spotSvg,
127
+ dotSvg,${defaultText ? `
116
128
  title,
117
129
  subtitle,` : ``}
118
130
  set,
@@ -124,6 +136,7 @@ export {
124
136
  dialogSvg,
125
137
  sceneSvg,
126
138
  spotSvg,
139
+ dotSvg,
127
140
  };`
128
141
  };
129
142
 
@@ -131,10 +144,11 @@ export {
131
144
  return `declare const dialogSvg: string;
132
145
  declare const sceneSvg: string;
133
146
  declare const spotSvg: string;
147
+ declare const dotSvg: string;
134
148
  declare const _default: "${illustrationSet === "fiori" ? "" : `${illustrationSet}/`}${illustrationName}";
135
149
 
136
150
  export default _default;
137
- export { dialogSvg, sceneSvg, spotSvg };`
151
+ export { dialogSvg, sceneSvg, spotSvg, dotSvg };`
138
152
  };
139
153
 
140
154
  await fs.mkdir(destPath, { recursive: true });
@@ -152,12 +166,15 @@ export { dialogSvg, sceneSvg, spotSvg };`
152
166
  }
153
167
  });
154
168
 
155
- for (let illustrationName of fileNames) {
156
- promises.push(fs.writeFile(path.join(destPath, `${illustrationName}.js`), illustrationImportTemplate(illustrationName)));
157
- promises.push(fs.writeFile(path.join(destPath, `${illustrationName}.d.ts`), illustrationTypeDefinition(illustrationName)));
158
- }
169
+ return Promise.all(promises).then(() => {
170
+ const nestedPromises = [];
171
+ for (let illustrationName of fileNames) {
172
+ nestedPromises.push(fs.writeFile(path.join(destPath, `${illustrationName}.js`), illustrationImportTemplate(illustrationName)));
173
+ nestedPromises.push(fs.writeFile(path.join(destPath, `${illustrationName}.d.ts`), illustrationTypeDefinition(illustrationName)));
174
+ }
159
175
 
160
- return Promise.all(promises);
176
+ return Promise.all(nestedPromises);
177
+ });
161
178
  };
162
179
 
163
180
  generate().then(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "1.23.0-rc.4",
3
+ "version": "1.23.0",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -79,5 +79,5 @@
79
79
  "esbuild": "^0.19.9",
80
80
  "yargs": "^17.5.1"
81
81
  },
82
- "gitHead": "841241411329ef51a41c25a228cac93f5dfb7560"
82
+ "gitHead": "6c2f16f7d091aed0a487986cfebe5f6aabf71160"
83
83
  }