@sap-ux/project-access 1.25.5 → 1.25.7
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/project/cap.d.ts +2 -2
- package/dist/project/cap.js +20 -14
- package/dist/project/info.d.ts +5 -4
- package/dist/project/info.js +16 -10
- package/package.json +2 -2
package/dist/project/cap.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export declare const toAbsoluteUri: (projectRoot: string, relativeUri: string) =
|
|
|
116
116
|
*/
|
|
117
117
|
export declare const toReferenceUri: (projectRoot: string, relativeUriFrom: string, relativeUriTo: string) => Promise<string>;
|
|
118
118
|
/**
|
|
119
|
-
* Clear cache of
|
|
119
|
+
* Clear cache of request to load global cds module.
|
|
120
120
|
*/
|
|
121
|
-
export declare function
|
|
121
|
+
export declare function clearGlobalCdsModulePromiseCache(): void;
|
|
122
122
|
//# sourceMappingURL=cap.d.ts.map
|
package/dist/project/cap.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.clearGlobalCdsModulePromiseCache = exports.toReferenceUri = exports.toAbsoluteUri = exports.clearCdsModuleCache = exports.getCapEnvironment = exports.readCapServiceMetadataEdmx = exports.getCdsServices = exports.getCdsRoots = exports.getCdsFiles = exports.getCapModelAndServices = exports.getCapCustomPaths = exports.isCapProject = exports.getCapProjectType = exports.isCapJavaProject = exports.isCapNodeJsProject = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
@@ -493,29 +493,35 @@ async function readPackageNameForFolder(baseUri, relativeUri) {
|
|
|
493
493
|
}
|
|
494
494
|
return packageName;
|
|
495
495
|
}
|
|
496
|
-
|
|
496
|
+
// Cache for request to load global cds. Cache the promise to avoid starting multiple identical requests in parallel.
|
|
497
|
+
let globalCdsModulePromise;
|
|
497
498
|
/**
|
|
498
499
|
* Try to load global installation of @sap/cds, usually child of @sap/cds-dk.
|
|
499
500
|
*
|
|
500
501
|
* @returns - module @sap/cds from global installed @sap/cds-dk
|
|
501
502
|
*/
|
|
502
503
|
async function loadGlobalCdsModule() {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
504
|
+
globalCdsModulePromise =
|
|
505
|
+
globalCdsModulePromise ??
|
|
506
|
+
new Promise((resolve, reject) => {
|
|
507
|
+
return getCdsVersionInfo().then((versions) => {
|
|
508
|
+
if (versions.home) {
|
|
509
|
+
resolve((0, module_loader_1.loadModuleFromProject)(versions.home, '@sap/cds'));
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
reject(new Error('Can not find global installation of module @sap/cds, which should be part of @sap/cds-dk'));
|
|
513
|
+
}
|
|
514
|
+
}, reject);
|
|
515
|
+
});
|
|
516
|
+
return globalCdsModulePromise;
|
|
511
517
|
}
|
|
512
518
|
/**
|
|
513
|
-
* Clear cache of
|
|
519
|
+
* Clear cache of request to load global cds module.
|
|
514
520
|
*/
|
|
515
|
-
function
|
|
516
|
-
|
|
521
|
+
function clearGlobalCdsModulePromiseCache() {
|
|
522
|
+
globalCdsModulePromise = undefined;
|
|
517
523
|
}
|
|
518
|
-
exports.
|
|
524
|
+
exports.clearGlobalCdsModulePromiseCache = clearGlobalCdsModulePromiseCache;
|
|
519
525
|
/**
|
|
520
526
|
* Get cds information, which includes versions and also the home path of cds module.
|
|
521
527
|
*
|
package/dist/project/info.d.ts
CHANGED
|
@@ -37,15 +37,16 @@ export declare function getProjectType(projectRoot: string): Promise<ProjectType
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function getMinUI5VersionFromManifest(manifest: Manifest): string | string[] | undefined;
|
|
39
39
|
/**
|
|
40
|
-
* Returns the minUI5Version as string[].
|
|
40
|
+
* Returns the valid minUI5Version(s) as string[].
|
|
41
41
|
*
|
|
42
42
|
* @param manifest - manifest object
|
|
43
|
+
* @param noValidation - disables the semver validation
|
|
43
44
|
* @returns minUI5Version, as an array of strings
|
|
44
45
|
*/
|
|
45
|
-
export declare function getMinUI5VersionAsArray(manifest: Manifest): string[];
|
|
46
|
+
export declare function getMinUI5VersionAsArray(manifest: Manifest, noValidation?: boolean): string[];
|
|
46
47
|
/**
|
|
47
|
-
* Returns the minUI5Version in string format.
|
|
48
|
-
* If it is defined as an
|
|
48
|
+
* Returns the minUI5Version in string format (if valid).
|
|
49
|
+
* If it is defined as an array, returns the minimum valid version from it.
|
|
49
50
|
*
|
|
50
51
|
* @param manifest - manifest object
|
|
51
52
|
* @returns the minimum version as string
|
package/dist/project/info.js
CHANGED
|
@@ -210,33 +210,39 @@ function getMinUI5VersionFromManifest(manifest) {
|
|
|
210
210
|
}
|
|
211
211
|
exports.getMinUI5VersionFromManifest = getMinUI5VersionFromManifest;
|
|
212
212
|
/**
|
|
213
|
-
* Returns the minUI5Version as string[].
|
|
213
|
+
* Returns the valid minUI5Version(s) as string[].
|
|
214
214
|
*
|
|
215
215
|
* @param manifest - manifest object
|
|
216
|
+
* @param noValidation - disables the semver validation
|
|
216
217
|
* @returns minUI5Version, as an array of strings
|
|
217
218
|
*/
|
|
218
|
-
function getMinUI5VersionAsArray(manifest) {
|
|
219
|
-
|
|
219
|
+
function getMinUI5VersionAsArray(manifest, noValidation = false) {
|
|
220
|
+
const result = [];
|
|
220
221
|
const minUI5Version = getMinUI5VersionFromManifest(manifest);
|
|
221
222
|
if (minUI5Version) {
|
|
222
|
-
|
|
223
|
+
const minUI5VersionArray = Array.isArray(minUI5Version) ? minUI5Version : [minUI5Version];
|
|
224
|
+
minUI5VersionArray.forEach((version) => {
|
|
225
|
+
if (noValidation || (0, semver_1.valid)(version)) {
|
|
226
|
+
result.push(version);
|
|
227
|
+
}
|
|
228
|
+
});
|
|
223
229
|
}
|
|
224
230
|
return result;
|
|
225
231
|
}
|
|
226
232
|
exports.getMinUI5VersionAsArray = getMinUI5VersionAsArray;
|
|
227
233
|
/**
|
|
228
|
-
* Returns the minUI5Version in string format.
|
|
229
|
-
* If it is defined as an
|
|
234
|
+
* Returns the minUI5Version in string format (if valid).
|
|
235
|
+
* If it is defined as an array, returns the minimum valid version from it.
|
|
230
236
|
*
|
|
231
237
|
* @param manifest - manifest object
|
|
232
238
|
* @returns the minimum version as string
|
|
233
239
|
*/
|
|
234
240
|
function getMinimumUI5Version(manifest) {
|
|
235
241
|
let result;
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
238
|
-
|
|
239
|
-
if (
|
|
242
|
+
const validVersionsArray = getMinUI5VersionAsArray(manifest);
|
|
243
|
+
if (validVersionsArray.length > 0) {
|
|
244
|
+
validVersionsArray.forEach((version) => {
|
|
245
|
+
if (!result || (0, semver_1.gte)(result, version)) {
|
|
240
246
|
result = version;
|
|
241
247
|
}
|
|
242
248
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-ux/project-access",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.7",
|
|
4
4
|
"description": "Library to access SAP Fiori tools projects",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@types/mem-fs": "1.1.2",
|
|
37
37
|
"@types/mem-fs-editor": "7.0.1",
|
|
38
38
|
"@types/semver": "7.5.2",
|
|
39
|
-
"@ui5/manifest": "1.
|
|
39
|
+
"@ui5/manifest": "1.66.0",
|
|
40
40
|
"vscode-uri": "3.0.7",
|
|
41
41
|
"@sap-ux/logger": "0.6.0"
|
|
42
42
|
},
|