@sap-ux/project-access 1.38.1 → 2.0.1

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 +28 -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,21 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getWebappPath = getWebappPath;
4
- exports.getPathMappings = getPathMappings;
5
- exports.readUi5Yaml = readUi5Yaml;
6
- exports.getAllUi5YamlFileNames = getAllUi5YamlFileNames;
7
- exports.getMockServerConfig = getMockServerConfig;
8
- exports.getMockDataPath = getMockDataPath;
9
- const node_path_1 = require("node:path");
10
- const ui5_config_1 = require("@sap-ux/ui5-config");
11
- const constants_1 = require("../constants");
12
- const file_1 = require("../file");
1
+ import { basename, dirname, join } from 'node:path';
2
+ import { UI5Config } from '@sap-ux/ui5-config';
3
+ import { DirName, FileName } from '../constants.js';
4
+ import { fileExists, findFilesByExtension, findFileUp, readFile } from '../file/index.js';
13
5
  /**
14
6
  * Default path mappings for each UI5 project type.
15
7
  *
16
8
  */
17
9
  const PATH_MAPPING_DEFAULTS = {
18
- application: { webapp: constants_1.DirName.Webapp },
10
+ application: { webapp: DirName.Webapp },
19
11
  library: { src: 'src', test: 'test' },
20
12
  'theme-library': { src: 'src', test: 'test' },
21
13
  module: {}
@@ -28,8 +20,8 @@ const PATH_MAPPING_DEFAULTS = {
28
20
  * @returns - base directory of the project
29
21
  */
30
22
  async function getBaseDir(appRoot, memFs) {
31
- const packageJsonPath = await (0, file_1.findFileUp)(constants_1.FileName.Package, appRoot, memFs);
32
- return packageJsonPath ? (0, node_path_1.dirname)(packageJsonPath) : appRoot;
23
+ const packageJsonPath = await findFileUp(FileName.Package, appRoot, memFs);
24
+ return packageJsonPath ? dirname(packageJsonPath) : appRoot;
33
25
  }
34
26
  /**
35
27
  * Get path to webapp.
@@ -38,7 +30,7 @@ async function getBaseDir(appRoot, memFs) {
38
30
  * @param [memFs] - optional mem-fs editor instance
39
31
  * @returns - path to webapp folder
40
32
  */
41
- async function getWebappPath(appRoot, memFs) {
33
+ export async function getWebappPath(appRoot, memFs) {
42
34
  let pathMappings;
43
35
  try {
44
36
  pathMappings = await getPathMappings(appRoot, memFs);
@@ -47,7 +39,7 @@ async function getWebappPath(appRoot, memFs) {
47
39
  // For backward compatibility ignore errors and use default
48
40
  pathMappings = {};
49
41
  }
50
- return 'webapp' in pathMappings ? pathMappings.webapp : (0, node_path_1.join)(appRoot, constants_1.DirName.Webapp);
42
+ return 'webapp' in pathMappings ? pathMappings.webapp : join(appRoot, DirName.Webapp);
51
43
  }
52
44
  /**
53
45
  * Get path mappings defined in 'ui5.yaml' depending on the project type defined in 'ui5.yaml'.
@@ -59,7 +51,7 @@ async function getWebappPath(appRoot, memFs) {
59
51
  * @throws {Error} if ui5.yaml or 'type' cannot be read
60
52
  * @throws {Error} if project type is not 'application', 'library', 'theme-library' or 'module'
61
53
  */
62
- async function getPathMappings(appRoot, memFs, fileName = constants_1.FileName.Ui5Yaml) {
54
+ export async function getPathMappings(appRoot, memFs, fileName = FileName.Ui5Yaml) {
63
55
  let ui5Config;
64
56
  let configuration;
65
57
  let type;
@@ -81,7 +73,7 @@ async function getPathMappings(appRoot, memFs, fileName = constants_1.FileName.U
81
73
  const defaults = PATH_MAPPING_DEFAULTS[type];
82
74
  for (const key in defaults) {
83
75
  const value = configPaths[key] ?? defaults[key];
84
- result[key] = (0, node_path_1.join)(baseDir, value);
76
+ result[key] = join(baseDir, value);
85
77
  }
86
78
  // Cast the merged result to PathMappings to re-enforce strict union keys for the caller
87
79
  return result;
@@ -97,11 +89,11 @@ async function getPathMappings(appRoot, memFs, fileName = constants_1.FileName.U
97
89
  * @returns {UI5Config} UI5 config file in yaml format
98
90
  * @throws {Error} if file is not found
99
91
  */
100
- async function readUi5Yaml(projectRoot, fileName, memFs, options) {
101
- const ui5YamlPath = (0, node_path_1.join)(projectRoot, fileName);
102
- if (await (0, file_1.fileExists)(ui5YamlPath, memFs)) {
103
- const yamlString = await (0, file_1.readFile)(ui5YamlPath, memFs);
104
- return await ui5_config_1.UI5Config.newInstance(yamlString, { validateSchema: options?.validateSchema });
92
+ export async function readUi5Yaml(projectRoot, fileName, memFs, options) {
93
+ const ui5YamlPath = join(projectRoot, fileName);
94
+ if (await fileExists(ui5YamlPath, memFs)) {
95
+ const yamlString = await readFile(ui5YamlPath, memFs);
96
+ return await UI5Config.newInstance(yamlString, { validateSchema: options?.validateSchema });
105
97
  }
106
98
  throw Error(`File '${fileName}' not found in project '${projectRoot}'`);
107
99
  }
@@ -113,10 +105,10 @@ async function readUi5Yaml(projectRoot, fileName, memFs, options) {
113
105
  * @returns list of valid and invalid UI5 configuration yaml file names
114
106
  * @throws {Error} if an error occurs while reading files from projectRoot
115
107
  */
116
- async function getAllUi5YamlFileNames(projectRoot, memFs) {
108
+ export async function getAllUi5YamlFileNames(projectRoot, memFs) {
117
109
  try {
118
- const yamlFilePaths = await (0, file_1.findFilesByExtension)('.yaml', projectRoot, [], memFs, true);
119
- return yamlFilePaths.map((path) => (0, node_path_1.basename)(path));
110
+ const yamlFilePaths = await findFilesByExtension('.yaml', projectRoot, [], memFs, true);
111
+ return yamlFilePaths.map((path) => basename(path));
120
112
  }
121
113
  catch (error) {
122
114
  throw new Error(`There was an error reading files from the directory '${projectRoot}': ${error}`);
@@ -130,7 +122,7 @@ async function getAllUi5YamlFileNames(projectRoot, memFs) {
130
122
  * @returns The mock server configuration or null if not found.
131
123
  * @throws {Error} If the sap-fe-mockserver middleware is not found.
132
124
  */
133
- async function getMockServerConfig(projectRoot, fileName = constants_1.FileName.Ui5MockYaml) {
125
+ export async function getMockServerConfig(projectRoot, fileName = FileName.Ui5MockYaml) {
134
126
  const ui5MockYamlFile = await readUi5Yaml(projectRoot, fileName);
135
127
  const mockserverMiddleware = ui5MockYamlFile.findCustomMiddleware('sap-fe-mockserver');
136
128
  if (!mockserverMiddleware) {
@@ -145,7 +137,7 @@ async function getMockServerConfig(projectRoot, fileName = constants_1.FileName.
145
137
  * @param fileName - Name of the YAML file to read. Defaults to FileName.Ui5MockYaml.
146
138
  * @returns The mock data path as a string. Returns an empty string if not found.
147
139
  */
148
- async function getMockDataPath(projectRoot, fileName = constants_1.FileName.Ui5MockYaml) {
140
+ export async function getMockDataPath(projectRoot, fileName = FileName.Ui5MockYaml) {
149
141
  const mockServerConfig = await getMockServerConfig(projectRoot, fileName);
150
142
  if (!mockServerConfig) {
151
143
  return '';
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isUI5IdUnique = isUI5IdUnique;
4
- const fast_xml_parser_1 = require("fast-xml-parser");
1
+ import { XMLParser } from 'fast-xml-parser';
5
2
  /**
6
3
  * Recursively checks if an object (parsed XML) contains an element with the specified id attribute.
7
4
  *
@@ -55,7 +52,7 @@ function checkIdInValue(value, id, attrPrefix) {
55
52
  * @returns true if the id is available (not found), false if it exists
56
53
  */
57
54
  function checkElementIdAvailable(id, xmlContent) {
58
- const parser = new fast_xml_parser_1.XMLParser({
55
+ const parser = new XMLParser({
59
56
  ignoreAttributes: false,
60
57
  attributeNamePrefix: '@_',
61
58
  parseAttributeValue: false
@@ -76,7 +73,7 @@ function checkElementIdAvailable(id, xmlContent) {
76
73
  * @param files - Array of XML file contents to check
77
74
  * @returns true if the id is unique (available), false if it already exists
78
75
  */
79
- function isUI5IdUnique(id, files) {
76
+ export function isUI5IdUnique(id, files) {
80
77
  return files.every((content) => content === '' || checkElementIdAvailable(id, content));
81
78
  }
82
79
  //# sourceMappingURL=ui5-xml-id-validator.js.map
@@ -1,10 +1,10 @@
1
1
  import type { Logger } from '@sap-ux/logger';
2
2
  import type { NewI18nEntry } from '@sap-ux/i18n';
3
- import type { I18nBundles } from '../i18n';
4
- import type { ApplicationStructure, I18nPropertiesPaths, Project, ProjectType } from '../info';
3
+ import type { I18nBundles } from '../i18n/index.js';
4
+ import type { ApplicationStructure, I18nPropertiesPaths, Project, ProjectType } from '../info/index.js';
5
5
  import type { Editor } from 'mem-fs-editor';
6
- import type { Package } from '../package';
7
- import type { AnnotationFile, Manifest } from '../webapp';
6
+ import type { Package } from '../package/index.js';
7
+ import type { AnnotationFile, Manifest } from '../webapp/index.js';
8
8
  interface BaseAccess {
9
9
  readonly project: Project;
10
10
  readonly root: string;
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { Manifest } from '../webapp';
1
+ import type { Manifest } from '../webapp/index.js';
2
2
  export type FioriArtifactTypes = 'applications' | 'adaptations' | 'extensions' | 'libraries' | 'components';
3
3
  /**
4
4
  * Search result when searching for apps. It is valid for all types of
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,10 @@
1
- export * from './access';
2
- export * from './cap';
3
- export * from './i18n';
4
- export * from './find';
5
- export * from './info';
6
- export * from './library';
7
- export * from './package';
8
- export * from './vscode';
9
- export * from './webapp';
1
+ export * from './access/index.js';
2
+ export * from './cap/index.js';
3
+ export * from './i18n/index.js';
4
+ export * from './find/index.js';
5
+ export * from './info/index.js';
6
+ export * from './library/index.js';
7
+ export * from './package/index.js';
8
+ export * from './vscode/index.js';
9
+ export * from './webapp/index.js';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,26 +1,10 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./access"), exports);
18
- __exportStar(require("./cap"), exports);
19
- __exportStar(require("./i18n"), exports);
20
- __exportStar(require("./find"), exports);
21
- __exportStar(require("./info"), exports);
22
- __exportStar(require("./library"), exports);
23
- __exportStar(require("./package"), exports);
24
- __exportStar(require("./vscode"), exports);
25
- __exportStar(require("./webapp"), exports);
1
+ export * from './access/index.js';
2
+ export * from './cap/index.js';
3
+ export * from './i18n/index.js';
4
+ export * from './find/index.js';
5
+ export * from './info/index.js';
6
+ export * from './library/index.js';
7
+ export * from './package/index.js';
8
+ export * from './vscode/index.js';
9
+ export * from './webapp/index.js';
26
10
  //# sourceMappingURL=index.js.map
@@ -1,5 +1,5 @@
1
- import type { CapCustomPaths, CapProjectType } from '../cap';
2
- import type { ManifestNamespace } from '../webapp';
1
+ import type { CapCustomPaths, CapProjectType } from '../cap/index.js';
2
+ import type { ManifestNamespace } from '../webapp/index.js';
3
3
  export interface Project {
4
4
  /**
5
5
  * Absolute path to the project root.
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export var ReuseLibType;
2
+ (function (ReuseLibType) {
3
+ ReuseLibType["Library"] = "library";
4
+ ReuseLibType["Component"] = "component";
5
+ })(ReuseLibType || (ReuseLibType = {}));
3
6
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=basic.js.map
@@ -1,4 +1,4 @@
1
- import type { PackageJson } from './package-json';
1
+ import type { PackageJson } from './package-json.js';
2
2
  interface SapUxPackage {
3
3
  sapux?: boolean | string[];
4
4
  sapuxLayer?: UI5FlexLayer;
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { Primitive } from './primitive';
1
+ import type { Primitive } from './primitive.js';
2
2
  /**
3
3
  Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
4
4
 
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=literal-union.js.map
@@ -1,5 +1,5 @@
1
- import type { LiteralUnion } from './literal-union';
2
- import type { JsonObject, JsonValue } from './basic';
1
+ import type { LiteralUnion } from './literal-union.js';
2
+ import type { JsonObject, JsonValue } from './basic.js';
3
3
  declare namespace PackageJson {
4
4
  /**
5
5
  A person who has been involved in creating or maintaining the package.
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=package-json.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=primitive.js.map
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,5 @@
1
- import type * as ManifestNamespace from '@ui5/manifest/types/manifest';
2
- export { ManifestNamespace };
3
- export type Manifest = ManifestNamespace.SAPJSONSchemaForWebApplicationManifestFile;
1
+ export type * as ManifestNamespace from '@ui5/manifest';
2
+ export type { SAPJSONSchemaForWebApplicationManifestFile as Manifest } from '@ui5/manifest';
4
3
  export interface AnnotationFile {
5
4
  dataSourceUri: string;
6
5
  fileContent: string;
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@sap-ux/project-access",
3
- "version": "1.38.1",
3
+ "version": "2.0.1",
4
4
  "description": "Library to access SAP Fiori tools projects",
5
+ "type": "module",
5
6
  "repository": {
6
7
  "type": "git",
7
8
  "url": "https://github.com/SAP/open-ux-tools.git",
@@ -29,17 +30,18 @@
29
30
  "mem-fs": "2.1.0",
30
31
  "mem-fs-editor": "9.4.0",
31
32
  "semver": "7.7.4",
32
- "@sap-ux/i18n": "0.4.0",
33
- "@sap-ux/ui5-config": "0.31.1"
33
+ "@sap-ux/i18n": "1.0.0",
34
+ "@sap-ux/ui5-config": "1.0.0"
34
35
  },
35
36
  "devDependencies": {
37
+ "@jest/globals": "30.3.0",
36
38
  "@sap-ux/vocabularies-types": "0.15.0",
37
39
  "@types/mem-fs": "1.1.2",
38
40
  "@types/mem-fs-editor": "7.0.1",
39
41
  "@types/semver": "7.7.1",
40
42
  "@ui5/manifest": "1.85.0",
41
43
  "vscode-uri": "3.1.0",
42
- "@sap-ux/logger": "0.9.0"
44
+ "@sap-ux/logger": "1.0.0"
43
45
  },
44
46
  "scripts": {
45
47
  "build": "tsc --build",
@@ -47,7 +49,7 @@
47
49
  "format": "prettier --write '**/*.{js,json,ts,yaml,yml}' --ignore-path ../../.prettierignore",
48
50
  "lint": "eslint",
49
51
  "lint:fix": "eslint --fix",
50
- "test": "jest --ci --forceExit --detectOpenHandles --colors",
52
+ "test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --ci --forceExit --detectOpenHandles --colors",
51
53
  "watch": "tsc --watch"
52
54
  }
53
55
  }