@sap-ux/project-access 1.38.1 → 2.0.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.
Files changed (76) hide show
  1. package/dist/command/index.d.ts +1 -1
  2. package/dist/command/index.js +1 -5
  3. package/dist/command/npm-command.js +3 -6
  4. package/dist/constants.js +10 -13
  5. package/dist/file/file-access.d.ts +1 -1
  6. package/dist/file/file-access.js +18 -32
  7. package/dist/file/file-search.js +25 -35
  8. package/dist/file/index.d.ts +2 -2
  9. package/dist/file/index.js +2 -19
  10. package/dist/index.d.ts +10 -10
  11. package/dist/index.js +9 -102
  12. package/dist/library/constants.js +1 -4
  13. package/dist/library/helpers.d.ts +1 -1
  14. package/dist/library/helpers.js +36 -44
  15. package/dist/library/index.d.ts +1 -1
  16. package/dist/library/index.js +1 -6
  17. package/dist/odata/index.d.ts +1 -1
  18. package/dist/odata/index.js +1 -6
  19. package/dist/odata/metadata.js +2 -6
  20. package/dist/path/index.d.ts +1 -1
  21. package/dist/path/index.js +1 -5
  22. package/dist/path/normalize.js +3 -6
  23. package/dist/project/access.d.ts +1 -1
  24. package/dist/project/access.js +30 -34
  25. package/dist/project/cap.d.ts +1 -1
  26. package/dist/project/cap.js +75 -102
  27. package/dist/project/dependencies.d.ts +1 -1
  28. package/dist/project/dependencies.js +16 -22
  29. package/dist/project/flex-changes.js +7 -10
  30. package/dist/project/i18n/i18n.d.ts +1 -1
  31. package/dist/project/i18n/i18n.js +22 -22
  32. package/dist/project/i18n/index.d.ts +3 -3
  33. package/dist/project/i18n/index.js +3 -13
  34. package/dist/project/i18n/read.d.ts +1 -1
  35. package/dist/project/i18n/read.js +11 -15
  36. package/dist/project/i18n/write.d.ts +1 -1
  37. package/dist/project/i18n/write.js +22 -28
  38. package/dist/project/index.d.ts +15 -15
  39. package/dist/project/index.js +14 -79
  40. package/dist/project/info.d.ts +1 -1
  41. package/dist/project/info.js +45 -54
  42. package/dist/project/module-loader.js +27 -64
  43. package/dist/project/mta.d.ts +1 -1
  44. package/dist/project/mta.js +6 -9
  45. package/dist/project/script.js +11 -18
  46. package/dist/project/search.d.ts +1 -1
  47. package/dist/project/search.js +77 -86
  48. package/dist/project/service.d.ts +1 -1
  49. package/dist/project/service.js +10 -16
  50. package/dist/project/specification.js +38 -44
  51. package/dist/project/ui5-config.js +21 -29
  52. package/dist/project/ui5-xml-id-validator.js +3 -6
  53. package/dist/types/access/index.d.ts +4 -4
  54. package/dist/types/access/index.js +1 -2
  55. package/dist/types/cap/index.js +1 -2
  56. package/dist/types/find/index.d.ts +1 -1
  57. package/dist/types/find/index.js +1 -2
  58. package/dist/types/i18n/index.js +1 -2
  59. package/dist/types/index.d.ts +9 -9
  60. package/dist/types/index.js +9 -25
  61. package/dist/types/info/index.d.ts +2 -2
  62. package/dist/types/info/index.js +1 -2
  63. package/dist/types/library/index.js +5 -2
  64. package/dist/types/mta/index.js +1 -2
  65. package/dist/types/package/basic.js +1 -2
  66. package/dist/types/package/index.d.ts +1 -1
  67. package/dist/types/package/index.js +1 -2
  68. package/dist/types/package/literal-union.d.ts +1 -1
  69. package/dist/types/package/literal-union.js +1 -2
  70. package/dist/types/package/package-json.d.ts +2 -2
  71. package/dist/types/package/package-json.js +1 -2
  72. package/dist/types/package/primitive.js +1 -2
  73. package/dist/types/vscode/index.js +1 -2
  74. package/dist/types/webapp/index.d.ts +2 -3
  75. package/dist/types/webapp/index.js +1 -2
  76. package/package.json +7 -5
