@sap/ux-cds-compiler-facade
Advanced tools
Comparing version
import type { XsnCompileModel } from '@sap/cds-compiler'; | ||
import type { ServiceName, DiagnosticBase } from '@sap/ux-odata-annotation-core'; | ||
import type { ServiceName, CompilerMessage } from '@sap-ux/odata-annotation-core'; | ||
import type { Project } from '@sapux/project-spec'; | ||
@@ -7,6 +7,2 @@ import type { BlitzIndex, MetadataElementMap, CdsCompilerFacade } from '.'; | ||
import type { File } from './compile'; | ||
export interface CompilerMessage { | ||
hasSyntaxErrors: boolean; | ||
messages: DiagnosticBase[]; | ||
} | ||
export interface CdsArtifactsType { | ||
@@ -13,0 +9,0 @@ fileSequence: string[]; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCompilerErrorMessages = exports.getCdsArtifacts = void 0; | ||
const path_1 = require("path"); | ||
const os = __importStar(require("os")); | ||
const vscode_languageserver_types_1 = require("vscode-languageserver-types"); | ||
@@ -12,2 +36,3 @@ const _1 = require("."); | ||
const compile_1 = require("./compile"); | ||
const cdsSource_1 = require("./cdsSource"); | ||
const getCdsArtifacts = async (project, serviceName, files, cache) => { | ||
@@ -132,2 +157,6 @@ if (files.length) { | ||
const fileUris = Object.keys(compileModel.sources); | ||
let root = project.root || ''; | ||
if (root && os.platform() === 'win32' && !fileUris.some((uri) => uri.startsWith(root.at(0)))) { | ||
root = (0, cdsSource_1.toggleCase)(root.at(0)) + root.substring(1); // adapt drive letter | ||
} | ||
for (const sourceUri of fileUris) { | ||
@@ -137,3 +166,3 @@ const source = compileModel.sources[sourceUri]; | ||
const fileName = compileMessage?.$location?.file; | ||
return fileName && (0, path_1.join)(project.root, fileName) === sourceUri; | ||
return fileName && (0, path_1.join)(root, fileName) === sourceUri; | ||
}); | ||
@@ -140,0 +169,0 @@ for (const message of messages) { |
import type { XsnCompileModel } from '@sap/cds-compiler'; | ||
import type { Annotation, Assignment, Node, Path, StringLiteral, Token } from '@sap/ux-cds-annotation-parser'; | ||
import type { Namespace } from '@sap/ux-odata-annotation-core-types'; | ||
import type { Namespace } from '@sap-ux/odata-annotation-core-types'; | ||
export interface AnnotateDirective extends Node { | ||
@@ -5,0 +5,0 @@ type: 'annotate-directive'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getCdsDocument = void 0; | ||
const ux_odata_annotation_core_types_1 = require("@sap/ux-odata-annotation-core-types"); | ||
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types"); | ||
const cdsSource_1 = require("./cdsSource"); | ||
@@ -39,3 +39,3 @@ const transform_1 = require("./transform"); | ||
const lastToken = tokens[tokens.length - 1]; | ||
const documentEnd = convertToken(lastToken)?.range?.end ?? ux_odata_annotation_core_types_1.Position.create(0, 0); | ||
const documentEnd = convertToken(lastToken)?.range?.end ?? odata_annotation_core_types_1.Position.create(0, 0); | ||
return { | ||
@@ -46,3 +46,3 @@ type: 'cds-document', | ||
namespace: undefined, | ||
range: ux_odata_annotation_core_types_1.Range.create(ux_odata_annotation_core_types_1.Position.create(0, 0), documentEnd) | ||
range: odata_annotation_core_types_1.Range.create(odata_annotation_core_types_1.Position.create(0, 0), documentEnd) | ||
}; | ||
@@ -129,5 +129,5 @@ } | ||
value: token.text, | ||
range: ux_odata_annotation_core_types_1.Range.create(token.line - 1, token.column, token.line - 1, token.column + token.text.length) | ||
range: odata_annotation_core_types_1.Range.create(token.line - 1, token.column, token.line - 1, token.column + token.text.length) | ||
}; | ||
} | ||
//# sourceMappingURL=cdsDocument.js.map |
import type { Token, XsnCompileModel } from '@sap/cds-compiler'; | ||
import type { AnnotationFile, Namespace, Reference, ServiceAnnotationFile } from '@sap/ux-odata-annotation-core'; | ||
import type { AnnotationFile, Namespace, Reference, ServiceAnnotationFile, CompilerMessage } from '@sap-ux/odata-annotation-core'; | ||
import type { Project } from '@sapux/project-spec'; | ||
@@ -8,3 +8,2 @@ import type { BlitzIndex, PropagatedTargetMap } from '.'; | ||
import type { CdsDocument } from './cdsDocument'; | ||
import type { CompilerMessage } from './cdsArtifacts'; | ||
/** | ||
@@ -11,0 +10,0 @@ * To abstract the calls to undocumented functionalities of @sap/cds-compiler module |
import type { ICdsCompiler, XsnArtifact, XsnElement, XsnFinalEffectiveType, XsnNamedObject, XsnObject, XsnOriginatedObject, XsnDependency, XsnUsing, XsnNamespace } from '@sap/cds-compiler'; | ||
import type { MetadataElement } from '@sap/ux-metadata'; | ||
import type { Reference, Namespace } from '@sap/ux-odata-annotation-core'; | ||
import type { Reference, Namespace } from '@sap-ux/odata-annotation-core'; | ||
import type { CdsCompilerFacade } from '../facade'; | ||
@@ -5,0 +5,0 @@ export declare class Converter { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Converter = void 0; | ||
const ux_odata_annotation_core_types_1 = require("@sap/ux-odata-annotation-core-types"); | ||
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types"); | ||
const transform_1 = require("../transform"); | ||
@@ -296,3 +296,3 @@ const utils_1 = require("../utils"); | ||
} | ||
let typeArtifact = typed?._effectiveType?.type?._artifact; | ||
let typeArtifact = effectiveType?.type?._artifact || effectiveType?.['_origin']?.type?._artifact; | ||
if (!typeArtifact && typed?.items) { | ||
@@ -373,3 +373,3 @@ typeArtifact = typed.items._effectiveType?.type?._artifact; | ||
if (nameLocation && range) { | ||
result.location = ux_odata_annotation_core_types_1.Location.create(this.adaptFilePath(nameLocation), range); | ||
result.location = odata_annotation_core_types_1.Location.create(this.adaptFilePath(nameLocation), range); | ||
} | ||
@@ -458,3 +458,3 @@ } | ||
else { | ||
result.push({ name, type: this.getPrimitiveType(key) }); | ||
result.push({ name, type: this.getPrimitiveType(key.targetElement?._artifact || key) }); | ||
} | ||
@@ -461,0 +461,0 @@ } |
import type { XsnCompileModel } from '@sap/cds-compiler'; | ||
import type { AnnotationFile, ServiceAnnotationFile } from '@sap/ux-odata-annotation-core'; | ||
import type { AnnotationFile, ServiceAnnotationFile } from '@sap-ux/odata-annotation-core'; | ||
export interface PropagatedTargetMap { | ||
@@ -4,0 +4,0 @@ [sourceTarget: string]: { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.buildGhostFiles = exports.toPropagatedTargetMap = void 0; | ||
const ux_odata_annotation_core_types_1 = require("@sap/ux-odata-annotation-core-types"); | ||
const ux_odata_annotation_core_1 = require("@sap/ux-odata-annotation-core"); | ||
const odata_annotation_core_types_1 = require("@sap-ux/odata-annotation-core-types"); | ||
const odata_annotation_core_1 = require("@sap-ux/odata-annotation-core"); | ||
const url_1 = require("url"); | ||
@@ -216,3 +216,3 @@ const utils_1 = require("../utils"); | ||
return (element.$annotations ?? []).find((a) => { | ||
return a?.location ? (0, ux_odata_annotation_core_1.rangeContained)((0, rangeConverters_1.locationToRange)(a.location), range) : false; | ||
return a?.location ? (0, odata_annotation_core_1.rangeContained)((0, rangeConverters_1.locationToRange)(a.location), range) : false; | ||
}); | ||
@@ -228,3 +228,3 @@ }; | ||
function getCacheKey(location) { | ||
const { start, end } = (0, rangeConverters_1.locationToRange)(location) || ux_odata_annotation_core_types_1.Range.create(0, 0, 0, 0); | ||
const { start, end } = (0, rangeConverters_1.locationToRange)(location) || odata_annotation_core_types_1.Range.create(0, 0, 0, 0); | ||
return `${location?.file} ${start.line}:${start.character}-${end.line}:${end.character}`; | ||
@@ -391,3 +391,3 @@ } | ||
.map((file) => ({ | ||
uri: ux_odata_annotation_core_1.GHOST_FILENAME_PREFIX + file.uri, | ||
uri: odata_annotation_core_1.GHOST_FILENAME_PREFIX + file.uri, | ||
content: ghostFiles[file.uri], | ||
@@ -394,0 +394,0 @@ serviceName: 'default' |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findUsing = void 0; | ||
const ux_odata_annotation_core_1 = require("@sap/ux-odata-annotation-core"); | ||
const odata_annotation_core_1 = require("@sap-ux/odata-annotation-core"); | ||
const rangeConverters_1 = require("./rangeConverters"); | ||
@@ -10,4 +10,4 @@ function findUsing(usings, dependency) { | ||
if (using.location && dependency.location?.line) { | ||
const pos = ux_odata_annotation_core_1.Position.create(dependency.location.line - 1, dependency.location.col); | ||
return (0, ux_odata_annotation_core_1.positionContained)((0, rangeConverters_1.locationToRange)(using.location), pos); | ||
const pos = odata_annotation_core_1.Position.create(dependency.location.line - 1, dependency.location.col); | ||
return (0, odata_annotation_core_1.positionContained)((0, rangeConverters_1.locationToRange)(using.location), pos); | ||
} | ||
@@ -14,0 +14,0 @@ else { |
{ | ||
"name": "@sap/ux-cds-compiler-facade", | ||
"version": "1.11.5", | ||
"version": "1.12.0", | ||
"description": "SAP Fiori tools - CDS compiler facade", | ||
@@ -29,12 +29,12 @@ "publisher": "SAPSE", | ||
"dependencies": { | ||
"@sap/cds-compiler": "4.3.0", | ||
"@sap/cds-compiler": "4.4.4", | ||
"vscode-languageserver-types": "3.17.2" | ||
}, | ||
"devDependencies": { | ||
"@sap/cds": "7.3.0", | ||
"@sap/ux-cds-annotation-parser": "1.11.5", | ||
"@sap/ux-cds-compiler-types": "1.11.5", | ||
"@sap/ux-odata-annotation-core": "1.11.5", | ||
"@sap/ux-odata-annotation-core-types": "1.11.5", | ||
"@sap/ux-project-access": "1.11.5", | ||
"@sap-ux/odata-annotation-core": "0.1.2", | ||
"@sap-ux/odata-annotation-core-types": "0.1.1", | ||
"@sap/cds": "7.4.1", | ||
"@sap/ux-cds-annotation-parser": "1.12.0", | ||
"@sap/ux-cds-compiler-types": "1.12.0", | ||
"@sap/ux-project-access": "1.12.0", | ||
"madge": "4.0.2", | ||
@@ -41,0 +41,0 @@ "typescript": "5.2.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
337016
0.47%3675
0.66%+ Added
- Removed
Updated