@ui5/webcomponents-tools 2.6.0 → 2.6.2-rc.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,22 @@
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.6.2-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.6.1...v2.6.2-rc.0) (2025-01-09)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.6.1](https://github.com/SAP/ui5-webcomponents/compare/v2.6.0...v2.6.1) (2025-01-08)
15
+
16
+ **Note:** Version bump only for package @ui5/webcomponents-tools
17
+
18
+
19
+
20
+
21
+
6
22
  # [2.6.0](https://github.com/SAP/ui5-webcomponents/compare/v2.6.0-rc.5...v2.6.0) (2025-01-07)
7
23
 
8
24
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -130,6 +130,23 @@ function processClass(ts, classNode, moduleDoc) {
130
130
  currClass.events = findAllDecorators(classNode, "event")
131
131
  ?.map(event => processEvent(ts, event, classNode, moduleDoc));
132
132
 
133
+ // TODO: remove after changing Button's click to custom event.
134
+ // Currently, the Button emits a native click that doesn't need and doesn't have an event decorator,
135
+ // so we add it manually to the events array.
136
+ if (currClass.tagName === "ui5-button") {
137
+ currClass.events.push({
138
+ "name": "click",
139
+ "_ui5privacy": "public",
140
+ "type": {
141
+ "text": "Event"
142
+ },
143
+ "description": "Fired when the component is activated either with a\nmouse/tap or by using the Enter or Space key.\n\n**Note:** The event will not be fired if the `disabled`\nproperty is set to `true`.",
144
+ "_ui5Cancelable": false,
145
+ "_ui5allowPreventDefault": false,
146
+ "_ui5Bubbles": true
147
+ });
148
+ }
149
+
133
150
  const filename = classNode.getSourceFile().fileName;
134
151
  const sourceFile = typeProgram.getSourceFile(filename);
135
152
  const tsProgramClassNode = sourceFile.statements.find(statement => ts.isClassDeclaration(statement) && statement.name?.text === classNode.name?.text);
package/lib/cem/utils.mjs CHANGED
@@ -3,6 +3,8 @@ import path from "path";
3
3
 
4
4
  let documentationErrors = new Map();
5
5
 
6
+ const packageRegex = /^((@([a-z0-9._-]+)\/)?([a-z0-9._-]+))/;
7
+
6
8
  const getDeprecatedStatus = (jsdocComment) => {
7
9
  const deprecatedTag = findTag(jsdocComment, "deprecated");
8
10
  return deprecatedTag?.name
@@ -30,7 +32,7 @@ const toKebabCase = str => {
30
32
  }
31
33
 
32
34
  const normalizeDescription = (description) => {
33
- return typeof description === 'string' ? description.replaceAll(/^-\s+|^(\n)+|(\n)+$/g, ""): description;
35
+ return typeof description === 'string' ? description.replaceAll(/^-\s+|^(\n)+|(\n)+$/g, "") : description;
34
36
  }
35
37
 
36
38
  const getTypeRefs = (ts, node, member) => {
@@ -111,10 +113,22 @@ const findPackageName = (ts, sourceFile, typeName) => {
111
113
  if (currentModuleSpecifier?.text?.startsWith(".")) {
112
114
  return packageJSON?.name;
113
115
  } else {
114
- return Object.keys(packageJSON?.dependencies || {}).find(
115
- (dependency) =>
116
- currentModuleSpecifier?.text?.startsWith(`${dependency}/`)
117
- );
116
+ // my-package/test
117
+ // my-package
118
+ // @scope/my-package
119
+ // my.package
120
+ // _mypackage
121
+ // mypackage-
122
+ // scope/my-package/test
123
+ // @scope/my-package/test
124
+ const match = currentModuleSpecifier?.text.match(packageRegex);
125
+ let packageName;
126
+
127
+ if (match) {
128
+ packageName = match[1];
129
+ }
130
+
131
+ return packageName || undefined;
118
132
  }
119
133
  }
120
134
  };
@@ -156,33 +170,24 @@ const findImportPath = (ts, sourceFile, typeName, modulePath) => {
156
170
  ?.replace("src", "dist")?.replace(".ts", ".js") || undefined
157
171
  );
158
172
  } else {
159
- // my-package/test
160
- // my-package
161
- // @scope/my-package
162
- // my.package
163
- // _mypackage
164
- // mypackage-
165
- // scope/my-package/test
166
- // @scope/my-package/test
167
- const match = currentModuleSpecifier?.text.match(/^((@([a-z0-9._-]+)\/)?([a-z0-9._-]+))/);
168
- let packageName;
173
+ let packageName = currentModuleSpecifier?.text?.replace(packageRegex, "") || undefined;
169
174
 
170
- if (match) {
171
- packageName = match[1];
175
+ if (packageName?.startsWith("/")) {
176
+ packageName = packageName.replace("/", "");
172
177
  }
173
178
 
174
- return packageName || undefined;
179
+ return packageName;
175
180
  }
176
181
  }
177
182
  };
178
183
 
179
184
 
180
185
  const isClass = text => {
181
- return text.includes("@abstract") || text.includes("@class") || text.includes("@constructor");
186
+ return text.includes("@abstract") || text.includes("@class") || text.includes("@constructor");
182
187
  };
183
188
 
184
189
  const normalizeTagType = (type) => {
185
- return type?.trim();
190
+ return type?.trim();
186
191
  }
187
192
 
188
193
  const packageJSON = JSON.parse(fs.readFileSync("./package.json"));
@@ -339,7 +344,7 @@ const validateJSDocComment = (fieldType, jsdocComment, node, moduleDoc) => {
339
344
  let isValid = false
340
345
 
341
346
  if (fieldType === "event" && tag?.tag === "param") {
342
- isValid = allowedTags[fieldType]?.includes(tag.tag) && validateJSDocTag({...tag, tag: "eventparam"});
347
+ isValid = allowedTags[fieldType]?.includes(tag.tag) && validateJSDocTag({ ...tag, tag: "eventparam" });
343
348
  } else {
344
349
  isValid = allowedTags[fieldType]?.includes(tag.tag) && validateJSDocTag(tag);
345
350
  }
@@ -368,20 +373,20 @@ const displayDocumentationErrors = () => {
368
373
  [...documentationErrors.keys()].forEach(modulePath => {
369
374
  const moduleErrors = documentationErrors.get(modulePath);
370
375
 
371
- console.log(`=== ERROR: ${moduleErrors.length > 1 ? `${moduleErrors.length} problems` : "Problem"} found in file: ${modulePath}:`)
376
+ console.log(`=== ERROR: ${moduleErrors.length > 1 ? `${moduleErrors.length} problems` : "Problem"} found in file: ${modulePath}:`)
372
377
  moduleErrors.forEach(moduleError => {
373
378
  errorsCount++;
374
379
  console.log(`\t- ${moduleError}`)
375
380
  })
376
381
  })
377
382
 
378
- if(errorsCount) {
383
+ if (errorsCount) {
379
384
  throw new Error(`Found ${errorsCount} errors in the description of the public API.`);
380
385
  }
381
386
  }
382
387
 
383
388
  const formatArrays = (typeText) => {
384
- return typeText?.replaceAll(/(\S+)\[\]/g, "Array<$1>")
389
+ return typeText?.replaceAll(/(\S+)\[\]/g, "Array<$1>")
385
390
  }
386
391
 
387
392
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "2.6.0",
3
+ "version": "2.6.2-rc.0",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -86,5 +86,5 @@
86
86
  "esbuild": "^0.19.9",
87
87
  "yargs": "^17.5.1"
88
88
  },
89
- "gitHead": "ea2ed927eac2710d061242f1fd4a3e8ca7bd0162"
89
+ "gitHead": "dfe4115234a48f7b174d86c0118b552d13403e5e"
90
90
  }