diff --git a/.changeset/tender-rivers-matter.md b/.changeset/tender-rivers-matter.md new file mode 100644 index 000000000..cf237fbbd --- /dev/null +++ b/.changeset/tender-rivers-matter.md @@ -0,0 +1,15 @@ +--- +"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch +"vscode-ui5-language-assistant": patch +"@ui5-language-assistant/xml-views-completion": patch +"@ui5-language-assistant/xml-views-validation": patch +"@ui5-language-assistant/xml-views-tooltip": patch +"@ui5-language-assistant/language-server": patch +"@ui5-language-assistant/test-utils": patch +"@ui5-language-assistant/semantic-model": patch +"@ui5-language-assistant/logic-utils": patch +"@ui5-language-assistant/constant": patch +"@ui5-language-assistant/context": patch +--- + +fix: introduce constant package to handle UI5 default version in central package diff --git a/packages/constant/README.md b/packages/constant/README.md new file mode 100644 index 000000000..54f3af3fc --- /dev/null +++ b/packages/constant/README.md @@ -0,0 +1,32 @@ +[![npm (scoped)](https://img.shields.io/npm/v/@ui5-language-assistant/constant.svg)](https://www.npmjs.com/package/@ui5-language-assistant/constant) + +# @ui5-language-assistant/constant + +A package for constants that can be reuse a cross other packages. This package is introduced to avoid cyclic dependency. + +## Installation + +With npm: + +- `npm install @ui5-language-assistant/constant` + +With Yarn: + +- `yarn add @ui5-language-assistant/constant` + +## Usage + +This package only exposes programmatic APIs, import the package and use the exported APIs +defined in [api.ts](./src/api.ts). + +## Support + +Please open [issues](https://github.com/SAP/ui5-language-assistant/issues) on github. + +## Contributing + +See [CONTRIBUTING.md](./CONTRIBUTING.md). + +## Licensing + +Copyright 2022 SAP SE. Please see our [LICENSE](../../LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/ui5-language-assistant). diff --git a/packages/constant/jest.config.js b/packages/constant/jest.config.js new file mode 100644 index 000000000..406cef575 --- /dev/null +++ b/packages/constant/jest.config.js @@ -0,0 +1,15 @@ +const { join } = require("path"); +const defaultConfig = require("../../jest.config"); + +module.exports = { + ...defaultConfig, + globals: { + "ts-jest": { + tsconfig: join(__dirname, "tsconfig-test.json"), + diagnostics: { + // warnOnly: true, + exclude: /\.(spec|test)\.ts$/, + }, + }, + }, +}; diff --git a/packages/constant/package.json b/packages/constant/package.json new file mode 100644 index 000000000..17f0f3520 --- /dev/null +++ b/packages/constant/package.json @@ -0,0 +1,27 @@ +{ + "name": "@ui5-language-assistant/constant", + "version": "0.0.0", + "private": true, + "description": "constant variables used across packages", + "keywords": [], + "files": [ + ".reuse", + "LICENSES", + "lib/src", + "src" + ], + "main": "lib/src/api.js", + "repository": "https://github.com/sap/ui5-language-assistant/", + "license": "Apache-2.0", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "ci": "npm-run-all clean compile lint", + "clean": "rimraf ./lib ./coverage ./nyc_output", + "compile": "yarn run clean && tsc -p .", + "compile:watch": "tsc -p . --watch", + "lint": "eslint . --ext .ts --max-warnings=0 --ignore-path=../../.gitignore", + "test": "echo nothing to test", + "format:fix": "prettier --write \"**/*.@(js|ts|json|md)\" --ignore-path=.gitignore" + } +} diff --git a/packages/constant/src/api.ts b/packages/constant/src/api.ts new file mode 100644 index 000000000..76e451a6f --- /dev/null +++ b/packages/constant/src/api.ts @@ -0,0 +1,8 @@ +export { + DEFAULT_OPEN_UI5_VERSION, + DEFAULT_UI5_FRAMEWORK, + DEFAULT_UI5_VERSION, + DEFAULT_UI5_VERSION_BASE, + OPEN_FRAMEWORK, + UI5_FRAMEWORK_CDN_BASE_URL, +} from "./constant"; diff --git a/packages/constant/src/constant.ts b/packages/constant/src/constant.ts new file mode 100644 index 000000000..7fe53ad27 --- /dev/null +++ b/packages/constant/src/constant.ts @@ -0,0 +1,11 @@ +export const OPEN_FRAMEWORK = "OpenUI5"; +export const DEFAULT_UI5_FRAMEWORK = "SAPUI5"; + +export const DEFAULT_UI5_VERSION = "1.71.70"; +export const DEFAULT_OPEN_UI5_VERSION = "1.71.67"; +export const DEFAULT_UI5_VERSION_BASE = "1.71"; + +export const UI5_FRAMEWORK_CDN_BASE_URL = { + OpenUI5: "https://sdk.openui5.org/", + SAPUI5: "https://ui5.sap.com/", +}; diff --git a/packages/constant/tsconfig.json b/packages/constant/tsconfig.json new file mode 100644 index 000000000..3057a3012 --- /dev/null +++ b/packages/constant/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "lib", + "baseUrl": "." + }, + "include": ["src/**/*", "api.d.ts"] +} diff --git a/packages/context/package.json b/packages/context/package.json index 68988ee9d..ed6b431e3 100644 --- a/packages/context/package.json +++ b/packages/context/package.json @@ -22,6 +22,7 @@ "@ui5-language-assistant/logger": "0.0.1", "@ui5-language-assistant/logic-utils": "4.0.18", "@ui5-language-assistant/settings": "4.0.9", + "@ui5-language-assistant/constant": "0.0.0", "fs-extra": "10.1.0", "globby": "11.1.0", "js-yaml": "4.1.0", diff --git a/packages/context/src/api.ts b/packages/context/src/api.ts index f5f481f91..281fd1fff 100644 --- a/packages/context/src/api.ts +++ b/packages/context/src/api.ts @@ -21,7 +21,6 @@ export { getUI5Yaml, findYamlPath, } from "./ui5-yaml"; -export { getCDNBaseUrl } from "./utils"; export { cache } from "./cache"; export { reactOnCdsFileChange, diff --git a/packages/context/src/types.ts b/packages/context/src/types.ts index af603f6cb..6ebd8e1be 100644 --- a/packages/context/src/types.ts +++ b/packages/context/src/types.ts @@ -6,14 +6,8 @@ import { ConvertedMetadata } from "@sap-ux/vocabularies-types"; import type { Manifest } from "@sap-ux/project-access"; import { FetchResponse } from "@ui5-language-assistant/logic-utils"; -export const DEFAULT_UI5_FRAMEWORK = "SAPUI5"; -export const DEFAULT_UI5_VERSION = "1.71.69"; -export const DEFAULT_UI5_VERSION_BASE = "1.71"; export const UI5_VERSION_S4_PLACEHOLDER = "${sap.ui5.dist.version}"; -export const UI5_FRAMEWORK_CDN_BASE_URL = { - OpenUI5: "https://sdk.openui5.org/", - SAPUI5: "https://ui5.sap.com/", -}; + export const UI5_PROJECT_TYPE = "UI5"; export const CAP_PROJECT_TYPE = "CAP"; export enum DirName { diff --git a/packages/context/src/ui5-model.ts b/packages/context/src/ui5-model.ts index e55ad9a1f..cafe8ce67 100644 --- a/packages/context/src/ui5-model.ts +++ b/packages/context/src/ui5-model.ts @@ -7,28 +7,25 @@ import { UI5Framework, UI5SemanticModel, } from "@ui5-language-assistant/semantic-model-types"; +import { + DEFAULT_UI5_VERSION_BASE, + DEFAULT_UI5_VERSION, +} from "@ui5-language-assistant/constant"; import { generate, Json, TypeNameFix, } from "@ui5-language-assistant/semantic-model"; -import { - DEFAULT_UI5_VERSION_BASE, - Fetcher, - UI5_VERSION_S4_PLACEHOLDER, -} from "./types"; +import { Fetcher, UI5_VERSION_S4_PLACEHOLDER } from "./types"; import { fetch, getLocalUrl, tryFetch, -} from "@ui5-language-assistant/logic-utils"; -import { - getLibraryAPIJsonUrl, - getLogger, getVersionInfoUrl, getVersionJsonUrl, -} from "./utils"; -import { DEFAULT_UI5_VERSION } from "./types"; + getLibraryAPIJsonUrl, +} from "@ui5-language-assistant/logic-utils"; +import { getLogger } from "./utils"; import { cache } from "./cache"; export type VersionMapJsonType = Record< diff --git a/packages/context/src/ui5-yaml.ts b/packages/context/src/ui5-yaml.ts index c2134997d..22178d332 100644 --- a/packages/context/src/ui5-yaml.ts +++ b/packages/context/src/ui5-yaml.ts @@ -3,12 +3,13 @@ import { maxBy, map, filter } from "lodash"; import { readFile } from "fs-extra"; import { URI } from "vscode-uri"; import { loadAll } from "js-yaml"; -import { DEFAULT_UI5_FRAMEWORK, YamlDetails } from "./types"; +import { YamlDetails } from "./types"; import { FileName } from "@sap-ux/project-access"; import findUp from "find-up"; import { cache } from "./cache"; import { getLogger } from "./utils"; import { findAllFilesInWorkspace } from "./utils/fileUtils"; +import { DEFAULT_UI5_FRAMEWORK } from "@ui5-language-assistant/constant"; export async function initializeUI5YamlData( workspaceFolderPath: string diff --git a/packages/context/src/utils/index.ts b/packages/context/src/utils/index.ts index eb040fb55..1c2b1584e 100644 --- a/packages/context/src/utils/index.ts +++ b/packages/context/src/utils/index.ts @@ -1,10 +1,3 @@ -export { - getLibraryAPIJsonUrl, - getVersionInfoUrl, - getVersionJsonUrl, - getCDNBaseUrl, -} from "./ui5"; - export { findAppRoot, getLocalAnnotationsForService, diff --git a/packages/context/src/utils/ui5.ts b/packages/context/src/utils/ui5.ts deleted file mode 100644 index c877db944..000000000 --- a/packages/context/src/utils/ui5.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { UI5Framework } from "@ui5-language-assistant/semantic-model-types"; -import { UI5_FRAMEWORK_CDN_BASE_URL } from "../types"; -import { getLogger } from "."; -import { tryFetch, getLocalUrl } from "@ui5-language-assistant/logic-utils"; - -/** - * Get CDN URL for UI5 framework. If a URL for `SAPUI5 Web Server` is maintained in settings, it appends UI5 version if available and tries to check if this URL is responding and return it, - * if it fails, it appends UI5 version if available to a public URL and return it - * - * @param framework UI5 framework e.g OpenUI5" | "SAPUI5" - * @param version min ui5 version specified in manifest.json file - */ -export async function getCDNBaseUrl( - framework: UI5Framework, - version: string | undefined -): Promise { - const localUrl = getLocalUrl(version); - if (localUrl) { - const response = await tryFetch(localUrl); - if (response) { - return localUrl; - } - - getLogger().info("Failed to load. Will try over internet.", { - localUrl, - }); - } - - let url = UI5_FRAMEWORK_CDN_BASE_URL[framework]; - if (version) { - url += `${version}/`; - } - return url; -} - -export function getVersionJsonUrl(framework: UI5Framework): string { - return `${UI5_FRAMEWORK_CDN_BASE_URL[framework]}version.json`; -} - -export async function getVersionInfoUrl( - framework: UI5Framework, - version: string -): Promise { - const cdnBaseUrl = await getCDNBaseUrl(framework, version); - return `${cdnBaseUrl}resources/sap-ui-version.json`; -} - -export async function getLibraryAPIJsonUrl( - framework: UI5Framework, - version: string, - libName: string -): Promise { - const cdnBaseUrl = await getCDNBaseUrl(framework, version); - const baseUrl = `${cdnBaseUrl}test-resources/`; - const suffix = "/designtime/api.json"; - return baseUrl + libName.replace(/\./g, "/") + suffix; -} diff --git a/packages/context/test/unit/ui5-model.test.ts b/packages/context/test/unit/ui5-model.test.ts index 9d50a5db9..83009a915 100644 --- a/packages/context/test/unit/ui5-model.test.ts +++ b/packages/context/test/unit/ui5-model.test.ts @@ -25,6 +25,10 @@ import { sync as rimrafSync } from "rimraf"; import { forEach, isPlainObject } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { + DEFAULT_UI5_VERSION_BASE, + DEFAULT_UI5_VERSION, +} from "@ui5-language-assistant/constant"; import { expectExists } from "@ui5-language-assistant/test-utils"; import { getSemanticModel, @@ -35,54 +39,35 @@ import { VersionMapJsonType, } from "../../src/ui5-model"; import { FetchResponse } from "@ui5-language-assistant/language-server"; -import { fetch } from "@ui5-language-assistant/logic-utils"; import * as logicUtils from "@ui5-language-assistant/logic-utils"; -import { getVersionJsonUrl } from "../../src/utils"; import semverMinSatisfying from "semver/ranges/min-satisfying"; import { Response } from "node-fetch"; - +import { UI5Framework } from "@ui5-language-assistant/semantic-model-types"; +import { UI5_VERSION_S4_PLACEHOLDER } from "../../src/types"; const GET_MODEL_TIMEOUT = 30000; -const FRAMEWORK = "SAPUI5"; -const OPEN_FRAMEWORK = "OpenUI5"; -const FALLBACK_VERSION = "1.71.69"; -const FALLBACK_VERSION_BASE = "1.71"; -const UI5_VERSION_S4_PLACEHOLDER = "${sap.ui5.dist.version}"; const NO_CACHE_FOLDER = undefined; +const { getVersionsMap } = logicUtils; +const frameworks: UI5Framework[] = ["OpenUI5", "SAPUI5"]; +const latestFallbackPatchVersion: Record = { + OpenUI5: undefined, + SAPUI5: undefined, +}; -type UI5FrameworkType = typeof FRAMEWORK | typeof OPEN_FRAMEWORK; -const frameworks = [FRAMEWORK, OPEN_FRAMEWORK] as UI5FrameworkType[]; - -async function getCurrentVersionMaps( - framework: UI5FrameworkType -): Promise { - const url = getVersionJsonUrl(framework); - const response = await fetch(url); - if (response.ok) { - return (await response.json()) as VersionMapJsonType; - } else { - return undefined; - } -} - -const latestFallbackPatchVersion: Record = - { - OpenUI5: undefined, - SAPUI5: undefined, - }; - -const currentVersionMaps: Record = { +const currentVersionMaps: Record = { OpenUI5: {}, SAPUI5: {}, }; const loadCurrentVersionMaps = Promise.all([ - getCurrentVersionMaps(FRAMEWORK).then((data) => { + getVersionsMap("SAPUI5", logicUtils.fetch).then((data) => { currentVersionMaps.SAPUI5 = data || {}; - latestFallbackPatchVersion.SAPUI5 = data?.[FALLBACK_VERSION_BASE]?.version; + latestFallbackPatchVersion.SAPUI5 = + data?.[DEFAULT_UI5_VERSION_BASE]?.version; }), - getCurrentVersionMaps(OPEN_FRAMEWORK).then((data) => { + getVersionsMap("OpenUI5", logicUtils.fetch).then((data) => { currentVersionMaps.OpenUI5 = data || {}; - latestFallbackPatchVersion.OpenUI5 = data?.[FALLBACK_VERSION_BASE]?.version; + latestFallbackPatchVersion.OpenUI5 = + data?.[DEFAULT_UI5_VERSION_BASE]?.version; }), ]); @@ -97,7 +82,7 @@ describe("the UI5 language assistant ui5 model", () => { ui5Model: UI5SemanticModel, expectedVersion?: string ): void { - expect(ui5Model.version).toEqual(expectedVersion || FALLBACK_VERSION); + expect(ui5Model.version).toEqual(expectedVersion || DEFAULT_UI5_VERSION); expect(Object.keys(ui5Model.classes).length).toBeGreaterThan(200); expect(Object.keys(ui5Model.namespaces).length).toBeGreaterThan(200); @@ -133,7 +118,7 @@ describe("the UI5 language assistant ui5 model", () => { async () => { const ui5Model = await getSemanticModel( NO_CACHE_FOLDER, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5, true ); @@ -154,7 +139,7 @@ describe("the UI5 language assistant ui5 model", () => { }; }, NO_CACHE_FOLDER, - FRAMEWORK, + "SAPUI5", undefined, true ); @@ -179,7 +164,7 @@ describe("the UI5 language assistant ui5 model", () => { async () => { const ui5Model = await getSemanticModel( cachePath, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5, true ); @@ -199,7 +184,7 @@ describe("the UI5 language assistant ui5 model", () => { ); }, cachePath, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5, true ); @@ -234,7 +219,7 @@ describe("the UI5 language assistant ui5 model", () => { async () => { // Create a folder with the file name so the file will not be written const cacheFilePath = getCacheFilePath( - getCacheFolder(cachePath, FRAMEWORK, FALLBACK_VERSION), + getCacheFolder(cachePath, "SAPUI5", DEFAULT_UI5_VERSION), "sap.m" ); expectExists(cacheFilePath, "cacheFilePath"); @@ -242,7 +227,7 @@ describe("the UI5 language assistant ui5 model", () => { const ui5Model = await getSemanticModel( cachePath, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5 ); expect(ui5Model).not.toBeUndefined(); @@ -259,8 +244,8 @@ describe("the UI5 language assistant ui5 model", () => { // Create a file with non-json content so the file will not be deserialized const cacheFolder = getCacheFolder( cachePath, - FRAMEWORK, - FALLBACK_VERSION + "SAPUI5", + DEFAULT_UI5_VERSION ); await mkdirs(cacheFolder); const cacheFilePath = getCacheFilePath(cacheFolder, "sap.m"); @@ -269,7 +254,7 @@ describe("the UI5 language assistant ui5 model", () => { const ui5Model = await getSemanticModel( cachePath, - FRAMEWORK, + "SAPUI5", undefined, true ); @@ -298,7 +283,7 @@ describe("the UI5 language assistant ui5 model", () => { async () => { const ui5Model = await getSemanticModel( cachePath, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5, true ); @@ -318,7 +303,7 @@ describe("the UI5 language assistant ui5 model", () => { }; }, cachePath, - FRAMEWORK, + "SAPUI5", latestFallbackPatchVersion.SAPUI5, true ); @@ -371,7 +356,7 @@ describe("the UI5 language assistant ui5 model", () => { }); const getExpectedVersion = ( - framework: typeof FRAMEWORK | typeof OPEN_FRAMEWORK, + framework: UI5Framework, requestedVersion: string ) => { const versions = currentVersionMaps[framework]; @@ -584,7 +569,7 @@ describe("the UI5 language assistant ui5 model", () => { { // outdated version version: () => "1.104", - expected: () => getExpectedVersion(FRAMEWORK, "1.104"), + expected: () => getExpectedVersion("SAPUI5", "1.104"), }, { // supported version @@ -595,7 +580,7 @@ describe("the UI5 language assistant ui5 model", () => { }, { // fallback base - version: () => FALLBACK_VERSION_BASE, + version: () => DEFAULT_UI5_VERSION_BASE, expected: () => latestFallbackPatchVersion.SAPUI5 || "", }, { @@ -621,7 +606,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", testCase.version() ); expect(result.version).toEqual(testCase.expected()); @@ -631,7 +616,7 @@ describe("the UI5 language assistant ui5 model", () => { }); it("resolve major version (should be closest supported)", async () => { - const expectedVersion = getExpectedVersion(FRAMEWORK, "1"); + const expectedVersion = getExpectedVersion("SAPUI5", "1"); const objNegotiatedVersionWithFetcher = await negotiateVersionWithFetcher( async (): Promise> => { return createSuccessfulResponse(currentVersionMaps.SAPUI5); @@ -643,7 +628,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", "1" ); expect(objNegotiatedVersionWithFetcher.version).toEqual(expectedVersion); @@ -708,7 +693,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", "1.38" ); expect(objNegotiatedVersionWithFetcher.version).toEqual( @@ -730,7 +715,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", "a.b" ); expect(objNegotiatedVersionWithFetcher.version).toEqual( @@ -752,7 +737,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", UI5_VERSION_S4_PLACEHOLDER ); expect(objNegotiatedVersionWithFetcher.version).toEqual( @@ -786,7 +771,7 @@ describe("the UI5 language assistant ui5 model", () => { return createFailedResponse(); }, cachePath, - FRAMEWORK, + "SAPUI5", testVersion ); expect(objNegotiatedVersionWithFetcher.version).toEqual(testVersion); diff --git a/packages/context/test/unit/ui5-model_fs-mocked.test.ts b/packages/context/test/unit/ui5-model_fs-mocked.test.ts index daf6d3dd2..9e22c7c65 100644 --- a/packages/context/test/unit/ui5-model_fs-mocked.test.ts +++ b/packages/context/test/unit/ui5-model_fs-mocked.test.ts @@ -13,7 +13,7 @@ import { negotiateVersionWithFetcher, } from "../../src/ui5-model"; import { FetchResponse } from "@ui5-language-assistant/language-server"; -import { DEFAULT_UI5_VERSION } from "../../src/types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; describe("the UI5 language assistant ui5 model", () => { // The default timeout is 2000ms and getSemanticModel can take ~3000-5000ms diff --git a/packages/context/test/unit/utils/ui5.test.ts b/packages/context/test/unit/utils/ui5.test.ts deleted file mode 100644 index f5d366e01..000000000 --- a/packages/context/test/unit/utils/ui5.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as logicUtils from "@ui5-language-assistant/logic-utils"; -import { getCDNBaseUrl } from "../../../src/utils/ui5"; -import { Response } from "node-fetch"; - -describe("ui5", () => { - afterEach(() => { - jest.restoreAllMocks(); - }); - describe("getCDNBaseUrl", () => { - it("get CDN without local url [with version]", async () => { - const result = await getCDNBaseUrl("SAPUI5", "1.111.0"); - expect(result).toEqual("https://ui5.sap.com/1.111.0/"); - }); - it("get CDN without local url [without version]", async () => { - const result = await getCDNBaseUrl("SAPUI5", undefined); - expect(result).toEqual("https://ui5.sap.com/"); - }); - it("get CDN with local url", async () => { - const fakeGetLocalUrl = jest - .spyOn(logicUtils, "getLocalUrl") - .mockReturnValue("http://localhost:3000/1.111.0/"); - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const fakeTryFetch = jest - .spyOn(logicUtils, "tryFetch") - .mockResolvedValue({ ok: true } as unknown as Response); - const result = await getCDNBaseUrl("SAPUI5", "1.111.0"); - expect(fakeGetLocalUrl).toHaveBeenCalled(); - expect(fakeTryFetch).toHaveBeenCalled(); - expect(result).toEqual("http://localhost:3000/1.111.0/"); - }); - it("get CDN with local url [fetch not responding => fall back to public]", async () => { - const fakeGetLocalUrl = jest - .spyOn(logicUtils, "getLocalUrl") - .mockReturnValue("http://localhost:3000/1.112.0/"); - const fakeTryFetch = jest - .spyOn(logicUtils, "tryFetch") - .mockResolvedValue(undefined); - const result = await getCDNBaseUrl("SAPUI5", "1.112.0"); - expect(fakeGetLocalUrl).toHaveBeenCalled(); - expect(fakeTryFetch).toHaveBeenCalled(); - expect(result).toEqual("https://ui5.sap.com/1.112.0/"); - }); - }); -}); diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 9d60576d6..044956329 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -25,6 +25,7 @@ "node": ">=10.0.0" }, "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/xml-views-definition": "0.0.4", "@ui5-language-assistant/binding": "1.0.30", "@sap/swa-for-sapbas-vsx": "1.1.9", diff --git a/packages/language-server/test/unit/completion-items-classes.test.ts b/packages/language-server/test/unit/completion-items-classes.test.ts index be0739ece..7c0abdcd6 100644 --- a/packages/language-server/test/unit/completion-items-classes.test.ts +++ b/packages/language-server/test/unit/completion-items-classes.test.ts @@ -5,11 +5,11 @@ import { CompletionItem, } from "vscode-languageserver"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generateModel, expectExists, getFallbackPatchVersions, - DEFAULT_UI5_VERSION, } from "@ui5-language-assistant/test-utils"; import { generate } from "@ui5-language-assistant/semantic-model"; import { diff --git a/packages/language-server/test/unit/completion-items-literals.test.ts b/packages/language-server/test/unit/completion-items-literals.test.ts index c52de2d9e..1004116b5 100644 --- a/packages/language-server/test/unit/completion-items-literals.test.ts +++ b/packages/language-server/test/unit/completion-items-literals.test.ts @@ -1,8 +1,8 @@ import { map, uniq } from "lodash"; import { CompletionItemKind, TextEdit } from "vscode-languageserver"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/language-server/test/unit/completion-items.test.ts b/packages/language-server/test/unit/completion-items.test.ts index dba63a345..ab23e603b 100644 --- a/packages/language-server/test/unit/completion-items.test.ts +++ b/packages/language-server/test/unit/completion-items.test.ts @@ -2,9 +2,9 @@ import { map, uniq, forEach, filter } from "lodash"; import { CompletionItemKind, TextEdit } from "vscode-languageserver"; import { UI5XMLViewCompletion } from "@ui5-language-assistant/xml-views-completion"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { Settings } from "@ui5-language-assistant/settings"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/language-server/test/unit/documentation.test.ts b/packages/language-server/test/unit/documentation.test.ts index a3c81df0e..48116c059 100644 --- a/packages/language-server/test/unit/documentation.test.ts +++ b/packages/language-server/test/unit/documentation.test.ts @@ -1,11 +1,11 @@ import { - DEFAULT_UI5_VERSION, buildUI5Enum, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { generate } from "@ui5-language-assistant/semantic-model"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { getNodeDocumentation } from "../../src/documentation"; describe("The @ui5-language-assistant/language-server function", () => { diff --git a/packages/language-server/test/unit/hover.test.ts b/packages/language-server/test/unit/hover.test.ts index 6e9636cce..4f4b5c694 100644 --- a/packages/language-server/test/unit/hover.test.ts +++ b/packages/language-server/test/unit/hover.test.ts @@ -7,11 +7,11 @@ import { MarkupKind, } from "vscode-languageserver"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generateModel, expectExists, getFallbackPatchVersions, - DEFAULT_UI5_VERSION, } from "@ui5-language-assistant/test-utils"; import { generate } from "@ui5-language-assistant/semantic-model"; import { getHoverResponse } from "../../src/hover"; diff --git a/packages/language-server/test/unit/quick-fix.test.ts b/packages/language-server/test/unit/quick-fix.test.ts index 2f745bee2..8efdb5df2 100644 --- a/packages/language-server/test/unit/quick-fix.test.ts +++ b/packages/language-server/test/unit/quick-fix.test.ts @@ -1,11 +1,11 @@ import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { Position, Range } from "vscode-languageserver-types"; import { generate } from "@ui5-language-assistant/semantic-model"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { QuickFixStableIdLSPInfo, diagnosticToCodeActionFix, diff --git a/packages/language-server/test/unit/snapshots/xml-view-diagnostics/snapshots-utils.ts b/packages/language-server/test/unit/snapshots/xml-view-diagnostics/snapshots-utils.ts index e18662649..029cc44d5 100644 --- a/packages/language-server/test/unit/snapshots/xml-view-diagnostics/snapshots-utils.ts +++ b/packages/language-server/test/unit/snapshots/xml-view-diagnostics/snapshots-utils.ts @@ -5,11 +5,11 @@ import { readJsonSync, readFileSync } from "fs-extra"; import { expect } from "chai"; import { sortBy, forEachRight, map, cloneDeep, forEach } from "lodash"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { getXMLViewDiagnostics } from "../../../../src/xml-view-diagnostics"; import { Context as AppContext } from "@ui5-language-assistant/context"; diff --git a/packages/logic-utils/api.d.ts b/packages/logic-utils/api.d.ts index a1a375623..81173bf54 100644 --- a/packages/logic-utils/api.d.ts +++ b/packages/logic-utils/api.d.ts @@ -279,6 +279,11 @@ export { getLocalUrl, isXMLView, getUI5KindByXMLElement, + getCDNBaseUrl, + getLibraryAPIJsonUrl, + getVersionInfoUrl, + getVersionJsonUrl, + getVersionsMap, } from "./src/api"; -export { FetchResponse } from "./src/utils/types"; +export { FetchResponse } from "./src/api"; diff --git a/packages/logic-utils/package.json b/packages/logic-utils/package.json index 8d2edfd40..8af99ec77 100644 --- a/packages/logic-utils/package.json +++ b/packages/logic-utils/package.json @@ -16,8 +16,10 @@ "license": "Apache-2.0", "typings": "./api.d.ts", "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/semantic-model-types": "4.0.10", "@ui5-language-assistant/settings": "4.0.9", + "@ui5-language-assistant/logger": "0.0.1", "@xml-tools/ast": "5.0.0", "lodash": "4.17.21", "node-fetch": "2.6.9", diff --git a/packages/logic-utils/src/api.ts b/packages/logic-utils/src/api.ts index 15f17dc0b..f189352cd 100644 --- a/packages/logic-utils/src/api.ts +++ b/packages/logic-utils/src/api.ts @@ -41,3 +41,13 @@ export { export { fetch } from "./utils/fetch"; export { tryFetch, getLocalUrl } from "./utils/fetch-helper"; export { isXMLView } from "./utils/document"; + +export type { FetchResponse } from "./utils/types"; + +export { + getCDNBaseUrl, + getLibraryAPIJsonUrl, + getVersionInfoUrl, + getVersionJsonUrl, + getVersionsMap, +} from "./utils/ui5"; diff --git a/packages/logic-utils/src/utils/constant.ts b/packages/logic-utils/src/utils/constant.ts new file mode 100644 index 000000000..4120c0165 --- /dev/null +++ b/packages/logic-utils/src/utils/constant.ts @@ -0,0 +1 @@ +export const PACKAGE_NAME = "@ui5-language-assistant/logic-utils"; diff --git a/packages/logic-utils/src/utils/logger.ts b/packages/logic-utils/src/utils/logger.ts new file mode 100644 index 000000000..a856e3c17 --- /dev/null +++ b/packages/logic-utils/src/utils/logger.ts @@ -0,0 +1,6 @@ +import { getLogger as logger, ILogger } from "@ui5-language-assistant/logger"; +import { PACKAGE_NAME } from "./constant"; + +export const getLogger = (): ILogger => { + return logger(PACKAGE_NAME); +}; diff --git a/packages/logic-utils/src/utils/types.ts b/packages/logic-utils/src/utils/types.ts index 0e35c21fe..744298109 100644 --- a/packages/logic-utils/src/utils/types.ts +++ b/packages/logic-utils/src/utils/types.ts @@ -3,3 +3,10 @@ export type FetchResponse = { status: number; json: () => Promise; }; + +export type Fetcher = (url: string) => Promise>; + +export type VersionMapJsonType = Record< + string, + { version: string; support: string; lts: boolean } +>; diff --git a/packages/logic-utils/src/utils/ui5.ts b/packages/logic-utils/src/utils/ui5.ts new file mode 100644 index 000000000..07a94c2d7 --- /dev/null +++ b/packages/logic-utils/src/utils/ui5.ts @@ -0,0 +1,113 @@ +import { UI5Framework } from "@ui5-language-assistant/semantic-model-types"; +import { + UI5_FRAMEWORK_CDN_BASE_URL, + DEFAULT_OPEN_UI5_VERSION, + DEFAULT_UI5_VERSION, +} from "@ui5-language-assistant/constant"; +import { Fetcher, VersionMapJsonType } from "./types"; +import { getLogger } from "./logger"; +import { tryFetch, getLocalUrl } from "./fetch-helper"; + +/** + * Get CDN URL for UI5 framework. If a URL for `SAPUI5 Web Server` is maintained in settings, it appends UI5 version if available and tries to check if this URL is responding and return it, + * if it fails, it appends UI5 version if available to a public URL and return it + * + * @param framework UI5 framework e.g OpenUI5" | "SAPUI5" + * @param version min ui5 version specified in manifest.json file + */ +export async function getCDNBaseUrl( + framework: UI5Framework, + version: string | undefined +): Promise { + const localUrl = getLocalUrl(version); + if (localUrl) { + const response = await tryFetch(localUrl); + if (response) { + return localUrl; + } + + getLogger().info("Failed to load. Will try over internet.", { + localUrl, + }); + } + + let url = UI5_FRAMEWORK_CDN_BASE_URL[framework]; + if (version) { + url += `${version}/`; + } + return url; +} + +export function getVersionJsonUrl(framework: UI5Framework): string { + return `${UI5_FRAMEWORK_CDN_BASE_URL[framework]}version.json`; +} + +export async function getVersionInfoUrl( + framework: UI5Framework, + version: string +): Promise { + const cdnBaseUrl = await getCDNBaseUrl(framework, version); + return `${cdnBaseUrl}resources/sap-ui-version.json`; +} + +export async function getLibraryAPIJsonUrl( + framework: UI5Framework, + version: string, + libName: string +): Promise { + const cdnBaseUrl = await getCDNBaseUrl(framework, version); + const baseUrl = `${cdnBaseUrl}test-resources/`; + const suffix = "/designtime/api.json"; + return baseUrl + libName.replace(/\./g, "/") + suffix; +} + +// if library is not found, resolve next minor highest patch +const versionMap: Record = + Object.create(null); // just an in-memory cache! + +/** + * Returns version map for the given framework + * + * @param framework The UI5 framework version + * @param versionJsonFetcher Fetcher function which loads version json + * @returns Object with versions json + * @note if it fails to read version mapping, it fallback to default version. + */ +export async function getVersionsMap( + framework: UI5Framework, + versionJsonFetcher: Fetcher +): Promise { + let versions = versionMap[framework]; + if (versions) { + return versions; + } + + // no version information found in the map, retrieve the version mapping using fetcher + const url = getVersionJsonUrl(framework); + const response = await versionJsonFetcher(url); + if (response.ok) { + versionMap[framework] = await response.json(); + } else { + const DEFAULT_FALL_BACK = + framework === "SAPUI5" ? DEFAULT_UI5_VERSION : DEFAULT_OPEN_UI5_VERSION; + + getLogger().error( + "Could not read version mapping, fallback to default version", + { + url, + DEFAULT_FALL_BACK, + } + ); + // update version map with default version only + versionMap[framework] = { + latest: { + version: DEFAULT_FALL_BACK, + support: "Maintenance", + lts: true, + }, + }; + } + versions = versionMap[framework]; + + return versions; +} diff --git a/packages/logic-utils/test/unit/find-classes-matching.test.ts b/packages/logic-utils/test/unit/find-classes-matching.test.ts index eaa8e6033..88109cd48 100644 --- a/packages/logic-utils/test/unit/find-classes-matching.test.ts +++ b/packages/logic-utils/test/unit/find-classes-matching.test.ts @@ -1,8 +1,8 @@ import { map, forEach, cloneDeep } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/logic-utils/test/unit/get-super-class.test.ts b/packages/logic-utils/test/unit/get-super-class.test.ts index 3de78fa99..2d2e1057c 100644 --- a/packages/logic-utils/test/unit/get-super-class.test.ts +++ b/packages/logic-utils/test/unit/get-super-class.test.ts @@ -1,8 +1,8 @@ import { cloneDeep } from "lodash"; import { UI5Class } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { - DEFAULT_UI5_VERSION, buildUI5Class, generateModel, getFallbackPatchVersions, diff --git a/packages/logic-utils/test/unit/ui5.test.ts b/packages/logic-utils/test/unit/ui5.test.ts new file mode 100644 index 000000000..712418cf5 --- /dev/null +++ b/packages/logic-utils/test/unit/ui5.test.ts @@ -0,0 +1,123 @@ +import * as fetchHelper from "./../../src/utils/fetch-helper"; +import { + getCDNBaseUrl, + getLibraryAPIJsonUrl, + getVersionInfoUrl, + getVersionJsonUrl, + getVersionsMap, +} from "../../src/api"; +import { Response } from "node-fetch"; +import { + DEFAULT_OPEN_UI5_VERSION, + DEFAULT_UI5_VERSION, +} from "@ui5-language-assistant/constant"; + +describe("ui5", () => { + afterEach(() => { + jest.restoreAllMocks(); + }); + describe("getCDNBaseUrl", () => { + it("get CDN without local url [with version]", async () => { + const result = await getCDNBaseUrl("SAPUI5", "1.111.0"); + expect(result).toEqual("https://ui5.sap.com/1.111.0/"); + }); + it("get CDN without local url [without version]", async () => { + const result = await getCDNBaseUrl("SAPUI5", undefined); + expect(result).toEqual("https://ui5.sap.com/"); + }); + it("get CDN with local url", async () => { + const fakeGetLocalUrl = jest + .spyOn(fetchHelper, "getLocalUrl") + .mockReturnValue("http://localhost:3000/1.111.0/"); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const fakeTryFetch = jest + .spyOn(fetchHelper, "tryFetch") + .mockResolvedValue({ ok: true } as unknown as Response); + const result = await getCDNBaseUrl("SAPUI5", "1.111.0"); + expect(fakeGetLocalUrl).toHaveBeenCalled(); + expect(fakeTryFetch).toHaveBeenCalled(); + expect(result).toEqual("http://localhost:3000/1.111.0/"); + }); + it("get CDN with local url [fetch not responding => fall back to public]", async () => { + const fakeGetLocalUrl = jest + .spyOn(fetchHelper, "getLocalUrl") + .mockReturnValue("http://localhost:3000/1.112.0/"); + const fakeTryFetch = jest + .spyOn(fetchHelper, "tryFetch") + .mockResolvedValue(undefined); + const result = await getCDNBaseUrl("SAPUI5", "1.112.0"); + expect(fakeGetLocalUrl).toHaveBeenCalled(); + expect(fakeTryFetch).toHaveBeenCalled(); + expect(result).toEqual("https://ui5.sap.com/1.112.0/"); + }); + }); + describe("getVersionJsonUrl", () => { + it("get version uri for SAPUI5", () => { + const result = getVersionJsonUrl("SAPUI5"); + expect(result).toStrictEqual("https://ui5.sap.com/version.json"); + }); + it("get version uri for OpenUI5", () => { + const result = getVersionJsonUrl("OpenUI5"); + expect(result).toStrictEqual("https://sdk.openui5.org/version.json"); + }); + }); +}); + +describe("getVersionInfoUrl", () => { + it("get version info uri for SAPUI5", async () => { + const result = await getVersionInfoUrl("SAPUI5", DEFAULT_UI5_VERSION); + expect(result).toStrictEqual( + "https://ui5.sap.com/1.71.70/resources/sap-ui-version.json" + ); + }); + it("get version info uri for OpenUI5", async () => { + const result = await getVersionInfoUrl("OpenUI5", DEFAULT_OPEN_UI5_VERSION); + expect(result).toStrictEqual( + "https://sdk.openui5.org/1.71.67/resources/sap-ui-version.json" + ); + }); +}); + +it("getLibraryAPIJsonUrl", async () => { + const result = await getLibraryAPIJsonUrl( + "SAPUI5", + DEFAULT_UI5_VERSION, + "sap.m" + ); + expect(result).toStrictEqual( + "https://ui5.sap.com/1.71.70/test-resources/sap/m/designtime/api.json" + ); +}); + +describe("getVersionsMap", () => { + it("get version map for SAPUI5 - http success", async () => { + const data = { + "1.71": { + version: "1.71.70", + support: "Maintenance", + lts: true, + }, + }; + const fetcherSpy = jest.fn().mockResolvedValue({ + ok: true, + json: () => data, + }); + const result = await getVersionsMap("SAPUI5", fetcherSpy); + expect(result).toEqual(data); + }); + + it("get version map for OpenUI5 - fallback default", async () => { + const data = { + latest: { + version: "1.71.67", + support: "Maintenance", + lts: true, + }, + }; + const fetcherSpy = jest.fn().mockResolvedValue({ + ok: false, + }); + const result = await getVersionsMap("OpenUI5", fetcherSpy); + expect(result).toEqual(data); + }); +}); diff --git a/packages/logic-utils/test/unit/xml-node-to-ui5-node.test.ts b/packages/logic-utils/test/unit/xml-node-to-ui5-node.test.ts index cf3271ea1..1a1349d89 100644 --- a/packages/logic-utils/test/unit/xml-node-to-ui5-node.test.ts +++ b/packages/logic-utils/test/unit/xml-node-to-ui5-node.test.ts @@ -2,12 +2,12 @@ import { find } from "lodash"; import { parse, DocumentCstNode } from "@xml-tools/parser"; import { buildAst, XMLElement, XMLAttribute } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { generateModel, expectExists, getFallbackPatchVersions, - DEFAULT_UI5_VERSION, } from "@ui5-language-assistant/test-utils"; import { getUI5ClassByXMLElement, diff --git a/packages/semantic-model/package.json b/packages/semantic-model/package.json index e40997e95..5c7517051 100644 --- a/packages/semantic-model/package.json +++ b/packages/semantic-model/package.json @@ -17,6 +17,7 @@ "license": "Apache-2.0", "typings": "./api.d.ts", "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/semantic-model-types": "4.0.10", "@ui5-language-assistant/logger": "0.0.1", "ajv": "6.12.3", diff --git a/packages/semantic-model/test/unit/api-negative.test.ts b/packages/semantic-model/test/unit/api-negative.test.ts index 64a02c305..8052411f3 100644 --- a/packages/semantic-model/test/unit/api-negative.test.ts +++ b/packages/semantic-model/test/unit/api-negative.test.ts @@ -1,12 +1,10 @@ import { keys } from "lodash"; -import { - DEFAULT_UI5_VERSION, - expectExists, -} from "@ui5-language-assistant/test-utils"; +import { expectExists } from "@ui5-language-assistant/test-utils"; import { UI5SemanticModel, UnresolvedType, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { forEachSymbol } from "../../src/utils"; import { generate } from "../../src/api"; diff --git a/packages/semantic-model/test/unit/api.test.ts b/packages/semantic-model/test/unit/api.test.ts index a876abb9d..be1d89257 100644 --- a/packages/semantic-model/test/unit/api.test.ts +++ b/packages/semantic-model/test/unit/api.test.ts @@ -5,13 +5,13 @@ import { expectProperty, expectExists, downloadLibraries, - DEFAULT_UI5_VERSION, } from "@ui5-language-assistant/test-utils"; import { UI5Framework, UI5SemanticModel, UI5Typedef, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { forEachSymbol } from "../../src/utils"; import { generate } from "../../src/api"; import { diff --git a/packages/semantic-model/test/unit/unit.test.ts b/packages/semantic-model/test/unit/unit.test.ts index caa33d9a0..8df843631 100644 --- a/packages/semantic-model/test/unit/unit.test.ts +++ b/packages/semantic-model/test/unit/unit.test.ts @@ -3,7 +3,6 @@ import { buildUI5Model, buildUI5Class, expectExists, - DEFAULT_UI5_VERSION, } from "@ui5-language-assistant/test-utils"; import { UI5Class, @@ -11,6 +10,7 @@ import { UI5Type, UnresolvedType, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { resolveType, setParent } from "../../src/resolve"; import { getSymbolMaps } from "../../src/utils"; import { generate } from "../../src/api"; diff --git a/packages/semantic-model/test/unit/utils.test.ts b/packages/semantic-model/test/unit/utils.test.ts index c3d67b681..e04ae3b86 100644 --- a/packages/semantic-model/test/unit/utils.test.ts +++ b/packages/semantic-model/test/unit/utils.test.ts @@ -1,10 +1,10 @@ import { - DEFAULT_UI5_VERSION, expectExists, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { findSymbol, generate } from "../../src/api"; import { getFQN } from "./utils/model-test-utils"; diff --git a/packages/xml-views-completion/package.json b/packages/xml-views-completion/package.json index b4d56ce8d..0fce6b12f 100644 --- a/packages/xml-views-completion/package.json +++ b/packages/xml-views-completion/package.json @@ -21,6 +21,7 @@ "license": "Apache-2.0", "typings": "./api.d.ts", "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/context": "4.0.26", "@ui5-language-assistant/logic-utils": "4.0.18", "@xml-tools/ast": "5.0.0", diff --git a/packages/xml-views-completion/test/unit/api.test.ts b/packages/xml-views-completion/test/unit/api.test.ts index 0ee973877..3d0c21e6b 100644 --- a/packages/xml-views-completion/test/unit/api.test.ts +++ b/packages/xml-views-completion/test/unit/api.test.ts @@ -5,8 +5,8 @@ import { UI5Aggregation, UI5SemanticModel, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-completion/test/unit/providers/attributeName/namespace.test.ts b/packages/xml-views-completion/test/unit/providers/attributeName/namespace.test.ts index 59b2061fa..0e43209fb 100644 --- a/packages/xml-views-completion/test/unit/providers/attributeName/namespace.test.ts +++ b/packages/xml-views-completion/test/unit/providers/attributeName/namespace.test.ts @@ -9,10 +9,10 @@ import { UI5Prop, UI5SemanticModel, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { ui5NodeToFQN } from "@ui5-language-assistant/logic-utils"; import { - DEFAULT_UI5_VERSION, expectSuggestions, expectXMLAttribute, generateModel, diff --git a/packages/xml-views-completion/test/unit/providers/attributeName/prop-event-assoc.test.ts b/packages/xml-views-completion/test/unit/providers/attributeName/prop-event-assoc.test.ts index 8bd930025..6bad8ab3c 100644 --- a/packages/xml-views-completion/test/unit/providers/attributeName/prop-event-assoc.test.ts +++ b/packages/xml-views-completion/test/unit/providers/attributeName/prop-event-assoc.test.ts @@ -1,9 +1,9 @@ import { difference, forEach, partial } from "lodash"; import { XMLAttribute } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { - DEFAULT_UI5_VERSION, expectSuggestions, expectXMLAttribute, generateModel, diff --git a/packages/xml-views-completion/test/unit/providers/attributeValue/boolean-literal.test.ts b/packages/xml-views-completion/test/unit/providers/attributeValue/boolean-literal.test.ts index 311247d8b..df196466d 100644 --- a/packages/xml-views-completion/test/unit/providers/attributeValue/boolean-literal.test.ts +++ b/packages/xml-views-completion/test/unit/providers/attributeValue/boolean-literal.test.ts @@ -1,8 +1,8 @@ import { forEach, map } from "lodash"; import { XMLAttribute, XMLElement } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-completion/test/unit/providers/attributeValue/enum.test.ts b/packages/xml-views-completion/test/unit/providers/attributeValue/enum.test.ts index 80063f682..01b41181c 100644 --- a/packages/xml-views-completion/test/unit/providers/attributeValue/enum.test.ts +++ b/packages/xml-views-completion/test/unit/providers/attributeValue/enum.test.ts @@ -1,7 +1,7 @@ import { forEach, map } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-completion/test/unit/providers/attributeValue/namespace.test.ts b/packages/xml-views-completion/test/unit/providers/attributeValue/namespace.test.ts index de086f856..cf6cd15e4 100644 --- a/packages/xml-views-completion/test/unit/providers/attributeValue/namespace.test.ts +++ b/packages/xml-views-completion/test/unit/providers/attributeValue/namespace.test.ts @@ -1,10 +1,10 @@ import { partial } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { ui5NodeToFQN } from "@ui5-language-assistant/logic-utils"; import { UI5NamespacesInXMLAttributeValueCompletion } from "@ui5-language-assistant/xml-views-completion"; import { generate } from "@ui5-language-assistant/semantic-model"; import { - DEFAULT_UI5_VERSION, expectSuggestions, expectXMLAttribute, generateModel, diff --git a/packages/xml-views-completion/test/unit/providers/elementName/aggregation.test.ts b/packages/xml-views-completion/test/unit/providers/elementName/aggregation.test.ts index d25903acf..509c37720 100644 --- a/packages/xml-views-completion/test/unit/providers/elementName/aggregation.test.ts +++ b/packages/xml-views-completion/test/unit/providers/elementName/aggregation.test.ts @@ -1,8 +1,8 @@ import { map, cloneDeep, forEach } from "lodash"; import { XMLElement } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, buildUI5Aggregation, generateModel, getFallbackPatchVersions, diff --git a/packages/xml-views-completion/test/unit/providers/elementName/classes.test.ts b/packages/xml-views-completion/test/unit/providers/elementName/classes.test.ts index 3f5cbf6fc..55f0c02b5 100644 --- a/packages/xml-views-completion/test/unit/providers/elementName/classes.test.ts +++ b/packages/xml-views-completion/test/unit/providers/elementName/classes.test.ts @@ -5,8 +5,8 @@ import { UI5Class, UI5SemanticModel, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-tooltip/package.json b/packages/xml-views-tooltip/package.json index b6e125874..5b6943dcc 100644 --- a/packages/xml-views-tooltip/package.json +++ b/packages/xml-views-tooltip/package.json @@ -22,6 +22,7 @@ "node": ">=10.0.0" }, "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/context": "4.0.26", "@ui5-language-assistant/logic-utils": "4.0.18", "@ui5-language-assistant/semantic-model": "4.0.17", diff --git a/packages/xml-views-tooltip/test/unit/tooltip.test.ts b/packages/xml-views-tooltip/test/unit/tooltip.test.ts index 281e47e98..8f434ca08 100644 --- a/packages/xml-views-tooltip/test/unit/tooltip.test.ts +++ b/packages/xml-views-tooltip/test/unit/tooltip.test.ts @@ -6,11 +6,11 @@ import { UI5SemanticModel, BaseUI5Node, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { generateModel, expectExists, - DEFAULT_UI5_VERSION, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { findUI5HoverNodeAtOffset } from "../../src/api"; diff --git a/packages/xml-views-validation/package.json b/packages/xml-views-validation/package.json index 684a1e8b6..79d401309 100644 --- a/packages/xml-views-validation/package.json +++ b/packages/xml-views-validation/package.json @@ -21,6 +21,7 @@ "license": "Apache-2.0", "typings": "./api.d.ts", "dependencies": { + "@ui5-language-assistant/constant": "0.0.0", "@ui5-language-assistant/logic-utils": "4.0.18", "@ui5-language-assistant/semantic-model-types": "4.0.10", "@ui5-language-assistant/user-facing-text": "4.0.8", diff --git a/packages/xml-views-validation/test/unit/api.test.ts b/packages/xml-views-validation/test/unit/api.test.ts index 0593d9fa5..b001c4120 100644 --- a/packages/xml-views-validation/test/unit/api.test.ts +++ b/packages/xml-views-validation/test/unit/api.test.ts @@ -1,7 +1,7 @@ import { map, cloneDeep } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/attributes/invalid-boolean-value.test.ts b/packages/xml-views-validation/test/unit/validators/attributes/invalid-boolean-value.test.ts index 804102f18..29f706e20 100644 --- a/packages/xml-views-validation/test/unit/validators/attributes/invalid-boolean-value.test.ts +++ b/packages/xml-views-validation/test/unit/validators/attributes/invalid-boolean-value.test.ts @@ -1,6 +1,6 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/attributes/unknown-attribute-key.test.ts b/packages/xml-views-validation/test/unit/validators/attributes/unknown-attribute-key.test.ts index fd4a946c5..176a4a4d4 100644 --- a/packages/xml-views-validation/test/unit/validators/attributes/unknown-attribute-key.test.ts +++ b/packages/xml-views-validation/test/unit/validators/attributes/unknown-attribute-key.test.ts @@ -2,10 +2,10 @@ import { find, partial } from "lodash"; import { DocumentCstNode, parse } from "@xml-tools/parser"; import { buildAst } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generateModel, expectExists, - DEFAULT_UI5_VERSION, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { generate } from "@ui5-language-assistant/semantic-model"; diff --git a/packages/xml-views-validation/test/unit/validators/attributes/unknown-enum-value.test.ts b/packages/xml-views-validation/test/unit/validators/attributes/unknown-enum-value.test.ts index 39a6fc7ea..4246bc340 100644 --- a/packages/xml-views-validation/test/unit/validators/attributes/unknown-enum-value.test.ts +++ b/packages/xml-views-validation/test/unit/validators/attributes/unknown-enum-value.test.ts @@ -1,6 +1,6 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/attributes/unknown-xmlns-namespace.test.ts b/packages/xml-views-validation/test/unit/validators/attributes/unknown-xmlns-namespace.test.ts index 32f2f575e..477de3d24 100644 --- a/packages/xml-views-validation/test/unit/validators/attributes/unknown-xmlns-namespace.test.ts +++ b/packages/xml-views-validation/test/unit/validators/attributes/unknown-xmlns-namespace.test.ts @@ -1,6 +1,6 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/attributes/use-of-depracated-attribute.test.ts b/packages/xml-views-validation/test/unit/validators/attributes/use-of-depracated-attribute.test.ts index 4af49ec2e..e93cd89ec 100644 --- a/packages/xml-views-validation/test/unit/validators/attributes/use-of-depracated-attribute.test.ts +++ b/packages/xml-views-validation/test/unit/validators/attributes/use-of-depracated-attribute.test.ts @@ -2,10 +2,10 @@ import { partial, find } from "lodash"; import { parse, DocumentCstNode } from "@xml-tools/parser"; import { buildAst } from "@xml-tools/ast"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generateModel, expectExists, - DEFAULT_UI5_VERSION, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; import { generate } from "@ui5-language-assistant/semantic-model"; diff --git a/packages/xml-views-validation/test/unit/validators/document/non-unique-id.test.ts b/packages/xml-views-validation/test/unit/validators/document/non-unique-id.test.ts index 5062f8905..0fe110838 100644 --- a/packages/xml-views-validation/test/unit/validators/document/non-unique-id.test.ts +++ b/packages/xml-views-validation/test/unit/validators/document/non-unique-id.test.ts @@ -1,6 +1,6 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/element/cardinality-of-aggregation.test.ts b/packages/xml-views-validation/test/unit/validators/element/cardinality-of-aggregation.test.ts index aa579017d..8bb4a36f1 100644 --- a/packages/xml-views-validation/test/unit/validators/element/cardinality-of-aggregation.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/cardinality-of-aggregation.test.ts @@ -1,7 +1,7 @@ import { partial } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/element/non-stable-id.test.ts b/packages/xml-views-validation/test/unit/validators/element/non-stable-id.test.ts index 8612588b3..55ff18e21 100644 --- a/packages/xml-views-validation/test/unit/validators/element/non-stable-id.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/non-stable-id.test.ts @@ -1,7 +1,7 @@ import { partial } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/element/type-of-aggregation.test.ts b/packages/xml-views-validation/test/unit/validators/element/type-of-aggregation.test.ts index 849d31793..006acd223 100644 --- a/packages/xml-views-validation/test/unit/validators/element/type-of-aggregation.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/type-of-aggregation.test.ts @@ -3,8 +3,8 @@ import { UI5SemanticModel, UI5Aggregation, } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-aggregation.test.ts b/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-aggregation.test.ts index 463a1c581..efa36c340 100644 --- a/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-aggregation.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-aggregation.test.ts @@ -1,8 +1,8 @@ import { partial, find } from "lodash"; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-class.test.ts b/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-class.test.ts index 4d774a5b7..c41ca0a13 100644 --- a/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-class.test.ts +++ b/packages/xml-views-validation/test/unit/validators/element/use-of-deprecated-class.test.ts @@ -1,7 +1,7 @@ import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; import { generate } from "@ui5-language-assistant/semantic-model"; import { - DEFAULT_UI5_VERSION, generateModel, getFallbackPatchVersions, } from "@ui5-language-assistant/test-utils"; diff --git a/test-packages/test-utils/api.d.ts b/test-packages/test-utils/api.d.ts index 68d16aa42..583bcc63c 100644 --- a/test-packages/test-utils/api.d.ts +++ b/test-packages/test-utils/api.d.ts @@ -20,6 +20,7 @@ import { import { XMLAttribute, XMLElement } from "@xml-tools/ast"; import { UI5XMLViewCompletion } from "@ui5-language-assistant/xml-views-completion"; import { FetchResponse } from "@ui5-language-assistant/language-server"; +import { DEFAULT_UI5_VERSION } from "@ui5-language-assistant/constant"; // easily build (partial) data structures for tests with mandatory "name" field export type PartialWithName = { name: string } & Partial; @@ -88,8 +89,6 @@ export function buildUI5Model>( opts: Partial ): UI5SemanticModel & Pick; -export const DEFAULT_UI5_VERSION = "1.71.69"; - // TODO: list should be updated continuously! export type TestModelVersion = | /* OOM */ typeof DEFAULT_UI5_VERSION diff --git a/test-packages/test-utils/package.json b/test-packages/test-utils/package.json index def767fdf..afe66916a 100644 --- a/test-packages/test-utils/package.json +++ b/test-packages/test-utils/package.json @@ -15,7 +15,9 @@ "dependencies": { "https-proxy-agent": "5.0.1", "node-fetch": "2.6.9", - "proxy-from-env": "1.1.0" + "proxy-from-env": "1.1.0", + "@ui5-language-assistant/constant": "0.0.0", + "@ui5-language-assistant/semantic-model-types": "4.0.10" }, "devDependencies": { "@types/node-fetch": "2.5.10" diff --git a/test-packages/test-utils/src/api.ts b/test-packages/test-utils/src/api.ts index 2471ffbb6..e83f9a3fd 100644 --- a/test-packages/test-utils/src/api.ts +++ b/test-packages/test-utils/src/api.ts @@ -30,5 +30,3 @@ export { expectProperty, } from "./utils/expect"; export { getFallbackPatchVersions } from "./utils/download-ui5-resources"; - -export const DEFAULT_UI5_VERSION = "1.71.69"; diff --git a/test-packages/test-utils/src/utils/download-ui5-resources.ts b/test-packages/test-utils/src/utils/download-ui5-resources.ts index 70d9d9686..ae2a41468 100644 --- a/test-packages/test-utils/src/utils/download-ui5-resources.ts +++ b/test-packages/test-utils/src/utils/download-ui5-resources.ts @@ -1,11 +1,13 @@ import { zipObject, map, noop, get } from "lodash"; import { resolve } from "path"; import { writeFile, mkdirs, pathExists } from "fs-extra"; - -export const UI5_FRAMEWORK_CDN_BASE_URL = { - OpenUI5: "https://sdk.openui5.org/", - SAPUI5: "https://ui5.sap.com/", -}; +import { UI5Framework } from "@ui5-language-assistant/semantic-model-types"; +import { + UI5_FRAMEWORK_CDN_BASE_URL, + DEFAULT_OPEN_UI5_VERSION, + DEFAULT_UI5_VERSION, + DEFAULT_UI5_VERSION_BASE, +} from "@ui5-language-assistant/constant"; const importDynamic = (modulePath: string) => { try { @@ -124,19 +126,25 @@ type VersionMapJsonType = Record< { version: string; support: string; lts: boolean } >; -const FRAMEWORK = "SAPUI5"; -const OPEN_FRAMEWORK = "OpenUI5"; -const FALLBACK_VERSION_BASE = "1.71"; - async function getCurrentVersionMaps( - framework: typeof FRAMEWORK | typeof OPEN_FRAMEWORK -): Promise { + framework: UI5Framework +): Promise { const url = `${UI5_FRAMEWORK_CDN_BASE_URL[framework]}version.json`; const response = await fetch(url); if (response.ok) { return (await response.json()) as VersionMapJsonType; } else { - return undefined; + const DEFAULT_FALL_BACK = + framework === "SAPUI5" ? DEFAULT_UI5_VERSION : DEFAULT_OPEN_UI5_VERSION; + const data = {}; + data[framework] = { + latest: { + version: DEFAULT_FALL_BACK, + support: "Maintenance", + lts: true, + }, + }; + return data; } } @@ -149,11 +157,11 @@ export async function getFallbackPatchVersions(): Promise<{ SAPUI5: undefined, }; - result.SAPUI5 = (await getCurrentVersionMaps(FRAMEWORK))?.[ - FALLBACK_VERSION_BASE + result.SAPUI5 = (await getCurrentVersionMaps("SAPUI5"))[ + DEFAULT_UI5_VERSION_BASE ]?.version; - result.OpenUI5 = (await getCurrentVersionMaps(OPEN_FRAMEWORK))?.[ - FALLBACK_VERSION_BASE + result.OpenUI5 = (await getCurrentVersionMaps("OpenUI5"))[ + DEFAULT_UI5_VERSION_BASE ]?.version; return result; } diff --git a/test-packages/test-utils/src/utils/semantic-model-provider.ts b/test-packages/test-utils/src/utils/semantic-model-provider.ts index d4fed1e5c..fa79cf9ed 100644 --- a/test-packages/test-utils/src/utils/semantic-model-provider.ts +++ b/test-packages/test-utils/src/utils/semantic-model-provider.ts @@ -14,7 +14,7 @@ const MODEL_CACHE: Record = Object.create(null); const fixes: Record = { - "1.71.69": { + "1.71.70": { array: "any[]", Array: "any[]", bloolean: undefined, @@ -258,7 +258,7 @@ type LibraryFix = (content: Json) => void; // Library version -> library name -> fix function const libraryFixes: Record> = { - "1.71.69": {}, + "1.71.70": {}, "1.84.41": {}, "1.96.27": { "sap.ui.mdc": [ diff --git a/tsconfig.json b/tsconfig.json index d50540f55..e70d22204 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,16 +1,13 @@ { "references": [ { - "path": "./test-packages/framework" - }, - { - "path": "./packages/logic-utils" + "path": "./packages/semantic-model-types" }, { - "path": "./packages/semantic-model" + "path": "./packages/constant" }, { - "path": "./packages/semantic-model-types" + "path": "./packages/binding-parser" }, { "path": "./packages/settings" @@ -19,31 +16,39 @@ "path": "./packages/user-facing-text" }, { - "path": "./packages/xml-views-completion" + "path": "./test-packages/framework" }, { - "path": "./packages/xml-views-quick-fix" + "path": "./test-packages/test-utils" }, { - "path": "./packages/xml-views-tooltip" + "path": "./packages/logger" }, + { - "path": "./packages/xml-views-validation" + "path": "./packages/semantic-model" }, + { - "path": "./packages/xml-views-definition" + "path": "./packages/logic-utils" }, { - "path": "./test-packages/test-utils" + "path": "./packages/context" }, { - "path": "./packages/context" + "path": "./packages/xml-views-validation" }, { - "path": "./packages/logger" + "path": "./packages/xml-views-completion" }, { - "path": "./packages/binding-parser" + "path": "./packages/xml-views-definition" + }, + { + "path": "./packages/xml-views-quick-fix" + }, + { + "path": "./packages/xml-views-tooltip" }, { "path": "./packages/binding"