diff --git a/.mocharc.json b/.mocharc.json index 7fdedf1c0..ecea57862 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -1,9 +1,10 @@ { "timeout": "10000", - "ui": "bdd", + "ui": "bdd", "extension": ["ts"], "package": "./package.json", "reporter": "spec", "watch-files": ["./test/*.test.ts"], - "spec": ["./test/*.test.ts"] + "spec": ["./test/*.test.ts"], + "node-option": ["require=tsx", "experimental-transform-types"] } diff --git a/eslint.config.mjs b/eslint.config.mjs index bb9fb355f..bfa9015fd 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -9,10 +9,10 @@ import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' export default defineConfig( js.configs.recommended, tseslint.configs.recommended, - { - files: ['**/*.{ts,tsx}'], - extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript], - }, + // { + // files: ['**/*.{ts,tsx}'], + // extends: [importPlugin.flatConfigs.recommended, importPlugin.flatConfigs.typescript], + // }, eslintPluginPrettierRecommended, // chai assertions are sometimes expressions { diff --git a/package-lock.json b/package-lock.json index f3e3a5df3..bc73d0d5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,9 +14,9 @@ "ajv-draft-04": "^1.0.0", "ajv-i18n": "^4.2.0", "prettier": "^3.8.1", - "request-light": "^0.5.7", + "request-light": "^0.8.0", "vscode-json-languageservice": "4.1.8", - "vscode-languageserver": "^9.0.0", + "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.16.0", "vscode-uri": "^3.0.2", @@ -30,7 +30,7 @@ "@microsoft/eslint-formatter-sarif": "3.0.0", "@types/chai": "^4.2.12", "@types/mocha": "8.2.2", - "@types/node": "18.x", + "@types/node": "22.x", "@types/sinon": "^9.0.5", "@types/sinon-chai": "^3.2.5", "@typescript-eslint/parser": "^8.59.4", @@ -43,11 +43,12 @@ "mocha-lcov-reporter": "^1.3.0", "nyc": "^15.1.0", "rimraf": "^3.0.2", - "sinon": "^9.0.3", + "sinon": "^22.0.0", "sinon-chai": "^3.5.0", "source-map-support": "^0.5.19", - "ts-node": "^10.0.0", - "typescript": "^4.8.3", + "testdouble": "^3.20.2", + "tsx": "^4.22.3", + "typescript": "^5.9.3", "typescript-eslint": "^8.59.4" } }, @@ -332,28 +333,446 @@ "node": ">=6.9.0" } }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", - "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.0.tgz", + "integrity": "sha512-lhRUCeuOyJQURhTxl4WkpFTjIsbDayJHih5kZC1giwE+MhIzAb7mEsQMqMf18rHLsrb5qI1tafG20mLxEWcWlA==", + "cpu": [ + "ppc64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@jridgewell/trace-mapping": "0.3.9" - }, + "optional": true, + "os": [ + "aix" + ], "engines": { - "node": ">=12" + "node": ">=18" } }, - "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", - "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "node_modules/@esbuild/android-arm": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.0.tgz", + "integrity": "sha512-wqh0ByljabXLKHeWXYLqoJ5jKC4XBaw6Hk08OfMrCRd2nP2ZQ5eleDZC41XHyCNgktBGYMbqnrJKq/K/lzPMSQ==", + "cpu": [ + "arm" + ], "dev": true, "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.0.3", - "@jridgewell/sourcemap-codec": "^1.4.10" + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.0.tgz", + "integrity": "sha512-+WzIXQOSaGs33tLEgYPYe/yQHf0WTU0X42Jca3y8NWMbUVhp7rUnw+vAsRC/QiDrdD31IszMrZy+qwPOPjd+rw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.0.tgz", + "integrity": "sha512-+VJggoaKhk2VNNqVL7f6S189UzShHC/mR9EE8rDdSkdpN0KflSwWY/gWjDrNxxisg8Fp1ZCD9jLMo4m0OUfeUA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.0.tgz", + "integrity": "sha512-0T+A9WZm+bZ84nZBtk1ckYsOvyA3x7e2Acj1KdVfV4/2tdG4fzUp91YHx+GArWLtwqp77pBXVCPn2We7Letr0Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.0.tgz", + "integrity": "sha512-fyzLm/DLDl/84OCfp2f/XQ4flmORsjU7VKt8HLjvIXChJoFFOIL6pLJPH4Yhd1n1gGFF9mPwtlN5Wf82DZs+LQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.0.tgz", + "integrity": "sha512-l9GeW5UZBT9k9brBYI+0WDffcRxgHQD8ShN2Ur4xWq/NFzUKm3k5lsH4PdaRgb2w7mI9u61nr2gI2mLI27Nh3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.0.tgz", + "integrity": "sha512-BXoQai/A0wPO6Es3yFJ7APCiKGc1tdAEOgeTNy3SsB491S3aHn4S4r3e976eUnPdU+NbdtmBuLncYir2tMU9Nw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.0.tgz", + "integrity": "sha512-CjaaREJagqJp7iTaNQjjidaNbCKYcd4IDkzbwwxtSvjI7NZm79qiHc8HqciMddQ6CKvJT6aBd8lO9kN/ZudLlw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.0.tgz", + "integrity": "sha512-RVyzfb3FWsGA55n6WY0MEIEPURL1FcbhFE6BffZEMEekfCzCIMtB5yyDcFnVbTnwk+CLAgTujmV/Lgvih56W+A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.0.tgz", + "integrity": "sha512-KBnSTt1kxl9x70q+ydterVdl+Cn0H18ngRMRCEQfrbqdUuntQQ0LoMZv47uB97NljZFzY6HcfqEZ2SAyIUTQBQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.0.tgz", + "integrity": "sha512-zpSlUce1mnxzgBADvxKXX5sl8aYQHo2ezvMNI8I0lbblJtp8V4odlm3Yzlj7gPyt3T8ReksE6bK+pT3WD+aJRg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.0.tgz", + "integrity": "sha512-2jIfP6mmjkdmeTlsX/9vmdmhBmKADrWqN7zcdtHIeNSCH1SqIoNI63cYsjQR8J+wGa4Y5izRcSHSm8K3QWmk3w==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.0.tgz", + "integrity": "sha512-bc0FE9wWeC0WBm49IQMPSPILRocGTQt3j5KPCA8os6VprfuJ7KD+5PzESSrJ6GmPIPJK965ZJHTUlSA6GNYEhg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.0.tgz", + "integrity": "sha512-SQPZOwoTTT/HXFXQJG/vBX8sOFagGqvZyXcgLA3NhIqcBv1BJU1d46c0rGcrij2B56Z2rNiSLaZOYW5cUk7yLQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.0.tgz", + "integrity": "sha512-SCfR0HN8CEEjnYnySJTd2cw0k9OHB/YFzt5zgJEwa+wL/T/raGWYMBqwDNAC6dqFKmJYZoQBRfHjgwLHGSrn3Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.0.tgz", + "integrity": "sha512-us0dSb9iFxIi8srnpl931Nvs65it/Jd2a2K3qs7fz2WfGPHqzfzZTfec7oxZJRNPXPnNYZtanmRc4AL/JwVzHQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.0.tgz", + "integrity": "sha512-CR/RYotgtCKwtftMwJlUU7xCVNg3lMYZ0RzTmAHSfLCXw3NtZtNpswLEj/Kkf6kEL3Gw+BpOekRX0BYCtklhUw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.0.tgz", + "integrity": "sha512-nU1yhmYutL+fQ71Kxnhg8uEOdC0pwEW9entHykTgEbna2pw2dkbFSMeqjjyHZoCmt8SBkOSvV+yNmm94aUrrqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.0.tgz", + "integrity": "sha512-cXb5vApOsRsxsEl4mcZ1XY3D4DzcoMxR/nnc4IyqYs0rTI8ZKmW6kyyg+11Z8yvgMfAEldKzP7AdP64HnSC/6g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.0.tgz", + "integrity": "sha512-8wZM2qqtv9UP3mzy7HiGYNH/zjTA355mpeuA+859TyR+e+Tc08IHYpLJuMsfpDJwoLo1ikIJI8jC3GFjnRClzA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.0.tgz", + "integrity": "sha512-FLGfyizszcef5C3YtoyQDACyg95+dndv79i2EekILBofh5wpCa1KuBqOWKrEHZg3zrL3t5ouE5jgr94vA+Wb2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.0.tgz", + "integrity": "sha512-1ZgjUoEdHZZl/YlV76TSCz9Hqj9h9YmMGAgAPYd+q4SicWNX3G5GCyx9uhQWSLcbvPW8Ni7lj4gDa1T40akdlw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.0.tgz", + "integrity": "sha512-Q9StnDmQ/enxnpxCCLSg0oo4+34B9TdXpuyPeTedN/6+iXBJ4J+zwfQI28u/Jl40nOYAxGoNi7mFP40RUtkmUA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.0.tgz", + "integrity": "sha512-zF3ag/gfiCe6U2iczcRzSYJKH1DCI+ByzSENHlM2FcDbEeo5Zd2C86Aq0tKUYAJJ1obRP84ymxIAksZUcdztHA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.0.tgz", + "integrity": "sha512-pEl1bO9mfAmIC+tW5btTmrKaujg3zGtUmWNdCw/xs70FBjwAL3o9OEKNHvNmnyylD6ubxUERiEhdsL0xBQ9efw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" } }, "node_modules/@eslint-community/eslint-utils": { @@ -1084,9 +1503,9 @@ "license": "MIT" }, "node_modules/@sinonjs/commons": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", - "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.1.tgz", + "integrity": "sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==", "dev": true, "license": "BSD-3-Clause", "dependencies": { @@ -1104,62 +1523,26 @@ } }, "node_modules/@sinonjs/fake-timers": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz", - "integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==", + "version": "15.4.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-15.4.0.tgz", + "integrity": "sha512-DsG+8/LscQIQg68J6Ef3dv10u6nVyetYn923s3/sus5eaGfTo1of5WMZSLf0UJc9KDuKPilPH0UDJCjvNbDNCA==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^1.7.0" + "@sinonjs/commons": "^3.0.1" } }, "node_modules/@sinonjs/samsam": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.3.1.tgz", - "integrity": "sha512-1Hc0b1TtyfBu8ixF/tpfSHTVWKwCBLY4QJbkgnE7HcwyvT2xArDxb4K7dMgqRm3szI+LJbzmW/s4xxEhv6hwDg==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-10.0.2.tgz", + "integrity": "sha512-8lVwD1Df1BmzoaOLhMcGGcz/Jyr5QY2KSB75/YK1QgKzoabTeLdIVyhXNZK9ojfSKSdirbXqdbsXXqP9/Ve8+A==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^1.6.0", - "lodash.get": "^4.4.2", - "type-detect": "^4.0.8" + "@sinonjs/commons": "^3.0.1", + "type-detect": "^4.1.0" } }, - "node_modules/@sinonjs/text-encoding": { - "version": "0.7.3", - "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.3.tgz", - "integrity": "sha512-DE427ROAphMQzU4ENbliGYrBSYPXF+TtLg9S8vzeA+OF4ZKzoDdzfL8sxuMUGS/lgRhM6j1URSk9ghf7Xo1tyA==", - "dev": true, - "license": "(Unlicense OR Apache-2.0)" - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", - "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", - "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", - "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", - "dev": true, - "license": "MIT" - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", - "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/chai": { "version": "4.3.20", "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.20.tgz", @@ -1196,13 +1579,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "18.19.119", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.119.tgz", - "integrity": "sha512-d0F6m9itIPaKnrvEMlzE48UjwZaAnFW7Jwibacw9MNdqadjKNpUm9tfJYDwmShJmgqcoqYUX3EMKO1+RWiuuNg==", + "version": "22.19.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.19.tgz", + "integrity": "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.21.0" } }, "node_modules/@types/sinon": { @@ -1233,6 +1616,45 @@ "dev": true, "license": "MIT" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.59.4", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.4.tgz", + "integrity": "sha512-PegsU+XfyJJNjd4+u/k6f9yTyp0lEXXiPopUNobZcIAUJFGICFLN+sP0Rb3JehVmiij1Ph0dFGYqODoRo/2+6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.59.4", + "@typescript-eslint/type-utils": "8.59.4", + "@typescript-eslint/utils": "8.59.4", + "@typescript-eslint/visitor-keys": "8.59.4", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.59.4", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/@typescript-eslint/parser": { "version": "8.59.4", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.59.4.tgz", @@ -1315,6 +1737,31 @@ "typescript": ">=4.8.4 <6.1.0" } }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.59.4", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.59.4.tgz", + "integrity": "sha512-uonTuPAAKr9XaBGqJ3LjYTh72zy5DyGesljO9gtmk/eFW0W1fRHjnwVYKB35Lm8d5Q5CluEW3gPHjTvZTmgrfA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.59.4", + "@typescript-eslint/typescript-estree": "8.59.4", + "@typescript-eslint/utils": "8.59.4", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, "node_modules/@typescript-eslint/types": { "version": "8.59.4", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.59.4.tgz", @@ -1483,21 +1930,8 @@ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, "license": "MIT", - "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.3.4", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", - "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", - "dev": true, - "license": "MIT", - "dependencies": { - "acorn": "^8.11.0" - }, - "engines": { - "node": ">=0.4.0" + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, "node_modules/aggregate-error": { @@ -1599,13 +2033,6 @@ "dev": true, "license": "MIT" }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true, - "license": "MIT" - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2114,13 +2541,6 @@ "dev": true, "license": "MIT" }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true, - "license": "MIT" - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -2505,6 +2925,48 @@ "dev": true, "license": "MIT" }, + "node_modules/esbuild": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.0.tgz", + "integrity": "sha512-sNR9MHpXSUV/XB4zmsFKN+QgVG82Cc7+/aaxJ8Adi8hyOac+EXptIp45QBPaVyX3N70664wRbTcLTOemCAnyqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.0", + "@esbuild/android-arm": "0.28.0", + "@esbuild/android-arm64": "0.28.0", + "@esbuild/android-x64": "0.28.0", + "@esbuild/darwin-arm64": "0.28.0", + "@esbuild/darwin-x64": "0.28.0", + "@esbuild/freebsd-arm64": "0.28.0", + "@esbuild/freebsd-x64": "0.28.0", + "@esbuild/linux-arm": "0.28.0", + "@esbuild/linux-arm64": "0.28.0", + "@esbuild/linux-ia32": "0.28.0", + "@esbuild/linux-loong64": "0.28.0", + "@esbuild/linux-mips64el": "0.28.0", + "@esbuild/linux-ppc64": "0.28.0", + "@esbuild/linux-riscv64": "0.28.0", + "@esbuild/linux-s390x": "0.28.0", + "@esbuild/linux-x64": "0.28.0", + "@esbuild/netbsd-arm64": "0.28.0", + "@esbuild/netbsd-x64": "0.28.0", + "@esbuild/openbsd-arm64": "0.28.0", + "@esbuild/openbsd-x64": "0.28.0", + "@esbuild/openharmony-arm64": "0.28.0", + "@esbuild/sunos-x64": "0.28.0", + "@esbuild/win32-arm64": "0.28.0", + "@esbuild/win32-ia32": "0.28.0", + "@esbuild/win32-x64": "0.28.0" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -2960,6 +3422,24 @@ "reusify": "^1.0.4" } }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/file-entry-cache": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", @@ -3100,6 +3580,21 @@ "dev": true, "license": "ISC" }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -3859,6 +4354,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-regexp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-regexp/-/is-regexp-1.0.0.tgz", + "integrity": "sha512-7zjFAPO4/gwyQAAgRRmqeEeyIICSdmCqa3tsVHMdBzaXXRiqopZL4Cyghg/XulGWrtABTpbnYYzzIRffLkP4oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-set": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", @@ -4267,13 +4772,6 @@ "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", "license": "MIT" }, - "node_modules/just-extend": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", - "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", - "dev": true, - "license": "MIT" - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -4328,14 +4826,6 @@ "dev": true, "license": "MIT" }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.", - "dev": true, - "license": "MIT" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -4406,13 +4896,6 @@ "semver": "bin/semver.js" } }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true, - "license": "ISC" - }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -4558,20 +5041,6 @@ "dev": true, "license": "MIT" }, - "node_modules/nise": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/nise/-/nise-4.1.0.tgz", - "integrity": "sha512-eQMEmGN/8arp0xsvGoQ+B1qvSkR73B1nWSCh7nOt5neMCtwcQVYQGdzQMhcNscktTsWB54xnlSQFzOAPJD8nXA==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "@sinonjs/commons": "^1.7.0", - "@sinonjs/fake-timers": "^6.0.0", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "path-to-regexp": "^1.7.0" - } - }, "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", @@ -5131,23 +5600,6 @@ "dev": true, "license": "ISC" }, - "node_modules/path-to-regexp": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.9.0.tgz", - "integrity": "sha512-xIp7/apCFJuUHdDLWe8O1HIkb0kQrOMb/0u6FXQjemHn/ii5LrIzU6bdECnsiTF/GjZkMEKg1xdiZwNqDYlZ6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "isarray": "0.0.1" - } - }, - "node_modules/path-to-regexp/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true, - "license": "MIT" - }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -5165,6 +5617,19 @@ "dev": true, "license": "ISC" }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", @@ -5326,6 +5791,20 @@ ], "license": "MIT" }, + "node_modules/quibble": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/quibble/-/quibble-0.9.2.tgz", + "integrity": "sha512-BrL7hrZcbyyt5ZDfePkGFDc3m82uUtxCPOnpRUrkOdtBnmV9ldQKxXORkKL8eIzToRNaCpIPyKyfdfq/tBlFAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21", + "resolve": "^1.22.8" + }, + "engines": { + "node": ">= 0.14.0" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -5408,9 +5887,9 @@ } }, "node_modules/request-light": { - "version": "0.5.8", - "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.5.8.tgz", - "integrity": "sha512-3Zjgh+8b5fhRJBQZoy+zbVKpAQGLyka0MPgW3zruTF4dFFJ8Fqcfu9YsAvi/rvdcaTeWG3MkbZv4WKxAn/84Lg==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/request-light/-/request-light-0.8.0.tgz", + "integrity": "sha512-bH6E4PMmsEXYrLX6Kr1vu+xI3HproB1vECAwaPSJeroLE1kpWE3HR27uB4icx+6YORu1ajqBJXxuedv8ZQg5Lw==", "license": "MIT" }, "node_modules/require-directory": { @@ -5812,19 +6291,16 @@ } }, "node_modules/sinon": { - "version": "9.2.4", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-9.2.4.tgz", - "integrity": "sha512-zljcULZQsJxVra28qIAL6ow1Z9tpattkCTEJR4RBP3TGc00FcttsP5pK284Nas5WjMZU5Yzy3kAIp3B3KRf5Yg==", - "deprecated": "16.1.1", + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/sinon/-/sinon-22.0.0.tgz", + "integrity": "sha512-sq/6DpdXOrLyfbKlXLg/Usc7xu8YXPeLkOFZRvA3bNUSA2lhbrZ06yuXbH1fkzBPCbz9O10+7hznzUsjaYNm0Q==", "dev": true, "license": "BSD-3-Clause", "dependencies": { - "@sinonjs/commons": "^1.8.1", - "@sinonjs/fake-timers": "^6.0.1", - "@sinonjs/samsam": "^5.3.1", - "diff": "^4.0.2", - "nise": "^4.0.4", - "supports-color": "^7.1.0" + "@sinonjs/commons": "^3.0.1", + "@sinonjs/fake-timers": "^15.4.0", + "@sinonjs/samsam": "^10.0.2", + "diff": "^9.0.0" }, "funding": { "type": "opencollective", @@ -5843,9 +6319,9 @@ } }, "node_modules/sinon/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-9.0.0.tgz", + "integrity": "sha512-svtcdpS8CgJyqAjEQIXdb3OjhFVVYjzGAPO8WGCmRbrml64SPw/jJD4GoE98aR7r25A0XcgrK3F02yw9R/vhQw==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -6062,6 +6538,30 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/stringify-object-es5": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/stringify-object-es5/-/stringify-object-es5-2.5.0.tgz", + "integrity": "sha512-vE7Xdx9ylG4JI16zy7/ObKUB+MtxuMcWlj/WHHr3+yAlQoN6sst2stU9E+2Qs3OrlJw/Pf3loWxL1GauEHf6MA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "is-plain-obj": "^1.0.0", + "is-regexp": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stringify-object-es5/node_modules/is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -6191,6 +6691,22 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/testdouble": { + "version": "3.20.2", + "resolved": "https://registry.npmjs.org/testdouble/-/testdouble-3.20.2.tgz", + "integrity": "sha512-790e9vJKdfddWNOaxW1/V9FcMk48cPEl3eJSj2i8Hh1fX89qArEJ6cp3DBnaECpGXc3xKJVWbc1jeNlWYWgiMg==", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21", + "quibble": "^0.9.2", + "stringify-object-es5": "^2.5.0", + "theredoc": "^1.0.0" + }, + "engines": { + "node": ">= 16" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -6198,6 +6714,13 @@ "dev": true, "license": "MIT" }, + "node_modules/theredoc": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/theredoc/-/theredoc-1.0.0.tgz", + "integrity": "sha512-KU3SA3TjRRM932jpNfD3u4Ec3bSvedyo5ITPI7zgWYnKep7BwQQaxlhI9qbO+lKJoRnoAbEVfMcAHRuKVYikDA==", + "dev": true, + "license": "MIT" + }, "node_modules/tinyglobby": { "version": "0.2.16", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", @@ -6215,37 +6738,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", - "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/ts-api-utils": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", @@ -6259,60 +6751,6 @@ "typescript": ">=4.8.4" } }, - "node_modules/ts-node": { - "version": "10.9.2", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", - "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@cspotcode/source-map-support": "^0.8.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.1", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, "node_modules/tsconfig-paths": { "version": "3.15.0", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", @@ -6349,6 +6787,25 @@ "node": ">=4" } }, + "node_modules/tsx": { + "version": "4.22.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.22.3.tgz", + "integrity": "sha512-mdoNxBC/cSQObGGVQ5Bpn5i+yv7j68gk3Nfm3wFjcJg3Z0Mix9jzAFfP12prmm5eVGmDKtp0yyArrs0Q+8gZHg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.28.0" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -6474,9 +6931,9 @@ } }, "node_modules/typescript": { - "version": "4.9.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", - "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -6484,7 +6941,7 @@ "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/typescript-eslint": { @@ -6511,70 +6968,6 @@ "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/typescript-eslint/node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.59.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.59.4.tgz", - "integrity": "sha512-PegsU+XfyJJNjd4+u/k6f9yTyp0lEXXiPopUNobZcIAUJFGICFLN+sP0Rb3JehVmiij1Ph0dFGYqODoRo/2+6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.12.2", - "@typescript-eslint/scope-manager": "8.59.4", - "@typescript-eslint/type-utils": "8.59.4", - "@typescript-eslint/utils": "8.59.4", - "@typescript-eslint/visitor-keys": "8.59.4", - "ignore": "^7.0.5", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.5.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.59.4", - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" - } - }, - "node_modules/typescript-eslint/node_modules/@typescript-eslint/type-utils": { - "version": "8.59.4", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.59.4.tgz", - "integrity": "sha512-uonTuPAAKr9XaBGqJ3LjYTh72zy5DyGesljO9gtmk/eFW0W1fRHjnwVYKB35Lm8d5Q5CluEW3gPHjTvZTmgrfA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.59.4", - "@typescript-eslint/typescript-estree": "8.59.4", - "@typescript-eslint/utils": "8.59.4", - "debug": "^4.4.3", - "ts-api-utils": "^2.5.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", - "typescript": ">=4.8.4 <6.1.0" - } - }, - "node_modules/typescript-eslint/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, "node_modules/unbox-primitive": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", @@ -6595,9 +6988,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" }, @@ -6659,13 +7052,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", - "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true, - "license": "MIT" - }, "node_modules/vscode-json-languageservice": { "version": "4.1.8", "resolved": "https://registry.npmjs.org/vscode-json-languageservice/-/vscode-json-languageservice-4.1.8.tgz", @@ -7119,16 +7505,6 @@ "node": ">=8" } }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/package.json b/package.json index 7b261837d..949d4369b 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ }, "main": "./out/server/src/index.js", "l10n": "./l10n", + "type": "module", "keywords": [ "yaml", "LSP" @@ -32,9 +33,9 @@ "ajv-draft-04": "^1.0.0", "ajv-i18n": "^4.2.0", "prettier": "^3.8.1", - "request-light": "^0.5.7", + "request-light": "^0.8.0", "vscode-json-languageservice": "4.1.8", - "vscode-languageserver": "^9.0.0", + "vscode-languageserver": "^9.0.1", "vscode-languageserver-textdocument": "^1.0.1", "vscode-languageserver-types": "^3.16.0", "vscode-uri": "^3.0.2", @@ -45,7 +46,7 @@ "@microsoft/eslint-formatter-sarif": "3.0.0", "@types/chai": "^4.2.12", "@types/mocha": "8.2.2", - "@types/node": "18.x", + "@types/node": "22.x", "@types/sinon": "^9.0.5", "@types/sinon-chai": "^3.2.5", "@typescript-eslint/parser": "^8.59.4", @@ -58,27 +59,25 @@ "mocha-lcov-reporter": "^1.3.0", "nyc": "^15.1.0", "rimraf": "^3.0.2", - "sinon": "^9.0.3", + "sinon": "^22.0.0", "sinon-chai": "^3.5.0", "source-map-support": "^0.5.19", - "ts-node": "^10.0.0", - "typescript": "^4.8.3", + "testdouble": "^3.20.2", + "tsx": "^4.22.3", + "typescript": "^5.9.3", "typescript-eslint": "^8.59.4" }, "scripts": { "clean": "rimraf out/server && rimraf lib", "compile": "tsc -p .", "watch": "tsc --watch -p .", - "test": "mocha --require ts-node/register --timeout 10000 --ui bdd ./test/*.test.ts", + "test": "mocha --loader=testdouble --timeout 10000 --ui bdd ./test/*.test.ts", "coverage": "nyc mocha --require ts-node/register --timeout 10000 --require source-map-support/register --recursive --ui bdd ./test/*.test.ts", "coveralls": "nyc --reporter=lcov --reporter=text mocha --timeout 10000 --require ts-node/register --require source-map-support/register --recursive --ui bdd ./test/*.test.ts", "lint": "eslint --max-warnings 0 --ext .ts src test", "lint-ci": "eslint --max-warnings 0 -f @microsoft/eslint-formatter-sarif -o eslint-result.sarif --ext .ts src test", "prettier-fix": "npm run prettier --write .", - "build": "npm run clean && npm run lint && npm run compile && npm run build:libs", - "build:libs": "npm run compile:umd && npm run compile:esm", - "compile:umd": "tsc -p ./tsconfig.umd.json", - "compile:esm": "tsc -p ./tsconfig.esm.json", + "build": "npm run clean && npm run lint && npm run compile", "check-dependencies": "node ./scripts/check-dependencies.js", "pull-remote": "git pull https://github.com/redhat-developer/yaml-language-server.git main" }, diff --git a/src/index.ts b/src/index.ts index d4c8a04dc..030a5d1c7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,5 @@ -export * from './languageservice/yamlLanguageService'; -export { getLanguageService as getJSONLanguageService } from 'vscode-json-languageservice'; +export * from './languageservice/yamlLanguageService.ts'; +import { getLanguageService } from 'vscode-json-languageservice'; +const getJSONLanguageService = getLanguageService; +export { getJSONLanguageService }; export * from 'vscode-languageserver-types'; diff --git a/src/languageserver/handlers/languageHandlers.ts b/src/languageserver/handlers/languageHandlers.ts index 1146fdbe5..d6d38292e 100644 --- a/src/languageserver/handlers/languageHandlers.ts +++ b/src/languageserver/handlers/languageHandlers.ts @@ -34,11 +34,11 @@ import { TextEdit, WorkspaceEdit, } from 'vscode-languageserver-types'; -import { isKubernetesAssociatedDocument } from '../../languageservice/parser/isKubernetes'; -import { LanguageService } from '../../languageservice/yamlLanguageService'; -import { SettingsState } from '../../yamlSettings'; -import { ValidationHandler } from './validationHandlers'; -import { ResultLimitReachedNotification } from '../../requestTypes'; +import { isKubernetesAssociatedDocument } from '../../languageservice/parser/isKubernetes.ts'; +import { LanguageService } from '../../languageservice/yamlLanguageService.ts'; +import { SettingsState } from '../../yamlSettings.ts'; +import { ValidationHandler } from './validationHandlers.ts'; +import { ResultLimitReachedNotification } from '../../requestTypes.ts'; import * as path from 'path'; import { TextDocument } from 'vscode-languageserver-textdocument'; diff --git a/src/languageserver/handlers/notificationHandlers.ts b/src/languageserver/handlers/notificationHandlers.ts index a273bdd01..f73f21bd1 100644 --- a/src/languageserver/handlers/notificationHandlers.ts +++ b/src/languageserver/handlers/notificationHandlers.ts @@ -3,17 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Connection } from 'vscode-languageserver'; -import { CustomSchemaProvider } from '../../languageservice/services/yamlSchemaService'; -import { LanguageService, SchemaConfiguration } from '../../languageservice/yamlLanguageService'; +import { CustomSchemaProvider } from '../../languageservice/services/yamlSchemaService.ts'; +import { LanguageService, SchemaConfiguration } from '../../languageservice/yamlLanguageService.ts'; import { CustomSchemaRequest, DynamicCustomSchemaRequestRegistration, SchemaAssociationNotification, SchemaSelectionRequests, VSCodeContentRequestRegistration, -} from '../../requestTypes'; -import { SettingsState } from '../../yamlSettings'; -import { SettingsHandler } from './settingsHandlers'; +} from '../../requestTypes.ts'; +import { SettingsState } from '../../yamlSettings.ts'; +import { SettingsHandler } from './settingsHandlers.ts'; export class NotificationHandlers { private languageService: LanguageService; diff --git a/src/languageserver/handlers/requestHandlers.ts b/src/languageserver/handlers/requestHandlers.ts index 50d21f007..cb9ea909d 100644 --- a/src/languageserver/handlers/requestHandlers.ts +++ b/src/languageserver/handlers/requestHandlers.ts @@ -8,9 +8,9 @@ import { SchemaAdditions, SchemaDeletions, SchemaDeletionsAll, -} from '../../languageservice/services/yamlSchemaService'; -import { LanguageService } from '../../languageservice/yamlLanguageService'; -import { SchemaModificationNotification } from '../../requestTypes'; +} from '../../languageservice/services/yamlSchemaService.ts'; +import { LanguageService } from '../../languageservice/yamlLanguageService.ts'; +import { SchemaModificationNotification } from '../../requestTypes.ts'; export class RequestHandlers { private languageService: LanguageService; diff --git a/src/languageserver/handlers/schemaSelectionHandlers.ts b/src/languageserver/handlers/schemaSelectionHandlers.ts index 65b7504e4..37d1868c1 100644 --- a/src/languageserver/handlers/schemaSelectionHandlers.ts +++ b/src/languageserver/handlers/schemaSelectionHandlers.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Connection } from 'vscode-languageserver/node'; -import { JSONSchema } from '../../languageservice/jsonSchema'; -import { yamlDocumentsCache } from '../../languageservice/parser/yaml-documents'; -import { YAMLSchemaService } from '../../languageservice/services/yamlSchemaService'; -import { getSchemaUrls } from '../../languageservice/utils/schemaUrls'; -import { SettingsState } from '../../yamlSettings'; -import { JSONSchemaDescription, JSONSchemaDescriptionExt, SchemaSelectionRequests } from '../../requestTypes'; +import { Connection } from 'vscode-languageserver/node.ts'; +import { JSONSchema } from '../../languageservice/jsonSchema.ts'; +import { yamlDocumentsCache } from '../../languageservice/parser/yaml-documents.ts'; +import { YAMLSchemaService } from '../../languageservice/services/yamlSchemaService.ts'; +import { getSchemaUrls } from '../../languageservice/utils/schemaUrls.ts'; +import { SettingsState } from '../../yamlSettings.ts'; +import { JSONSchemaDescription, JSONSchemaDescriptionExt, SchemaSelectionRequests } from '../../requestTypes.ts'; export class JSONSchemaSelection { constructor( diff --git a/src/languageserver/handlers/settingsHandlers.ts b/src/languageserver/handlers/settingsHandlers.ts index a2eae3da4..9e14fdf84 100644 --- a/src/languageserver/handlers/settingsHandlers.ts +++ b/src/languageserver/handlers/settingsHandlers.ts @@ -4,18 +4,18 @@ *--------------------------------------------------------------------------------------------*/ import { configure as configureHttpRequests, xhr } from 'request-light'; import { Connection, DidChangeConfigurationNotification, DocumentFormattingRequest } from 'vscode-languageserver'; -import { isRelativePath, relativeToAbsolutePath } from '../../languageservice/utils/paths'; +import { isRelativePath, relativeToAbsolutePath } from '../../languageservice/utils/paths.ts'; import { checkSchemaURI, EMPTY_SCHEMA_URL, JSON_SCHEMASTORE_URL, KUBERNETES_SCHEMA_URL, -} from '../../languageservice/utils/schemaUrls'; -import { LanguageService, LanguageSettings, SchemaPriority } from '../../languageservice/yamlLanguageService'; -import { SchemaSelectionRequests } from '../../requestTypes'; -import { Settings, SettingsState } from '../../yamlSettings'; -import { Telemetry } from '../../languageservice/telemetry'; -import { ValidationHandler } from './validationHandlers'; +} from '../../languageservice/utils/schemaUrls.ts'; +import { LanguageService, LanguageSettings, SchemaPriority } from '../../languageservice/yamlLanguageService.ts'; +import { SchemaSelectionRequests } from '../../requestTypes.ts'; +import { Settings, SettingsState } from '../../yamlSettings.ts'; +import { Telemetry } from '../../languageservice/telemetry.ts'; +import { ValidationHandler } from './validationHandlers.ts'; export class SettingsHandler { constructor( diff --git a/src/languageserver/handlers/validationHandlers.ts b/src/languageserver/handlers/validationHandlers.ts index d9c1ef285..9b015d3dc 100644 --- a/src/languageserver/handlers/validationHandlers.ts +++ b/src/languageserver/handlers/validationHandlers.ts @@ -5,10 +5,10 @@ import { Connection } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic } from 'vscode-languageserver-types'; -import { isKubernetesAssociatedDocument } from '../../languageservice/parser/isKubernetes'; -import { removeDuplicatesObj } from '../../languageservice/utils/arrUtils'; -import { LanguageService } from '../../languageservice/yamlLanguageService'; -import { SettingsState } from '../../yamlSettings'; +import { isKubernetesAssociatedDocument } from '../../languageservice/parser/isKubernetes.ts'; +import { removeDuplicatesObj } from '../../languageservice/utils/arrUtils.ts'; +import { LanguageService } from '../../languageservice/yamlLanguageService.ts'; +import { SettingsState } from '../../yamlSettings.ts'; export class ValidationHandler { private languageService: LanguageService; diff --git a/src/languageserver/handlers/workspaceHandlers.ts b/src/languageserver/handlers/workspaceHandlers.ts index 05b808b41..1ff1fee31 100644 --- a/src/languageserver/handlers/workspaceHandlers.ts +++ b/src/languageserver/handlers/workspaceHandlers.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ExecuteCommandParams, Connection } from 'vscode-languageserver'; -import { CommandExecutor } from '../commandExecutor'; +import { CommandExecutor } from '../commandExecutor.ts'; export class WorkspaceHandlers { constructor( diff --git a/src/languageserver/telemetry.ts b/src/languageserver/telemetry.ts index a1db7f2aa..e758aad64 100644 --- a/src/languageserver/telemetry.ts +++ b/src/languageserver/telemetry.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { Connection } from 'vscode-languageserver'; -import { TelemetryEvent, Telemetry } from '../languageservice/telemetry'; -import { convertErrorToTelemetryMsg } from '../languageservice/utils/objects'; +import { TelemetryEvent, Telemetry } from '../languageservice/telemetry.ts'; +import { convertErrorToTelemetryMsg } from '../languageservice/utils/objects.ts'; export class TelemetryImpl implements Telemetry { constructor(private readonly connection: Connection) {} diff --git a/src/languageservice/jsonASTTypes.ts b/src/languageservice/jsonASTTypes.ts index ce1059ce4..4a6e62647 100644 --- a/src/languageservice/jsonASTTypes.ts +++ b/src/languageservice/jsonASTTypes.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Node, Pair } from 'yaml'; -import type { CustomTagReturnType } from './utils/customTags'; +import { CustomTagReturnType } from './utils/customTags.ts'; export type YamlNode = Node | Pair; diff --git a/src/languageservice/jsonSchema.ts b/src/languageservice/jsonSchema.ts index ecbe42a4b..1324f88cc 100644 --- a/src/languageservice/jsonSchema.ts +++ b/src/languageservice/jsonSchema.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CompletionItemKind } from 'vscode-json-languageservice'; -import { SchemaVersions } from './yamlTypes'; +import type { CompletionItemKind } from 'vscode-json-languageservice'; +import { SchemaVersions } from './yamlTypes.ts'; export type JSONSchemaRef = JSONSchema | boolean; export enum SchemaDialect { diff --git a/src/languageservice/parser/ast-converter.ts b/src/languageservice/parser/ast-converter.ts index e3d89f286..e00c33820 100644 --- a/src/languageservice/parser/ast-converter.ts +++ b/src/languageservice/parser/ast-converter.ts @@ -4,32 +4,32 @@ *--------------------------------------------------------------------------------------------*/ import { + Alias, + Document, + LineCounter, Node, - isScalar, + Pair, Scalar, - isMap, YAMLMap, - isPair, - Pair, - isSeq, YAMLSeq, - isNode, isAlias, - Alias, - Document, - LineCounter, + isMap, + isNode, + isPair, + isScalar, + isSeq, } from 'yaml'; -import { ASTNode, YamlNode } from '../jsonASTTypes'; -import { getCustomTagReturnType } from '../utils/customTags'; +import { ASTNode, YamlNode } from '../jsonASTTypes.ts'; import { + ArrayASTNodeImpl, + BooleanASTNodeImpl, NullASTNodeImpl, + NumberASTNodeImpl, + ObjectASTNodeImpl, PropertyASTNodeImpl, StringASTNodeImpl, - ObjectASTNodeImpl, - NumberASTNodeImpl, - ArrayASTNodeImpl, - BooleanASTNodeImpl, -} from './jsonDocument'; +} from './jsonDocument.ts'; +import { getCustomTagReturnType } from '../utils/customTags.ts'; type NodeRange = [number, number, number]; diff --git a/src/languageservice/parser/astNodeUtils.ts b/src/languageservice/parser/astNodeUtils.ts index b98f7f484..f0674571c 100644 --- a/src/languageservice/parser/astNodeUtils.ts +++ b/src/languageservice/parser/astNodeUtils.ts @@ -1,4 +1,4 @@ -import type { ASTNode } from '../jsonASTTypes'; +import type { ASTNode } from '../jsonASTTypes.ts'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function getNodeValue(node: ASTNode): any { diff --git a/src/languageservice/parser/custom-tag-provider.ts b/src/languageservice/parser/custom-tag-provider.ts index 31df7533c..bb5f95fb4 100644 --- a/src/languageservice/parser/custom-tag-provider.ts +++ b/src/languageservice/parser/custom-tag-provider.ts @@ -1,5 +1,5 @@ -import { Tags, isSeq, isMap, YAMLMap, YAMLSeq, Scalar } from 'yaml'; -import { CustomTagInputType, CustomTagReturnType, parseCustomTag, setCustomTagReturnType } from '../utils/customTags'; +import { isMap, isSeq, Scalar, Tags, YAMLMap, YAMLSeq } from 'yaml'; +import { CustomTagInputType, CustomTagReturnType, parseCustomTag, setCustomTagReturnType } from '../utils/customTags.ts'; class CommonTagImpl { tag: string; diff --git a/src/languageservice/parser/isKubernetes.ts b/src/languageservice/parser/isKubernetes.ts index acd8d8dfa..805527d39 100644 --- a/src/languageservice/parser/isKubernetes.ts +++ b/src/languageservice/parser/isKubernetes.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { TextDocument } from 'vscode-languageserver-textdocument'; -import { FilePatternAssociation } from '../utils/filePatternAssociation'; -import * as Parser from './jsonDocument'; +import { FilePatternAssociation } from '../utils/filePatternAssociation.ts'; +import * as Parser from './jsonDocument.ts'; export function setKubernetesParserOption(jsonDocuments: Parser.JSONDocument[], option: boolean): void { for (const jsonDoc of jsonDocuments) { diff --git a/src/languageservice/parser/jsonDocument.ts b/src/languageservice/parser/jsonDocument.ts index 1cef45e62..64cbb92e7 100644 --- a/src/languageservice/parser/jsonDocument.ts +++ b/src/languageservice/parser/jsonDocument.ts @@ -3,25 +3,25 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { JSONSchema } from '../jsonSchema'; +import { TextDocument } from 'vscode-languageserver-textdocument'; +import { Diagnostic, Range } from 'vscode-languageserver-types'; +import { Node, Pair } from 'yaml'; import { - ASTNode, - ObjectASTNode, ArrayASTNode, + ASTNode, BooleanASTNode, - NumberASTNode, - StringASTNode, NullASTNode, + NumberASTNode, + ObjectASTNode, PropertyASTNode, + StringASTNode, YamlNode, -} from '../jsonASTTypes'; -import type { CustomTagReturnType } from '../utils/customTags'; -import { Diagnostic, Range } from 'vscode-languageserver-types'; -import { TextDocument } from 'vscode-languageserver-textdocument'; -import { Node, Pair } from 'yaml'; -import { type IApplicableSchema } from './schemaValidation/baseValidator'; -import { findNodeAtOffset } from './astNodeUtils'; -import { getValidator } from './schemaValidation/validatorFactory'; +} from '../jsonASTTypes.ts'; +import { JSONSchema } from '../jsonSchema.ts'; +import { findNodeAtOffset } from './astNodeUtils.ts'; +import { type IApplicableSchema } from './schemaValidation/baseValidator.ts'; +import { getValidator } from './schemaValidation/validatorFactory.ts'; +import { CustomTagReturnType } from '../utils/customTags.ts'; abstract class ASTNodeImpl { public abstract readonly type: 'object' | 'property' | 'array' | 'number' | 'boolean' | 'null' | 'string'; diff --git a/src/languageservice/parser/schemaValidation/baseValidator.ts b/src/languageservice/parser/schemaValidation/baseValidator.ts index e2e5b8a0e..e6615b4a7 100644 --- a/src/languageservice/parser/schemaValidation/baseValidator.ts +++ b/src/languageservice/parser/schemaValidation/baseValidator.ts @@ -4,21 +4,21 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { JSONSchema, JSONSchemaRef, SchemaDialect } from '../../jsonSchema'; -import type { ASTNode, ArrayASTNode, NumberASTNode, ObjectASTNode, PropertyASTNode, StringASTNode } from '../../jsonASTTypes'; -import { equals, isBoolean, isDefined, isIterable, isNumber, isString } from '../../utils/objects'; -import { getSchemaTypeName } from '../../utils/schemaUtils'; -import { isArrayEqual } from '../../utils/arrUtils'; -import { safeCreateUnicodeRegExp } from '../../utils/strings'; -import { FilePatternAssociation } from '../../utils/filePatternAssociation'; -import { floatSafeRemainder } from '../../utils/math'; +import type { JSONSchema, JSONSchemaRef, SchemaDialect } from '../../jsonSchema.ts'; +import type { ASTNode, ArrayASTNode, NumberASTNode, ObjectASTNode, PropertyASTNode, StringASTNode } from '../../jsonASTTypes.ts'; +import { equals, isBoolean, isDefined, isIterable, isNumber, isString } from '../../utils/objects.ts'; +import { getSchemaTypeName } from '../../utils/schemaUtils.ts'; +import { isArrayEqual } from '../../utils/arrUtils.ts'; +import { safeCreateUnicodeRegExp } from '../../utils/strings.ts'; +import { FilePatternAssociation } from '../../utils/filePatternAssociation.ts'; +import { floatSafeRemainder } from '../../utils/math.ts'; import { ErrorCode } from 'vscode-json-languageservice'; import * as l10n from '@vscode/l10n'; import { URI } from 'vscode-uri'; import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types'; import type { TextDocument } from 'vscode-languageserver-textdocument'; -import { contains, getNodeValue } from '../astNodeUtils'; -import { getValidator } from './validatorFactory'; +import { contains, getNodeValue } from '../astNodeUtils.ts'; +import { getValidator } from './validatorFactory.ts'; export const YAML_SOURCE = 'YAML'; const YAML_SCHEMA_PREFIX = 'yaml-schema: '; diff --git a/src/languageservice/parser/schemaValidation/draft04Validator.ts b/src/languageservice/parser/schemaValidation/draft04Validator.ts index afcd526b8..2f0c85083 100644 --- a/src/languageservice/parser/schemaValidation/draft04Validator.ts +++ b/src/languageservice/parser/schemaValidation/draft04Validator.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { JSONSchema } from '../../jsonSchema'; -import { SchemaDialect } from '../../jsonSchema'; -import { isBoolean, isNumber } from '../../utils/objects'; -import { BaseValidator } from './baseValidator'; +import type { JSONSchema } from '../../jsonSchema.ts'; +import { SchemaDialect } from '../../jsonSchema.ts'; +import { isBoolean, isNumber } from '../../utils/objects.ts'; +import { BaseValidator } from './baseValidator.ts'; export class Draft04Validator extends BaseValidator { protected override getCurrentDialect(): SchemaDialect { diff --git a/src/languageservice/parser/schemaValidation/draft07Validator.ts b/src/languageservice/parser/schemaValidation/draft07Validator.ts index a15a7c60b..b4a3d4bd9 100644 --- a/src/languageservice/parser/schemaValidation/draft07Validator.ts +++ b/src/languageservice/parser/schemaValidation/draft07Validator.ts @@ -3,10 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { JSONSchema } from '../../jsonSchema'; -import { SchemaDialect } from '../../jsonSchema'; -import { isNumber } from '../../utils/objects'; -import { BaseValidator } from './baseValidator'; +import type { JSONSchema } from '../../jsonSchema.ts'; +import { SchemaDialect } from '../../jsonSchema.ts'; +import { isNumber } from '../../utils/objects.ts'; +import { BaseValidator } from './baseValidator.ts'; export class Draft07Validator extends BaseValidator { protected override getCurrentDialect(): SchemaDialect { diff --git a/src/languageservice/parser/schemaValidation/draft2019Validator.ts b/src/languageservice/parser/schemaValidation/draft2019Validator.ts index b59e131cf..e152c1bd5 100644 --- a/src/languageservice/parser/schemaValidation/draft2019Validator.ts +++ b/src/languageservice/parser/schemaValidation/draft2019Validator.ts @@ -3,16 +3,16 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { JSONSchema, JSONSchemaRef } from '../../jsonSchema'; -import { SchemaDialect } from '../../jsonSchema'; -import type { ASTNode, ArrayASTNode, ObjectASTNode } from '../../jsonASTTypes'; -import { isNumber } from '../../utils/objects'; +import type { JSONSchema, JSONSchemaRef } from '../../jsonSchema.ts'; +import { SchemaDialect } from '../../jsonSchema.ts'; +import type { ASTNode, ArrayASTNode, ObjectASTNode } from '../../jsonASTTypes.ts'; +import { isNumber } from '../../utils/objects.ts'; import * as l10n from '@vscode/l10n'; import { DiagnosticSeverity } from 'vscode-languageserver-types'; import { ErrorCode } from 'vscode-json-languageservice'; -import { Draft07Validator } from './draft07Validator'; -import { ValidationResult, asSchema } from './baseValidator'; -import type { ISchemaCollector, Options } from './baseValidator'; +import { Draft07Validator } from './draft07Validator.ts'; +import { ValidationResult, asSchema } from './baseValidator.ts'; +import type { ISchemaCollector, Options } from './baseValidator.ts'; export class Draft2019Validator extends Draft07Validator { protected override getCurrentDialect(): SchemaDialect { diff --git a/src/languageservice/parser/schemaValidation/draft2020Validator.ts b/src/languageservice/parser/schemaValidation/draft2020Validator.ts index 067346c65..c867c7ff2 100644 --- a/src/languageservice/parser/schemaValidation/draft2020Validator.ts +++ b/src/languageservice/parser/schemaValidation/draft2020Validator.ts @@ -3,15 +3,15 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import type { JSONSchema, JSONSchemaRef } from '../../jsonSchema'; -import { SchemaDialect } from '../../jsonSchema'; -import type { ASTNode, ArrayASTNode } from '../../jsonASTTypes'; -import { isNumber } from '../../utils/objects'; +import type { JSONSchema, JSONSchemaRef } from '../../jsonSchema.ts'; +import { SchemaDialect } from '../../jsonSchema.ts'; +import type { ASTNode, ArrayASTNode } from '../../jsonASTTypes.ts'; +import { isNumber } from '../../utils/objects.ts'; import * as l10n from '@vscode/l10n'; import { DiagnosticSeverity } from 'vscode-languageserver-types'; -import { Draft2019Validator } from './draft2019Validator'; -import type { ISchemaCollector, Options } from './baseValidator'; -import { ValidationResult, asSchema } from './baseValidator'; +import { Draft2019Validator } from './draft2019Validator.ts'; +import type { ISchemaCollector, Options } from './baseValidator.ts'; +import { ValidationResult, asSchema } from './baseValidator.ts'; export class Draft2020Validator extends Draft2019Validator { protected override getCurrentDialect(): SchemaDialect { diff --git a/src/languageservice/parser/schemaValidation/validatorFactory.ts b/src/languageservice/parser/schemaValidation/validatorFactory.ts index ba8777983..34554aa87 100644 --- a/src/languageservice/parser/schemaValidation/validatorFactory.ts +++ b/src/languageservice/parser/schemaValidation/validatorFactory.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SchemaDialect } from '../../jsonSchema'; -import { BaseValidator } from './baseValidator'; -import { Draft04Validator } from './draft04Validator'; -import { Draft07Validator } from './draft07Validator'; -import { Draft2019Validator } from './draft2019Validator'; -import { Draft2020Validator } from './draft2020Validator'; +import { SchemaDialect } from '../../jsonSchema.ts'; +import { BaseValidator } from './baseValidator.ts'; +import { Draft04Validator } from './draft04Validator.ts'; +import { Draft07Validator } from './draft07Validator.ts'; +import { Draft2019Validator } from './draft2019Validator.ts'; +import { Draft2020Validator } from './draft2020Validator.ts'; export function getValidator(dialect: SchemaDialect): BaseValidator { switch (dialect) { diff --git a/src/languageservice/parser/yaml-documents.ts b/src/languageservice/parser/yaml-documents.ts index b83d164a1..dc831ff89 100644 --- a/src/languageservice/parser/yaml-documents.ts +++ b/src/languageservice/parser/yaml-documents.ts @@ -4,18 +4,17 @@ *--------------------------------------------------------------------------------------------*/ import { TextDocument } from 'vscode-languageserver-textdocument'; -import { JSONDocument } from './jsonDocument'; -import { Document, isNode, isPair, isScalar, LineCounter, Node, visit, YAMLError } from 'yaml'; -import { ASTNode, YamlNode } from '../jsonASTTypes'; -import { defaultOptions, parse as parseYAML, ParserOptions } from './yamlParser07'; +import { JSONDocument } from './jsonDocument.ts'; +import { CST, Document, isNode, isPair, isScalar, LineCounter, Node, visit, YAMLError } from 'yaml'; +import { ASTNode, YamlNode } from '../jsonASTTypes.ts'; +import { defaultOptions, parse as parseYAML, ParserOptions } from './yamlParser07.ts'; import { ErrorCode } from 'vscode-json-languageservice'; -import { convertAST } from './ast-converter'; -import { YAMLDocDiagnostic } from '../utils/parseUtils'; -import { isArrayEqual } from '../utils/arrUtils'; -import { getParent } from '../utils/yamlAstUtils'; -import { TextBuffer } from '../utils/textBuffer'; -import { getIndentation } from '../utils/strings'; -import { Token } from 'yaml/dist/parse/cst'; +import { convertAST } from './ast-converter.ts'; +import { YAMLDocDiagnostic } from '../utils/parseUtils.ts'; +import { isArrayEqual } from '../utils/arrUtils.ts'; +import { getParent } from '../utils/yamlAstUtils.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; +import { getIndentation } from '../utils/strings.ts'; /** * These documents are collected into a final YAMLDocument @@ -241,12 +240,12 @@ export class SingleYAMLDocument extends JSONDocument { */ export class YAMLDocument { documents: SingleYAMLDocument[]; - tokens: Token[]; + tokens: CST.Token[]; private errors: YAMLDocDiagnostic[]; private warnings: YAMLDocDiagnostic[]; - constructor(documents: SingleYAMLDocument[], tokens: Token[]) { + constructor(documents: SingleYAMLDocument[], tokens: CST.Token[]) { this.documents = documents; this.tokens = tokens; this.errors = []; diff --git a/src/languageservice/parser/yamlParser07.ts b/src/languageservice/parser/yamlParser07.ts index 1f39a8220..7ebac6a41 100644 --- a/src/languageservice/parser/yamlParser07.ts +++ b/src/languageservice/parser/yamlParser07.ts @@ -5,10 +5,10 @@ *--------------------------------------------------------------------------------------------*/ import { Parser, Composer, Document, LineCounter, ParseOptions, DocumentOptions, SchemaOptions } from 'yaml'; -import { YAMLDocument, SingleYAMLDocument } from './yaml-documents'; -import { getCustomTags } from './custom-tag-provider'; +import { YAMLDocument, SingleYAMLDocument } from './yaml-documents.ts'; +import { getCustomTags } from './custom-tag-provider.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { TextBuffer } from '../utils/textBuffer'; +import { TextBuffer } from '../utils/textBuffer.ts'; export { YAMLDocument, SingleYAMLDocument }; diff --git a/src/languageservice/services/documentSymbols.ts b/src/languageservice/services/documentSymbols.ts index ebf0f9cf6..f8ac72e82 100644 --- a/src/languageservice/services/documentSymbols.ts +++ b/src/languageservice/services/documentSymbols.ts @@ -5,12 +5,12 @@ *--------------------------------------------------------------------------------------------*/ import { SymbolInformation, DocumentSymbol } from 'vscode-languageserver-types'; -import { YAMLSchemaService } from './yamlSchemaService'; -import { JSONDocumentSymbols } from 'vscode-json-languageservice/lib/umd/services/jsonDocumentSymbols'; -import { DocumentSymbolsContext } from 'vscode-json-languageservice/lib/umd/jsonLanguageTypes'; +import { YAMLSchemaService } from './yamlSchemaService.ts'; +import { JSONDocumentSymbols } from 'vscode-json-languageservice/lib/umd/services/jsonDocumentSymbols.js'; +import { DocumentSymbolsContext } from 'vscode-json-languageservice/lib/umd/jsonLanguageTypes.js'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { Telemetry } from '../telemetry'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { Telemetry } from '../telemetry.ts'; import { isMap, isSeq, Node } from 'yaml'; export class YAMLDocumentSymbols { diff --git a/src/languageservice/services/k8sSchemaUtil.ts b/src/languageservice/services/k8sSchemaUtil.ts index f29413221..226e619dc 100644 --- a/src/languageservice/services/k8sSchemaUtil.ts +++ b/src/languageservice/services/k8sSchemaUtil.ts @@ -1,9 +1,9 @@ -import { JSONDocument } from '../parser/jsonDocument'; -import { SingleYAMLDocument } from '../parser/yamlParser07'; +import { JSONDocument } from '../parser/jsonDocument.ts'; +import { SingleYAMLDocument } from '../parser/yamlParser07.ts'; -import { ResolvedSchema } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService'; -import { JSONSchema } from '../jsonSchema'; -import { BASE_KUBERNETES_SCHEMA_URL } from '../utils/schemaUrls'; +import { ResolvedSchema } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService.ts'; +import { JSONSchema } from '../jsonSchema.ts'; +import { BASE_KUBERNETES_SCHEMA_URL } from '../utils/schemaUrls.ts'; /** * Attempt to retrieve the schema for a given YAML document based on the Kubernetes GroupVersionKind (GVK). diff --git a/src/languageservice/services/modelineUtil.ts b/src/languageservice/services/modelineUtil.ts index 091935bb4..4413519a2 100644 --- a/src/languageservice/services/modelineUtil.ts +++ b/src/languageservice/services/modelineUtil.ts @@ -3,8 +3,8 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SingleYAMLDocument } from '../parser/yamlParser07'; -import { JSONDocument } from '../parser/jsonDocument'; +import { SingleYAMLDocument } from '../parser/yamlParser07.ts'; +import { JSONDocument } from '../parser/jsonDocument.ts'; /** * Retrieve schema if declared as modeline. diff --git a/src/languageservice/services/schemaRequestHandler.ts b/src/languageservice/services/schemaRequestHandler.ts index 44d822109..df0c244fc 100644 --- a/src/languageservice/services/schemaRequestHandler.ts +++ b/src/languageservice/services/schemaRequestHandler.ts @@ -1,11 +1,12 @@ import { join } from 'path'; -import { getErrorStatusDescription, xhr, XHRResponse } from 'request-light'; +import type { XHRResponse } from 'request-light'; +import { getErrorStatusDescription, xhr } from 'request-light'; import * as URL from 'url'; import { Connection, RequestType, WorkspaceFolder } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; -import { CustomSchemaContentRequest, VSCodeContentRequest } from '../../requestTypes'; -import { isRelativePath, relativeToAbsolutePath } from '../utils/paths'; -import { WorkspaceContextService } from '../yamlLanguageService'; +import { CustomSchemaContentRequest, VSCodeContentRequest } from '../../requestTypes.ts'; +import { isRelativePath, relativeToAbsolutePath } from '../utils/paths.ts'; +import { WorkspaceContextService } from '../yamlLanguageService.ts'; export interface FileSystem { readFile(fsPath: string, encoding?: string): Promise; diff --git a/src/languageservice/services/validation/map-key-order.ts b/src/languageservice/services/validation/map-key-order.ts index a3d350d5f..f87685247 100644 --- a/src/languageservice/services/validation/map-key-order.ts +++ b/src/languageservice/services/validation/map-key-order.ts @@ -5,10 +5,9 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types'; -import { isMap, Node, Pair, visit } from 'yaml'; -import { SingleYAMLDocument } from '../../parser/yaml-documents'; -import { AdditionalValidator } from './types'; -import { SourceToken } from 'yaml/dist/parse/cst'; +import { CST, isMap, Node, Pair, visit } from 'yaml'; +import { SingleYAMLDocument } from '../../parser/yaml-documents.ts'; +import { AdditionalValidator } from './types.ts'; export class MapKeyOrderValidator implements AdditionalValidator { validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[] { @@ -38,7 +37,7 @@ export class MapKeyOrderValidator implements AdditionalValidator { } function createRange(document: TextDocument, node: Pair): Range { - const keySourceToken = (node.key as Node).srcToken as SourceToken; + const keySourceToken = (node.key as Node).srcToken as CST.SourceToken; const start = keySourceToken.offset; const end = start + keySourceToken.source.length; return Range.create(document.positionAt(start), document.positionAt(end)); diff --git a/src/languageservice/services/validation/types.ts b/src/languageservice/services/validation/types.ts index c31bcfaad..18cfaa5be 100644 --- a/src/languageservice/services/validation/types.ts +++ b/src/languageservice/services/validation/types.ts @@ -5,7 +5,7 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic } from 'vscode-languageserver-types'; -import { SingleYAMLDocument } from '../../parser/yaml-documents'; +import { SingleYAMLDocument } from '../../parser/yaml-documents.ts'; export interface AdditionalValidator { validate(document: TextDocument, yamlDoc: SingleYAMLDocument): Diagnostic[]; diff --git a/src/languageservice/services/validation/unused-anchors.ts b/src/languageservice/services/validation/unused-anchors.ts index 34eb8edad..38078efdf 100644 --- a/src/languageservice/services/validation/unused-anchors.ts +++ b/src/languageservice/services/validation/unused-anchors.ts @@ -6,10 +6,10 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic, DiagnosticSeverity, DiagnosticTag, Range } from 'vscode-languageserver-types'; import { isAlias, isCollection, isNode, isScalar, Node, Scalar, visit, YAMLMap, YAMLSeq, CST, Pair } from 'yaml'; -import { YamlNode } from '../../jsonASTTypes'; -import { SingleYAMLDocument } from '../../parser/yaml-documents'; -import { AdditionalValidator } from './types'; -import { isCollectionItem } from '../../utils/yamlAstUtils'; +import { YamlNode } from '../../jsonASTTypes.ts'; +import { SingleYAMLDocument } from '../../parser/yaml-documents.ts'; +import { AdditionalValidator } from './types.ts'; +import { isCollectionItem } from '../../utils/yamlAstUtils.ts'; import * as l10n from '@vscode/l10n'; export class UnusedAnchorsValidator implements AdditionalValidator { @@ -79,7 +79,7 @@ export class UnusedAnchorsValidator implements AdditionalValidator { if (parentNode && parentNode.srcToken) { const token = parentNode.srcToken; if (isCollectionItem(token)) { - return getAnchorFromCollectionItem(token); + return getAnchorFromCollectionItem(token); } else if (CST.isCollection(token)) { for (const t of token.items) { if (node.srcToken !== t.value) continue; diff --git a/src/languageservice/services/validation/yaml-style.ts b/src/languageservice/services/validation/yaml-style.ts index b1c20aaf1..7c6a1e639 100644 --- a/src/languageservice/services/validation/yaml-style.ts +++ b/src/languageservice/services/validation/yaml-style.ts @@ -1,10 +1,9 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Diagnostic, DiagnosticSeverity, Range } from 'vscode-languageserver-types'; -import { isMap, isSeq, visit } from 'yaml'; -import { FlowCollection } from 'yaml/dist/parse/cst'; -import { SingleYAMLDocument } from '../../parser/yaml-documents'; -import { LanguageSettings } from '../../yamlLanguageService'; -import { AdditionalValidator } from './types'; +import { CST, isMap, isSeq, visit } from 'yaml'; +import { SingleYAMLDocument } from '../../parser/yaml-documents.ts'; +import { LanguageSettings } from '../../yamlLanguageService.ts'; +import { AdditionalValidator } from './types.ts'; import * as l10n from '@vscode/l10n'; export class YAMLStyleValidator implements AdditionalValidator { @@ -42,7 +41,7 @@ export class YAMLStyleValidator implements AdditionalValidator { return result; } - private getRangeOf(document: TextDocument, node: FlowCollection): Range { + private getRangeOf(document: TextDocument, node: CST.FlowCollection): Range { const endOffset = node.end[0].offset; let endPosition = document.positionAt(endOffset); endPosition = { character: endPosition.character + 1, line: endPosition.line }; diff --git a/src/languageservice/services/yamlCodeActions.ts b/src/languageservice/services/yamlCodeActions.ts index 68a51387c..1b899f449 100644 --- a/src/languageservice/services/yamlCodeActions.ts +++ b/src/languageservice/services/yamlCodeActions.ts @@ -20,21 +20,20 @@ import { ClientCapabilities, CodeActionParams } from 'vscode-languageserver-prot import { TextDocument } from 'vscode-languageserver-textdocument'; import { CST, isMap, isSeq, isScalar, Scalar, visit, YAMLMap } from 'yaml'; -import { SourceToken } from 'yaml/dist/parse/cst'; -import { YamlCommands } from '../../commands'; -import { TextBuffer } from '../utils/textBuffer'; -import { toYamlStringScalar } from '../utils/yamlScalar'; -import { LanguageSettings } from '../yamlLanguageService'; -import { YAML_SOURCE } from '../parser/schemaValidation/baseValidator'; -import { getFirstNonWhitespaceCharacterAfterOffset } from '../utils/strings'; -import { matchOffsetToDocument } from '../utils/arrUtils'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; +import { YamlCommands } from '../../commands.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; +import { toYamlStringScalar } from '../utils/yamlScalar.ts'; +import { LanguageSettings } from '../yamlLanguageService.ts'; +import { YAML_SOURCE } from '../parser/schemaValidation/baseValidator.ts'; +import { getFirstNonWhitespaceCharacterAfterOffset } from '../utils/strings.ts'; +import { matchOffsetToDocument } from '../utils/arrUtils.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; -import { BlockStringRewriter } from '../utils/block-string-rewriter'; -import { FlowStyleRewriter } from '../utils/flow-style-rewriter'; +import { BlockStringRewriter } from '../utils/block-string-rewriter.ts'; +import { FlowStyleRewriter } from '../utils/flow-style-rewriter.ts'; -import { ASTNode } from '../jsonASTTypes'; +import { ASTNode } from '../jsonASTTypes.ts'; interface YamlDiagnosticData { schemaUri: string[]; @@ -313,12 +312,12 @@ export class YamlCodeActions { if (node && isMap(node.internalNode)) { const sorted: YAMLMap = structuredClone(node.internalNode); - const _getTrailingTokens = (value: CST.Token): SourceToken[] => { + const _getTrailingTokens = (value: CST.Token): CST.SourceToken[] => { if (!value) return; if (CST.isScalar(value)) { if (value.type === 'block-scalar') { value.props ??= []; - return value.props as SourceToken[]; + return value.props as CST.SourceToken[]; } value.end ??= []; return value.end; @@ -364,7 +363,7 @@ export class YamlCodeActions { _getTrailingTokens(uItem.value)?.find((p) => p.type === 'newline' && p.offset < node.offset + node.length) ?? null; if (uNewLineToken && itemNewLineIndex < 0 && itemTokens) { - itemTokens.push({ type: 'newline', indent: 0, offset: item.value.offset, source: '\n' } as SourceToken); + itemTokens.push({ type: 'newline', indent: 0, offset: item.value.offset, source: '\n' } as CST.SourceToken); } if (!uNewLineToken && itemNewLineIndex > -1 && itemTokens) { itemTokens.splice(itemNewLineIndex, 1); diff --git a/src/languageservice/services/yamlCodeLens.ts b/src/languageservice/services/yamlCodeLens.ts index a1a43c3fd..4a248f61d 100644 --- a/src/languageservice/services/yamlCodeLens.ts +++ b/src/languageservice/services/yamlCodeLens.ts @@ -5,13 +5,13 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { CodeLens, Range } from 'vscode-languageserver-types'; -import { YamlCommands } from '../../commands'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { YAMLSchemaService } from './yamlSchemaService'; -import { JSONSchema } from '../jsonSchema'; -import { Telemetry } from '../telemetry'; -import { getSchemaUrls } from '../utils/schemaUrls'; -import { getSchemaTitle } from '../utils/schemaUtils'; +import { YamlCommands } from '../../commands.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { YAMLSchemaService } from './yamlSchemaService.ts'; +import { JSONSchema } from '../jsonSchema.ts'; +import { Telemetry } from '../telemetry.ts'; +import { getSchemaUrls } from '../utils/schemaUrls.ts'; +import { getSchemaTitle } from '../utils/schemaUtils.ts'; export class YamlCodeLens { constructor( diff --git a/src/languageservice/services/yamlCommands.ts b/src/languageservice/services/yamlCommands.ts index 28307bd7b..de9483dd2 100644 --- a/src/languageservice/services/yamlCommands.ts +++ b/src/languageservice/services/yamlCommands.ts @@ -4,8 +4,8 @@ *--------------------------------------------------------------------------------------------*/ import { Connection } from 'vscode-languageserver'; -import { YamlCommands } from '../../commands'; -import { CommandExecutor } from '../../languageserver/commandExecutor'; +import { YamlCommands } from '../../commands.ts'; +import { CommandExecutor } from '../../languageserver/commandExecutor.ts'; import { URI } from 'vscode-uri'; export function registerCommands(commandExecutor: CommandExecutor, connection: Connection): void { diff --git a/src/languageservice/services/yamlCompletion.ts b/src/languageservice/services/yamlCompletion.ts index 06a3d5eff..a412211dd 100644 --- a/src/languageservice/services/yamlCompletion.ts +++ b/src/languageservice/services/yamlCompletion.ts @@ -3,8 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextDocument } from 'vscode-languageserver-textdocument'; +import * as l10n from '@vscode/l10n'; +import { ResolvedSchema } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService.ts'; import { ClientCapabilities } from 'vscode-languageserver'; +import { TextDocument } from 'vscode-languageserver-textdocument'; import { CompletionItem as CompletionItemBase, CompletionItemKind, @@ -17,29 +19,27 @@ import { Range, TextEdit, } from 'vscode-languageserver-types'; -import { Node, isPair, isScalar, isMap, YAMLMap, isSeq, YAMLSeq, isNode, Pair } from 'yaml'; -import { parseCustomTag } from '../utils/customTags'; -import { Telemetry } from '../telemetry'; -import { SingleYAMLDocument, YamlDocuments } from '../parser/yaml-documents'; -import { YamlVersion } from '../parser/yamlParser07'; -import { matchOffsetToDocument } from '../utils/arrUtils'; -import { guessIndentation } from '../utils/indentationGuesser'; -import { TextBuffer } from '../utils/textBuffer'; -import { LanguageSettings } from '../yamlLanguageService'; -import { YAMLSchemaService } from './yamlSchemaService'; -import { ResolvedSchema } from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService'; -import { JSONSchema, JSONSchemaRef } from '../jsonSchema'; -import { stringifyObject, StringifySettings } from '../utils/json'; -import { isDefined, isString } from '../utils/objects'; -import { setKubernetesParserOption } from '../parser/isKubernetes'; -import { asSchema } from '../parser/schemaValidation/baseValidator'; -import { indexOf, isInComment, isMapContainsEmptyPair } from '../utils/yamlAstUtils'; -import { isModeline } from './modelineUtil'; -import { getSchemaTypeName, isAnyOfAllOfOneOfType, isPrimitiveType } from '../utils/schemaUtils'; -import { YamlNode } from '../jsonASTTypes'; -import { SettingsState } from '../../yamlSettings'; -import { toYamlStringScalar } from '../utils/yamlScalar'; -import * as l10n from '@vscode/l10n'; +import { isMap, isNode, isPair, isScalar, isSeq, Node, Pair, YAMLMap, YAMLSeq } from 'yaml'; +import { SettingsState } from '../../yamlSettings.ts'; +import { YamlNode } from '../jsonASTTypes.ts'; +import { JSONSchema, JSONSchemaRef } from '../jsonSchema.ts'; +import { setKubernetesParserOption } from '../parser/isKubernetes.ts'; +import { asSchema } from '../parser/schemaValidation/baseValidator.ts'; +import { SingleYAMLDocument, YamlDocuments } from '../parser/yaml-documents.ts'; +import { YamlVersion } from '../parser/yamlParser07.ts'; +import { Telemetry } from '../telemetry.ts'; +import { matchOffsetToDocument } from '../utils/arrUtils.ts'; +import { guessIndentation } from '../utils/indentationGuesser.ts'; +import { stringifyObject, StringifySettings } from '../utils/json.ts'; +import { isDefined, isString } from '../utils/objects.ts'; +import { getSchemaTypeName, isAnyOfAllOfOneOfType, isPrimitiveType } from '../utils/schemaUtils.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; +import { indexOf, isInComment, isMapContainsEmptyPair } from '../utils/yamlAstUtils.ts'; +import { toYamlStringScalar } from '../utils/yamlScalar.ts'; +import { LanguageSettings } from '../yamlLanguageService.ts'; +import { isModeline } from './modelineUtil.ts'; +import { YAMLSchemaService } from './yamlSchemaService.ts'; +import { parseCustomTag } from '../utils/customTags.ts'; const parentCompletionKind = CompletionItemKind.Class; diff --git a/src/languageservice/services/yamlDefinition.ts b/src/languageservice/services/yamlDefinition.ts index 8b9261344..24b59edc5 100644 --- a/src/languageservice/services/yamlDefinition.ts +++ b/src/languageservice/services/yamlDefinition.ts @@ -7,10 +7,10 @@ import { DefinitionParams } from 'vscode-languageserver-protocol'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { DefinitionLink, LocationLink, Range } from 'vscode-languageserver-types'; import { isAlias } from 'yaml'; -import { Telemetry } from '../telemetry'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { matchOffsetToDocument } from '../utils/arrUtils'; -import { TextBuffer } from '../utils/textBuffer'; +import { Telemetry } from '../telemetry.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { matchOffsetToDocument } from '../utils/arrUtils.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; export class YamlDefinition { constructor(private readonly telemetry?: Telemetry) {} diff --git a/src/languageservice/services/yamlFolding.ts b/src/languageservice/services/yamlFolding.ts index bada72d52..d933273a4 100644 --- a/src/languageservice/services/yamlFolding.ts +++ b/src/languageservice/services/yamlFolding.ts @@ -3,9 +3,9 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { FoldingRange, Range } from 'vscode-languageserver-types'; -import { FoldingRangesContext } from '../yamlTypes'; -import { ASTNode } from '../jsonASTTypes'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; +import { FoldingRangesContext } from '../yamlTypes.ts'; +import { ASTNode } from '../jsonASTTypes.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; export function getFoldingRanges(document: TextDocument, context: FoldingRangesContext): FoldingRange[] | undefined { diff --git a/src/languageservice/services/yamlFormatter.ts b/src/languageservice/services/yamlFormatter.ts index 0ac7285f9..aded384ac 100644 --- a/src/languageservice/services/yamlFormatter.ts +++ b/src/languageservice/services/yamlFormatter.ts @@ -5,11 +5,11 @@ *--------------------------------------------------------------------------------------------*/ import { Range, Position, TextEdit, FormattingOptions } from 'vscode-languageserver-types'; -import { CustomFormatterOptions, LanguageSettings } from '../yamlLanguageService'; +import { CustomFormatterOptions, LanguageSettings } from '../yamlLanguageService.ts'; import { Options } from 'prettier'; -import * as yamlPlugin from 'prettier/plugins/yaml'; -import * as estreePlugin from 'prettier/plugins/estree'; -import { format } from 'prettier/standalone'; +import * as yamlPlugin from 'prettier/plugins/yaml.js'; +import * as estreePlugin from 'prettier/plugins/estree.js'; +import { format } from 'prettier/standalone.js'; import { TextDocument } from 'vscode-languageserver-textdocument'; export class YAMLFormatter { diff --git a/src/languageservice/services/yamlHover.ts b/src/languageservice/services/yamlHover.ts index fdaa1eac7..3bd68c22e 100644 --- a/src/languageservice/services/yamlHover.ts +++ b/src/languageservice/services/yamlHover.ts @@ -10,18 +10,18 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Hover, MarkupContent, MarkupKind, Position, Range } from 'vscode-languageserver-types'; import { URI } from 'vscode-uri'; import { isAlias, isMap, isSeq, Node, stringify as stringifyYAML } from 'yaml'; -import { ASTNode, ObjectASTNode, PropertyASTNode } from '../jsonASTTypes'; -import { JSONSchema } from '../jsonSchema'; -import { setKubernetesParserOption } from '../parser/isKubernetes'; -import { getNodeValue } from '../parser/astNodeUtils'; -import { IApplicableSchema } from '../parser/schemaValidation/baseValidator'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { SingleYAMLDocument } from '../parser/yamlParser07'; -import { Telemetry } from '../telemetry'; -import { matchOffsetToDocument } from '../utils/arrUtils'; -import { toYamlStringScalar } from '../utils/yamlScalar'; -import { LanguageSettings } from '../yamlLanguageService'; -import { YAMLSchemaService } from './yamlSchemaService'; +import { ASTNode, ObjectASTNode, PropertyASTNode } from '../jsonASTTypes.ts'; +import { JSONSchema } from '../jsonSchema.ts'; +import { setKubernetesParserOption } from '../parser/isKubernetes.ts'; +import { getNodeValue } from '../parser/astNodeUtils.ts'; +import { IApplicableSchema } from '../parser/schemaValidation/baseValidator.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { SingleYAMLDocument } from '../parser/yamlParser07.ts'; +import { Telemetry } from '../telemetry.ts'; +import { matchOffsetToDocument } from '../utils/arrUtils.ts'; +import { toYamlStringScalar } from '../utils/yamlScalar.ts'; +import { LanguageSettings } from '../yamlLanguageService.ts'; +import { YAMLSchemaService } from './yamlSchemaService.ts'; export class YAMLHover { private shouldHover: boolean; diff --git a/src/languageservice/services/yamlLinks.ts b/src/languageservice/services/yamlLinks.ts index eac352e09..0da66b0dc 100644 --- a/src/languageservice/services/yamlLinks.ts +++ b/src/languageservice/services/yamlLinks.ts @@ -2,11 +2,11 @@ * Copyright (c) Red Hat, Inc. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { findLinks as JSONFindLinks } from 'vscode-json-languageservice/lib/umd/services/jsonLinks'; +import { findLinks as JSONFindLinks } from 'vscode-json-languageservice/lib/umd/services/jsonLinks.js'; import { DocumentLink } from 'vscode-languageserver-types'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { Telemetry } from '../telemetry'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; +import { Telemetry } from '../telemetry.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; export class YamlLinks { constructor(private readonly telemetry?: Telemetry) {} diff --git a/src/languageservice/services/yamlOnTypeFormatting.ts b/src/languageservice/services/yamlOnTypeFormatting.ts index e46238dbb..9d57296e8 100644 --- a/src/languageservice/services/yamlOnTypeFormatting.ts +++ b/src/languageservice/services/yamlOnTypeFormatting.ts @@ -6,7 +6,7 @@ import { DocumentOnTypeFormattingParams } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { Position, Range, TextEdit } from 'vscode-languageserver-types'; -import { TextBuffer } from '../utils/textBuffer'; +import { TextBuffer } from '../utils/textBuffer.ts'; export function doDocumentOnTypeFormatting( document: TextDocument, diff --git a/src/languageservice/services/yamlRename.ts b/src/languageservice/services/yamlRename.ts index 2bf4b477b..dae883934 100644 --- a/src/languageservice/services/yamlRename.ts +++ b/src/languageservice/services/yamlRename.ts @@ -5,19 +5,18 @@ import { TextDocument } from 'vscode-languageserver-textdocument'; import { Position, Range, WorkspaceEdit, TextEdit } from 'vscode-languageserver-types'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { matchOffsetToDocument } from '../utils/arrUtils'; -import { TextBuffer } from '../utils/textBuffer'; -import { Telemetry } from '../telemetry'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { matchOffsetToDocument } from '../utils/arrUtils.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; +import { Telemetry } from '../telemetry.ts'; import { CST, isAlias, isCollection, isScalar, visit, Node } from 'yaml'; -import { SourceToken, CollectionItem } from 'yaml/dist/parse/cst'; -import { SingleYAMLDocument } from '../parser/yamlParser07'; -import { isCollectionItem } from '../utils/yamlAstUtils'; +import { SingleYAMLDocument } from '../parser/yamlParser07.ts'; +import { isCollectionItem } from '../utils/yamlAstUtils.ts'; import { PrepareRenameParams, RenameParams, ResponseError, ErrorCodes } from 'vscode-languageserver-protocol'; interface RenameTarget { anchorNode: Node; - token: SourceToken; + token: CST.SourceToken; yamlDoc: SingleYAMLDocument; } @@ -64,7 +63,7 @@ export class YamlRename { visit(target.yamlDoc.internalDocument, (key, node) => { if (isAlias(node) && node.srcToken && node.resolve(target.yamlDoc.internalDocument) === target.anchorNode) { - edits.push(TextEdit.replace(this.getNameRange(document, node.srcToken as SourceToken), newName)); + edits.push(TextEdit.replace(this.getNameRange(document, node.srcToken as CST.SourceToken), newName)); } }); @@ -95,12 +94,12 @@ export class YamlRename { return this.findByToken(yamlDoc, offset); } - if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken as SourceToken, offset)) { + if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken as CST.SourceToken, offset)) { const anchorNode = node.resolve(yamlDoc.internalDocument); if (!anchorNode) { return null; } - return { anchorNode, token: node.srcToken as SourceToken, yamlDoc }; + return { anchorNode, token: node.srcToken as CST.SourceToken, yamlDoc }; } if ((isCollection(node) || isScalar(node)) && node.anchor) { @@ -116,10 +115,10 @@ export class YamlRename { private findByToken(yamlDoc: SingleYAMLDocument, offset: number): RenameTarget | null { let target: RenameTarget; visit(yamlDoc.internalDocument, (key, node) => { - if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken as SourceToken, offset)) { + if (isAlias(node) && node.srcToken && this.isOffsetInsideToken(node.srcToken as CST.SourceToken, offset)) { const anchorNode = node.resolve(yamlDoc.internalDocument); if (anchorNode) { - target = { anchorNode, token: node.srcToken as SourceToken, yamlDoc }; + target = { anchorNode, token: node.srcToken as CST.SourceToken, yamlDoc }; return visit.BREAK; } } @@ -135,14 +134,14 @@ export class YamlRename { return target ?? null; } - private findAnchorToken(yamlDoc: SingleYAMLDocument, node: Node): SourceToken | undefined { + private findAnchorToken(yamlDoc: SingleYAMLDocument, node: Node): CST.SourceToken | undefined { const parent = yamlDoc.getParent(node); const candidates = []; - if (parent && (parent as unknown as { srcToken?: SourceToken }).srcToken) { - candidates.push((parent as unknown as { srcToken: SourceToken }).srcToken); + if (parent && (parent as unknown as { srcToken?: CST.SourceToken }).srcToken) { + candidates.push((parent as unknown as { srcToken: CST.SourceToken }).srcToken); } - if ((node as unknown as { srcToken?: SourceToken }).srcToken) { - candidates.push((node as unknown as { srcToken: SourceToken }).srcToken); + if ((node as unknown as { srcToken?: CST.SourceToken }).srcToken) { + candidates.push((node as unknown as { srcToken: CST.SourceToken }).srcToken); } for (const token of candidates) { @@ -155,13 +154,13 @@ export class YamlRename { return undefined; } - private getAnchorFromToken(token: SourceToken, node: Node): SourceToken | undefined { + private getAnchorFromToken(token: CST.SourceToken, node: Node): CST.SourceToken | undefined { if (isCollectionItem(token)) { return this.getAnchorFromCollectionItem(token); } else if (CST.isCollection(token)) { - const collection = token as unknown as { items?: CollectionItem[] }; + const collection = token as unknown as { items?: CST.CollectionItem[] }; for (const item of collection.items ?? []) { - if (item.value !== (node as unknown as { srcToken?: SourceToken }).srcToken) { + if (item.value !== (node as unknown as { srcToken?: CST.SourceToken }).srcToken) { continue; } const anchor = this.getAnchorFromCollectionItem(item); @@ -173,7 +172,7 @@ export class YamlRename { return undefined; } - private getAnchorFromCollectionItem(token: CollectionItem): SourceToken | undefined { + private getAnchorFromCollectionItem(token: CST.CollectionItem): CST.SourceToken | undefined { for (const t of token.start) { if (t.type === 'anchor') { return t; @@ -189,13 +188,13 @@ export class YamlRename { return undefined; } - private getNameRange(document: TextDocument, token: SourceToken): Range { + private getNameRange(document: TextDocument, token: CST.SourceToken): Range { const startOffset = token.offset + 1; const endOffset = token.offset + token.source.length; return Range.create(document.positionAt(startOffset), document.positionAt(endOffset)); } - private isOffsetInsideToken(token: SourceToken, offset: number): boolean { + private isOffsetInsideToken(token: CST.SourceToken, offset: number): boolean { return offset >= token.offset && offset <= token.offset + token.source.length; } diff --git a/src/languageservice/services/yamlSchemaService.ts b/src/languageservice/services/yamlSchemaService.ts index 454538256..99f7f6e17 100644 --- a/src/languageservice/services/yamlSchemaService.ts +++ b/src/languageservice/services/yamlSchemaService.ts @@ -11,31 +11,31 @@ import { SchemaDependencies, SchemaHandle, UnresolvedSchema, -} from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService'; -import { SettingsState } from '../../yamlSettings'; -import { JSONSchema, JSONSchemaMap, JSONSchemaRef, SchemaDialect } from '../jsonSchema'; -import { SchemaPriority, SchemaRequestService, WorkspaceContextService } from '../yamlLanguageService'; +} from 'vscode-json-languageservice/lib/umd/services/jsonSchemaService.js'; +import { SettingsState } from '../../yamlSettings.ts'; +import { JSONSchema, JSONSchemaMap, JSONSchemaRef, SchemaDialect } from '../jsonSchema.ts'; +import { SchemaPriority, SchemaRequestService, WorkspaceContextService } from '../yamlLanguageService.ts'; import * as l10n from '@vscode/l10n'; import * as path from 'path'; import { URI } from 'vscode-uri'; -import { JSONSchemaDescriptionExt } from '../../requestTypes'; -import { JSONDocument } from '../parser/jsonDocument'; -import { SingleYAMLDocument } from '../parser/yamlParser07'; -import { SchemaVersions } from '../yamlTypes'; -import { getSchemaFromModeline } from './modelineUtil'; +import { JSONSchemaDescriptionExt } from '../../requestTypes.ts'; +import { JSONDocument } from '../parser/jsonDocument.ts'; +import { SingleYAMLDocument } from '../parser/yamlParser07.ts'; +import { SchemaVersions } from '../yamlTypes.ts'; +import { getSchemaFromModeline } from './modelineUtil.ts'; -import Ajv, { DefinedError, type AnySchemaObject, type ErrorObject, type ValidateFunction } from 'ajv'; +import { Ajv, DefinedError, type AnySchemaObject, type ErrorObject, type ValidateFunction } from 'ajv'; import Ajv4 from 'ajv-draft-04'; -import Ajv2019 from 'ajv/dist/2019'; -import Ajv2020 from 'ajv/dist/2020'; -import type { Localize } from 'ajv-i18n/localize/types'; +import { Ajv2019 } from 'ajv/dist/2019.js'; +import { Ajv2020 } from 'ajv/dist/2020.js'; +import type { Localize } from 'ajv-i18n/localize/types.js'; import * as Json from 'jsonc-parser'; import { parse } from 'yaml'; -import { CRD_CATALOG_URL, EMPTY_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../utils/schemaUrls'; -import { autoDetectKubernetesSchema } from './k8sSchemaUtil'; +import { CRD_CATALOG_URL, EMPTY_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../utils/schemaUrls.ts'; +import { autoDetectKubernetesSchema } from './k8sSchemaUtil.ts'; -const ajv4 = new Ajv4({ allErrors: true }); +const ajv4 = new Ajv4.default({ allErrors: true }); const ajv7 = new Ajv({ allErrors: true }); const ajv2019 = new Ajv2019({ allErrors: true }); const ajv2020 = new Ajv2020({ allErrors: true }); diff --git a/src/languageservice/services/yamlSelectionRanges.ts b/src/languageservice/services/yamlSelectionRanges.ts index f60dcc91a..7276266bc 100644 --- a/src/languageservice/services/yamlSelectionRanges.ts +++ b/src/languageservice/services/yamlSelectionRanges.ts @@ -1,5 +1,5 @@ import { Position, Range, SelectionRange } from 'vscode-languageserver-types'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { ASTNode } from 'vscode-json-languageservice'; diff --git a/src/languageservice/services/yamlValidation.ts b/src/languageservice/services/yamlValidation.ts index 7c4b10eb2..1e7f064d1 100644 --- a/src/languageservice/services/yamlValidation.ts +++ b/src/languageservice/services/yamlValidation.ts @@ -5,21 +5,21 @@ *--------------------------------------------------------------------------------------------*/ import { Diagnostic, Position } from 'vscode-languageserver-types'; -import { LanguageSettings } from '../yamlLanguageService'; -import { YAMLDocument, YamlVersion, SingleYAMLDocument } from '../parser/yamlParser07'; -import { YAMLSchemaService } from './yamlSchemaService'; -import { YAMLDocDiagnostic } from '../utils/parseUtils'; +import { LanguageSettings } from '../yamlLanguageService.ts'; +import { YAMLDocument, YamlVersion, SingleYAMLDocument } from '../parser/yamlParser07.ts'; +import { YAMLSchemaService } from './yamlSchemaService.ts'; +import { YAMLDocDiagnostic } from '../utils/parseUtils.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { JSONValidation } from 'vscode-json-languageservice/lib/umd/services/jsonValidation'; -import { YAML_SOURCE } from '../parser/schemaValidation/baseValidator'; -import { TextBuffer } from '../utils/textBuffer'; -import { filterSuppressedDiagnostics } from '../utils/diagnostic-filter'; -import { yamlDocumentsCache } from '../parser/yaml-documents'; -import { Telemetry } from '../telemetry'; -import { AdditionalValidator } from './validation/types'; -import { UnusedAnchorsValidator } from './validation/unused-anchors'; -import { YAMLStyleValidator } from './validation/yaml-style'; -import { MapKeyOrderValidator } from './validation/map-key-order'; +import { JSONValidation } from 'vscode-json-languageservice/lib/umd/services/jsonValidation.js'; +import { YAML_SOURCE } from '../parser/schemaValidation/baseValidator.ts'; +import { TextBuffer } from '../utils/textBuffer.ts'; +import { filterSuppressedDiagnostics } from '../utils/diagnostic-filter.ts'; +import { yamlDocumentsCache } from '../parser/yaml-documents.ts'; +import { Telemetry } from '../telemetry.ts'; +import { AdditionalValidator } from './validation/types.ts'; +import { UnusedAnchorsValidator } from './validation/unused-anchors.ts'; +import { YAMLStyleValidator } from './validation/yaml-style.ts'; +import { MapKeyOrderValidator } from './validation/map-key-order.ts'; /** * Convert a YAMLDocDiagnostic to a language server Diagnostic diff --git a/src/languageservice/utils/arrUtils.ts b/src/languageservice/utils/arrUtils.ts index 0d3f80f81..39f16023a 100644 --- a/src/languageservice/utils/arrUtils.ts +++ b/src/languageservice/utils/arrUtils.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { YAMLDocument, SingleYAMLDocument } from '../parser/yamlParser07'; +import { YAMLDocument, SingleYAMLDocument } from '../parser/yamlParser07.ts'; export function getLineOffsets(textDocString: string): number[] { const lineOffsets: number[] = []; diff --git a/src/languageservice/utils/block-string-rewriter.ts b/src/languageservice/utils/block-string-rewriter.ts index 17e4a9755..22cca3e4f 100644 --- a/src/languageservice/utils/block-string-rewriter.ts +++ b/src/languageservice/utils/block-string-rewriter.ts @@ -3,7 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { CST, Scalar } from 'yaml'; -import { FlowScalar } from 'yaml/dist/parse/cst'; export class BlockStringRewriter { constructor( @@ -17,7 +16,7 @@ export class BlockStringRewriter { } const stringContent = node.value; - const currentIndentNum = (node.srcToken as FlowScalar).indent; + const currentIndentNum = (node.srcToken as CST.FlowScalar).indent; let indentText = this.indentation; for (let i = 0; i < currentIndentNum / this.indentation.length; i++) { indentText += this.indentation; @@ -160,7 +159,7 @@ export class BlockStringRewriter { if (stringContent.indexOf('\n') < 0) { return null; } - const currentIndentNum = (node.srcToken as FlowScalar).indent; + const currentIndentNum = (node.srcToken as CST.FlowScalar).indent; let indentText = this.indentation; for (let i = 0; i < currentIndentNum / this.indentation.length; i++) { indentText += this.indentation; diff --git a/src/languageservice/utils/filePatternAssociation.ts b/src/languageservice/utils/filePatternAssociation.ts index 7edba5d42..7e39cf8ce 100644 --- a/src/languageservice/utils/filePatternAssociation.ts +++ b/src/languageservice/utils/filePatternAssociation.ts @@ -1,4 +1,4 @@ -import { convertSimple2RegExpPattern } from './strings'; +import { convertSimple2RegExpPattern } from './strings.ts'; export class FilePatternAssociation { private schemas: string[]; diff --git a/src/languageservice/utils/flow-style-rewriter.ts b/src/languageservice/utils/flow-style-rewriter.ts index 6e977203d..54506d6c9 100644 --- a/src/languageservice/utils/flow-style-rewriter.ts +++ b/src/languageservice/utils/flow-style-rewriter.ts @@ -1,6 +1,5 @@ import { CST, visit } from 'yaml'; -import { SourceToken } from 'yaml/dist/parse/cst'; -import { ASTNode } from '../jsonASTTypes'; +import { ASTNode } from '../jsonASTTypes.ts'; export class FlowStyleRewriter { constructor(private readonly indentation: string) {} @@ -23,10 +22,10 @@ export class FlowStyleRewriter { for (const item of collection.items) { CST.visit(item, ({ key, sep, value }) => { if (blockType === 'block-map') { - const start = [{ type: 'space', indent: 0, offset: key.offset, source: this.indentation } as SourceToken]; + const start = [{ type: 'space', indent: 0, offset: key.offset, source: this.indentation } as CST.SourceToken]; if (parentType === 'property') { // add a new line if part of a map - start.unshift({ type: 'newline', indent: 0, offset: key.offset, source: '\n' } as SourceToken); + start.unshift({ type: 'newline', indent: 0, offset: key.offset, source: '\n' } as CST.SourceToken); } blockStyle.items.push({ start: start, @@ -37,10 +36,10 @@ export class FlowStyleRewriter { } else if (blockType === 'block-seq') { blockStyle.items.push({ start: [ - { type: 'newline', indent: 0, offset: value.offset, source: '\n' } as SourceToken, - { type: 'space', indent: 0, offset: value.offset, source: this.indentation } as SourceToken, - { type: 'seq-item-ind', indent: 0, offset: value.offset, source: '-' } as SourceToken, - { type: 'space', indent: 0, offset: value.offset, source: ' ' } as SourceToken, + { type: 'newline', indent: 0, offset: value.offset, source: '\n' } as CST.SourceToken, + { type: 'space', indent: 0, offset: value.offset, source: this.indentation } as CST.SourceToken, + { type: 'seq-item-ind', indent: 0, offset: value.offset, source: '-' } as CST.SourceToken, + { type: 'space', indent: 0, offset: value.offset, source: ' ' } as CST.SourceToken, ], value: value, }); diff --git a/src/languageservice/utils/indentationGuesser.ts b/src/languageservice/utils/indentationGuesser.ts index 5b84a0266..272326707 100644 --- a/src/languageservice/utils/indentationGuesser.ts +++ b/src/languageservice/utils/indentationGuesser.ts @@ -5,8 +5,8 @@ //copied from https://github.com/Microsoft/vscode/blob/015c3afe96966df50c15a7d66be2ab0ef1dc5f49/src/vs/editor/common/model/indentationGuesser.ts -import { CharCode } from './charCode'; -import { TextBuffer } from './textBuffer'; +import { CharCode } from './charCode.ts'; +import { TextBuffer } from './textBuffer.ts'; class SpacesDiffResult { public spacesDiff = 0; diff --git a/src/languageservice/utils/objects.ts b/src/languageservice/utils/objects.ts index e6db971c2..42c6e8fec 100644 --- a/src/languageservice/utils/objects.ts +++ b/src/languageservice/utils/objects.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { parseYamlBoolean } from '../parser/scalar-type'; +import { parseYamlBoolean } from '../parser/scalar-type.ts'; // eslint-disable-next-line @typescript-eslint/no-explicit-any export function equals(one: any, other: any, type?: any): boolean { diff --git a/src/languageservice/utils/parseUtils.ts b/src/languageservice/utils/parseUtils.ts index 3087a4819..415f21a8a 100644 --- a/src/languageservice/utils/parseUtils.ts +++ b/src/languageservice/utils/parseUtils.ts @@ -1,4 +1,4 @@ -import { ErrorCode } from 'vscode-json-languageservice/lib/umd/jsonLanguageTypes'; +import { ErrorCode } from 'vscode-json-languageservice/lib/umd/jsonLanguageTypes.js'; export const DUPLICATE_KEY_REASON = 'duplicate key'; /** diff --git a/src/languageservice/utils/schemaUrls.ts b/src/languageservice/utils/schemaUrls.ts index 188fc4b41..b68067589 100644 --- a/src/languageservice/utils/schemaUrls.ts +++ b/src/languageservice/utils/schemaUrls.ts @@ -1,9 +1,9 @@ import { WorkspaceFolder } from 'vscode-languageserver-protocol'; import { URI } from 'vscode-uri'; -import { Telemetry } from '../telemetry'; -import { JSONSchema, JSONSchemaRef } from '../jsonSchema'; -import { isBoolean } from './objects'; -import { isRelativePath, relativeToAbsolutePath } from './paths'; +import { Telemetry } from '../telemetry.ts'; +import { JSONSchema, JSONSchemaRef } from '../jsonSchema.ts'; +import { isBoolean } from './objects.ts'; +import { isRelativePath, relativeToAbsolutePath } from './paths.ts'; export const BASE_KUBERNETES_SCHEMA_URL = 'https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.32.1-standalone-strict/'; diff --git a/src/languageservice/utils/schemaUtils.ts b/src/languageservice/utils/schemaUtils.ts index bc763fb48..51c3bedbf 100644 --- a/src/languageservice/utils/schemaUtils.ts +++ b/src/languageservice/utils/schemaUtils.ts @@ -1,5 +1,5 @@ import { URI } from 'vscode-uri'; -import { JSONSchema } from '../jsonSchema'; +import { JSONSchema } from '../jsonSchema.ts'; import * as path from 'path'; export function getSchemaTypeName(schema: JSONSchema): string { diff --git a/src/languageservice/utils/strings.ts b/src/languageservice/utils/strings.ts index 9587f6874..c0da2c1d0 100644 --- a/src/languageservice/utils/strings.ts +++ b/src/languageservice/utils/strings.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { CharCode } from './charCode'; +import { CharCode } from './charCode.ts'; export function startsWith(haystack: string, needle: string): boolean { if (haystack.length < needle.length) { diff --git a/src/languageservice/utils/yamlAstUtils.ts b/src/languageservice/utils/yamlAstUtils.ts index 9d0b33175..aee1293ab 100644 --- a/src/languageservice/utils/yamlAstUtils.ts +++ b/src/languageservice/utils/yamlAstUtils.ts @@ -3,12 +3,10 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { Document, isDocument, isScalar, Node, visit, YAMLMap, YAMLSeq } from 'yaml'; -import { CollectionItem, SourceToken, Token } from 'yaml/dist/parse/cst'; -import { VisitPath } from 'yaml/dist/parse/cst-visit'; -import { YamlNode } from '../jsonASTTypes'; +import { Document, isDocument, isScalar, Node, visit, YAMLMap, YAMLSeq, CST } from 'yaml'; +import { YamlNode } from '../jsonASTTypes.ts'; -type Visitor = (item: SourceToken, path: VisitPath) => number | symbol | Visitor | void; +type Visitor = (item: CST.SourceToken, path: CST.VisitPath) => number | symbol | Visitor | void; export function getParent(doc: Document, nodeToFind: YamlNode): YamlNode | undefined { let parentNode: Node; @@ -48,11 +46,11 @@ export function indexOf(seq: YAMLSeq, item: YamlNode): number | undefined { * @param doc the yaml document * @param offset the offset to check */ -export function isInComment(tokens: Token[], offset: number): boolean { +export function isInComment(tokens: CST.Token[], offset: number): boolean { let inComment = false; for (const token of tokens) { if (token.type === 'document') { - _visit([], token as unknown as SourceToken, (item) => { + _visit([], token as unknown as CST.SourceToken, (item) => { if (isCollectionItem(item) && item.value?.type === 'comment') { if (token.offset <= offset && item.value.source.length + item.value.offset >= offset) { inComment = true; @@ -76,11 +74,11 @@ export function isInComment(tokens: Token[], offset: number): boolean { return inComment; } -export function isCollectionItem(token: unknown): token is CollectionItem { +export function isCollectionItem(token: unknown): token is CST.CollectionItem { return token['start'] !== undefined; } -function _visit(path: VisitPath, item: SourceToken, visitor: Visitor): number | symbol | Visitor | void { +function _visit(path: CST.VisitPath, item: CST.SourceToken, visitor: Visitor): number | symbol | Visitor | void { let ctrl = visitor(item, path); if (typeof ctrl === 'symbol') return ctrl; for (const field of ['key', 'value'] as const) { diff --git a/src/languageservice/yamlLanguageService.ts b/src/languageservice/yamlLanguageService.ts index f26ea2118..e0d909d09 100644 --- a/src/languageservice/yamlLanguageService.ts +++ b/src/languageservice/yamlLanguageService.ts @@ -10,7 +10,7 @@ import { SchemaAdditions, SchemaDeletions, SchemaDeletionsAll, -} from './services/yamlSchemaService'; +} from './services/yamlSchemaService.ts'; import { Position, CodeAction, @@ -28,13 +28,13 @@ import { Range, WorkspaceEdit, } from 'vscode-languageserver-types'; -import { JSONSchema } from './jsonSchema'; -import { YAMLDocumentSymbols } from './services/documentSymbols'; -import { YAMLHover } from './services/yamlHover'; -import { YAMLValidation } from './services/yamlValidation'; -import { YAMLFormatter } from './services/yamlFormatter'; +import { JSONSchema } from './jsonSchema.ts'; +import { YAMLDocumentSymbols } from './services/documentSymbols.ts'; +import { YAMLHover } from './services/yamlHover.ts'; +import { YAMLValidation } from './services/yamlValidation.ts'; +import { YAMLFormatter } from './services/yamlFormatter.ts'; import { DocumentSymbolsContext } from 'vscode-json-languageservice'; -import { YamlLinks } from './services/yamlLinks'; +import { YamlLinks } from './services/yamlLinks.ts'; import { ClientCapabilities, CodeActionParams, @@ -45,20 +45,20 @@ import { RenameParams, } from 'vscode-languageserver'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { getFoldingRanges } from './services/yamlFolding'; -import { FoldingRangesContext, SchemaVersions } from './yamlTypes'; -import { YamlCodeActions } from './services/yamlCodeActions'; -import { doDocumentOnTypeFormatting } from './services/yamlOnTypeFormatting'; -import { YamlCodeLens } from './services/yamlCodeLens'; -import { Telemetry } from './telemetry'; -import { YamlVersion } from './parser/yamlParser07'; -import { YamlCompletion } from './services/yamlCompletion'; -import { yamlDocumentsCache } from './parser/yaml-documents'; -import { SettingsState } from '../yamlSettings'; -import { JSONSchemaSelection } from '../languageserver/handlers/schemaSelectionHandlers'; -import { YamlDefinition } from './services/yamlDefinition'; -import { getSelectionRanges } from './services/yamlSelectionRanges'; -import { YamlRename } from './services/yamlRename'; +import { getFoldingRanges } from './services/yamlFolding.ts'; +import { FoldingRangesContext, SchemaVersions } from './yamlTypes.ts'; +import { YamlCodeActions } from './services/yamlCodeActions.ts'; +import { doDocumentOnTypeFormatting } from './services/yamlOnTypeFormatting.ts'; +import { YamlCodeLens } from './services/yamlCodeLens.ts'; +import { Telemetry } from './telemetry.ts'; +import { YamlVersion } from './parser/yamlParser07.ts'; +import { YamlCompletion } from './services/yamlCompletion.ts'; +import { yamlDocumentsCache } from './parser/yaml-documents.ts'; +import { SettingsState } from '../yamlSettings.ts'; +import { JSONSchemaSelection } from '../languageserver/handlers/schemaSelectionHandlers.ts'; +import { YamlDefinition } from './services/yamlDefinition.ts'; +import { getSelectionRanges } from './services/yamlSelectionRanges.ts'; +import { YamlRename } from './services/yamlRename.ts'; export enum SchemaPriority { SchemaStore = 1, diff --git a/src/requestTypes.ts b/src/requestTypes.ts index 5cdffa1c1..e65251327 100644 --- a/src/requestTypes.ts +++ b/src/requestTypes.ts @@ -1,8 +1,8 @@ /* eslint-disable @typescript-eslint/no-namespace */ import { NotificationType, RequestType } from 'vscode-languageserver'; -import { SchemaAdditions, SchemaDeletions } from './languageservice/services/yamlSchemaService'; -import { SchemaConfiguration } from './languageservice/yamlLanguageService'; -import { SchemaVersions } from './languageservice/yamlTypes'; +import { SchemaAdditions, SchemaDeletions } from './languageservice/services/yamlSchemaService.ts'; +import { SchemaConfiguration } from './languageservice/yamlLanguageService.ts'; +import { SchemaVersions } from './languageservice/yamlTypes.ts'; export type ISchemaAssociations = Record; diff --git a/src/server.ts b/src/server.ts index 76fbfbd8b..0b0cd504f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -6,13 +6,13 @@ *--------------------------------------------------------------------------------------------*/ import { promises as fs } from 'fs'; -import { Connection, createConnection, ProposedFeatures } from 'vscode-languageserver/node'; -import { TelemetryImpl } from './languageserver/telemetry'; -import { schemaRequestHandler, workspaceContext } from './languageservice/services/schemaRequestHandler'; -import { convertErrorToTelemetryMsg } from './languageservice/utils/objects'; -import { setupl10nBundle } from './nodeTranslationSetup'; -import { YAMLServerInit } from './yamlServerInit'; -import { SettingsState } from './yamlSettings'; +import { Connection, createConnection, ProposedFeatures } from 'vscode-languageserver/node.ts'; +import { TelemetryImpl } from './languageserver/telemetry.ts'; +import { schemaRequestHandler, workspaceContext } from './languageservice/services/schemaRequestHandler.ts'; +import { convertErrorToTelemetryMsg } from './languageservice/utils/objects.ts'; +import { setupl10nBundle } from './nodeTranslationSetup.ts'; +import { YAMLServerInit } from './yamlServerInit.ts'; +import { SettingsState } from './yamlSettings.ts'; // Create a connection for the server. let connection: Connection = null; diff --git a/src/webworker/yamlServerMain.ts b/src/webworker/yamlServerMain.ts index 1ea7647c0..6b7834abd 100644 --- a/src/webworker/yamlServerMain.ts +++ b/src/webworker/yamlServerMain.ts @@ -5,11 +5,11 @@ *--------------------------------------------------------------------------------------------*/ import * as l10n from '@vscode/l10n'; import { Connection, RequestType } from 'vscode-languageserver'; -import { BrowserMessageReader, BrowserMessageWriter, createConnection } from 'vscode-languageserver/browser'; -import { TelemetryImpl } from '../languageserver/telemetry'; -import { schemaRequestHandler, workspaceContext } from '../languageservice/services/schemaRequestHandler'; -import { YAMLServerInit } from '../yamlServerInit'; -import { SettingsState } from '../yamlSettings'; +import { BrowserMessageReader, BrowserMessageWriter, createConnection } from 'vscode-languageserver/browser.ts'; +import { TelemetryImpl } from '../languageserver/telemetry.ts'; +import { schemaRequestHandler, workspaceContext } from '../languageservice/services/schemaRequestHandler.ts'; +import { YAMLServerInit } from '../yamlServerInit.ts'; +import { SettingsState } from '../yamlSettings.ts'; // eslint-disable-next-line @typescript-eslint/no-namespace namespace FSReadFile { diff --git a/src/yamlServerInit.ts b/src/yamlServerInit.ts index 876c582be..d70fb3664 100644 --- a/src/yamlServerInit.ts +++ b/src/yamlServerInit.ts @@ -1,23 +1,23 @@ import { Connection, InitializeParams, InitializeResult, TextDocumentSyncKind } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; -import { YamlCommands } from './commands'; -import { commandExecutor } from './languageserver/commandExecutor'; -import { LanguageHandlers } from './languageserver/handlers/languageHandlers'; -import { NotificationHandlers } from './languageserver/handlers/notificationHandlers'; -import { RequestHandlers } from './languageserver/handlers/requestHandlers'; -import { SettingsHandler } from './languageserver/handlers/settingsHandlers'; -import { ValidationHandler } from './languageserver/handlers/validationHandlers'; -import { WorkspaceHandlers } from './languageserver/handlers/workspaceHandlers'; -import { registerCommands } from './languageservice/services/yamlCommands'; -import { Telemetry } from './languageservice/telemetry'; -import { workspaceFoldersChanged } from './languageservice/utils/paths'; +import { YamlCommands } from './commands.ts'; +import { commandExecutor } from './languageserver/commandExecutor.ts'; +import { LanguageHandlers } from './languageserver/handlers/languageHandlers.ts'; +import { NotificationHandlers } from './languageserver/handlers/notificationHandlers.ts'; +import { RequestHandlers } from './languageserver/handlers/requestHandlers.ts'; +import { SettingsHandler } from './languageserver/handlers/settingsHandlers.ts'; +import { ValidationHandler } from './languageserver/handlers/validationHandlers.ts'; +import { WorkspaceHandlers } from './languageserver/handlers/workspaceHandlers.ts'; +import { registerCommands } from './languageservice/services/yamlCommands.ts'; +import { Telemetry } from './languageservice/telemetry.ts'; +import { workspaceFoldersChanged } from './languageservice/utils/paths.ts'; import { getLanguageService as getCustomLanguageService, LanguageService, SchemaRequestService, WorkspaceContextService, -} from './languageservice/yamlLanguageService'; -import { SettingsState } from './yamlSettings'; +} from './languageservice/yamlLanguageService.ts'; +import { SettingsState } from './yamlSettings.ts'; export class YAMLServerInit { languageService: LanguageService; diff --git a/src/yamlSettings.ts b/src/yamlSettings.ts index 875e7ea92..0a9e5810b 100644 --- a/src/yamlSettings.ts +++ b/src/yamlSettings.ts @@ -1,11 +1,11 @@ import { TextDocuments, Disposable, ClientCapabilities, WorkspaceFolder } from 'vscode-languageserver'; -import { CustomFormatterOptions, SchemaConfiguration } from './languageservice/yamlLanguageService'; -import { ISchemaAssociations } from './requestTypes'; +import { CustomFormatterOptions, SchemaConfiguration } from './languageservice/yamlLanguageService.ts'; +import { ISchemaAssociations } from './requestTypes.ts'; import { URI } from 'vscode-uri'; -import { JSONSchema } from './languageservice/jsonSchema'; +import { JSONSchema } from './languageservice/jsonSchema.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { CRD_CATALOG_URL, JSON_SCHEMASTORE_URL } from './languageservice/utils/schemaUrls'; -import { YamlVersion } from './languageservice/parser/yamlParser07'; +import { CRD_CATALOG_URL, JSON_SCHEMASTORE_URL } from './languageservice/utils/schemaUrls.ts'; +import { YamlVersion } from './languageservice/parser/yamlParser07.ts'; // Client settings interface to grab settings relevant for the language server export interface Settings { diff --git a/test/arrUtils.test.ts b/test/arrUtils.test.ts index d20493d21..57164e63e 100644 --- a/test/arrUtils.test.ts +++ b/test/arrUtils.test.ts @@ -2,7 +2,7 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { getLineOffsets, removeDuplicatesObj } from '../src/languageservice/utils/arrUtils'; +import { getLineOffsets, removeDuplicatesObj } from '../src/languageservice/utils/arrUtils.ts'; import * as assert from 'assert'; describe('Array Utils Tests', () => { diff --git a/test/astUtils.test.ts b/test/astUtils.test.ts index e214485a0..2a4366650 100644 --- a/test/astUtils.test.ts +++ b/test/astUtils.test.ts @@ -5,10 +5,10 @@ import * as chai from 'chai'; import { isPair, isSeq, Pair, YAMLSeq } from 'yaml'; -import { YamlDocuments } from '../src/languageservice/parser/yaml-documents'; -import { getParent, isInComment } from '../src/languageservice/utils/yamlAstUtils'; -import { TextBuffer } from '../src/languageservice/utils/textBuffer'; -import { setupTextDocument } from './utils/testHelper'; +import { YamlDocuments } from '../src/languageservice/parser/yaml-documents.ts'; +import { getParent, isInComment } from '../src/languageservice/utils/yamlAstUtils.ts'; +import { TextBuffer } from '../src/languageservice/utils/textBuffer.ts'; +import { setupTextDocument } from './utils/testHelper.ts'; const expect = chai.expect; describe('AST Utils Tests', () => { diff --git a/test/autoCompletion.test.ts b/test/autoCompletion.test.ts index f8f763520..09f37d1b2 100644 --- a/test/autoCompletion.test.ts +++ b/test/autoCompletion.test.ts @@ -10,11 +10,11 @@ import { setupSchemaIDTextDocument, TestCustomSchemaProvider, toFsPath, -} from './utils/testHelper'; +} from './utils/testHelper.ts'; import * as assert from 'assert'; import * as path from 'path'; -import { createExpectedCompletion } from './utils/verifyError'; -import { ServiceSetup } from './utils/serviceSetup'; +import { createExpectedCompletion } from './utils/verifyError.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { CompletionItemKind, CompletionList, @@ -24,9 +24,9 @@ import { Position, } from 'vscode-languageserver-types'; import { expect } from 'chai'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { LanguageService } from '../src'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { LanguageService } from '../src/index.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; describe('Auto Completion Tests', () => { let languageSettingsSetup: ServiceSetup; diff --git a/test/autoCompletionFix.test.ts b/test/autoCompletionFix.test.ts index c8aae5e5e..d8977eed4 100644 --- a/test/autoCompletionFix.test.ts +++ b/test/autoCompletionFix.test.ts @@ -4,21 +4,21 @@ *--------------------------------------------------------------------------------------------*/ import { CompletionItemKind, CompletionList, InsertTextFormat, Position, Range } from 'vscode-languageserver-types'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; -import { LanguageService } from '../src/languageservice/yamlLanguageService'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ServiceSetup } from './utils/serviceSetup'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; +import { LanguageService } from '../src/languageservice/yamlLanguageService.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { caretPosition, SCHEMA_ID, setupLanguageService, setupSchemaIDTextDocument, TestCustomSchemaProvider, -} from './utils/testHelper'; +} from './utils/testHelper.ts'; import { expect } from 'chai'; -import { createExpectedCompletion } from './utils/verifyError'; +import { createExpectedCompletion } from './utils/verifyError.ts'; import * as path from 'path'; -import { JSONSchema } from './../src/languageservice/jsonSchema'; +import { JSONSchema } from './../src/languageservice/jsonSchema.ts'; describe('Auto Completion Fix Tests', () => { let languageSettingsSetup: ServiceSetup; diff --git a/test/bundlel10n.test.ts b/test/bundlel10n.test.ts index e88ce823d..51e43d97a 100644 --- a/test/bundlel10n.test.ts +++ b/test/bundlel10n.test.ts @@ -5,13 +5,13 @@ import * as l10n from '@vscode/l10n'; import * as assert from 'assert'; import * as path from 'path'; -import { Connection, createConnection } from 'vscode-languageserver/node'; -import { schemaRequestHandler, workspaceContext } from '../src/languageservice/services/schemaRequestHandler'; -import { setupl10nBundle } from '../src/nodeTranslationSetup'; -import { YAMLServerInit } from '../src/yamlServerInit'; -import { SettingsState } from '../src/yamlSettings'; -import { TestCustomSchemaProvider, testFileSystem } from './utils/testHelper'; -import { TestTelemetry } from './utils/testsTypes'; +import { Connection, createConnection } from 'vscode-languageserver/node.js'; +import { schemaRequestHandler, workspaceContext } from '../src/languageservice/services/schemaRequestHandler.ts'; +import { setupl10nBundle } from '../src/nodeTranslationSetup.ts'; +import { YAMLServerInit } from '../src/yamlServerInit.ts'; +import { SettingsState } from '../src/yamlSettings.ts'; +import { TestCustomSchemaProvider, testFileSystem } from './utils/testHelper.ts'; +import { TestTelemetry } from './utils/testsTypes.ts'; describe('Bundle l10n Test', () => { let serverInit: YAMLServerInit; diff --git a/test/code-action-schema.test.ts b/test/code-action-schema.test.ts index 91e787c00..6e5b72e3c 100644 --- a/test/code-action-schema.test.ts +++ b/test/code-action-schema.test.ts @@ -8,13 +8,13 @@ import { setupSchemaIDTextDocument, TEST_URI, TestCustomSchemaProvider, -} from './utils/testHelper'; -import { ServiceSetup } from './utils/serviceSetup'; +} from './utils/testHelper.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { TextDocumentIdentifier, CodeActionParams, CodeActionContext, TextEdit, Range } from 'vscode-languageserver'; import { expect } from 'chai'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { YamlCodeActions } from '../src/languageservice/services/yamlCodeActions'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { YamlCodeActions } from '../src/languageservice/services/yamlCodeActions.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; describe('Schema Errors Code Action Tests', () => { diff --git a/test/customTags.test.ts b/test/customTags.test.ts index a77d0e040..aea4cfd14 100644 --- a/test/customTags.test.ts +++ b/test/customTags.test.ts @@ -2,13 +2,13 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { setupLanguageService, setupTextDocument } from './utils/testHelper'; -import { ServiceSetup } from './utils/serviceSetup'; -import { createExpectedError } from './utils/verifyError'; +import { setupLanguageService, setupTextDocument } from './utils/testHelper.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { createExpectedError } from './utils/verifyError.ts'; import * as assert from 'assert'; import { Diagnostic } from 'vscode-languageserver-types'; -import { LanguageService } from '../src/languageservice/yamlLanguageService'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; +import { LanguageService } from '../src/languageservice/yamlLanguageService.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; // Defines a Mocha test describe to group tests of similar kind together describe('Custom Tag tests Tests', () => { diff --git a/test/defaultSnippets.test.ts b/test/defaultSnippets.test.ts index a9e8ea50f..214dd3156 100644 --- a/test/defaultSnippets.test.ts +++ b/test/defaultSnippets.test.ts @@ -2,12 +2,12 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { toFsPath, setupSchemaIDTextDocument, setupLanguageService, caretPosition } from './utils/testHelper'; +import { toFsPath, setupSchemaIDTextDocument, setupLanguageService, caretPosition } from './utils/testHelper.ts'; import * as assert from 'assert'; import * as path from 'path'; -import { ServiceSetup } from './utils/serviceSetup'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; import { CompletionList, TextEdit } from 'vscode-languageserver-types'; import { expect } from 'chai'; diff --git a/test/diagnostic-filter.test.ts b/test/diagnostic-filter.test.ts index 4090d224b..592170ede 100644 --- a/test/diagnostic-filter.test.ts +++ b/test/diagnostic-filter.test.ts @@ -10,7 +10,7 @@ import { parseDisableSpecifiers, shouldSuppressDiagnostic, GetLineText, -} from '../src/languageservice/utils/diagnostic-filter'; +} from '../src/languageservice/utils/diagnostic-filter.ts'; function makeDiag(startLine: number, message: string): { startLine: number; message: string } { return { startLine, message }; diff --git a/test/documentPositionCalculator.test.ts b/test/documentPositionCalculator.test.ts index 15082e6cc..2dabe7096 100644 --- a/test/documentPositionCalculator.test.ts +++ b/test/documentPositionCalculator.test.ts @@ -2,7 +2,7 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { binarySearch, getLineStartPositions, getPosition } from '../src/languageservice/utils/documentPositionCalculator'; +import { binarySearch, getLineStartPositions, getPosition } from '../src/languageservice/utils/documentPositionCalculator.ts'; import * as assert from 'assert'; describe('DocumentPositionCalculator Tests', () => { diff --git a/test/documentSymbols.test.ts b/test/documentSymbols.test.ts index c586c6c67..22e8d39b8 100644 --- a/test/documentSymbols.test.ts +++ b/test/documentSymbols.test.ts @@ -2,17 +2,17 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { setupLanguageService, setupTextDocument, TEST_URI } from './utils/testHelper'; +import { setupLanguageService, setupTextDocument, TEST_URI } from './utils/testHelper.ts'; import { createExpectedSymbolInformation, createExpectedDocumentSymbol, createExpectedDocumentSymbolNoDetail, -} from './utils/verifyError'; +} from './utils/verifyError.ts'; import { DocumentSymbol, SymbolKind, SymbolInformation } from 'vscode-languageserver-types'; import * as assert from 'assert'; -import { ServiceSetup } from './utils/serviceSetup'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; describe('Document Symbols Tests', () => { let languageHandler: LanguageHandlers; @@ -38,7 +38,7 @@ describe('Document Symbols Tests', () => { const warnings = languageHandler.pendingLimitExceededWarnings; assert.deepEqual(Object.keys(warnings), [TEST_URI]); assert.deepEqual(warnings[TEST_URI].features, { 'document symbols': 'document symbols' }); - assert(warnings[TEST_URI].timeout); + assert.ok(warnings[TEST_URI].timeout); } describe('Document Symbols Tests (Non Hierarchical)', function () { diff --git a/test/findLinks.test.ts b/test/findLinks.test.ts index 3d9e6c6e9..97e3ebf24 100644 --- a/test/findLinks.test.ts +++ b/test/findLinks.test.ts @@ -2,12 +2,12 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { setupLanguageService, setupTextDocument } from './utils/testHelper'; +import { setupLanguageService, setupTextDocument } from './utils/testHelper.ts'; import * as assert from 'assert'; -import { ServiceSetup } from './utils/serviceSetup'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { DocumentLink } from 'vscode-languageserver-types'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; describe('Find Links Tests', () => { let languageHandler: LanguageHandlers; diff --git a/test/flow-style-rewriter.test.ts b/test/flow-style-rewriter.test.ts index 7cc773755..652f6f4b1 100644 --- a/test/flow-style-rewriter.test.ts +++ b/test/flow-style-rewriter.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; -import { YamlDocuments } from '../src/languageservice/parser/yaml-documents'; -import { FlowStyleRewriter } from '../src/languageservice/utils/flow-style-rewriter'; -import { setupTextDocument } from './utils/testHelper'; +import { YamlDocuments } from '../src/languageservice/parser/yaml-documents.ts'; +import { FlowStyleRewriter } from '../src/languageservice/utils/flow-style-rewriter.ts'; +import { setupTextDocument } from './utils/testHelper.ts'; describe('Flow style rewriter', () => { let writer: FlowStyleRewriter; diff --git a/test/formatter.test.ts b/test/formatter.test.ts index 3fc9f997d..9679a28f1 100644 --- a/test/formatter.test.ts +++ b/test/formatter.test.ts @@ -5,11 +5,11 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; import { FormattingOptions, TextEdit } from 'vscode-languageserver-types'; -import { CustomFormatterOptions } from '../src'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ServiceSetup } from './utils/serviceSetup'; -import { setupLanguageService, setupTextDocument } from './utils/testHelper'; +import { CustomFormatterOptions } from '../src/index.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { setupLanguageService, setupTextDocument } from './utils/testHelper.ts'; type LanguageHandlerWithConnection = { connection: { diff --git a/test/hover.test.ts b/test/hover.test.ts index 79fea557f..8c2609519 100644 --- a/test/hover.test.ts +++ b/test/hover.test.ts @@ -2,20 +2,20 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { ServiceSetup } from './utils/serviceSetup'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { caretPosition, SCHEMA_ID, setupLanguageService, setupSchemaIDTextDocument, TestCustomSchemaProvider, -} from './utils/testHelper'; +} from './utils/testHelper.ts'; import * as assert from 'assert'; import { Hover, MarkupContent, Position } from 'vscode-languageserver-types'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; import { expect } from 'chai'; -import { TestTelemetry } from './utils/testsTypes'; +import { TestTelemetry } from './utils/testsTypes.ts'; describe('Hover Tests', () => { let languageSettingsSetup: ServiceSetup; diff --git a/test/integration.test.ts b/test/integration.test.ts index ffa8751a7..a4ef6d516 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -2,13 +2,13 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { setupLanguageService, setupTextDocument } from './utils/testHelper'; +import { setupLanguageService, setupTextDocument } from './utils/testHelper.ts'; import * as assert from 'assert'; import { Diagnostic, CompletionList, Hover, MarkupContent } from 'vscode-languageserver-types'; -import { ServiceSetup } from './utils/serviceSetup'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; // Defines a Mocha test describe to group tests of similar kind together describe('Kubernetes Integration Tests', () => { diff --git a/test/invalid-metaschema.test.ts b/test/invalid-metaschema.test.ts index f20b2b206..ba934aea5 100644 --- a/test/invalid-metaschema.test.ts +++ b/test/invalid-metaschema.test.ts @@ -4,11 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { assert } from 'chai'; import * as sinon from 'sinon'; -import { Connection, RemoteClient } from 'vscode-languageserver/node'; -import { JSONSchemaSelection } from '../src/languageserver/handlers/schemaSelectionHandlers'; -import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { setupSchemaIDTextDocument } from './utils/testHelper'; +import { Connection, RemoteClient } from 'vscode-languageserver/node.ts'; +import { JSONSchemaSelection } from '../src/languageserver/handlers/schemaSelectionHandlers.ts'; +import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { setupSchemaIDTextDocument } from './utils/testHelper.ts'; describe('unexpected meta schema', () => { const sandbox = sinon.createSandbox(); diff --git a/test/jsonParser.test.ts b/test/jsonParser.test.ts index 6eafda74d..507d9210a 100644 --- a/test/jsonParser.test.ts +++ b/test/jsonParser.test.ts @@ -5,10 +5,10 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; -import { JSONDocument } from '../src/languageservice/parser/jsonDocument'; -import { getNodeValue } from '../src/languageservice/parser/astNodeUtils'; -import * as JsonSchema from './../src/languageservice/jsonSchema'; -import { ASTNode, ObjectASTNode } from './../src/languageservice/jsonASTTypes'; +import { JSONDocument } from '../src/languageservice/parser/jsonDocument.ts'; +import { getNodeValue } from '../src/languageservice/parser/astNodeUtils.ts'; +import * as JsonSchema from './../src/languageservice/jsonSchema.ts'; +import { ASTNode, ObjectASTNode } from './../src/languageservice/jsonASTTypes.ts'; import { ErrorCode, getLanguageService } from 'vscode-json-languageservice'; import { Diagnostic, TextDocument, Range } from 'vscode-languageserver-types'; diff --git a/test/multipleDocuments.test.ts b/test/multipleDocuments.test.ts index 1e1fd20b9..7124928e3 100644 --- a/test/multipleDocuments.test.ts +++ b/test/multipleDocuments.test.ts @@ -3,14 +3,14 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as path from 'path'; -import { setupLanguageService, setupTextDocument, toFsPath } from './utils/testHelper'; +import { setupLanguageService, setupTextDocument, toFsPath } from './utils/testHelper.ts'; import * as assert from 'assert'; -import { ServiceSetup } from './utils/serviceSetup'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { Diagnostic, Hover, MarkupContent } from 'vscode-languageserver-types'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { LanguageService } from '../src/languageservice/yamlLanguageService'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { LanguageService } from '../src/languageservice/yamlLanguageService.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { LanguageHandlers } from '../src/languageserver/handlers/languageHandlers.ts'; /** * Setup the schema we are going to use with the language settings diff --git a/test/objects.test.ts b/test/objects.test.ts index 03f97556a..de2142263 100644 --- a/test/objects.test.ts +++ b/test/objects.test.ts @@ -2,7 +2,7 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { equals, convertErrorToTelemetryMsg } from '../src/languageservice/utils/objects'; +import { equals, convertErrorToTelemetryMsg } from '../src/languageservice/utils/objects.ts'; import * as assert from 'assert'; describe('Object Equals Tests', () => { diff --git a/test/paths.test.ts b/test/paths.test.ts index 73488fc93..5590a5979 100644 --- a/test/paths.test.ts +++ b/test/paths.test.ts @@ -2,7 +2,7 @@ import * as assert from 'assert'; import { WorkspaceFolder } from 'vscode-languageserver-protocol'; import { join } from 'path'; -import { relativeToAbsolutePath, isRelativePath, workspaceFoldersChanged } from '../src/languageservice/utils/paths'; +import { relativeToAbsolutePath, isRelativePath, workspaceFoldersChanged } from '../src/languageservice/utils/paths.ts'; import { URI } from 'vscode-uri'; class TestWorkspace { @@ -77,14 +77,14 @@ const ws4 = new TestWorkspace( const checkBadPath = (path: string): void => { it('Rejects "' + path + '"', () => { - assert(!isRelativePath(path)); + assert.ok(!isRelativePath(path)); }); }; const checkGoodPath = (path: string, expect1: string, expect2: string, expect3: string): void => { describe('Relative path = "' + path + '"', () => { it('Recognises relative path', () => { - assert(isRelativePath(path)); + assert.ok(isRelativePath(path)); }); it('Resolves relative path in single-root workspace', () => { @@ -182,7 +182,7 @@ describe('File path tests', () => { const path4 = join('test', 'test.json'); it('Recognises relative path "' + path1 + '"', () => { - assert(isRelativePath(path1)); + assert.ok(isRelativePath(path1)); }); it('Resolves "' + path1 + '" in single-root workspace', () => { @@ -209,7 +209,7 @@ describe('File path tests', () => { if (process.platform !== 'win32') { this.skip(); } else { - assert(isRelativePath(path)); + assert.ok(isRelativePath(path)); } }); diff --git a/test/schema.test.ts b/test/schema.test.ts index e0a5df453..d8d376b90 100644 --- a/test/schema.test.ts +++ b/test/schema.test.ts @@ -1,14 +1,14 @@ import * as assert from 'assert'; -import * as parser from '../src/languageservice/parser/yamlParser07'; -import * as SchemaService from '../src/languageservice/services/yamlSchemaService'; -import * as JsonSchema from '../src/languageservice/jsonSchema'; +import * as parser from '../src/languageservice/parser/yamlParser07.ts'; +import * as SchemaService from '../src/languageservice/services/yamlSchemaService.ts'; +import * as JsonSchema from '../src/languageservice/jsonSchema.ts'; import * as url from 'url'; import * as path from 'path'; import { XHRResponse, xhr } from 'request-light'; -import { MODIFICATION_ACTIONS, SchemaDeletions } from '../src/languageservice/services/yamlSchemaService'; -import { EMPTY_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; +import { MODIFICATION_ACTIONS, SchemaDeletions } from '../src/languageservice/services/yamlSchemaService.ts'; +import { EMPTY_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; import { expect } from 'chai'; -import { ServiceSetup } from './utils/serviceSetup'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { SCHEMA_ID, TestCustomSchemaProvider, @@ -16,14 +16,14 @@ import { setupSchemaIDTextDocument, setupTextDocument, TEST_URI, -} from './utils/testHelper'; -import { LanguageService, SchemaPriority } from '../src'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; +} from './utils/testHelper.ts'; +import { LanguageService, SchemaPriority } from '../src/index.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; import { Diagnostic, MarkupContent, Position } from 'vscode-languageserver-types'; import { LineCounter } from 'yaml'; -import { getSchemaFromModeline } from '../src/languageservice/services/modelineUtil'; -import { getGroupVersionKindFromDocument } from '../src/languageservice/services/k8sSchemaUtil'; +import { getSchemaFromModeline } from '../src/languageservice/services/modelineUtil.ts'; +import { getGroupVersionKindFromDocument } from '../src/languageservice/services/k8sSchemaUtil.ts'; const requestServiceMock = function (uri: string): Promise { return Promise.reject(`Resource ${uri} not found.`); diff --git a/test/schema2019Validation.test.ts b/test/schema2019Validation.test.ts index 9c08c7761..e54faf57f 100644 --- a/test/schema2019Validation.test.ts +++ b/test/schema2019Validation.test.ts @@ -2,14 +2,14 @@ * Copyright (c) IBM Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper'; -import { ServiceSetup } from './utils/serviceSetup'; +import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { Diagnostic } from 'vscode-languageserver-types'; import { expect } from 'chai'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; -import { JSONSchema } from '../src/languageservice/jsonSchema'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; +import { JSONSchema } from '../src/languageservice/jsonSchema.ts'; describe('Validation Tests', () => { let languageSettingsSetup: ServiceSetup; diff --git a/test/schema2020Validation.test.ts b/test/schema2020Validation.test.ts index 8f516e29b..e91fc3263 100644 --- a/test/schema2020Validation.test.ts +++ b/test/schema2020Validation.test.ts @@ -2,14 +2,14 @@ * Copyright (c) IBM Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper'; -import { ServiceSetup } from './utils/serviceSetup'; +import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { Diagnostic } from 'vscode-languageserver-types'; import { expect } from 'chai'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; -import { JSONSchema } from '../src/languageservice/jsonSchema'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; +import { JSONSchema } from '../src/languageservice/jsonSchema.ts'; describe('Validation Tests', () => { let languageSettingsSetup: ServiceSetup; diff --git a/test/schemaRequestHandler.test.ts b/test/schemaRequestHandler.test.ts index eb75c1d05..e23d31357 100644 --- a/test/schemaRequestHandler.test.ts +++ b/test/schemaRequestHandler.test.ts @@ -3,18 +3,17 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { schemaRequestHandler } from '../src/languageservice/services/schemaRequestHandler'; +import { schemaRequestHandler } from '../src/languageservice/services/schemaRequestHandler.ts'; import * as sinon from 'sinon'; -import * as request from 'request-light'; -import { XHRResponse } from 'request-light'; import { Connection } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; import * as chai from 'chai'; import * as sinonChai from 'sinon-chai'; +import * as td from 'testdouble'; const expect = chai.expect; -chai.use(sinonChai); -import { testFileSystem } from './utils/testHelper'; +chai.use(sinonChai.default); +import { testFileSystem } from './utils/testHelper.ts'; describe('Schema Request Handler Tests', () => { describe('schemaRequestHandler', () => { @@ -71,15 +70,18 @@ describe('Schema Request Handler Tests', () => { describe('HTTP(S) schema requests', () => { const sandbox = sinon.createSandbox(); - let xhrStub: sinon.SinonStub; + let xhrStub: sinon.SinonSpy; const connection = {} as Connection; - beforeEach(() => { - xhrStub = sandbox.stub(request, 'xhr'); - xhrStub.resolves({ responseText: '{"$schema":"http://json-schema.org/draft-07/schema"}', status: 200 } as XHRResponse); + beforeEach(async () => { + xhrStub = sandbox.fake.resolves({ responseText: '{"$schema":"http://json-schema.org/draft-07/schema"}', status: 200 }); + await td.replaceEsm('request-light', { + xhr: xhrStub, + }); }); afterEach(() => { + td.reset(); sandbox.restore(); delete process.env.YAML_LANGUAGE_SERVER_VERSION; }); @@ -132,7 +134,10 @@ describe('Schema Request Handler Tests', () => { }); it('should reject with responseText on xhr error', async () => { - xhrStub.rejects({ responseText: 'Not Found', status: 404 } as XHRResponse); + xhrStub = sandbox.fake.rejects({ responseText: 'Not Found', status: 404 }); + await td.replaceEsm('request-light', { + xhr: xhrStub, + }); try { await schemaRequestHandler( connection, diff --git a/test/schemaSelectionHandlers.test.ts b/test/schemaSelectionHandlers.test.ts index ede5e6581..8086bf27c 100644 --- a/test/schemaSelectionHandlers.test.ts +++ b/test/schemaSelectionHandlers.test.ts @@ -5,15 +5,15 @@ import * as sinon from 'sinon'; import * as chai from 'chai'; import * as sinonChai from 'sinon-chai'; -import { JSONSchemaSelection } from '../src/languageserver/handlers/schemaSelectionHandlers'; -import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService'; -import { Connection, RemoteClient } from 'vscode-languageserver/node'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { SchemaSelectionRequests } from '../src/requestTypes'; -import { SCHEMA_ID, setupSchemaIDTextDocument } from './utils/testHelper'; +import { JSONSchemaSelection } from '../src/languageserver/handlers/schemaSelectionHandlers.ts'; +import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService.ts'; +import { Connection, RemoteClient } from 'vscode-languageserver/node.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { SchemaSelectionRequests } from '../src/requestTypes.ts'; +import { SCHEMA_ID, setupSchemaIDTextDocument } from './utils/testHelper.ts'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('Schema Selection Handlers', () => { const sandbox = sinon.createSandbox(); diff --git a/test/schemaValidation.test.ts b/test/schemaValidation.test.ts index 5c1c18b57..420322443 100644 --- a/test/schemaValidation.test.ts +++ b/test/schemaValidation.test.ts @@ -2,9 +2,9 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper'; -import { createDiagnosticWithData, createExpectedError } from './utils/verifyError'; -import { ServiceSetup } from './utils/serviceSetup'; +import { SCHEMA_ID, TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper.ts'; +import { createDiagnosticWithData, createExpectedError } from './utils/verifyError.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; import { StringTypeError, BooleanTypeError, @@ -14,18 +14,18 @@ import { DuplicateKeyError, propertyIsNotAllowed, MissingRequiredPropWarning, -} from './utils/errorMessages'; +} from './utils/errorMessages.ts'; import * as assert from 'assert'; import * as path from 'path'; import { Diagnostic, DiagnosticSeverity, Position } from 'vscode-languageserver-types'; import { expect } from 'chai'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { LanguageService } from '../src/languageservice/yamlLanguageService'; -import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; -import { IProblem } from '../src/languageservice/parser/schemaValidation/baseValidator'; -import { JSONSchema } from '../src/languageservice/jsonSchema'; -import { TestTelemetry } from './utils/testsTypes'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { LanguageService } from '../src/languageservice/yamlLanguageService.ts'; +import { KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; +import { IProblem } from '../src/languageservice/parser/schemaValidation/baseValidator.ts'; +import { JSONSchema } from '../src/languageservice/jsonSchema.ts'; +import { TestTelemetry } from './utils/testsTypes.ts'; import { ErrorCode } from 'vscode-json-languageservice'; describe('Validation Tests', () => { diff --git a/test/settingsHandlers.test.ts b/test/settingsHandlers.test.ts index ae5e236c2..d78d9774d 100644 --- a/test/settingsHandlers.test.ts +++ b/test/settingsHandlers.test.ts @@ -8,17 +8,22 @@ import * as request from 'request-light'; import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import { Connection, RemoteClient, RemoteWorkspace } from 'vscode-languageserver'; -import { LanguageService, LanguageSettings, SchemaConfiguration, SchemaPriority } from '../src'; -import { SettingsHandler } from '../src/languageserver/handlers/settingsHandlers'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { EMPTY_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; -import { Telemetry } from '../src/languageservice/telemetry'; -import { SettingsState } from '../src/yamlSettings'; -import { TestCustomSchemaProvider, setupLanguageService, setupSchemaIDTextDocument, setupTextDocument } from './utils/testHelper'; -import { TestWorkspace } from './utils/testsTypes'; +import { LanguageService, LanguageSettings, SchemaConfiguration, SchemaPriority } from '../src/index.ts'; +import { SettingsHandler } from '../src/languageserver/handlers/settingsHandlers.ts'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { EMPTY_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; +import { Telemetry } from '../src/languageservice/telemetry.ts'; +import { SettingsState } from '../src/yamlSettings.ts'; +import { + TestCustomSchemaProvider, + setupLanguageService, + setupSchemaIDTextDocument, + setupTextDocument, +} from './utils/testHelper.ts'; +import { TestWorkspace } from './utils/testsTypes.ts'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('Settings Handlers Tests', () => { const sandbox = sinon.createSandbox(); diff --git a/test/strings.test.ts b/test/strings.test.ts index a823bb7c4..36f026ace 100644 --- a/test/strings.test.ts +++ b/test/strings.test.ts @@ -2,7 +2,7 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { startsWith, endsWith, convertSimple2RegExp, safeCreateUnicodeRegExp } from '../src/languageservice/utils/strings'; +import { startsWith, endsWith, convertSimple2RegExp, safeCreateUnicodeRegExp } from '../src/languageservice/utils/strings.ts'; import * as assert from 'assert'; import { expect } from 'chai'; diff --git a/test/telemetry.test.ts b/test/telemetry.test.ts index af4055d7d..3a300445d 100644 --- a/test/telemetry.test.ts +++ b/test/telemetry.test.ts @@ -5,13 +5,13 @@ import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; -import { checkSchemaURI } from '../src/languageservice/utils/schemaUrls'; -import { TelemetryImpl } from '../src/languageserver/telemetry'; +import { checkSchemaURI } from '../src/languageservice/utils/schemaUrls.ts'; +import { TelemetryImpl } from '../src/languageserver/telemetry.ts'; import { URI } from 'vscode-uri'; import { Connection } from 'vscode-languageserver'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('Telemetry Tests', () => { const sandbox = sinon.createSandbox(); diff --git a/test/textBuffer.test.ts b/test/textBuffer.test.ts index 3b7cd967d..1ee5e2d9d 100644 --- a/test/textBuffer.test.ts +++ b/test/textBuffer.test.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TextBuffer } from '../src/languageservice/utils/textBuffer'; +import { TextBuffer } from '../src/languageservice/utils/textBuffer.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; import * as assert from 'assert'; diff --git a/test/utils/serviceSetup.ts b/test/utils/serviceSetup.ts index a7bc5d906..cf00d4ce1 100644 --- a/test/utils/serviceSetup.ts +++ b/test/utils/serviceSetup.ts @@ -2,8 +2,8 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { LanguageSettings, SchemasSettings } from '../../src/languageservice/yamlLanguageService'; -import { YamlVersion } from '../../src/languageservice/parser/yamlParser07'; +import { LanguageSettings, SchemasSettings } from '../../src/languageservice/yamlLanguageService.ts'; +import { YamlVersion } from '../../src/languageservice/parser/yamlParser07.ts'; export class ServiceSetup { /* diff --git a/test/utils/testHelper.ts b/test/utils/testHelper.ts index 6942830ae..e21445c0f 100644 --- a/test/utils/testHelper.ts +++ b/test/utils/testHelper.ts @@ -5,16 +5,16 @@ import { promises as fs } from 'fs'; import { ClientCapabilities } from 'vscode-json-languageservice'; import { TextDocument } from 'vscode-languageserver-textdocument'; -import { Connection, createConnection, ClientCapabilities as LSPClientCapabilities } from 'vscode-languageserver/node'; -import { LanguageService, LanguageSettings } from '../../src'; -import { LanguageHandlers } from '../../src/languageserver/handlers/languageHandlers'; -import { ValidationHandler } from '../../src/languageserver/handlers/validationHandlers'; -import { JSONSchema } from '../../src/languageservice/jsonSchema'; -import { yamlDocumentsCache } from '../../src/languageservice/parser/yaml-documents'; -import { FileSystem, schemaRequestHandler, workspaceContext } from '../../src/languageservice/services/schemaRequestHandler'; -import { YAMLServerInit } from '../../src/yamlServerInit'; -import { SettingsState } from '../../src/yamlSettings'; -import { TestTelemetry } from './testsTypes'; +import { Connection, createConnection, ClientCapabilities as LSPClientCapabilities } from 'vscode-languageserver/node.js'; +import { LanguageService, LanguageSettings } from '../../src/index.ts'; +import { LanguageHandlers } from '../../src/languageserver/handlers/languageHandlers.ts'; +import { ValidationHandler } from '../../src/languageserver/handlers/validationHandlers.ts'; +import { JSONSchema } from '../../src/languageservice/jsonSchema.ts'; +import { yamlDocumentsCache } from '../../src/languageservice/parser/yaml-documents.ts'; +import { FileSystem, schemaRequestHandler, workspaceContext } from '../../src/languageservice/services/schemaRequestHandler.ts'; +import { YAMLServerInit } from '../../src/yamlServerInit.ts'; +import { SettingsState } from '../../src/yamlSettings.ts'; +import { TestTelemetry } from './testsTypes.ts'; import * as path from 'path'; export function toFsPath(str: unknown): string { diff --git a/test/utils/testsTypes.ts b/test/utils/testsTypes.ts index fbd556b8f..e8c6f74d7 100644 --- a/test/utils/testsTypes.ts +++ b/test/utils/testsTypes.ts @@ -18,8 +18,8 @@ import { ServerCapabilities, } from 'vscode-languageserver-protocol'; import { Connection, RemoteWorkspace } from 'vscode-languageserver'; -import { TelemetryImpl } from '../../src/languageserver/telemetry'; -import { TelemetryEvent } from '../../src/languageservice/telemetry'; +import { TelemetryImpl } from '../../src/languageserver/telemetry.ts'; +import { TelemetryEvent } from '../../src/languageservice/telemetry.ts'; /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-unused-vars */ diff --git a/test/yaml-documents.test.ts b/test/yaml-documents.test.ts index c2278b969..d5308cb91 100644 --- a/test/yaml-documents.test.ts +++ b/test/yaml-documents.test.ts @@ -6,15 +6,15 @@ import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; -import { YamlDocuments } from '../src/languageservice/parser/yaml-documents'; -import { setupTextDocument } from './utils/testHelper'; -import * as yamlParser from '../src/languageservice/parser/yamlParser07'; +import { YamlDocuments } from '../src/languageservice/parser/yaml-documents.ts'; +import { setupTextDocument } from './utils/testHelper.ts'; +import * as yamlParser from '../src/languageservice/parser/yamlParser07.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; import { isMap, isScalar, isSeq, Pair, Scalar, YAMLMap, YAMLSeq } from 'yaml'; -import { TextBuffer } from '../src/languageservice/utils/textBuffer'; +import { TextBuffer } from '../src/languageservice/utils/textBuffer.ts'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('YAML Documents', () => { const sandbox = sinon.createSandbox(); describe('YAML Documents Cache Tests', () => { diff --git a/test/yamlCodeActions.test.ts b/test/yamlCodeActions.test.ts index 932046b95..14a81c909 100644 --- a/test/yamlCodeActions.test.ts +++ b/test/yamlCodeActions.test.ts @@ -6,7 +6,7 @@ import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; -import { YamlCodeActions } from '../src/languageservice/services/yamlCodeActions'; +import { YamlCodeActions } from '../src/languageservice/services/yamlCodeActions.ts'; import { CodeAction, CodeActionContext, @@ -19,14 +19,14 @@ import { WorkspaceEdit, } from 'vscode-languageserver-types'; import { ClientCapabilities, CodeActionParams } from 'vscode-languageserver'; -import { setupTextDocument, TEST_URI } from './utils/testHelper'; -import { createDiagnosticWithData, createExpectedError, createUnusedAnchorDiagnostic } from './utils/verifyError'; -import { YamlCommands } from '../src/commands'; -import { LanguageSettings } from '../src'; +import { setupTextDocument, TEST_URI } from './utils/testHelper.ts'; +import { createDiagnosticWithData, createExpectedError, createUnusedAnchorDiagnostic } from './utils/verifyError.ts'; +import { YamlCommands } from '../src/commands.ts'; +import { LanguageSettings } from '../src/index.ts'; import { ErrorCode } from 'vscode-json-languageservice'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); const JSON_SCHEMA_LOCAL = 'file://some/path/schema.json'; const JSON_SCHEMA2_LOCAL = 'file://some/path/schema2.json'; diff --git a/test/yamlCodeLens.test.ts b/test/yamlCodeLens.test.ts index 9619ad51b..83c4779eb 100644 --- a/test/yamlCodeLens.test.ts +++ b/test/yamlCodeLens.test.ts @@ -5,17 +5,17 @@ import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; -import { YamlCodeLens } from '../src/languageservice/services/yamlCodeLens'; -import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService'; -import { setupTextDocument } from './utils/testHelper'; -import { JSONSchema } from '../src/languageservice/jsonSchema'; +import { YamlCodeLens } from '../src/languageservice/services/yamlCodeLens.ts'; +import { YAMLSchemaService } from '../src/languageservice/services/yamlSchemaService.ts'; +import { setupTextDocument } from './utils/testHelper.ts'; +import { JSONSchema } from '../src/languageservice/jsonSchema.ts'; import { CodeLens, Command, Range } from 'vscode-languageserver-protocol'; -import { YamlCommands } from '../src/commands'; -import { TelemetryImpl } from '../src/languageserver/telemetry'; -import { Telemetry } from '../src/languageservice/telemetry'; +import { YamlCommands } from '../src/commands.ts'; +import { TelemetryImpl } from '../src/languageserver/telemetry.ts'; +import { Telemetry } from '../src/languageservice/telemetry.ts'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('YAML CodeLens', () => { const sandbox = sinon.createSandbox(); diff --git a/test/yamlCommands.test.ts b/test/yamlCommands.test.ts index 5a68f3efd..3e7180d92 100644 --- a/test/yamlCommands.test.ts +++ b/test/yamlCommands.test.ts @@ -6,13 +6,13 @@ import * as sinon from 'sinon'; import * as sinonChai from 'sinon-chai'; import * as chai from 'chai'; -import { registerCommands } from '../src/languageservice/services/yamlCommands'; -import { commandExecutor } from '../src/languageserver/commandExecutor'; +import { registerCommands } from '../src/languageservice/services/yamlCommands.ts'; +import { commandExecutor } from '../src/languageserver/commandExecutor.ts'; import { Connection } from 'vscode-languageserver'; import { URI } from 'vscode-uri'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); describe('Yaml Commands', () => { const JSON_SCHEMA_LOCAL = 'file://some/path/schema.json'; diff --git a/test/yamlDefinition.test.ts b/test/yamlDefinition.test.ts index 9a80dca87..ae6560759 100644 --- a/test/yamlDefinition.test.ts +++ b/test/yamlDefinition.test.ts @@ -3,11 +3,11 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { setupTextDocument, TEST_URI } from './utils/testHelper'; +import { setupTextDocument, TEST_URI } from './utils/testHelper.ts'; import { expect } from 'chai'; -import { YamlDefinition } from '../src/languageservice/services/yamlDefinition'; +import { YamlDefinition } from '../src/languageservice/services/yamlDefinition.ts'; import { LocationLink, Position, Range } from 'vscode-languageserver-types'; -import { Telemetry } from '../src/languageservice/telemetry'; +import { Telemetry } from '../src/languageservice/telemetry.ts'; describe('YAML Definition', () => { it('should not provide definition for non anchor node', () => { diff --git a/test/yamlFolding.test.ts b/test/yamlFolding.test.ts index a3f6f30c5..51e39a8cf 100644 --- a/test/yamlFolding.test.ts +++ b/test/yamlFolding.test.ts @@ -5,9 +5,9 @@ import { expect } from 'chai'; import { FoldingRange } from 'vscode-languageserver-types'; -import { getFoldingRanges } from '../src/languageservice/services/yamlFolding'; -import { FoldingRangesContext } from '../src/languageservice/yamlTypes'; -import { setupTextDocument, TEST_URI } from './utils/testHelper'; +import { getFoldingRanges } from '../src/languageservice/services/yamlFolding.ts'; +import { FoldingRangesContext } from '../src/languageservice/yamlTypes.ts'; +import { setupTextDocument, TEST_URI } from './utils/testHelper.ts'; const context: FoldingRangesContext = { rangeLimit: 10_0000 }; diff --git a/test/yamlLanguageService.test.ts b/test/yamlLanguageService.test.ts index 1806a4c49..d007fe30e 100644 --- a/test/yamlLanguageService.test.ts +++ b/test/yamlLanguageService.test.ts @@ -4,9 +4,9 @@ *--------------------------------------------------------------------------------------------*/ import { assert } from 'chai'; import { Position, TextDocument } from 'vscode-languageserver-textdocument'; -import { getLanguageService, LanguageService, SchemaRequestService, WorkspaceContextService } from '../src'; -import { workspaceContext } from '../src/languageservice/services/schemaRequestHandler'; -import { caretPosition, setupSchemaIDTextDocument } from './utils/testHelper'; +import { getLanguageService, LanguageService, SchemaRequestService, WorkspaceContextService } from '../src/index.ts'; +import { workspaceContext } from '../src/languageservice/services/schemaRequestHandler.ts'; +import { caretPosition, setupSchemaIDTextDocument } from './utils/testHelper.ts'; /** * Builds a simple schema request service diff --git a/test/yamlOnTypeFormatting.test.ts b/test/yamlOnTypeFormatting.test.ts index 61aac78c1..3a8169efc 100644 --- a/test/yamlOnTypeFormatting.test.ts +++ b/test/yamlOnTypeFormatting.test.ts @@ -5,8 +5,8 @@ import { expect } from 'chai'; import { DocumentOnTypeFormattingParams } from 'vscode-languageserver-protocol'; import { FormattingOptions, Position, Range, TextEdit } from 'vscode-languageserver-types'; -import { doDocumentOnTypeFormatting } from '../src/languageservice/services/yamlOnTypeFormatting'; -import { setupTextDocument } from './utils/testHelper'; +import { doDocumentOnTypeFormatting } from '../src/languageservice/services/yamlOnTypeFormatting.ts'; +import { setupTextDocument } from './utils/testHelper.ts'; function createParams(position: Position): DocumentOnTypeFormattingParams { return { diff --git a/test/yamlParser.test.ts b/test/yamlParser.test.ts index 7a38f8567..b836a28b2 100644 --- a/test/yamlParser.test.ts +++ b/test/yamlParser.test.ts @@ -4,85 +4,85 @@ *--------------------------------------------------------------------------------------------*/ import * as assert from 'assert'; import { expect } from 'chai'; -import { ArrayASTNode, ObjectASTNode, PropertyASTNode } from '../src/languageservice/jsonASTTypes'; -import { parse, YAMLDocument } from './../src/languageservice/parser/yamlParser07'; -import { aliasDepth } from '../src/languageservice/parser/ast-converter'; +import { ArrayASTNode, ObjectASTNode, PropertyASTNode } from '../src/languageservice/jsonASTTypes.ts'; +import { parse, YAMLDocument } from './../src/languageservice/parser/yamlParser07.ts'; +import { aliasDepth } from '../src/languageservice/parser/ast-converter.ts'; describe('YAML parser', () => { describe('YAML parser', function () { it('parse emtpy text', () => { const parsedDocument = parse(''); - assert(parsedDocument.documents.length === 1, 'A document has been created for an empty text'); + assert.ok(parsedDocument.documents.length === 1, 'A document has been created for an empty text'); }); it('parse only comment', () => { const parsedDocument = parse('# a comment'); - assert(parsedDocument.documents.length === 1, 'A document has been created when there is a comment'); + assert.ok(parsedDocument.documents.length === 1, 'A document has been created when there is a comment'); }); it('parse single document with --- at the start of the file', () => { const parsedDocument = parse('---\n# a comment\ntest: test'); - assert( + assert.ok( parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse multi document with --- at the start of the file', () => { const parsedDocument = parse('---\n# a comment\ntest: test\n...\n---\n# second document\ntest2: test2'); - assert( + assert.ok( parsedDocument.documents.length === 2, `two documents should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); - assert(parsedDocument.documents[1].lineComments.length === 1); - assert(parsedDocument.documents[1].lineComments[0] === '# second document'); + assert.ok(parsedDocument.documents[1].lineComments.length === 1); + assert.ok(parsedDocument.documents[1].lineComments[0] === '# second document'); }); it('parse single document with directives and line comments', () => { const parsedDocument = parse('%TAG !yaml! tag:yaml.org,2002:\n---\n# a comment\ntest'); - assert( + assert.ok( parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse 2 documents with directives and line comments', () => { const parsedDocument = parse('%TAG !yaml! tag:yaml.org,2002:\n# a comment\ntest\n...\n---\ntest2'); - assert( + assert.ok( parsedDocument.documents.length === 2, `2 documents should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert( + assert.ok( parsedDocument.documents[1].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[1].root.children.length}` ); - assert(parsedDocument.documents[1].root.value === 'test2'); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[1].root.value === 'test2'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse single document', () => { const parsedDocument = parse('test'); - assert( + assert.ok( parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); @@ -90,11 +90,11 @@ describe('YAML parser', () => { it('parse single document with directives', () => { const parsedDocument = parse('%TAG !yaml! tag:yaml.org,2002:\n---\ntest'); - assert( + assert.ok( parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); @@ -102,147 +102,147 @@ describe('YAML parser', () => { it('parse 2 documents', () => { const parsedDocument = parse('test\n---\ntest2'); - assert( + assert.ok( parsedDocument.documents.length === 2, `2 documents should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].root.value === 'test'); - assert( + assert.ok(parsedDocument.documents[0].root.value === 'test'); + assert.ok( parsedDocument.documents[1].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[1].root.children.length}` ); - assert(parsedDocument.documents[1].root.value === 'test2'); + assert.ok(parsedDocument.documents[1].root.value === 'test2'); }); it('parse 3 documents', () => { const parsedDocument = parse('test\n---\ntest2\n---\ntest3'); - assert( + assert.ok( parsedDocument.documents.length === 3, `3 documents should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].root.value === 'test'); - assert( + assert.ok(parsedDocument.documents[0].root.value === 'test'); + assert.ok( parsedDocument.documents[1].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[1].root.children.length}` ); - assert(parsedDocument.documents[1].root.value === 'test2'); - assert( + assert.ok(parsedDocument.documents[1].root.value === 'test2'); + assert.ok( parsedDocument.documents[2].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[2].root.children.length}` ); - assert(parsedDocument.documents[2].root.value === 'test3'); + assert.ok(parsedDocument.documents[2].root.value === 'test3'); }); it('parse single document with comment', () => { const parsedDocument = parse('# a comment\ntest'); - assert( + assert.ok( parsedDocument.documents.length === 1, `A single document should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse 2 documents with comment', () => { const parsedDocument = parse('---\n# a comment\ntest: test\n---\n# a second comment\ntest2'); - assert( + assert.ok( parsedDocument.documents.length === 2, `2 documents should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 1, `There should one children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); - assert( + assert.ok( parsedDocument.documents[1].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[1].lineComments.length === 1); - assert(parsedDocument.documents[1].lineComments[0] === '# a second comment'); + assert.ok(parsedDocument.documents[1].lineComments.length === 1); + assert.ok(parsedDocument.documents[1].lineComments[0] === '# a second comment'); }); it('parse 2 documents with comment and a directive', () => { const parsedDocument = parse('%TAG !yaml! tag:yaml.org,2002:\n---\n# a comment\ntest\n---\n# a second comment\ntest2'); - assert( + assert.ok( parsedDocument.documents.length === 2, `2 documents should be available but there are ${parsedDocument.documents.length}` ); - assert( + assert.ok( parsedDocument.documents[0].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); - assert( + assert.ok( parsedDocument.documents[1].root.children.length === 0, `There should no children available but there are ${parsedDocument.documents[0].root.children.length}` ); - assert(parsedDocument.documents[1].lineComments.length === 1); - assert(parsedDocument.documents[1].lineComments[0] === '# a second comment'); + assert.ok(parsedDocument.documents[1].lineComments.length === 1); + assert.ok(parsedDocument.documents[1].lineComments[0] === '# a second comment'); }); it('parse document with comment first', () => { const parsedDocument = parse('# a comment\n---\ntest:test'); - assert( + assert.ok( parsedDocument.documents.length === 1, `1 document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse document with comment first and directive', () => { const parsedDocument = parse('# a comment\n%TAG !yaml! tag:yaml.org,2002:\ntest: test'); - assert( + assert.ok( parsedDocument.documents.length === 1, `1 document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse document with comment first, directive, and seperator', () => { const parsedDocument = parse('# a comment\n%TAG !yaml! tag:yaml.org,2002:\n---test: test'); - assert( + assert.ok( parsedDocument.documents.length === 1, `1 document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].lineComments.length === 1); - assert(parsedDocument.documents[0].lineComments[0] === '# a comment'); + assert.ok(parsedDocument.documents[0].lineComments.length === 1); + assert.ok(parsedDocument.documents[0].lineComments[0] === '# a comment'); }); it('parse document with "str" tag from recommended schema', () => { const parsedDocument = parse('"yes as a string with tag": !!str yes'); - assert( + assert.ok( parsedDocument.documents.length === 1, `1 document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].errors.length === 0); + assert.ok(parsedDocument.documents[0].errors.length === 0); }); it('parse document with "int" tag from recommended schema', () => { const parsedDocument = parse('POSTGRES_PORT: !!int 54'); - assert( + assert.ok( parsedDocument.documents.length === 1, `1 document should be available but there are ${parsedDocument.documents.length}` ); - assert(parsedDocument.documents[0].errors.length === 0, JSON.stringify(parsedDocument.documents[0].errors)); + assert.ok(parsedDocument.documents[0].errors.length === 0, JSON.stringify(parsedDocument.documents[0].errors)); }); it('parse aliases up to a depth', () => { @@ -274,9 +274,9 @@ c: &c const cvalprops: PropertyASTNode = (cnode.properties[0].valueNode as ObjectASTNode).properties[0]; const cval = cvalprops.valueNode; - assert(aval?.value === 'web'); - assert(bval?.value === 'web'); - assert(cval?.value === undefined); + assert.ok(aval?.value === 'web'); + assert.ok(bval?.value === 'web'); + assert.ok(cval?.value === undefined); }); it('parse aliases up to a depth for multiple objects', () => { @@ -308,8 +308,8 @@ o: &o const cvalprops: PropertyASTNode = (cnode.properties[0].valueNode as ObjectASTNode).properties[0]; const cval = cvalprops.valueNode; - assert(cval?.value === undefined); - assert(oval?.value === 'web'); + assert.ok(cval?.value === undefined); + assert.ok(oval?.value === 'web'); }); }); @@ -360,12 +360,12 @@ metadata: describe('YAML version', () => { it('should use yaml 1.2 by default', () => { const parsedDocument = parse('SOME_BOOLEAN : !!bool yes'); - assert(parsedDocument.documents[0].warnings.length === 1); + assert.ok(parsedDocument.documents[0].warnings.length === 1); }); it('should respect yaml 1.1', () => { const parsedDocument = parse('SOME_BOOLEAN : !!bool yes', { customTags: [], yamlVersion: '1.1' }); - assert(parsedDocument.documents[0].warnings.length === 0); + assert.ok(parsedDocument.documents[0].warnings.length === 0); }); }); }); diff --git a/test/yamlRename.test.ts b/test/yamlRename.test.ts index c9be25234..9de3fdec7 100644 --- a/test/yamlRename.test.ts +++ b/test/yamlRename.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; import { Position, TextEdit } from 'vscode-languageserver-types'; -import { setupLanguageService, setupTextDocument, TEST_URI } from './utils/testHelper'; +import { setupLanguageService, setupTextDocument, TEST_URI } from './utils/testHelper.ts'; import { TextDocument } from 'vscode-languageserver-textdocument'; function applyEdits(document: TextDocument, edits: TextEdit[]): string { diff --git a/test/yamlSchema.test.ts b/test/yamlSchema.test.ts index 1df22b3e2..c2e3c9a96 100644 --- a/test/yamlSchema.test.ts +++ b/test/yamlSchema.test.ts @@ -2,14 +2,14 @@ * Copyright (c) Red Hat. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import * as SchemaService from '../src/languageservice/services/yamlSchemaService'; +import * as SchemaService from '../src/languageservice/services/yamlSchemaService.ts'; import * as url from 'url'; import * as sinon from 'sinon'; import * as chai from 'chai'; import * as sinonChai from 'sinon-chai'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); const workspaceContext = { resolveRelativePath: (relativePath: string, resource: string) => { diff --git a/test/yamlSchemaService.test.ts b/test/yamlSchemaService.test.ts index cded6b686..ea57c5dc6 100644 --- a/test/yamlSchemaService.test.ts +++ b/test/yamlSchemaService.test.ts @@ -7,13 +7,13 @@ import * as chai from 'chai'; import * as sinonChai from 'sinon-chai'; import * as path from 'path'; import * as url from 'url'; -import * as SchemaService from '../src/languageservice/services/yamlSchemaService'; -import { parse } from '../src/languageservice/parser/yamlParser07'; -import { SettingsState } from '../src/yamlSettings'; -import { BASE_KUBERNETES_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls'; +import * as SchemaService from '../src/languageservice/services/yamlSchemaService.ts'; +import { parse } from '../src/languageservice/parser/yamlParser07.ts'; +import { SettingsState } from '../src/yamlSettings.ts'; +import { BASE_KUBERNETES_SCHEMA_URL, KUBERNETES_SCHEMA_URL } from '../src/languageservice/utils/schemaUrls.ts'; const expect = chai.expect; -chai.use(sinonChai); +chai.use(sinonChai.default); const workspaceContext = { resolveRelativePath: (relativePath: string, resource: string) => { return url.resolve(resource, relativePath); diff --git a/test/yamlSelectionRanges.test.ts b/test/yamlSelectionRanges.test.ts index 3fffe2b5d..737fe1809 100644 --- a/test/yamlSelectionRanges.test.ts +++ b/test/yamlSelectionRanges.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { Position, Range, SelectionRange } from 'vscode-languageserver-types'; -import { setupTextDocument } from './utils/testHelper'; -import { getSelectionRanges } from '../src/languageservice/services/yamlSelectionRanges'; +import { setupTextDocument } from './utils/testHelper.ts'; +import { getSelectionRanges } from '../src/languageservice/services/yamlSelectionRanges.ts'; function isRangesEqual(range1: Range, range2: Range): boolean { return ( diff --git a/test/yamlValidation.test.ts b/test/yamlValidation.test.ts index 2cb683d35..0970eee70 100644 --- a/test/yamlValidation.test.ts +++ b/test/yamlValidation.test.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import { Diagnostic, DiagnosticSeverity } from 'vscode-languageserver-types'; -import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers'; -import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings'; -import { ServiceSetup } from './utils/serviceSetup'; -import { setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper'; +import { ValidationHandler } from '../src/languageserver/handlers/validationHandlers.ts'; +import { SettingsState, TextDocumentTestManager } from '../src/yamlSettings.ts'; +import { ServiceSetup } from './utils/serviceSetup.ts'; +import { setupLanguageService, setupSchemaIDTextDocument } from './utils/testHelper.ts'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { createExpectedError, createUnusedAnchorDiagnostic } from './utils/verifyError'; +import { createExpectedError, createUnusedAnchorDiagnostic } from './utils/verifyError.ts'; type ValidationHandlerWithConnection = { connection: { diff --git a/tsconfig.json b/tsconfig.json index fa23d249a..afd01c8dc 100755 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,13 +4,14 @@ "declaration": true, "forceConsistentCasingInFileNames": true, "lib": ["es2020", "WebWorker"], - "module": "commonjs", - "moduleResolution": "node", + "module": "nodenext", + "moduleResolution": "nodenext", "outDir": "./out/server", "sourceMap": true, "target": "es2020", "allowSyntheticDefaultImports": true, - "skipLibCheck": true + "skipLibCheck": true, + "rewriteRelativeImportExtensions": true, }, "include": [ "src", "test" ], "exclude": ["node_modules", "out"]