@@ -1,19 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getReuseLibs = void 0;
4
- exports.checkDependencies = checkDependencies;
5
- exports.getLibraryDesc = getLibraryDesc;
6
- exports.getLibraryDependencies = getLibraryDependencies;
7
- exports.getManifestDesc = getManifestDesc;
8
- exports.getManifestDependencies = getManifestDependencies;
9
- const node_path_1 = require("node:path");
10
- const constants_1 = require("./constants");
11
- const file_1 = require("../file");
12
- const constants_2 = require("../constants");
13
- const node_fs_1 = require("node:fs");
14
- const fast_xml_parser_1 = require("fast-xml-parser");
15
- const i18n_1 = require("../project/i18n");
16
- const i18n_2 = require("@sap-ux/i18n");
1
+ import { dirname, join } from 'node:path';
2
+ import { ui5Libs } from './constants.js';
3
+ import { ReuseLibType } from '../types/index.js';
4
+ import { findFiles, readJSON } from '../file/index.js';
5
+ import { FileName } from '../constants.js';
6
+ import { existsSync, promises as fs } from 'node:fs';
7
+ import { XMLParser } from 'fast-xml-parser';
8
+ import { getI18nPropertiesPaths } from '../project/i18n/index.js';
9
+ import { getPropertiesI18nBundle } from '@sap-ux/i18n';
17
10
  /**
18
11
  * Reads the manifest file and returns the reuse library.
19
12
  *
@@ -30,11 +23,11 @@ const getLibraryFromManifest = async (manifest, manifestPath, reuseLibs, project
30
23
  const reuseType = getReuseType(manifestPath);
31
24
  const libDeps = getManifestDependencies(manifest);
32
25
  const description = await getManifestDesc(manifest, manifestPath);
33
- const libIndex = reuseLibs.findIndex((reuseLib) => reuseLib.name === manifest?.['sap.app'].id);
26
+ const libIndex = reuseLibs.findIndex((reuseLib) => reuseLib.name === manifest?.['sap.app']?.id);
34
27
  if (libIndex === -1) {
35
28
  reuseLib = {
36
- name: `${manifest['sap.app'].id}`,
37
- path: (0, node_path_1.dirname)(manifestPath),
29
+ name: `${manifest['sap.app']?.id ?? ''}`,
30
+ path: dirname(manifestPath),
38
31
  type: reuseType,
39
32
  uri: manifest['sap.platform.abap']?.uri ?? '',
40
33
  dependencies: libDeps,
@@ -55,7 +48,7 @@ const getLibraryFromManifest = async (manifest, manifestPath, reuseLibs, project
55
48
  */
