@sap-ux/fe-fpm-writer 0.43.22 → 0.43.24

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.
@@ -9,8 +9,7 @@ exports.extendJSON = extendJSON;
9
9
  exports.copyTpl = copyTpl;
10
10
  exports.getRelativeTemplateComponentPath = getRelativeTemplateComponentPath;
11
11
  const node_path_1 = require("node:path");
12
- const file_1 = require("@sap-ux/project-access/dist/file");
13
- const xmldom_1 = require("@xmldom/xmldom");
12
+ const project_access_1 = require("@sap-ux/project-access");
14
13
  const CHAR_SPACE = ' ';
15
14
  const CHAR_TAB = '\t';
16
15
  exports.CONFIG = {
@@ -112,18 +111,14 @@ exports.CONFIG = {
112
111
  */
113
112
  function generateUniqueElementId(baseId, filteredFilesContent, validatedIds = []) {
114
113
  const maxAttempts = 1000;
115
- function checkElementIdAvailable(id, xmlContent) {
116
- const xmlDocument = new xmldom_1.DOMParser({ errorHandler: () => { } }).parseFromString(xmlContent);
117
- return xmlDocument.documentElement ? !xmlDocument.getElementById(id) : true;
118
- }
119
- if (filteredFilesContent.every((content) => content === '' || checkElementIdAvailable(baseId, content)) &&
120
- !validatedIds.includes(baseId)) {
114
+ // Check both in-memory validatedIds and filesystem files
115
+ if (!validatedIds.includes(baseId) && (0, project_access_1.isUI5IdUnique)(baseId, filteredFilesContent)) {
121
116
  return baseId;
122
117
  }
123
118
  for (let counter = 1; counter < maxAttempts; counter++) {
124
119
  const candidateId = `${baseId}${counter}`;
125
- if (filteredFilesContent.every((content) => content === '' || checkElementIdAvailable(candidateId, content)) &&
126
- !validatedIds.includes(candidateId)) {
120
+ // Check both in-memory validatedIds and filesystem files
121
+ if (!validatedIds.includes(candidateId) && (0, project_access_1.isUI5IdUnique)(candidateId, filteredFilesContent)) {
127
122
  return candidateId;
128
123
  }
129
124
  }
@@ -138,7 +133,7 @@ function generateUniqueElementId(baseId, filteredFilesContent, validatedIds = []
138
133
  * @returns A list of view and fragment files
139
134
  */
140
135
  async function getFragmentAndViewFiles(appPath, fs) {
141
- const files = await (0, file_1.findFilesByExtension)('.xml', appPath, ['.git', 'node_modules', 'dist', 'annotations', 'localService'], fs);
136
+ const files = await (0, project_access_1.findFilesByExtension)('.xml', appPath, ['.git', 'node_modules', 'dist', 'annotations', 'localService'], fs);
142
137
  const lookupFiles = ['.fragment.xml', '.view.xml'];
143
138
  return files.filter((fileName) => lookupFiles.some((lookupFile) => fileName.endsWith(lookupFile)));
144
139
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sap-ux/fe-fpm-writer",
3
3
  "description": "SAP Fiori elements flexible programming model writer",
4
- "version": "0.43.22",
4
+ "version": "0.43.24",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -30,9 +30,9 @@
30
30
  "semver": "7.7.4",
31
31
  "xml-formatter": "3.7.0",
32
32
  "xpath": "0.0.34",
33
- "@sap-ux/fiori-annotation-api": "0.9.43",
33
+ "@sap-ux/fiori-annotation-api": "0.9.45",
34
34
  "@sap-ux/i18n": "0.3.10",
35
- "@sap-ux/project-access": "1.35.21",
35
+ "@sap-ux/project-access": "1.36.0",
36
36
  "@sap-ux/logger": "0.8.5"
37
37
  },
38
38
  "devDependencies": {