@sap-ux/project-access 1.32.2 → 1.32.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/dist/constants.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MinCdsVersionUi5Plugin = exports.moduleCacheRoot = exports.fioriToolsDirectory = exports.SchemaName = exports.FioriToolsSettings = exports.DirName = exports.FileName = void 0;
4
- const os_1 = require("os");
5
- const path_1 = require("path");
4
+ const node_os_1 = require("node:os");
5
+ const node_path_1 = require("node:path");
6
6
  exports.FileName = {
7
7
  AdaptationConfig: 'config.json',
8
8
  CapJavaApplicationYaml: 'application.yaml',
@@ -61,10 +61,10 @@ exports.SchemaName = {
61
61
  /**
62
62
  * Directory where fiori tools settings are stored
63
63
  */
64
- exports.fioriToolsDirectory = (0, path_1.join)((0, os_1.homedir)(), exports.FioriToolsSettings.dir);
64
+ exports.fioriToolsDirectory = (0, node_path_1.join)((0, node_os_1.homedir)(), exports.FioriToolsSettings.dir);
65
65
  /**
66
66
  * Directory where modules are cached
67
67
  */
68
- exports.moduleCacheRoot = (0, path_1.join)(exports.fioriToolsDirectory, exports.DirName.ModuleCache);
68
+ exports.moduleCacheRoot = (0, node_path_1.join)(exports.fioriToolsDirectory, exports.DirName.ModuleCache);
69
69
  exports.MinCdsVersionUi5Plugin = '6.8.2';
70
70
  //# sourceMappingURL=constants.js.map
@@ -12,7 +12,7 @@ exports.updateManifestJSON = updateManifestJSON;
12
12
  exports.deleteFile = deleteFile;
13
13
  exports.readDirectory = readDirectory;
14
14
  exports.deleteDirectory = deleteDirectory;
15
- const fs_1 = require("fs");
15
+ const node_fs_1 = require("node:fs");
16
16
  const json_parse_even_better_errors_1 = __importDefault(require("json-parse-even-better-errors"));
17
17
  /**
18
18
  * Read file asynchronously. Throws error if file does not exist.
@@ -26,7 +26,7 @@ async function readFile(path, memFs) {
26
26
  return memFs.read(path);
27
27
  }
28
28
  else {
29
- return fs_1.promises.readFile(path, { encoding: 'utf8' });
29
+ return node_fs_1.promises.readFile(path, { encoding: 'utf8' });
30
30
  }
31
31
  }
32
32
  /**
@@ -56,7 +56,7 @@ async function writeFile(path, content, memFs) {
56
56
  if (memFs) {
57
57
  return memFs.write(path, content);
58
58
  }
59
- return fs_1.promises.writeFile(path, content, { encoding: 'utf8' });
59
+ return node_fs_1.promises.writeFile(path, content, { encoding: 'utf8' });
60
60
  }
61
61
  /**
62
62
  * Checks if the provided file exists in the file system.
@@ -71,7 +71,7 @@ async function fileExists(path, memFs) {
71
71
  return memFs.exists(path);
72
72
  }
73
73
  else {
74
- await fs_1.promises.access(path);
74
+ await node_fs_1.promises.access(path);
75
75
  return true;
76
76
  }
77
77
  }
@@ -126,7 +126,7 @@ async function deleteFile(path, memFs) {
126
126
  if (memFs) {
127
127
  return memFs.delete(path);
128
128
  }
129
- return fs_1.promises.unlink(path);
129
+ return node_fs_1.promises.unlink(path);
130
130
  }
131
131
  /**
132
132
  * Read array of files from folder asynchronously.
@@ -135,7 +135,7 @@ async function deleteFile(path, memFs) {
135
135
  * @returns Array of the names of the files in the directory.
136
136
  */
137
137
  async function readDirectory(path) {
138
- return fs_1.promises.readdir(path, { encoding: 'utf8' });
138
+ return node_fs_1.promises.readdir(path, { encoding: 'utf8' });
139
139
  }
140
140
  /**
141
141
  * Deletes folder asynchronously.
@@ -148,6 +148,6 @@ async function deleteDirectory(path, memFs) {
148
148
  if (memFs) {
149
149
  return memFs.delete(path);
150
150
  }
151
- return fs_1.promises.rm(path, { recursive: true, force: true });
151
+ return node_fs_1.promises.rm(path, { recursive: true, force: true });
152
152
  }
153
153
  //# sourceMappingURL=file-access.js.map
@@ -8,10 +8,10 @@ exports.findFiles = findFiles;
8
8
  exports.findFilesByExtension = findFilesByExtension;
9
9
  exports.findFileUp = findFileUp;
10
10
  exports.getFilePaths = getFilePaths;
11
- const path_1 = require("path");
11
+ const node_path_1 = require("node:path");
12
12
  const findit2_1 = __importDefault(require("findit2"));
13
13
  const file_access_1 = require("./file-access");
14
- const fs_1 = require("fs");
14
+ const node_fs_1 = require("node:fs");
15
15
  /**
16
16
  * Get deleted and modified files from mem-fs editor filtered by query and 'by' (name|extension).
17
17
  *
@@ -32,16 +32,16 @@ const fs_1 = require("fs");
32
32
  function getMemFsChanges(changes, fileNames, extensionNames, root) {
33
33
  const deleted = [];
34
34
  const modified = [];
35
- const filteredChanges = Object.keys(changes).filter((f) => f.startsWith(root.replaceAll(path_1.sep, path_1.posix.sep)) &&
36
- (fileNames.includes((0, path_1.basename)(f)) ||
37
- extensionNames.includes((0, path_1.extname)(f)) ||
35
+ const filteredChanges = Object.keys(changes).filter((f) => f.startsWith(root.replaceAll(node_path_1.sep, node_path_1.posix.sep)) &&
36
+ (fileNames.includes((0, node_path_1.basename)(f)) ||
37
+ extensionNames.includes((0, node_path_1.extname)(f)) ||
38
38
  (fileNames.length === 0 && extensionNames.length === 0)));
39
39
  for (const file of filteredChanges) {
40
40
  if (changes[file].state === 'deleted') {
41
- deleted.push((0, path_1.join)(file));
41
+ deleted.push((0, node_path_1.join)(file));
42
42
  }
43
43
  if (changes[file].state === 'modified') {
44
- modified.push((0, path_1.join)(file));
44
+ modified.push((0, node_path_1.join)(file));
45
45
  }
46
46
  }
47
47
  return { deleted, modified };
@@ -95,14 +95,14 @@ function findBy(options) {
95
95
  const errors = [];
96
96
  const finder = (0, findit2_1.default)(options.root);
97
97
  finder.on('directory', (dir, _stat, stop) => {
98
- const base = (0, path_1.basename)(dir);
98
+ const base = (0, node_path_1.basename)(dir);
99
99
  if (excludeFolders.includes(base) || (noTraversal && dir !== options.root)) {
100
100
  stop();
101
101
  }
102
102
  });
103
103
  finder.on('file', (file) => {
104
- if (extensionNames.includes((0, path_1.extname)(file)) ||
105
- fileNames.includes((0, path_1.basename)(file)) ||
104
+ if (extensionNames.includes((0, node_path_1.extname)(file)) ||
105
+ fileNames.includes((0, node_path_1.basename)(file)) ||
106
106
  (fileNames.length === 0 && extensionNames.length === 0)) {
107
107
  results.push(file);
108
108
  }
@@ -133,7 +133,7 @@ function findBy(options) {
133
133
  */
134
134
  async function findFiles(filename, root, excludeFolders, memFs) {
135
135
  const results = await findBy({ fileNames: [filename], root, excludeFolders, memFs });
136
- return results.map((f) => (0, path_1.dirname)(f));
136
+ return results.map((f) => (0, node_path_1.dirname)(f));
137
137
  }
138
138
  /**
139
139
  * Search for 'filename' starting from 'root'. Returns array of paths that contain the file.
@@ -157,12 +157,12 @@ function findFilesByExtension(extension, root, excludeFolders, memFs, noTraversa
157
157
  * @returns - path to file name if found, otherwise undefined
158
158
  */
159
159
  async function findFileUp(fileName, startPath, fs) {
160
- const filePath = (0, path_1.join)(startPath, fileName);
160
+ const filePath = (0, node_path_1.join)(startPath, fileName);
161
161
  if (await (0, file_access_1.fileExists)(filePath, fs)) {
162
162
  return filePath;
163
163
  }
164
164
  else {
165
- return (0, path_1.dirname)(startPath) !== startPath ? findFileUp(fileName, (0, path_1.dirname)(startPath), fs) : undefined;
165
+ return (0, node_path_1.dirname)(startPath) !== startPath ? findFileUp(fileName, (0, node_path_1.dirname)(startPath), fs) : undefined;
166
166
  }
167
167
  }
168
168
  /**
@@ -173,10 +173,10 @@ async function findFileUp(fileName, startPath, fs) {
173
173
  * @throws if an error occurs reading a file path
174
174
  */
175
175
  async function getFilePaths(dir) {
176
- const entries = await fs_1.promises.readdir(dir);
176
+ const entries = await node_fs_1.promises.readdir(dir);
177
177
  const filePathsPromises = entries.map(async (entry) => {
178
- const entryPath = (0, path_1.join)(dir, entry);
179
- const isDirectory = (await fs_1.promises.stat(entryPath)).isDirectory();
178
+ const entryPath = (0, node_path_1.join)(dir, entry);
179
+ const isDirectory = (await node_fs_1.promises.stat(entryPath)).isDirectory();
180
180
  return isDirectory ? getFilePaths(entryPath) : entryPath;
181
181
  });
182
182
  const filePaths = await Promise.all(filePathsPromises);
@@ -6,11 +6,11 @@ exports.getLibraryDesc = getLibraryDesc;
6
6
  exports.getLibraryDependencies = getLibraryDependencies;
7
7
  exports.getManifestDesc = getManifestDesc;
8
8
  exports.getManifestDependencies = getManifestDependencies;
9
- const path_1 = require("path");
9
+ const node_path_1 = require("node:path");
10
10
  const constants_1 = require("./constants");
11
11
  const file_1 = require("../file");
12
12
  const constants_2 = require("../constants");
13
- const fs_1 = require("fs");
13
+ const node_fs_1 = require("node:fs");
14
14
  const fast_xml_parser_1 = require("fast-xml-parser");
15
15
  const i18n_1 = require("../project/i18n");
16
16
  const i18n_2 = require("@sap-ux/i18n");
@@ -34,7 +34,7 @@ const getLibraryFromManifest = async (manifest, manifestPath, reuseLibs, project
34
34
  if (libIndex === -1) {
35
35
  reuseLib = {
36
36
  name: `${manifest['sap.app'].id}`,
37
- path: (0, path_1.dirname)(manifestPath),
37
+ path: (0, node_path_1.dirname)(manifestPath),
38
38
  type: reuseType,
39
39
  uri: manifest['sap.platform.abap']?.uri ?? '',
40
40
  dependencies: libDeps,
@@ -64,7 +64,7 @@ const getLibraryFromLibraryFile = async (library, libraryPath, projectRoot) => {
64
64
  const description = await getLibraryDesc(parsedFile, libraryPath);
65
65
  libEntry = {
66
66
  name: `${parsedFile.library.name}`,
67
- path: (0, path_1.dirname)(libraryPath),
67
+ path: (0, node_path_1.dirname)(libraryPath),
68
68
  type: reuseType,
69
69
  uri: parsedFile.library?.appData?.manifest?.['sap.platform.abap']?.uri ?? '',
70
70
  dependencies: libDeps,
@@ -110,7 +110,7 @@ const getReuseLibs = async (libs) => {
110
110
  ...(await (0, file_1.findFiles)('library.ts', lib.projectRoot, excludeFolders))
111
111
  ];
112
112
  for (const manifestPath of manifestPaths) {
113
- const manifestFilePath = (0, path_1.join)(manifestPath, constants_2.FileName.Manifest);
113
+ const manifestFilePath = (0, node_path_1.join)(manifestPath, constants_2.FileName.Manifest);
114
114
  const manifest = await (0, file_1.readJSON)(manifestFilePath);
115
115
  const library = await getLibraryFromManifest(manifest, manifestFilePath, reuseLibs, lib.projectRoot);
116
116
  if (library) {
@@ -119,8 +119,8 @@ const getReuseLibs = async (libs) => {
119
119
  }
120
120
  for (const libraryPath of libraryPaths) {
121
121
  try {
122
- const libraryFilePath = (0, path_1.join)(libraryPath, constants_2.FileName.Library);
123
- const library = (await fs_1.promises.readFile(libraryFilePath, { encoding: 'utf8' })).toString();
122
+ const libraryFilePath = (0, node_path_1.join)(libraryPath, constants_2.FileName.Library);
123
+ const library = (await node_fs_1.promises.readFile(libraryFilePath, { encoding: 'utf8' })).toString();
124
124
  const libFile = await getLibraryFromLibraryFile(library, libraryFilePath, lib.projectRoot);
125
125
  updateLibOptions(reuseLibs, libFile);
126
126
  }
@@ -140,8 +140,8 @@ exports.getReuseLibs = getReuseLibs;
140
140
  * @returns the type of reuse library
141
141
  */
142
142
  function getReuseType(libraryPath) {
143
- return (0, fs_1.existsSync)((0, path_1.join)((0, path_1.dirname)(libraryPath), '/library.js')) ||
144
- (0, fs_1.existsSync)((0, path_1.join)((0, path_1.dirname)(libraryPath), '/library.ts'))
143
+ return (0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_path_1.dirname)(libraryPath), '/library.js')) ||
144
+ (0, node_fs_1.existsSync)((0, node_path_1.join)((0, node_path_1.dirname)(libraryPath), '/library.ts'))
145
145
  ? "library" /* ReuseLibType.Library */
146
146
  : "component" /* ReuseLibType.Component */;
147
147
  }
@@ -179,7 +179,7 @@ async function getLibraryDesc(library, libraryPath) {
179
179
  let libraryDesc = library?.library?.documentation;
180
180
  if (typeof libraryDesc === 'string' && libraryDesc.startsWith('{{')) {
181
181
  const key = libraryDesc.substring(2, libraryDesc.length - 2);
182
- libraryDesc = await geti18nPropertyValue((0, path_1.join)((0, path_1.dirname)(libraryPath), library.library?.appData?.manifest?.i18n?.toString() ?? ''), key);
182
+ libraryDesc = await geti18nPropertyValue((0, node_path_1.join)((0, node_path_1.dirname)(libraryPath), library.library?.appData?.manifest?.i18n?.toString() ?? ''), key);
183
183
  }
184
184
  return libraryDesc?.toString() ?? '';
185
185
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizePath = normalizePath;
4
- const fs_1 = require("fs");
4
+ const node_fs_1 = require("node:fs");
5
5
  let toUpperCase;
6
6
  /**
7
7
  * Normalize path to canonical form.
@@ -13,7 +13,7 @@ function normalizePath(path) {
13
13
  // for windows, some NodeJS methods will output uppercase drive letters, some in lowercase
14
14
  if (process.platform === 'win32') {
15
15
  if (toUpperCase === undefined) {
16
- const driveLetter = fs_1.realpathSync.native('\\')[0];
16
+ const driveLetter = node_fs_1.realpathSync.native('\\')[0];
17
17
  toUpperCase = driveLetter === driveLetter.toUpperCase();
18
18
  }
19
19
  const correctedDriveLetter = toUpperCase ? path.charAt(0).toUpperCase() : path.charAt(0).toLowerCase();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createApplicationAccess = createApplicationAccess;
4
4
  exports.createProjectAccess = createProjectAccess;
5
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
6
6
  const i18n_1 = require("./i18n");
7
7
  const info_1 = require("./info");
8
8
  const search_1 = require("./search");
@@ -152,7 +152,7 @@ class ApplicationAccessImp {
152
152
  * @param memFs - optional mem-fs-editor instance
153
153
  */
154
154
  async updatePackageJSON(packageJson, memFs) {
155
- await (0, file_1.updatePackageJSON)((0, path_1.join)(this.app.appRoot, constants_1.FileName.Package), packageJson, memFs ?? this.options?.fs);
155
+ await (0, file_1.updatePackageJSON)((0, node_path_1.join)(this.app.appRoot, constants_1.FileName.Package), packageJson, memFs ?? this.options?.fs);
156
156
  }
157
157
  /**
158
158
  * Updates manifest.json file asynchronously by keeping the previous indentation.
@@ -280,7 +280,7 @@ async function createApplicationAccess(appRoot, fs) {
280
280
  options = isEditor(fs) ? { fs } : fs;
281
281
  }
282
282
  const project = await (0, info_1.getProject)(app.projectRoot, options?.fs);
283
- const appId = (0, path_1.relative)(project.root, appRoot);
283
+ const appId = (0, node_path_1.relative)(project.root, appRoot);
284
284
  return new ApplicationAccessImp(project, appId, options);
285
285
  }
286
286
  catch (error) {
@@ -21,7 +21,7 @@ exports.getWorkspaceInfo = getWorkspaceInfo;
21
21
  exports.satisfiesMinCdsVersion = satisfiesMinCdsVersion;
22
22
  exports.hasMinCdsVersion = hasMinCdsVersion;
23
23
  const child_process_1 = require("child_process");
24
- const path_1 = require("path");
24
+ const node_path_1 = require("node:path");
25
25
  const constants_1 = require("../constants");
26
26
  const file_1 = require("../file");
27
27
  const module_loader_1 = require("./module-loader");
@@ -49,7 +49,7 @@ function isCapNodeJsProject(packageJson) {
49
49
  */
50
50
  async function isCapJavaProject(projectRoot, capCustomPaths, memFs) {
51
51
  const srv = capCustomPaths?.srv ?? (await getCapCustomPaths(projectRoot)).srv;
52
- return (0, file_1.fileExists)((0, path_1.join)(projectRoot, srv, 'src', 'main', 'resources', constants_1.FileName.CapJavaApplicationYaml), memFs);
52
+ return (0, file_1.fileExists)((0, node_path_1.join)(projectRoot, srv, 'src', 'main', 'resources', constants_1.FileName.CapJavaApplicationYaml), memFs);
53
53
  }
54
54
  /**
55
55
  * Checks if there are files in the `srv` folder, using node fs or mem-fs.
@@ -75,7 +75,7 @@ async function checkFilesInSrvFolder(srvFolderPath, memFs) {
75
75
  */
76
76
  async function getCapProjectType(projectRoot, memFs) {
77
77
  const capCustomPaths = await getCapCustomPaths(projectRoot);
78
- if (!(await checkFilesInSrvFolder((0, path_1.join)(projectRoot, capCustomPaths.srv), memFs))) {
78
+ if (!(await checkFilesInSrvFolder((0, node_path_1.join)(projectRoot, capCustomPaths.srv), memFs))) {
79
79
  return undefined;
80
80
  }
81
81
  if (await isCapJavaProject(projectRoot, capCustomPaths, memFs)) {
@@ -83,7 +83,7 @@ async function getCapProjectType(projectRoot, memFs) {
83
83
  }
84
84
  let packageJson;
85
85
  try {
86
- packageJson = await (0, file_1.readJSON)((0, path_1.join)(projectRoot, constants_1.FileName.Package), memFs);
86
+ packageJson = await (0, file_1.readJSON)((0, node_path_1.join)(projectRoot, constants_1.FileName.Package), memFs);
87
87
  }
88
88
  catch {
89
89
  // Ignore errors while reading the package.json file
@@ -161,7 +161,7 @@ async function getCapModelAndServices(projectRoot) {
161
161
  const capProjectPaths = await getCapCustomPaths(_projectRoot);
162
162
  const modelPaths = [];
163
163
  _pathSelection?.forEach((path) => {
164
- modelPaths.push((0, path_1.join)(_projectRoot, capProjectPaths[path]));
164
+ modelPaths.push((0, node_path_1.join)(_projectRoot, capProjectPaths[path]));
165
165
  });
166
166
  const model = await cds.load(modelPaths, { root: _projectRoot });
167
167
  _logger?.info(`@sap-ux/project-access:getCapModelAndServices - Using 'cds.home': ${cds.home}`);
@@ -246,7 +246,7 @@ async function getCdsRoots(projectRoot, clearCache = false) {
246
246
  clearCdsResolveCache(cds);
247
247
  }
248
248
  for (const cdsEnvRoot of cdsEnvRoots) {
249
- const resolvedRoots = cds.resolve((0, path_1.join)(projectRoot, cdsEnvRoot), {
249
+ const resolvedRoots = cds.resolve((0, node_path_1.join)(projectRoot, cdsEnvRoot), {
250
250
  skipModelCache: true
251
251
  }) || [];
252
252
  for (const resolvedRoot of resolvedRoots) {
@@ -305,8 +305,8 @@ function extractCdsFilesFromMessage(sources) {
305
305
  const cdsFiles = [];
306
306
  for (const source in sources) {
307
307
  let filename = sources[source].filename;
308
- if (typeof filename === 'string' && !filename.startsWith(path_1.sep)) {
309
- filename = (0, path_1.join)(path_1.sep, filename);
308
+ if (typeof filename === 'string' && !filename.startsWith(node_path_1.sep)) {
309
+ filename = (0, node_path_1.join)(node_path_1.sep, filename);
310
310
  }
311
311
  if (filename) {
312
312
  cdsFiles.push(filename);
@@ -406,7 +406,7 @@ async function loadCdsModuleFromProject(capProjectPath, strict = false) {
406
406
  const cds = 'default' in module ? module.default : module;
407
407
  // In case strict is true and there was a fallback to global cds installation for a project that has a cds dependency, check if major versions match
408
408
  if (strict && loadProjectError) {
409
- const cdsDependencyVersion = await getCdsVersionFromPackageJson((0, path_1.join)(capProjectPath, constants_1.FileName.Package));
409
+ const cdsDependencyVersion = await getCdsVersionFromPackageJson((0, node_path_1.join)(capProjectPath, constants_1.FileName.Package));
410
410
  if (typeof cdsDependencyVersion === 'string') {
411
411
  const globalCdsVersion = cds.version;
412
412
  if (getMajorVersion(cdsDependencyVersion) !== getMajorVersion(globalCdsVersion)) {
@@ -459,7 +459,7 @@ function clearCdsResolveCache(cds) {
459
459
  * @param relativeUri - relative resource path.
460
460
  * @returns {string} - absolute path.
461
461
  */
462
- const toAbsoluteUri = (projectRoot, relativeUri) => (0, path_1.join)(projectRoot, relativeUri);
462
+ const toAbsoluteUri = (projectRoot, relativeUri) => (0, node_path_1.join)(projectRoot, relativeUri);
463
463
  exports.toAbsoluteUri = toAbsoluteUri;
464
464
  /**
465
465
  * Converts to referenced uri to be used in using statements.
@@ -491,8 +491,8 @@ const toReferenceUri = async (projectRoot, relativeUriFrom, relativeUriTo) => {
491
491
  }
492
492
  if (!relativeUri) {
493
493
  // build relative path
494
- const fromDir = (0, path_1.dirname)((0, exports.toAbsoluteUri)(projectRoot, relativeUriFrom));
495
- relativeUri = (0, path_1.relative)(fromDir, (0, exports.toAbsoluteUri)(projectRoot, relativeUriTo));
494
+ const fromDir = (0, node_path_1.dirname)((0, exports.toAbsoluteUri)(projectRoot, relativeUriFrom));
495
+ relativeUri = (0, node_path_1.relative)(fromDir, (0, exports.toAbsoluteUri)(projectRoot, relativeUriTo));
496
496
  if (!relativeUri.startsWith('.')) {
497
497
  relativeUri = './' + relativeUri;
498
498
  }
@@ -503,7 +503,7 @@ const toReferenceUri = async (projectRoot, relativeUriFrom, relativeUriTo) => {
503
503
  relativeUri = relativeUri.slice(0, relativeUri.length - fileExtension.length - 1);
504
504
  }
505
505
  // always use '/' instead of platform specific separator
506
- return relativeUri.split(path_1.sep).join('/');
506
+ return relativeUri.split(node_path_1.sep).join('/');
507
507
  };
508
508
  exports.toReferenceUri = toReferenceUri;
509
509
  /**
@@ -514,10 +514,10 @@ exports.toReferenceUri = toReferenceUri;
514
514
  * @returns {Promise<{ packageName: string; packageFolder: string }>} - package name and folder
515
515
  */
516
516
  async function getPackageNameInFolder(baseUri, relativeUri) {
517
- const refUriParts = relativeUri.split(path_1.sep);
517
+ const refUriParts = relativeUri.split(node_path_1.sep);
518
518
  const result = { packageName: '', packageFolder: relativeUri };
519
519
  for (let i = refUriParts.length - 1; i >= 0 && !result.packageName; i--) {
520
- const currentFolder = refUriParts.slice(0, i).join(path_1.sep);
520
+ const currentFolder = refUriParts.slice(0, i).join(node_path_1.sep);
521
521
  result.packageName = await readPackageNameForFolder(baseUri, currentFolder);
522
522
  if (result.packageName) {
523
523
  result.packageFolder = currentFolder;
@@ -535,7 +535,7 @@ async function getPackageNameInFolder(baseUri, relativeUri) {
535
535
  async function readPackageNameForFolder(baseUri, relativeUri) {
536
536
  let packageName = '';
537
537
  try {
538
- const path = (0, path_1.normalize)(baseUri + '/' + relativeUri + '/' + constants_1.FileName.Package);
538
+ const path = (0, node_path_1.normalize)(baseUri + '/' + relativeUri + '/' + constants_1.FileName.Package);
539
539
  const content = await (0, file_1.readJSON)(path);
540
540
  if (typeof content?.name === 'string') {
541
541
  packageName = content.name;
@@ -631,7 +631,7 @@ async function getCdsVersionFromPackageJson(packageJsonPath) {
631
631
  * @returns - major version as number
632
632
  */
633
633
  function getMajorVersion(versionString) {
634
- return parseInt(/\d+/.exec(versionString.split('.')[0])?.[0] ?? '0', 10);
634
+ return Number.parseInt(/\d+/.exec(versionString.split('.')[0])?.[0] ?? '0', 10);
635
635
  }
636
636
  /**
637
637
  * Method resolves cap service name for passed project root and service uri.
@@ -689,16 +689,16 @@ async function cleanupCdsFiles(cdsFilePaths, appName, memFs, logger) {
689
689
  * @param [logger] - function to log messages (optional)
690
690
  */
691
691
  async function deleteCapApp(appPath, memFs, logger) {
692
- const appName = (0, path_1.basename)(appPath);
692
+ const appName = (0, node_path_1.basename)(appPath);
693
693
  const projectRoot = await (0, search_1.findCapProjectRoot)(appPath);
694
694
  if (!projectRoot) {
695
695
  const message = `Project root was not found for CAP application with path '${appPath}'`;
696
696
  logger?.error(message);
697
697
  throw Error(message);
698
698
  }
699
- const packageJsonPath = (0, path_1.join)(projectRoot, constants_1.FileName.Package);
699
+ const packageJsonPath = (0, node_path_1.join)(projectRoot, constants_1.FileName.Package);
700
700
  const packageJson = await (0, file_1.readJSON)(packageJsonPath, memFs);
701
- const cdsFilePaths = [(0, path_1.join)((0, path_1.dirname)(appPath), constants_1.FileName.ServiceCds), (0, path_1.join)((0, path_1.dirname)(appPath), constants_1.FileName.IndexCds)];
701
+ const cdsFilePaths = [(0, node_path_1.join)((0, node_path_1.dirname)(appPath), constants_1.FileName.ServiceCds), (0, node_path_1.join)((0, node_path_1.dirname)(appPath), constants_1.FileName.IndexCds)];
702
702
  logger?.info(`Deleting app '${appName}' from CAP project '${projectRoot}'.`);
703
703
  // Update `sapux` array if presented in package.json
704
704
  if (Array.isArray(packageJson.sapux)) {
@@ -719,9 +719,9 @@ async function deleteCapApp(appPath, memFs, logger) {
719
719
  // Cleanup app/service.cds and app/index.cds files
720
720
  await cleanupCdsFiles(cdsFilePaths, appName, memFs, logger);
721
721
  // Check if app folder is now empty
722
- if ((await (0, file_1.readDirectory)((0, path_1.dirname)(appPath))).length === 0) {
723
- logger?.info(`Directory '${(0, path_1.dirname)(appPath)}' is now empty. Deleting it.`);
724
- await (0, file_1.deleteDirectory)((0, path_1.dirname)(appPath), memFs);
722
+ if ((await (0, file_1.readDirectory)((0, node_path_1.dirname)(appPath))).length === 0) {
723
+ logger?.info(`Directory '${(0, node_path_1.dirname)(appPath)}' is now empty. Deleting it.`);
724
+ await (0, file_1.deleteDirectory)((0, node_path_1.dirname)(appPath), memFs);
725
725
  }
726
726
  }
727
727
  /**
@@ -739,7 +739,7 @@ async function checkCdsUi5PluginEnabled(basePath, fs, moreInfo, cdsVersionInfo)
739
739
  if (!fs) {
740
740
  fs = (0, mem_fs_editor_1.create)((0, mem_fs_1.create)());
741
741
  }
742
- const packageJsonPath = (0, path_1.join)(basePath, 'package.json');
742
+ const packageJsonPath = (0, node_path_1.join)(basePath, 'package.json');
743
743
  if (!fs.exists(packageJsonPath)) {
744
744
  return false;
745
745
  }
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.hasDependency = void 0;
4
4
  exports.getNodeModulesPath = getNodeModulesPath;
5
5
  exports.addPackageDevDependency = addPackageDevDependency;
6
- const fs_1 = require("fs");
7
- const path_1 = require("path");
6
+ const node_fs_1 = require("node:fs");
7
+ const node_path_1 = require("node:path");
8
8
  const constants_1 = require("../constants");
9
9
  const file_1 = require("../file");
10
10
  /**
@@ -26,22 +26,22 @@ exports.hasDependency = hasDependency;
26
26
  * @returns - parent path of node_modules used by project or undefined if node module path was not found
27
27
  */
28
28
  function getNodeModulesPath(projectRoot, module) {
29
- if (!(0, path_1.isAbsolute)(projectRoot)) {
29
+ if (!(0, node_path_1.isAbsolute)(projectRoot)) {
30
30
  return undefined;
31
31
  }
32
- const { root } = (0, path_1.parse)(projectRoot);
32
+ const { root } = (0, node_path_1.parse)(projectRoot);
33
33
  let currentDir = projectRoot;
34
34
  let modulesPath;
35
35
  while (currentDir !== root) {
36
- let checkPath = (0, path_1.join)(currentDir, 'node_modules');
36
+ let checkPath = (0, node_path_1.join)(currentDir, 'node_modules');
37
37
  if (module) {
38
- checkPath = (0, path_1.join)(checkPath, module, constants_1.FileName.Package);
38
+ checkPath = (0, node_path_1.join)(checkPath, module, constants_1.FileName.Package);
39
39
  }
40
- if ((0, fs_1.existsSync)(checkPath)) {
40
+ if ((0, node_fs_1.existsSync)(checkPath)) {
41
41
  modulesPath = currentDir;
42
42
  break;
43
43
  }
44
- currentDir = (0, path_1.dirname)(currentDir);
44
+ currentDir = (0, node_path_1.dirname)(currentDir);
45
45
  }
46
46
  return modulesPath;
47
47
  }
@@ -54,7 +54,7 @@ function getNodeModulesPath(projectRoot, module) {
54
54
  * @param fs - optional memfs editor instance
55
55
  */
56
56
  async function addPackageDevDependency(basePath, depName, depVersion, fs) {
57
- const filePath = (0, path_1.join)(basePath, constants_1.FileName.Package);
57
+ const filePath = (0, node_path_1.join)(basePath, constants_1.FileName.Package);
58
58
  const packageJson = await (0, file_1.readJSON)(filePath, fs);
59
59
  packageJson.devDependencies = packageJson.devDependencies ?? {};
60
60
  if (!packageJson.devDependencies[depName]) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getI18nPropertiesPaths = getI18nPropertiesPaths;
4
4
  exports.getRelativeI18nPropertiesPaths = getRelativeI18nPropertiesPaths;
5
- const path_1 = require("path");
5
+ const node_path_1 = require("node:path");
6
6
  const file_1 = require("../../file");
7
7
  /**
8
8
  * Return absolute paths to i18n.properties files from manifest.
@@ -14,15 +14,15 @@ const file_1 = require("../../file");
14
14
  */
15
15
  async function getI18nPropertiesPaths(manifestPath, manifest, memFs) {
16
16
  const parsedManifest = manifest ?? (await (0, file_1.readJSON)(manifestPath, memFs));
17
- const manifestFolder = (0, path_1.dirname)(manifestPath);
17
+ const manifestFolder = (0, node_path_1.dirname)(manifestPath);
18
18
  const relativeI18nPropertiesPaths = getRelativeI18nPropertiesPaths(parsedManifest);
19
19
  const i18nPropertiesPaths = {
20
- 'sap.app': (0, path_1.join)(manifestFolder, relativeI18nPropertiesPaths['sap.app']),
20
+ 'sap.app': (0, node_path_1.join)(manifestFolder, relativeI18nPropertiesPaths['sap.app']),
21
21
  models: {}
22
22
  };
23
23
  for (const modelKey in relativeI18nPropertiesPaths.models) {
24
24
  i18nPropertiesPaths.models[modelKey] = {
25
- path: (0, path_1.join)(manifestFolder, relativeI18nPropertiesPaths.models[modelKey].path)
25
+ path: (0, node_path_1.join)(manifestFolder, relativeI18nPropertiesPaths.models[modelKey].path)
26
26
  };
27
27
  }
28
28
  return i18nPropertiesPaths;
@@ -52,20 +52,20 @@ function getRelativeI18nPropertiesPaths(manifest) {
52
52
  * @returns - path to i18n.properties file
53
53
  */
54
54
  function getI18nAppPath(manifest) {
55
- const defaultPath = (0, path_1.join)('i18n/i18n.properties');
55
+ const defaultPath = (0, node_path_1.join)('i18n/i18n.properties');
56
56
  if (typeof manifest?.['sap.app']?.i18n === 'string') {
57
- return (0, path_1.join)(manifest['sap.app'].i18n);
57
+ return (0, node_path_1.join)(manifest['sap.app'].i18n);
58
58
  }
59
59
  if (typeof manifest?.['sap.app']?.i18n === 'object') {
60
60
  // bundleName wins over `bundleUrl`
61
61
  if ('bundleName' in manifest['sap.app'].i18n) {
62
62
  // module name is in dot notation
63
63
  const withoutAppId = manifest['sap.app'].i18n.bundleName.replace(manifest['sap.app'].id, '');
64
- const i18nPath = `${(0, path_1.join)(...withoutAppId.split('.'))}.properties`;
65
- return (0, path_1.join)(i18nPath);
64
+ const i18nPath = `${(0, node_path_1.join)(...withoutAppId.split('.'))}.properties`;
65
+ return (0, node_path_1.join)(i18nPath);
66
66
  }
67
67
  if ('bundleUrl' in manifest['sap.app'].i18n) {
68
- return (0, path_1.join)(manifest['sap.app'].i18n.bundleUrl);
68
+ return (0, node_path_1.join)(manifest['sap.app'].i18n.bundleUrl);
69
69
  }
70
70
  }
71
71
  // default
@@ -96,17 +96,17 @@ function getI18nModelPaths(manifest) {
96
96
  if (i18nModel.settings.bundleName) {
97
97
  // module name is in dot notation
98
98
  const withoutAppId = i18nModel.settings.bundleName.replace(manifest['sap.app'].id, '');
99
- const i18nPath = `${(0, path_1.join)(...withoutAppId.split('.'))}.properties`;
100
- result[modelKey] = { path: (0, path_1.join)(i18nPath) };
99
+ const i18nPath = `${(0, node_path_1.join)(...withoutAppId.split('.'))}.properties`;
100
+ result[modelKey] = { path: (0, node_path_1.join)(i18nPath) };
101
101
  continue;
102
102
  }
103
103
  if (i18nModel.settings.bundleUrl) {
104
- result[modelKey] = { path: (0, path_1.join)(i18nModel.settings.bundleUrl) };
104
+ result[modelKey] = { path: (0, node_path_1.join)(i18nModel.settings.bundleUrl) };
105
105
  continue;
106
106
  }
107
107
  }
108
108
  if (i18nModel.uri) {
109
- result[modelKey] = { path: (0, path_1.join)(i18nModel.uri) };
109
+ result[modelKey] = { path: (0, node_path_1.join)(i18nModel.uri) };
110
110
  }
111
111
  }
112
112
  return result;
@@ -6,7 +6,7 @@ exports.createAnnotationI18nEntries = createAnnotationI18nEntries;
6
6
  exports.createManifestI18nEntries = createManifestI18nEntries;
7
7
  const i18n_1 = require("@sap-ux/i18n");
8
8
  const __1 = require("..");
9
- const path_1 = require("path");
9
+ const node_path_1 = require("node:path");
10
10
  const file_1 = require("../../file");
11
11
  const promises_1 = require("fs/promises");
12
12
  /**
@@ -40,7 +40,7 @@ async function createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths,
40
40
  const i18nFilePath = i18nPropertiesPaths.models[modelKey]?.path;
41
41
  if (i18nFilePath) {
42
42
  // ensure folder for i18n exists
43
- const dirPath = (0, path_1.dirname)(i18nFilePath);
43
+ const dirPath = (0, node_path_1.dirname)(i18nFilePath);
44
44
  if (!fs) {
45
45
  // create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
46
46
  await (0, promises_1.mkdir)(dirPath, { recursive: true });
@@ -62,12 +62,12 @@ async function createUI5I18nEntriesBase(root, manifestPath, i18nPropertiesPaths,
62
62
  };
63
63
  await (0, file_1.writeFile)(manifestPath, JSON.stringify(newContent, undefined, 4), fs);
64
64
  // make sure i18n folder exists
65
- const dirPath = (0, path_1.dirname)(defaultPath);
65
+ const dirPath = (0, node_path_1.dirname)(defaultPath);
66
66
  if (!fs) {
67
67
  // create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
68
- await (0, promises_1.mkdir)((0, path_1.join)((0, path_1.dirname)(manifestPath), dirPath), { recursive: true });
68
+ await (0, promises_1.mkdir)((0, node_path_1.join)((0, node_path_1.dirname)(manifestPath), dirPath), { recursive: true });
69
69
  }
70
- return (0, i18n_1.createPropertiesI18nEntries)((0, path_1.join)((0, path_1.dirname)(manifestPath), defaultPath), newEntries, root, fs);
70
+ return (0, i18n_1.createPropertiesI18nEntries)((0, node_path_1.join)((0, node_path_1.dirname)(manifestPath), defaultPath), newEntries, root, fs);
71
71
  }
72
72
  /**
73
73
  * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist.
@@ -137,7 +137,7 @@ async function createAnnotationI18nEntries(root, manifestPath, i18nPropertiesPat
137
137
  async function createManifestI18nEntries(root, i18nPropertiesPaths, newEntries, fs) {
138
138
  const i18nFilePath = i18nPropertiesPaths['sap.app'];
139
139
  // make sure i18n folder exists
140
- const dirPath = (0, path_1.dirname)(i18nFilePath);
140
+ const dirPath = (0, node_path_1.dirname)(i18nFilePath);
141
141
  if (!fs) {
142
142
  // create directory when mem-fs-editor is not provided. when mem-fs-editor is provided, directory is created on using `.commit()` API
143
143
  await (0, promises_1.mkdir)(dirPath, { recursive: true });
@@ -7,7 +7,7 @@ exports.getProjectType = getProjectType;
7
7
  exports.getMinUI5VersionFromManifest = getMinUI5VersionFromManifest;
8
8
  exports.getMinUI5VersionAsArray = getMinUI5VersionAsArray;
9
9
  exports.getMinimumUI5Version = getMinimumUI5Version;
10
- const path_1 = require("path");
10
+ const node_path_1 = require("node:path");
11
11
  const constants_1 = require("../constants");
12
12
  const file_1 = require("../file");
13
13
  const cap_1 = require("./cap");
@@ -16,7 +16,7 @@ const search_1 = require("./search");
16
16
  const service_1 = require("./service");
17
17
  const ui5_config_1 = require("./ui5-config");
18
18
  const semver_1 = require("semver");
19
- const path_2 = require("../path");
19
+ const path_1 = require("../path");
20
20
  /**
21
21
  * Returns the project structure for a given Fiori project.
22
22
  *
@@ -25,7 +25,7 @@ const path_2 = require("../path");
25
25
  * @returns - project structure with project info like project type, apps, root folder
26
26
  */
27
27
  async function getProject(root, memFs) {
28
- if (!(await (0, file_1.fileExists)((0, path_1.join)(root, constants_1.FileName.Package), memFs))) {
28
+ if (!(await (0, file_1.fileExists)((0, node_path_1.join)(root, constants_1.FileName.Package), memFs))) {
29
29
  throw new Error(`The project root folder '${root}' is not a Fiori project. No 'package.json' found.`);
30
30
  }
31
31
  const capProjectType = await (0, cap_1.getCapProjectType)(root);
@@ -34,7 +34,7 @@ async function getProject(root, memFs) {
34
34
  const appFolders = await getAppFolders(root, memFs);
35
35
  const apps = await getApps(root, appFolders, memFs);
36
36
  return {
37
- root: (0, path_2.normalizePath)(root),
37
+ root: (0, path_1.normalizePath)(root),
38
38
  projectType,
39
39
  apps,
40
40
  capCustomPaths
@@ -51,7 +51,7 @@ async function getProject(root, memFs) {
51
51
  */
52
52
  async function getAppFolders(root, memFs) {
53
53
  const apps = await (0, search_1.findAllApps)([root], memFs);
54
- return apps.length > 0 ? apps.map((app) => (0, path_1.relative)(root, app.appRoot)) : [''];
54
+ return apps.length > 0 ? apps.map((app) => (0, node_path_1.relative)(root, app.appRoot)) : [''];
55
55
  }
56
56
  /**
57
57
  * Get the application structure for each application in the project.
@@ -80,15 +80,15 @@ async function getApps(root, appFolders, memFs) {
80
80
  * @returns - application structure with application info like manifest, changes, main service, services, annotations
81
81
  */
82
82
  async function getApplicationStructure(root, appFolder, memFs) {
83
- const appRoot = (0, path_1.join)(root, appFolder);
83
+ const appRoot = (0, node_path_1.join)(root, appFolder);
84
84
  const absoluteWebappPath = await (0, ui5_config_1.getWebappPath)(appRoot, memFs);
85
85
  const appType = (await getAppType(appRoot, memFs));
86
- const manifest = (0, path_1.join)(absoluteWebappPath, constants_1.FileName.Manifest);
86
+ const manifest = (0, node_path_1.join)(absoluteWebappPath, constants_1.FileName.Manifest);
87
87
  if (!(await (0, file_1.fileExists)(manifest, memFs))) {
88
88
  return undefined;
89
89
  }
90
90
  const manifestObject = await (0, file_1.readJSON)(manifest, memFs);
91
- const changes = (0, path_1.join)(absoluteWebappPath, constants_1.DirName.Changes);
91
+ const changes = (0, node_path_1.join)(absoluteWebappPath, constants_1.DirName.Changes);
92
92
  const i18n = await (0, i18n_1.getI18nPropertiesPaths)(manifest, manifestObject, memFs);
93
93
  const mainService = (0, service_1.getMainService)(manifestObject);
94
94
  const services = await (0, service_1.getServicesAndAnnotations)(manifest, manifestObject, memFs);
@@ -115,7 +115,7 @@ async function getAppProgrammingLanguage(appRoot, memFs) {
115
115
  try {
116
116
  const webappPath = await (0, ui5_config_1.getWebappPath)(appRoot, memFs);
117
117
  if (await (0, file_1.fileExists)(webappPath, memFs)) {
118
- if ((await (0, file_1.fileExists)((0, path_1.join)(appRoot, constants_1.FileName.Tsconfig), memFs)) &&
118
+ if ((await (0, file_1.fileExists)((0, node_path_1.join)(appRoot, constants_1.FileName.Tsconfig), memFs)) &&
119
119
  (await (0, file_1.findFilesByExtension)('.ts', webappPath, ignoreFolders, memFs)).length > 0) {
120
120
  appLanguage = 'TypeScript';
121
121
  }
@@ -177,7 +177,7 @@ async function getAppType(appRoot, memFs) {
177
177
  */
178
178
  async function getApplicationType(application, memFs) {
179
179
  let appType;
180
- const rootPackageJsonPath = (0, path_1.join)(application.projectRoot, constants_1.FileName.Package);
180
+ const rootPackageJsonPath = (0, node_path_1.join)(application.projectRoot, constants_1.FileName.Package);
181
181
  const packageJson = (await (0, file_1.fileExists)(rootPackageJsonPath, memFs))
182
182
  ? await (0, file_1.readJSON)(rootPackageJsonPath, memFs)
183
183
  : null;
@@ -187,7 +187,7 @@ async function getApplicationType(application, memFs) {
187
187
  else if (packageJson) {
188
188
  appType =
189
189
  Array.isArray(packageJson.sapux) &&
190
- packageJson.sapux.find((relAppPath) => (0, path_1.join)(application.projectRoot, ...relAppPath.split(/[/\\]/)) === application.appRoot)
190
+ packageJson.sapux.find((relAppPath) => (0, node_path_1.join)(application.projectRoot, ...relAppPath.split(/[/\\]/)) === application.appRoot)
191
191
  ? 'SAP Fiori elements'
192
192
  : 'SAPUI5 freestyle';
193
193
  }
@@ -37,9 +37,9 @@ exports.getModulePath = getModulePath;
37
37
  exports.loadModuleFromProject = loadModuleFromProject;
38
38
  exports.getModule = getModule;
39
39
  exports.deleteModule = deleteModule;
40
- const fs_1 = require("fs");
40
+ const node_fs_1 = require("node:fs");
41
41
  const promises_1 = require("fs/promises");
42
- const path_1 = require("path");
42
+ const node_path_1 = require("node:path");
43
43
  const dependencies_1 = require("./dependencies");
44
44
  const constants_1 = require("../constants");
45
45
  const command_1 = require("../command");
@@ -91,11 +91,11 @@ async function loadModuleFromProject(projectRoot, moduleName) {
91
91
  */
92
92
  async function getModule(module, version, options) {
93
93
  const logger = options?.logger;
94
- const moduleDirectory = (0, path_1.join)(constants_1.moduleCacheRoot, module, version);
95
- const modulePackagePath = (0, path_1.join)(moduleDirectory, constants_1.FileName.Package);
94
+ const moduleDirectory = (0, node_path_1.join)(constants_1.moduleCacheRoot, module, version);
95
+ const modulePackagePath = (0, node_path_1.join)(moduleDirectory, constants_1.FileName.Package);
96
96
  const installCommand = ['install', '--prefix', moduleDirectory, `${module}@${version}`];
97
- if (!(0, fs_1.existsSync)(modulePackagePath)) {
98
- if ((0, fs_1.existsSync)(moduleDirectory)) {
97
+ if (!(0, node_fs_1.existsSync)(modulePackagePath)) {
98
+ if ((0, node_fs_1.existsSync)(moduleDirectory)) {
99
99
  await (0, promises_1.rm)(moduleDirectory, { recursive: true });
100
100
  }
101
101
  await (0, promises_1.mkdir)(moduleDirectory, { recursive: true });
@@ -110,9 +110,9 @@ async function getModule(module, version, options) {
110
110
  }
111
111
  catch (e) {
112
112
  logger?.error(`Failed to load module: ${module}. Attempting to fix installation.`);
113
- const modulePackageLockPath = (0, path_1.join)(moduleDirectory, constants_1.FileName.PackageLock);
113
+ const modulePackageLockPath = (0, node_path_1.join)(moduleDirectory, constants_1.FileName.PackageLock);
114
114
  // If 'package-lock.json' file exists then use 'npm ci', otherwise try reinstall
115
- const command = (0, fs_1.existsSync)(modulePackageLockPath) ? ['ci'] : installCommand;
115
+ const command = (0, node_fs_1.existsSync)(modulePackageLockPath) ? ['ci'] : installCommand;
116
116
  // Run reinstall only if the first attempt fails
117
117
  await (0, command_1.execNpmCommand)(command, {
118
118
  cwd: moduleDirectory,
@@ -130,8 +130,8 @@ async function getModule(module, version, options) {
130
130
  * @param version - version of the module
131
131
  */
132
132
  async function deleteModule(module, version) {
133
- const moduleDirectory = (0, path_1.join)(constants_1.moduleCacheRoot, module, version);
134
- if ((0, fs_1.existsSync)(moduleDirectory)) {
133
+ const moduleDirectory = (0, node_path_1.join)(constants_1.moduleCacheRoot, module, version);
134
+ if ((0, node_fs_1.existsSync)(moduleDirectory)) {
135
135
  await (0, promises_1.rm)(moduleDirectory, { recursive: true });
136
136
  }
137
137
  }
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMtaPath = getMtaPath;
4
4
  const file_search_1 = require("../file/file-search");
5
5
  const constants_1 = require("../constants");
6
- const path_1 = require("path");
6
+ const node_path_1 = require("node:path");
7
7
  /**
8
8
  * Searches `projectPath` and parent folders.
9
9
  * If mta.yaml file is inside projectPath, this is a special type of MTA project
@@ -21,7 +21,7 @@ async function getMtaPath(projectPath, fs) {
21
21
  return undefined;
22
22
  }
23
23
  else {
24
- const mtaFolderPath = (0, path_1.dirname)(mtaPath);
24
+ const mtaFolderPath = (0, node_path_1.dirname)(mtaPath);
25
25
  return {
26
26
  mtaPath,
27
27
  hasRoot: mtaFolderPath !== projectPath
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.updatePackageScript = updatePackageScript;
7
7
  exports.hasUI5CliV3 = hasUI5CliV3;
8
- const path_1 = require("path");
8
+ const node_path_1 = require("node:path");
9
9
  const constants_1 = require("../constants");
10
10
  const file_1 = require("../file");
11
11
  const semver_1 = __importDefault(require("semver"));
@@ -18,7 +18,7 @@ const semver_1 = __importDefault(require("semver"));
18
18
  * @param fs - optional memfs editor instance
19
19
  */
20
20
  async function updatePackageScript(basePath, scriptName, script, fs) {
21
- const filePath = (0, path_1.join)(basePath, constants_1.FileName.Package);
21
+ const filePath = (0, node_path_1.join)(basePath, constants_1.FileName.Package);
22
22
  const packageJson = await (0, file_1.readJSON)(filePath, fs);
23
23
  if (!packageJson.scripts) {
24
24
  packageJson.scripts = {};
@@ -7,7 +7,7 @@ exports.findCapProjectRoot = findCapProjectRoot;
7
7
  exports.findAllApps = findAllApps;
8
8
  exports.findFioriArtifacts = findFioriArtifacts;
9
9
  exports.findCapProjects = findCapProjects;
10
- const path_1 = require("path");
10
+ const node_path_1 = require("node:path");
11
11
  const constants_1 = require("../constants");
12
12
  const file_1 = require("../file");
13
13
  const dependencies_1 = require("./dependencies");
@@ -78,11 +78,11 @@ async function findProjectRoot(path, sapuxRequired = true, silent = false, memFs
78
78
  }
79
79
  throw new Error(`Could not find any project root for '${path}'. Search was done for ${sapuxRequired ? 'Fiori elements' : 'All'} projects.`);
80
80
  }
81
- let root = (0, path_1.dirname)(packageJson);
81
+ let root = (0, node_path_1.dirname)(packageJson);
82
82
  if (sapuxRequired) {
83
83
  const sapux = (await (0, file_1.readJSON)(packageJson, memFs)).sapux;
84
84
  if (!sapux) {
85
- root = await findProjectRoot((0, path_1.dirname)(root), sapuxRequired, silent, memFs);
85
+ root = await findProjectRoot((0, node_path_1.dirname)(root), sapuxRequired, silent, memFs);
86
86
  }
87
87
  }
88
88
  return root;
@@ -105,12 +105,12 @@ function findRootsWithSapux(sapux, path, root) {
105
105
  else if (Array.isArray(sapux)) {
106
106
  // Backward compatibility for FE apps in CAP projects that have no app package.json,
107
107
  // but are listed in CAP root sapux array
108
- const pathWithSep = path.endsWith(path_1.sep) ? path : path + path_1.sep;
109
- const relAppPaths = sapux.map((a) => (0, path_1.join)(...a.split(/[\\/]/)));
110
- const relApp = relAppPaths.find((app) => pathWithSep.startsWith((0, path_1.join)(root, app) + path_1.sep));
108
+ const pathWithSep = path.endsWith(node_path_1.sep) ? path : path + node_path_1.sep;
109
+ const relAppPaths = sapux.map((a) => (0, node_path_1.join)(...a.split(/[\\/]/)));
110
+ const relApp = relAppPaths.find((app) => pathWithSep.startsWith((0, node_path_1.join)(root, app) + node_path_1.sep));
111
111
  if (relApp) {
112
112
  return {
113
- appRoot: (0, path_1.join)(root, relApp),
113
+ appRoot: (0, node_path_1.join)(root, relApp),
114
114
  projectRoot: root
115
115
  };
116
116
  }
@@ -126,9 +126,9 @@ function findRootsWithSapux(sapux, path, root) {
126
126
  */
127
127
  async function getAppRootFromWebappPath(webappPath) {
128
128
  const ui5YamlPath = await (0, file_1.findFileUp)(constants_1.FileName.Ui5Yaml, webappPath);
129
- let appRoot = (0, path_1.dirname)(webappPath);
129
+ let appRoot = (0, node_path_1.dirname)(webappPath);
130
130
  if (ui5YamlPath) {
131
- const candidate = (0, path_1.dirname)(ui5YamlPath);
131
+ const candidate = (0, node_path_1.dirname)(ui5YamlPath);
132
132
  const webapp = await (0, ui5_config_1.getWebappPath)(candidate);
133
133
  if (webapp === webappPath) {
134
134
  appRoot = candidate;
@@ -190,7 +190,7 @@ async function findRootsForPath(path, options) {
190
190
  if (!appRoot) {
191
191
  return null;
192
192
  }
193
- cache.files[path] ??= await (0, file_1.readJSON)((0, path_1.join)(appRoot, constants_1.FileName.Package), memFs);
193
+ cache.files[path] ??= await (0, file_1.readJSON)((0, node_path_1.join)(appRoot, constants_1.FileName.Package), memFs);
194
194
  const appPckJson = cache.files[path];
195
195
  // Check for most common app, Fiori elements with sapux=true in package.json
196
196
  if (appPckJson.sapux) {
@@ -207,7 +207,7 @@ async function findRootsForPath(path, options) {
207
207
  }
208
208
  else if (
209
209
  // Check for freestyle non CAP
210
- (await (0, file_1.fileExists)((0, path_1.join)(appRoot, constants_1.FileName.Ui5LocalYaml), memFs)) &&
210
+ (await (0, file_1.fileExists)((0, node_path_1.join)(appRoot, constants_1.FileName.Ui5LocalYaml), memFs)) &&
211
211
  (0, dependencies_1.hasDependency)(appPckJson, '@sap/ux-ui5-tooling')) {
212
212
  return {
213
213
  appRoot,
@@ -230,12 +230,12 @@ async function findRootsForPath(path, options) {
230
230
  */
231
231
  async function findCapProjectRoot(path, checkForAppRouter = true, options) {
232
232
  try {
233
- if (!(0, path_1.isAbsolute)(path)) {
233
+ if (!(0, node_path_1.isAbsolute)(path)) {
234
234
  return null;
235
235
  }
236
236
  const { memFs, cache } = getFindOptions(options);
237
- const { root } = (0, path_1.parse)(path);
238
- let projectRoot = (0, path_1.dirname)(path);
237
+ const { root } = (0, node_path_1.parse)(path);
238
+ let projectRoot = (0, node_path_1.dirname)(path);
239
239
  while (projectRoot !== root) {
240
240
  if (!cache.capProjectType.has(projectRoot)) {
241
241
  cache.capProjectType.set(projectRoot, await (0, cap_1.getCapProjectType)(projectRoot, memFs));
@@ -245,11 +245,11 @@ async function findCapProjectRoot(path, checkForAppRouter = true, options) {
245
245
  // We have found a CAP project as root. Check if the found app is not directly in CAP's 'app/' folder.
246
246
  // Sometime there is a <CAP_ROOT>/app/package.json file that is used for app router (not an app)
247
247
  // or skip app router check if checkForAppRouter is false and return the project root.
248
- if ((checkForAppRouter && (0, path_1.join)(projectRoot, 'app') !== path) || !checkForAppRouter) {
248
+ if ((checkForAppRouter && (0, node_path_1.join)(projectRoot, 'app') !== path) || !checkForAppRouter) {
249
249
  return projectRoot;
250
250
  }
251
251
  }
252
- projectRoot = (0, path_1.dirname)(projectRoot);
252
+ projectRoot = (0, node_path_1.dirname)(projectRoot);
253
253
  }
254
254
  }
255
255
  catch {
@@ -279,7 +279,7 @@ async function findAllApps(wsFolders, memFs) {
279
279
  */
280
280
  async function filterApplications(pathMap, memFs) {
281
281
  const result = [];
282
- const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
282
+ const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, node_path_1.basename)(path) === constants_1.FileName.Manifest);
283
283
  for (const manifestPath of manifestPaths) {
284
284
  try {
285
285
  // All UI5 apps have at least sap.app: { id: <ID>, type: "application" } in manifest.json
@@ -288,8 +288,8 @@ async function filterApplications(pathMap, memFs) {
288
288
  if (!manifest['sap.app']?.id || manifest['sap.app'].type !== 'application') {
289
289
  continue;
290
290
  }
291
- const roots = await findRootsForPath((0, path_1.dirname)(manifestPath), { memFs, cache: pathMap });
292
- if (roots && !(await (0, file_1.fileExists)((0, path_1.join)(roots.appRoot, '.adp', constants_1.FileName.AdaptationConfig), memFs))) {
291
+ const roots = await findRootsForPath((0, node_path_1.dirname)(manifestPath), { memFs, cache: pathMap });
292
+ if (roots && !(await (0, file_1.fileExists)((0, node_path_1.join)(roots.appRoot, '.adp', constants_1.FileName.AdaptationConfig), memFs))) {
293
293
  result.push({ appRoot: roots.appRoot, projectRoot: roots.projectRoot, manifest, manifestPath });
294
294
  }
295
295
  }
@@ -310,10 +310,10 @@ async function filterAdaptations(pathMap, memFs) {
310
310
  const results = [];
311
311
  const manifestAppDescrVars = Object.keys(pathMap.files).filter((path) => path.endsWith(constants_1.FileName.ManifestAppDescrVar));
312
312
  for (const manifestAppDescrVar of manifestAppDescrVars) {
313
- const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestAppDescrVar), memFs);
314
- const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
313
+ const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, node_path_1.dirname)(manifestAppDescrVar), memFs);
314
+ const projectRoot = packageJsonPath ? (0, node_path_1.dirname)(packageJsonPath) : null;
315
315
  const webappPath = await (0, ui5_config_1.getWebappPath)(projectRoot ?? '', memFs);
316
- if (projectRoot && (await (0, file_1.fileExists)((0, path_1.join)(webappPath, constants_1.FileName.ManifestAppDescrVar), memFs))) {
316
+ if (projectRoot && (await (0, file_1.fileExists)((0, node_path_1.join)(webappPath, constants_1.FileName.ManifestAppDescrVar), memFs))) {
317
317
  results.push({ appRoot: projectRoot, manifestAppdescrVariantPath: manifestAppDescrVar });
318
318
  }
319
319
  }
@@ -328,11 +328,11 @@ async function filterAdaptations(pathMap, memFs) {
328
328
  */
329
329
  async function filterExtensions(pathMap, memFs) {
330
330
  const results = [];
331
- const extensionConfigs = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.ExtConfigJson);
331
+ const extensionConfigs = Object.keys(pathMap.files).filter((path) => (0, node_path_1.basename)(path) === constants_1.FileName.ExtConfigJson);
332
332
  for (const extensionConfig of extensionConfigs) {
333
333
  try {
334
334
  let manifest = null;
335
- let manifestPath = Object.keys(pathMap).find((path) => path.startsWith((0, path_1.dirname)(extensionConfig) + path_1.sep) && (0, path_1.basename)(path) === constants_1.FileName.Manifest);
335
+ let manifestPath = Object.keys(pathMap).find((path) => path.startsWith((0, node_path_1.dirname)(extensionConfig) + node_path_1.sep) && (0, node_path_1.basename)(path) === constants_1.FileName.Manifest);
336
336
  if (manifestPath) {
337
337
  pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
338
338
  manifest = pathMap.files[manifestPath];
@@ -340,7 +340,7 @@ async function filterExtensions(pathMap, memFs) {
340
340
  else {
341
341
  const manifests = await (0, file_1.findBy)({
342
342
  fileNames: [constants_1.FileName.Manifest],
343
- root: (0, path_1.dirname)(extensionConfig),
343
+ root: (0, node_path_1.dirname)(extensionConfig),
344
344
  excludeFolders,
345
345
  memFs
346
346
  });
@@ -350,7 +350,7 @@ async function filterExtensions(pathMap, memFs) {
350
350
  }
351
351
  }
352
352
  if (manifestPath && manifest) {
353
- results.push({ appRoot: (0, path_1.dirname)(extensionConfig), manifest, manifestPath });
353
+ results.push({ appRoot: (0, node_path_1.dirname)(extensionConfig), manifest, manifestPath });
354
354
  }
355
355
  }
356
356
  catch {
@@ -370,12 +370,12 @@ async function filterExtensions(pathMap, memFs) {
370
370
  async function filterDotLibraries(pathMap, manifestPaths, memFs) {
371
371
  const dotLibraries = [];
372
372
  const dotLibraryPaths = Object.keys(pathMap.files)
373
- .filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Library)
374
- .map((path) => (0, path_1.dirname)(path))
375
- .filter((path) => !manifestPaths.map((manifestPath) => (0, path_1.dirname)(manifestPath)).includes(path));
373
+ .filter((path) => (0, node_path_1.basename)(path) === constants_1.FileName.Library)
374
+ .map((path) => (0, node_path_1.dirname)(path))
375
+ .filter((path) => !manifestPaths.map((manifestPath) => (0, node_path_1.dirname)(manifestPath)).includes(path));
376
376
  if (dotLibraryPaths) {
377
377
  for (const libraryPath of dotLibraryPaths) {
378
- const projectRoot = (0, path_1.dirname)((await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(libraryPath), memFs)) ?? libraryPath);
378
+ const projectRoot = (0, node_path_1.dirname)((await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, node_path_1.dirname)(libraryPath), memFs)) ?? libraryPath);
379
379
  dotLibraries.push({ projectRoot, libraryPath });
380
380
  }
381
381
  }
@@ -390,16 +390,16 @@ async function filterDotLibraries(pathMap, manifestPaths, memFs) {
390
390
  */
391
391
  async function filterLibraries(pathMap, memFs) {
392
392
  const results = [];
393
- const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
393
+ const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, node_path_1.basename)(path) === constants_1.FileName.Manifest);
394
394
  results.push(...(await filterDotLibraries(pathMap, manifestPaths, memFs)));
395
395
  for (const manifestPath of manifestPaths) {
396
396
  try {
397
397
  pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
398
398
  const manifest = pathMap.files[manifestPath];
399
399
  if (manifest['sap.app'] && manifest['sap.app'].type === 'library') {
400
- const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestPath), memFs);
401
- const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
402
- if (projectRoot && (await (0, file_1.fileExists)((0, path_1.join)(projectRoot, constants_1.FileName.Ui5Yaml), memFs))) {
400
+ const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, node_path_1.dirname)(manifestPath), memFs);
401
+ const projectRoot = packageJsonPath ? (0, node_path_1.dirname)(packageJsonPath) : null;
402
+ if (projectRoot && (await (0, file_1.fileExists)((0, node_path_1.join)(projectRoot, constants_1.FileName.Ui5Yaml), memFs))) {
403
403
  results.push({ projectRoot, manifestPath, manifest });
404
404
  }
405
405
  }
@@ -419,14 +419,14 @@ async function filterLibraries(pathMap, memFs) {
419
419
  */
420
420
  async function filterComponents(pathMap, memFs) {
421
421
  const results = [];
422
- const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, path_1.basename)(path) === constants_1.FileName.Manifest);
422
+ const manifestPaths = Object.keys(pathMap.files).filter((path) => (0, node_path_1.basename)(path) === constants_1.FileName.Manifest);
423
423
  for (const manifestPath of manifestPaths) {
424
424
  try {
425
425
  pathMap.files[manifestPath] ??= await (0, file_1.readJSON)(manifestPath, memFs);
426
426
  const manifest = pathMap.files[manifestPath];
427
427
  if (manifest['sap.app'] && manifest['sap.app'].type === 'component') {
428
- const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, path_1.dirname)(manifestPath), memFs);
429
- const projectRoot = packageJsonPath ? (0, path_1.dirname)(packageJsonPath) : null;
428
+ const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, (0, node_path_1.dirname)(manifestPath), memFs);
429
+ const projectRoot = packageJsonPath ? (0, node_path_1.dirname)(packageJsonPath) : null;
430
430
  if (projectRoot) {
431
431
  results.push({ projectRoot, manifestPath, manifest });
432
432
  }
@@ -517,11 +517,11 @@ async function findCapProjects(options) {
517
517
  excludeFolders
518
518
  });
519
519
  const appYamlsToCheck = Array.from(new Set(filesToCheck
520
- .filter((file) => (0, path_1.basename)(file) === constants_1.FileName.CapJavaApplicationYaml)
521
- .map((file) => (0, path_1.dirname)(file))));
520
+ .filter((file) => (0, node_path_1.basename)(file) === constants_1.FileName.CapJavaApplicationYaml)
521
+ .map((file) => (0, node_path_1.dirname)(file))));
522
522
  const foldersToCheck = Array.from(new Set(filesToCheck
523
- .filter((file) => (0, path_1.basename)(file) !== constants_1.FileName.CapJavaApplicationYaml)
524
- .map((file) => (0, path_1.dirname)(file))));
523
+ .filter((file) => (0, node_path_1.basename)(file) !== constants_1.FileName.CapJavaApplicationYaml)
524
+ .map((file) => (0, node_path_1.dirname)(file))));
525
525
  for (const appYamlToCheck of appYamlsToCheck) {
526
526
  const capRoot = await findCapProjectRoot(appYamlToCheck);
527
527
  if (capRoot) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMainService = getMainService;
4
4
  exports.getServicesAndAnnotations = getServicesAndAnnotations;
5
5
  exports.filterDataSourcesByType = filterDataSourcesByType;
6
- const path_1 = require("path");
6
+ const node_path_1 = require("node:path");
7
7
  const file_1 = require("../file");
8
8
  /**
9
9
  * Get the main service name from the manifest.
@@ -29,7 +29,7 @@ function getMainService(manifest) {
29
29
  */
30
30
  async function getServicesAndAnnotations(manifestPath, manifest, memFs) {
31
31
  const parsedManifest = manifest ?? (await (0, file_1.readJSON)(manifestPath, memFs));
32
- const manifestFolder = (0, path_1.dirname)(manifestPath);
32
+ const manifestFolder = (0, node_path_1.dirname)(manifestPath);
33
33
  const services = {};
34
34
  const dataSources = parsedManifest?.['sap.app']?.dataSources ?? {};
35
35
  for (const name in dataSources) {
@@ -52,7 +52,7 @@ function getServiceSpecification(webappFolder, name, dataSources) {
52
52
  const dataSource = dataSources[name];
53
53
  const uri = dataSource.uri;
54
54
  const local = typeof dataSource.settings?.localUri === 'string'
55
- ? (0, path_1.join)(webappFolder, dataSource.settings.localUri)
55
+ ? (0, node_path_1.join)(webappFolder, dataSource.settings.localUri)
56
56
  : '';
57
57
  const odataVersion = dataSource.settings?.odataVersion ?? '2.0';
58
58
  const annotations = [];
@@ -63,7 +63,7 @@ function getServiceSpecification(webappFolder, name, dataSources) {
63
63
  if (annotation) {
64
64
  annotations.push({
65
65
  uri: annotation.uri,
66
- local: annotation.settings?.localUri ? (0, path_1.join)(webappFolder, annotation.settings.localUri) : undefined
66
+ local: annotation.settings?.localUri ? (0, node_path_1.join)(webappFolder, annotation.settings.localUri) : undefined
67
67
  });
68
68
  }
69
69
  }
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSpecification = getSpecification;
4
4
  exports.refreshSpecificationDistTags = refreshSpecificationDistTags;
5
5
  exports.getSpecificationPath = getSpecificationPath;
6
- const fs_1 = require("fs");
6
+ const node_fs_1 = require("node:fs");
7
7
  const promises_1 = require("fs/promises");
8
- const path_1 = require("path");
8
+ const node_path_1 = require("node:path");
9
9
  const semver_1 = require("semver");
10
10
  const module_loader_1 = require("./module-loader");
11
11
  const ui5_config_1 = require("./ui5-config");
@@ -13,7 +13,7 @@ const info_1 = require("./info");
13
13
  const constants_1 = require("../constants");
14
14
  const file_1 = require("../file");
15
15
  const command_1 = require("../command");
16
- const specificationDistTagPath = (0, path_1.join)(constants_1.fioriToolsDirectory, constants_1.FileName.SpecificationDistTags);
16
+ const specificationDistTagPath = (0, node_path_1.join)(constants_1.fioriToolsDirectory, constants_1.FileName.SpecificationDistTags);
17
17
  /**
18
18
  * Gets the dist-tag for the provided project/app and returns it.
19
19
  *
@@ -26,7 +26,7 @@ async function getProjectDistTag(root, options) {
26
26
  let distTag = 'latest';
27
27
  try {
28
28
  const webappPath = await (0, ui5_config_1.getWebappPath)(root);
29
- const manifest = await (0, file_1.readJSON)((0, path_1.join)(webappPath, constants_1.FileName.Manifest));
29
+ const manifest = await (0, file_1.readJSON)((0, node_path_1.join)(webappPath, constants_1.FileName.Manifest));
30
30
  const minUI5Version = (0, info_1.getMinimumUI5Version)(manifest);
31
31
  if (minUI5Version && (0, semver_1.valid)(minUI5Version)) {
32
32
  const [mayor, minor] = minUI5Version.split('.');
@@ -45,7 +45,7 @@ async function getProjectDistTag(root, options) {
45
45
  * @returns If dev dependency to specification is found in package.json
46
46
  */
47
47
  async function hasSpecificationDevDependency(root) {
48
- const packageJson = await (0, file_1.readJSON)((0, path_1.join)(root, constants_1.FileName.Package));
48
+ const packageJson = await (0, file_1.readJSON)((0, node_path_1.join)(root, constants_1.FileName.Package));
49
49
  return !!packageJson.devDependencies?.['@sap/ux-specification'];
50
50
  }
51
51
  /**
@@ -110,8 +110,8 @@ async function refreshSpecificationDistTags(options) {
110
110
  await (0, file_1.writeFile)(specificationDistTagPath, JSON.stringify(distTags, null, 4));
111
111
  const uniqueVersions = new Set(Object.values(distTags));
112
112
  // Check if we have cached versions that are not required anymore
113
- const specificationCachePath = (0, path_1.join)(constants_1.moduleCacheRoot, '@sap/ux-specification');
114
- const removeExistingVersions = (0, fs_1.existsSync)(specificationCachePath)
113
+ const specificationCachePath = (0, node_path_1.join)(constants_1.moduleCacheRoot, '@sap/ux-specification');
114
+ const removeExistingVersions = (0, node_fs_1.existsSync)(specificationCachePath)
115
115
  ? (await (0, promises_1.readdir)(specificationCachePath, { withFileTypes: true }))
116
116
  .filter((d) => d.isDirectory())
117
117
  .filter((d) => !uniqueVersions.has(d.name))
@@ -150,7 +150,7 @@ async function getSpecificationByVersion(version, options) {
150
150
  */
151
151
  async function convertDistTagToVersion(distTag, options) {
152
152
  const logger = options?.logger;
153
- if (!(0, fs_1.existsSync)(specificationDistTagPath)) {
153
+ if (!(0, node_fs_1.existsSync)(specificationDistTagPath)) {
154
154
  logger?.debug(`Specification dist-tags not found at '${specificationDistTagPath}'. Trying to refresh.`);
155
155
  await refreshSpecificationDistTags({ logger });
156
156
  }
@@ -186,13 +186,13 @@ async function getSpecificationPath(root, options) {
186
186
  if (await hasSpecificationDevDependency(root)) {
187
187
  const modulePath = await (0, module_loader_1.getModulePath)(root, moduleName);
188
188
  logger?.debug(`Specification root found in project '${root}'`);
189
- return modulePath.slice(0, modulePath.lastIndexOf((0, path_1.join)(moduleName)) + (0, path_1.join)(moduleName).length);
189
+ return modulePath.slice(0, modulePath.lastIndexOf((0, node_path_1.join)(moduleName)) + (0, node_path_1.join)(moduleName).length);
190
190
  }
191
191
  await getSpecificationModule(root, { logger });
192
192
  const version = await getSpecificationVersion(root, { logger });
193
193
  logger?.debug(`Specification not found in project '${root}', using path from cache with version '${version}'`);
194
- const moduleRoot = (0, path_1.join)(constants_1.moduleCacheRoot, moduleName, version);
194
+ const moduleRoot = (0, node_path_1.join)(constants_1.moduleCacheRoot, moduleName, version);
195
195
  const modulePath = await (0, module_loader_1.getModulePath)(moduleRoot, moduleName);
196
- return modulePath.slice(0, modulePath.lastIndexOf((0, path_1.join)(moduleName)) + (0, path_1.join)(moduleName).length);
196
+ return modulePath.slice(0, modulePath.lastIndexOf((0, node_path_1.join)(moduleName)) + (0, node_path_1.join)(moduleName).length);
197
197
  }
198
198
  //# sourceMappingURL=specification.js.map
@@ -5,7 +5,7 @@ exports.readUi5Yaml = readUi5Yaml;
5
5
  exports.getAllUi5YamlFileNames = getAllUi5YamlFileNames;
6
6
  exports.getMockServerConfig = getMockServerConfig;
7
7
  exports.getMockDataPath = getMockDataPath;
8
- const path_1 = require("path");
8
+ const node_path_1 = require("node:path");
9
9
  const ui5_config_1 = require("@sap-ux/ui5-config");
10
10
  const constants_1 = require("../constants");
11
11
  const file_1 = require("../file");
@@ -17,8 +17,8 @@ const file_1 = require("../file");
17
17
  * @returns - path to webapp folder
18
18
  */
19
19
  async function getWebappPath(appRoot, memFs) {
20
- const ui5YamlPath = (0, path_1.join)(appRoot, constants_1.FileName.Ui5Yaml);
21
- let webappPath = (0, path_1.join)(appRoot, constants_1.DirName.Webapp);
20
+ const ui5YamlPath = (0, node_path_1.join)(appRoot, constants_1.FileName.Ui5Yaml);
21
+ let webappPath = (0, node_path_1.join)(appRoot, constants_1.DirName.Webapp);
22
22
  if (await (0, file_1.fileExists)(ui5YamlPath, memFs)) {
23
23
  const yamlString = await (0, file_1.readFile)(ui5YamlPath, memFs);
24
24
  const ui5Config = await ui5_config_1.UI5Config.newInstance(yamlString);
@@ -27,8 +27,8 @@ async function getWebappPath(appRoot, memFs) {
27
27
  // Search for folder with package.json inside
28
28
  const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, appRoot, memFs);
29
29
  if (packageJsonPath) {
30
- const packageJsonDirPath = (0, path_1.dirname)(packageJsonPath);
31
- webappPath = (0, path_1.join)(packageJsonDirPath, relativeWebappPath);
30
+ const packageJsonDirPath = (0, node_path_1.dirname)(packageJsonPath);
31
+ webappPath = (0, node_path_1.join)(packageJsonDirPath, relativeWebappPath);
32
32
  }
33
33
  }
34
34
  }
@@ -46,7 +46,7 @@ async function getWebappPath(appRoot, memFs) {
46
46
  * @throws {Error} if file is not found
47
47
  */
48
48
  async function readUi5Yaml(projectRoot, fileName, memFs, options) {
49
- const ui5YamlPath = (0, path_1.join)(projectRoot, fileName);
49
+ const ui5YamlPath = (0, node_path_1.join)(projectRoot, fileName);
50
50
  if (await (0, file_1.fileExists)(ui5YamlPath, memFs)) {
51
51
  const yamlString = await (0, file_1.readFile)(ui5YamlPath, memFs);
52
52
  return await ui5_config_1.UI5Config.newInstance(yamlString, { validateSchema: options?.validateSchema });
@@ -64,7 +64,7 @@ async function readUi5Yaml(projectRoot, fileName, memFs, options) {
64
64
  async function getAllUi5YamlFileNames(projectRoot, memFs) {
65
65
  try {
66
66
  const yamlFilePaths = await (0, file_1.findFilesByExtension)('.yaml', projectRoot, [], memFs, true);
67
- return yamlFilePaths.map((path) => (0, path_1.basename)(path));
67
+ return yamlFilePaths.map((path) => (0, node_path_1.basename)(path));
68
68
  }
69
69
  catch (error) {
70
70
  throw new Error(`There was an error reading files from the directory '${projectRoot}': ${error}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.32.2",
3
+ "version": "1.32.3",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,8 +29,8 @@
29
29
  "mem-fs": "2.1.0",
30
30
  "mem-fs-editor": "9.4.0",
31
31
  "semver": "7.5.4",
32
- "@sap-ux/i18n": "0.3.3",
33
- "@sap-ux/ui5-config": "0.29.6"
32
+ "@sap-ux/i18n": "0.3.4",
33
+ "@sap-ux/ui5-config": "0.29.7"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/mem-fs": "1.1.2",