56
49
  const getLibraryFromLibraryFile = async (library, libraryPath, projectRoot) => {
57
50
  let libEntry;
58
- const parsedFile = new fast_xml_parser_1.XMLParser({ removeNSPrefix: true }).parse(library, false);
51
+ const parsedFile = new XMLParser({ removeNSPrefix: true }).parse(library, false);
59
52
  if (parsedFile?.library?.name) {
60
53
  const manifestType = parsedFile?.library ? 'library' : 'component';
61
54
  if (manifestType === 'component' || manifestType === 'library') {
@@ -64,7 +57,7 @@ const getLibraryFromLibraryFile = async (library, libraryPath, projectRoot) => {
64
57
  const description = await getLibraryDesc(parsedFile, libraryPath);
65
58
  libEntry = {
66
59
  name: `${parsedFile.library.name}`,
67
- path: (0, node_path_1.dirname)(libraryPath),
60
+ path: dirname(libraryPath),
68
61
  type: reuseType,
69
62
  uri: parsedFile.library?.appData?.manifest?.['sap.platform.abap']?.uri ?? '',
70
63
  dependencies: libDeps,
@@ -99,19 +92,19 @@ const updateLibOptions = (reuseLibs, reuseLib) => {
99
92
  * @param libs - array of libraries found in the workspace folders.
100
93
  * @returns list of reuse library
101
94
  */
102
- const getReuseLibs = async (libs) => {
95
+ export const getReuseLibs = async (libs) => {
103
96
  const reuseLibs = [];
104
97
  if (libs) {
105
98
  for (const lib of libs) {
106
99
  const excludeFolders = ['.git', 'node_modules', 'dist'];
107
- const manifestPaths = await (0, file_1.findFiles)('manifest.json', lib.projectRoot, excludeFolders);
100
+ const manifestPaths = await findFiles('manifest.json', lib.projectRoot, excludeFolders);
108
101
  const libraryPaths = [
109
- ...(await (0, file_1.findFiles)('library.js', lib.projectRoot, excludeFolders)),
110
- ...(await (0, file_1.findFiles)('library.ts', lib.projectRoot, excludeFolders))
102
+ ...(await findFiles('library.js', lib.projectRoot, excludeFolders)),
103
+ ...(await findFiles('library.ts', lib.projectRoot, excludeFolders))
111
104
  ];
112
105
  for (const manifestPath of manifestPaths) {
113
- const manifestFilePath = (0, node_path_1.join)(manifestPath, constants_2.FileName.Manifest);
114
- const manifest = await (0, file_1.readJSON)(manifestFilePath);
106
+ const manifestFilePath = join(manifestPath, FileName.Manifest);
107
+ const manifest = await readJSON(manifestFilePath);
115
108
  const library = await getLibraryFromManifest(manifest, manifestFilePath, reuseLibs, lib.projectRoot);
116
109
  if (library) {
117
110
  reuseLibs.push(library);
@@ -119,8 +112,8 @@ const getReuseLibs = async (libs) => {
119
112
  }
120
113
  for (const libraryPath of libraryPaths) {
121
114
  try {
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();
115
+ const libraryFilePath = join(libraryPath, FileName.Library);
116
+ const library = (await fs.readFile(libraryFilePath, { encoding: 'utf8' })).toString();
124
117
  const libFile = await getLibraryFromLibraryFile(library, libraryFilePath, lib.projectRoot);
125
118
  updateLibOptions(reuseLibs, libFile);
126
119
  }
@@ -132,7 +125,6 @@ const getReuseLibs = async (libs) => {
132
125
  }
133
126
  return reuseLibs;
134
127
  };
135
- exports.getReuseLibs = getReuseLibs;
136
128
  /**
137
129
  * Gets the type of reuse library.
138
130
  *
@@ -140,10 +132,10 @@ exports.getReuseLibs = getReuseLibs;
140
132
  * @returns the type of reuse library
141
133
  */
142
134
  function getReuseType(libraryPath) {
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
- ? "library" /* ReuseLibType.Library */
146
- : "component" /* ReuseLibType.Component */;
135
+ return existsSync(join(dirname(libraryPath), '/library.js')) ||
136
+ existsSync(join(dirname(libraryPath), '/library.ts'))
137
+ ? ReuseLibType.Library
138
+ : ReuseLibType.Component;
147
139
  }
148
140
  /**
149
141
  * Checks for missing dependencies in the selected reuse libraries.
@@ -152,7 +144,7 @@ function getReuseType(libraryPath) {
152
144
  * @param reuseLibs - all available reuse libraries
153
145
  * @returns a string with the missing dependencies
154
146
  */
155
- function checkDependencies(answers, reuseLibs) {
147
+ export function checkDependencies(answers, reuseLibs) {
156
148
  const missingDeps = [];
157
149
  answers.forEach((answer) => {
158
150
  const dependencies = answer.dependencies;
@@ -175,11 +167,11 @@ function checkDependencies(answers, reuseLibs) {
175
167
  * @param libraryPath - library path
176
168
  * @returns library description
177
169
  */
178
- async function getLibraryDesc(library, libraryPath) {
170
+ export async function getLibraryDesc(library, libraryPath) {
179
171
  let libraryDesc = library?.library?.documentation;
180
172
  if (typeof libraryDesc === 'string' && libraryDesc.startsWith('{{')) {
181
173
  const key = libraryDesc.substring(2, libraryDesc.length - 2);
182
- libraryDesc = await geti18nPropertyValue((0, node_path_1.join)((0, node_path_1.dirname)(libraryPath), library.library?.appData?.manifest?.i18n?.toString() ?? ''), key);
174
+ libraryDesc = await geti18nPropertyValue(join(dirname(libraryPath), library.library?.appData?.manifest?.i18n?.toString() ?? ''), key);
183
175
  }
184
176
  return libraryDesc?.toString() ?? '';
185
177
  }
@@ -189,7 +181,7 @@ async function getLibraryDesc(library, libraryPath) {
189
181
  * @param library - library object
190
182
  * @returns array of dependencies
191
183
  */
192
- function getLibraryDependencies(library) {
184
+ export function getLibraryDependencies(library) {
193
185
  const result = [];
194
186
  if (library?.library?.dependencies?.dependency) {
195
187
  let deps = library.library.dependencies.dependency;
@@ -198,7 +190,7 @@ function getLibraryDependencies(library) {
198
190
  }
199
191
  deps.forEach((lib) => {
200
192
  // ignore libs that start with SAPUI5 delivered namespaces
201
- if (!constants_1.ui5Libs.some((substring) => {
193
+ if (!ui5Libs.some((substring) => {
202
194
  return lib.libraryName === substring || lib.libraryName.startsWith(substring + '.');
203
195
  })) {
204
196
  result.push(lib.libraryName);
@@ -217,7 +209,7 @@ function getLibraryDependencies(library) {
217
209
  async function geti18nPropertyValue(i18nPath, key) {
218
210
  let value = '';
219
211
  try {
220
- const bundle = await (0, i18n_2.getPropertiesI18nBundle)(i18nPath);
212
+ const bundle = await getPropertiesI18nBundle(i18nPath);
221
213
  const node = bundle[key].find((i) => i.key.value === key);
222
214
  if (node) {
223
215
  value = node.value.value;
@@ -235,11 +227,11 @@ async function geti18nPropertyValue(i18nPath, key) {
235
227
  * @param manifestPath - manifestPath path
236
228
  * @returns manifest description
237
229
  */
238
- async function getManifestDesc(manifest, manifestPath) {
230
+ export async function getManifestDesc(manifest, manifestPath) {
239
231
  let manifestDesc = manifest['sap.app']?.description;
240
232
  if (typeof manifestDesc === 'string' && manifestDesc.startsWith('{{')) {
241
233
  const key = manifestDesc.substring(2, manifestDesc.length - 2);
242
- const { 'sap.app': i18nPath } = await (0, i18n_1.getI18nPropertiesPaths)(manifestPath, manifest);
234
+ const { 'sap.app': i18nPath } = await getI18nPropertiesPaths(manifestPath, manifest);
243
235
  manifestDesc = await geti18nPropertyValue(i18nPath, key);
244
236
  }
245
237
  return (manifestDesc ?? '').toString();
@@ -250,7 +242,7 @@ async function getManifestDesc(manifest, manifestPath) {
250
242
  * @param manifest - manifest object
251
243
  * @returns array of dependencies
252
244
  */
253
- function getManifestDependencies(manifest) {
245
+ export function getManifestDependencies(manifest) {
254
246
  const result = [];
255
247
  const depTypes = ['libs', 'components'];
256
248
  Object.values(depTypes).forEach((reuseType) => {
@@ -260,7 +252,7 @@ function getManifestDependencies(manifest) {
260
252
  if (libs) {
261
253
  Object.keys(libs).forEach((manifestLibKey) => {
262
254
  // ignore libs that start with SAPUI5 delivered namespaces
263
- if (!constants_1.ui5Libs.some((substring) => {
255
+ if (!ui5Libs.some((substring) => {
264
256
  return manifestLibKey === substring || manifestLibKey.startsWith(substring + '.');
265
257
  })) {
266
258
  result.push(manifestLibKey);
@@ -1,2 +1,2 @@
1
- export { getReuseLibs, checkDependencies } from './helpers';
1
+ export { getReuseLibs, checkDependencies } from './helpers.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.checkDependencies = exports.getReuseLibs = void 0;
4
- var helpers_1 = require("./helpers");
5
- Object.defineProperty(exports, "getReuseLibs", { enumerable: true, get: function () { return helpers_1.getReuseLibs; } });
6
- Object.defineProperty(exports, "checkDependencies", { enumerable: true, get: function () { return helpers_1.checkDependencies; } });
1
+ export { getReuseLibs, checkDependencies } from './helpers.js';
7
2
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- export { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from './metadata';
1
+ export { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from './metadata.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTableCapabilitiesByEntitySet = exports.findRecursiveHierarchyKey = void 0;
4
- var metadata_1 = require("./metadata");
5
- Object.defineProperty(exports, "findRecursiveHierarchyKey", { enumerable: true, get: function () { return metadata_1.findRecursiveHierarchyKey; } });
6
- Object.defineProperty(exports, "getTableCapabilitiesByEntitySet", { enumerable: true, get: function () { return metadata_1.getTableCapabilitiesByEntitySet; } });
1
+ export { findRecursiveHierarchyKey, getTableCapabilitiesByEntitySet } from './metadata.js';
7
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findRecursiveHierarchyKey = findRecursiveHierarchyKey;
4
- exports.getTableCapabilitiesByEntitySet = getTableCapabilitiesByEntitySet;
5
1
  /**
6
2
  * Annotation pattern for RecursiveHierarchy.
7
3
  */
@@ -22,7 +18,7 @@ function hasRecursiveHierarchyForEntitySet(entitySet) {
22
18
  * @param entitySet The entity set to check for recursive hierarchy annotation.
23
19
  * @returns The RecursiveHierarchy key if found, undefined otherwise.
24
20
  */
25
- function findRecursiveHierarchyKey(entitySet) {
21
+ export function findRecursiveHierarchyKey(entitySet) {
26
22
  const hierarchyAnnotations = entitySet?.entityType?.annotations?.Hierarchy;
27
23
  if (!hierarchyAnnotations) {
28
24
  return undefined;
@@ -78,7 +74,7 @@ function hasAggregateTransformationsForEntitySet(entitySet, requiredTransformati
78
74
  * - `hasAggregateTransformationsForEntitySet`: Indicates if aggregate transformations are applicable to the specific entity set.
79
75
  * - `hasRecursiveHierarchyForEntitySet`: Indicates if a recursive hierarchy is present for the specific entity set.
80
76
  */
81
- function getTableCapabilitiesByEntitySet(entitySet, requiredTransformations) {
77
+ export function getTableCapabilitiesByEntitySet(entitySet, requiredTransformations) {
82
78
  return {
83
79
  hasAggregateTransformations: hasAggregateTransformations(entitySet),
84
80
  hasAggregateTransformationsForEntitySet: hasAggregateTransformationsForEntitySet(entitySet, requiredTransformations),
@@ -1,2 +1,2 @@
1
- export { normalizePath } from './normalize';
1
+ export { normalizePath } from './normalize.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizePath = void 0;
4
- var normalize_1 = require("./normalize");
5
- Object.defineProperty(exports, "normalizePath", { enumerable: true, get: function () { return normalize_1.normalizePath; } });
1
+ export { normalizePath } from './normalize.js';
6
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.normalizePath = normalizePath;
4
- const node_fs_1 = require("node:fs");
1
+ import { realpathSync } from 'node:fs';
5
2
  let toUpperCase;
6
3
  /**
7
4
  * Normalize path to canonical form.
@@ -9,11 +6,11 @@ let toUpperCase;
9
6
  * @param path - URI or string.
10
7
  * @returns File path.
11
8
  */
12
- function normalizePath(path) {
9
+ export function normalizePath(path) {
13
10
  // for windows, some NodeJS methods will output uppercase drive letters, some in lowercase
14
11
  if (process.platform === 'win32') {
15
12
  if (toUpperCase === undefined) {
16
- const driveLetter = node_fs_1.realpathSync.native('\\')[0];
13
+ const driveLetter = realpathSync.native('\\')[0];
17
14
  toUpperCase = driveLetter === driveLetter.toUpperCase();
18
15
  }
19
16
  const correctedDriveLetter = toUpperCase ? path.charAt(0).toUpperCase() : path.charAt(0).toLowerCase();
@@ -1,4 +1,4 @@
1
- import type { ApplicationAccess, ApplicationAccessOptions, ProjectAccess, ProjectAccessOptions } from '../types';
1
+ import type { ApplicationAccess, ApplicationAccessOptions, ProjectAccess, ProjectAccessOptions } from '../types/index.js';
2
2
  import type { Editor } from 'mem-fs-editor';
3
3
  /**
4
4
  * Create an instance of ApplicationAccess that contains information about the application, like paths and services.
@@ -1,16 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createApplicationAccess = createApplicationAccess;
4
- exports.createProjectAccess = createProjectAccess;
5
- const node_path_1 = require("node:path");
6
- const i18n_1 = require("./i18n");
7
- const info_1 = require("./info");
8
- const search_1 = require("./search");
9
- const file_1 = require("../file");
10
- const constants_1 = require("../constants");
11
- const specification_1 = require("./specification");
12
- const flex_changes_1 = require("./flex-changes");
13
- const cap_1 = require("./cap");
1
+ import { join, relative } from 'node:path';
2
+ import { getI18nBundles, getI18nPropertiesPaths, createCapI18nEntries, createManifestI18nEntries, createUI5I18nEntries, createAnnotationI18nEntries } from './i18n/index.js';
3
+ import { getProject } from './info.js';
4
+ import { findAllApps } from './search.js';
5
+ import { readFile, readJSON, updateManifestJSON, updatePackageJSON } from '../file/index.js';
6
+ import { FileName } from '../constants.js';
7
+ import { getSpecification } from './specification.js';
8
+ import { readFlexChanges } from './flex-changes.js';
9
+ import { readCapServiceMetadataEdmx } from './cap.js';
14
10
  /**
15
11
  *
16
12
  */
@@ -60,7 +56,7 @@ class ApplicationAccessImp {
60
56
  * ```
61
57
  */
62
58
  createAnnotationI18nEntries(newEntries) {
63
- return (0, i18n_1.createAnnotationI18nEntries)(this.project.root, this.app.manifest, this.app.i18n, newEntries, this.options?.fs);
59
+ return createAnnotationI18nEntries(this.project.root, this.app.manifest, this.app.i18n, newEntries, this.options?.fs);
64
60
  }
65
61
  /**
66
62
  * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist.
@@ -84,7 +80,7 @@ class ApplicationAccessImp {
84
80
  * ```
85
81
  */
86
82
  createUI5I18nEntries(newEntries, modelKey = 'i18n') {
87
- return (0, i18n_1.createUI5I18nEntries)(this.project.root, this.app.manifest, this.app.i18n, newEntries, modelKey, this.options?.fs);
83
+ return createUI5I18nEntries(this.project.root, this.app.manifest, this.app.i18n, newEntries, modelKey, this.options?.fs);
88
84
  }
89
85
  /**
90
86
  * Maintains new translation entries in an existing i18n file or in a new i18n properties file if it does not exist.
@@ -94,7 +90,7 @@ class ApplicationAccessImp {
94
90
  * @description If `i18n` entry is missing from `"sap.app":{}`, default `i18n/i18n.properties` is used. Update of `manifest.json` file is not needed.
95
91
  */
96
92
  createManifestI18nEntries(newEntries) {
97
- return (0, i18n_1.createManifestI18nEntries)(this.project.root, this.app.i18n, newEntries, this.options?.fs);
93
+ return createManifestI18nEntries(this.project.root, this.app.i18n, newEntries, this.options?.fs);
98
94
  }
99
95
  /**
100
96
  * Maintains new translation entries in CAP i18n files.
@@ -104,7 +100,7 @@ class ApplicationAccessImp {
104
100
  * @returns boolean or exception
105
101
  */
106
102
  createCapI18nEntries(filePath, newI18nEntries) {
107
- return (0, i18n_1.createCapI18nEntries)(this.project.root, filePath, newI18nEntries, this.options?.fs);
103
+ return createCapI18nEntries(this.project.root, filePath, newI18nEntries, this.options?.fs);
108
104
  }
109
105
  /**
110
106
  * Return the application id of this app, which is the relative path from the project root
@@ -129,7 +125,7 @@ class ApplicationAccessImp {
129
125
  * @returns i18n bundles or exception captured in optional errors object
130
126
  */
131
127
  getI18nBundles() {
132
- return (0, i18n_1.getI18nBundles)(this.project.root, this.app.i18n, this.project.projectType, this.options?.fs);
128
+ return getI18nBundles(this.project.root, this.app.i18n, this.project.projectType, this.options?.fs);
133
129
  }
134
130
  /**
135
131
  * Return absolute paths to i18n.properties files from manifest.
@@ -137,7 +133,7 @@ class ApplicationAccessImp {
137
133
  * @returns absolute paths to i18n.properties
138
134
  */
139
135
  getI18nPropertiesPaths() {
140
- return (0, i18n_1.getI18nPropertiesPaths)(this.app.manifest);
136
+ return getI18nPropertiesPaths(this.app.manifest);
141
137
  }
142
138
  /**
143
139
  * Return an instance of @sap/ux-specification specific to the application version.
@@ -145,7 +141,7 @@ class ApplicationAccessImp {
145
141
  * @returns - instance of @sap/ux-specification
146
142
  */
147
143
  async getSpecification() {
148
- return (0, specification_1.getSpecification)(this.app.appRoot);
144
+ return getSpecification(this.app.appRoot);
149
145
  }
150
146
  /**
151
147
  * Updates package.json file asynchronously by keeping the previous indentation.
@@ -154,7 +150,7 @@ class ApplicationAccessImp {
154
150
  * @param memFs - optional mem-fs-editor instance
155
151
  */
156
152
  async updatePackageJSON(packageJson, memFs) {
157
- await (0, file_1.updatePackageJSON)((0, node_path_1.join)(this.app.appRoot, constants_1.FileName.Package), packageJson, memFs ?? this.options?.fs);
153
+ await updatePackageJSON(join(this.app.appRoot, FileName.Package), packageJson, memFs ?? this.options?.fs);
158
154
  }
159
155
  /**
160
156
  * Updates manifest.json file asynchronously by keeping the previous indentation.
@@ -163,7 +159,7 @@ class ApplicationAccessImp {
163
159
  * @param memFs - optional mem-fs-editor instance
164
160
  */
165
161
  async updateManifestJSON(manifest, memFs) {
166
- await (0, file_1.updateManifestJSON)(this.app.manifest, manifest, memFs ?? this.options?.fs);
162
+ await updateManifestJSON(this.app.manifest, manifest, memFs ?? this.options?.fs);
167
163
  }
168
164
  /**
169
165
  * Reads and returns the parsed `manifest.json` file for the application.
@@ -172,7 +168,7 @@ class ApplicationAccessImp {
172
168
  * @returns A promise resolving to the parsed `manifest.json` content.
173
169
  */
174
170
  async readManifest(memFs) {
175
- return (0, file_1.readJSON)(this.app.manifest, memFs ?? this.options?.fs);
171
+ return readJSON(this.app.manifest, memFs ?? this.options?.fs);
176
172
  }
177
173
  /**
178
174
  * Reads and returns all Flex Changes (`*.change` files) associated with the application.
@@ -181,7 +177,7 @@ class ApplicationAccessImp {
181
177
  * @returns A promise that resolves to an array of flex change files.
182
178
  */
183
179
  async readFlexChanges(memFs) {
184
- return (0, flex_changes_1.readFlexChanges)(this.app.changes, memFs ?? this.options?.fs);
180
+ return readFlexChanges(this.app.changes, memFs ?? this.options?.fs);
185
181
  }
186
182
  /**
187
183
  * Reads and returns all annotation files associated with the application's main service.
@@ -199,7 +195,7 @@ class ApplicationAccessImp {
199
195
  if (mainService.uri && (this.projectType === 'CAPJava' || this.projectType === 'CAPNodejs')) {
200
196
  const serviceUri = mainService?.uri ?? '';
201
197
  if (serviceUri) {
202
- const edmx = await (0, cap_1.readCapServiceMetadataEdmx)(this.root, serviceUri);
198
+ const edmx = await readCapServiceMetadataEdmx(this.root, serviceUri);
203
199
  annotationData.push({
204
200
  fileContent: edmx,
205
201
  dataSourceUri: serviceUri
@@ -208,7 +204,7 @@ class ApplicationAccessImp {
208
204
  }
209
205
  else {
210
206
  if (mainService.local) {
211
- const serviceFile = await (0, file_1.readFile)(mainService.local, memFs ?? this.options?.fs);
207
+ const serviceFile = await readFile(mainService.local, memFs ?? this.options?.fs);
212
208
  annotationData.push({
213
209
  dataSourceUri: mainService.local,
214
210
  fileContent: serviceFile.toString()
@@ -217,7 +213,7 @@ class ApplicationAccessImp {
217
213
  const { annotations = [] } = mainService;
218
214
  for (const annotation of annotations) {
219
215
  if (annotation.local) {
220
- const annotationFile = await (0, file_1.readFile)(annotation.local, memFs ?? this.options?.fs);
216
+ const annotationFile = await readFile(annotation.local, memFs ?? this.options?.fs);
221
217
  annotationData.push({
222
218
  dataSourceUri: annotation.local,
223
219
  fileContent: annotationFile.toString()
@@ -285,7 +281,7 @@ class ProjectAccessImp {
285
281
  */
286
282
  async getApplicationIdByManifestAppId(manifestAppId) {
287
283
  for (const [appId, { manifest: manifestPath }] of Object.entries(this._project.apps)) {
288
- const manifestContent = await (0, file_1.readJSON)(manifestPath, this.options?.memFs);
284
+ const manifestContent = await readJSON(manifestPath, this.options?.memFs);
289
285
  if (manifestContent['sap.app']?.id === manifestAppId) {
290
286
  return appId;
291
287
  }
@@ -348,19 +344,19 @@ function isEditor(argument) {
348
344
  * When calling this function, adding or removing a CDS file in memory or changing CDS configuration will not be considered until present on real file system.
349
345
  * @returns - Instance of ApplicationAccess that contains information about the application, like paths and services
350
346
  */
351
- async function createApplicationAccess(appRoot, fs) {
347
+ export async function createApplicationAccess(appRoot, fs) {
352
348
  try {
353
349
  let options;
354
350
  if (fs) {
355
351
  options = isEditor(fs) ? { fs } : fs;
356
352
  }
357
- const apps = await (0, search_1.findAllApps)([appRoot], options?.fs);
353
+ const apps = await findAllApps([appRoot], options?.fs);
358
354
  const app = apps.find((app) => app.appRoot === appRoot);
359
355
  if (!app) {
360
356
  throw new Error(`Could not find app with root ${appRoot}`);
361
357
  }
362
- const project = await (0, info_1.getProject)(app.projectRoot, options?.fs);
363
- const appId = (0, node_path_1.relative)(project.root, appRoot);
358
+ const project = await getProject(app.projectRoot, options?.fs);
359
+ const appId = relative(project.root, appRoot);
364
360
  return new ApplicationAccessImp(project, appId, options);
365
361
  }
366
362
  catch (error) {
@@ -374,9 +370,9 @@ async function createApplicationAccess(appRoot, fs) {
374
370
  * @param options - optional options, e.g. logger instance.
375
371
  * @returns - Instance of ProjectAccess that contains information about the project
376
372
  */
377
- async function createProjectAccess(root, options) {
373
+ export async function createProjectAccess(root, options) {
378
374
  try {
379
- const project = await (0, info_1.getProject)(root, options?.memFs);
375
+ const project = await getProject(root, options?.memFs);
380
376
  const projectAccess = new ProjectAccessImp(project, options);
381
377
  return projectAccess;
382
378
  }
@@ -1,6 +1,6 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
2
  import type { Editor } from 'mem-fs-editor';
3
- import type { CapCustomPaths, CapProjectType, CdsEnvironment, csn, Package, ServiceDefinitions, ServiceInfo, CdsVersionInfo, CdsUi5PluginInfo } from '../types';
3
+ import type { CapCustomPaths, CapProjectType, CdsEnvironment, csn, Package, ServiceDefinitions, ServiceInfo, CdsVersionInfo, CdsUi5PluginInfo } from '../types/index.js';
4
4
  /**
5
5
  * Returns true if the project is a CAP Node.js project.
6
6
  *