diff --git a/extensions/ql-vscode/package-lock.json b/extensions/ql-vscode/package-lock.json index 3d2c2f3c60b..e150296bb4d 100644 --- a/extensions/ql-vscode/package-lock.json +++ b/extensions/ql-vscode/package-lock.json @@ -24,7 +24,7 @@ "d3": "^7.9.0", "d3-graphviz": "^5.6.0", "fs-extra": "^11.1.1", - "js-yaml": "^4.2.0", + "js-yaml": "^5.0.0", "koffi": "^2.15.5", "msw": "^2.14.6", "nanoid": "^5.0.7", @@ -76,7 +76,6 @@ "@types/fs-extra": "^11.0.1", "@types/gulp": "^4.0.18", "@types/jest": "^30.0.0", - "@types/js-yaml": "^4.0.6", "@types/node": "22.19.*", "@types/proper-lockfile": "^4.1.4", "@types/react": "^19.2.17", @@ -3190,6 +3189,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@eslint/eslintrc/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -5451,6 +5473,29 @@ "node": ">=8" } }, + "node_modules/@microsoft/eslint-formatter-sarif/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@microsoft/eslint-formatter-sarif/node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", @@ -8182,6 +8227,29 @@ "node": ">=8" } }, + "node_modules/@textlint/linter-formatter/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/@textlint/linter-formatter/node_modules/pluralize": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-2.0.0.tgz", @@ -9079,12 +9147,6 @@ "node": ">=8" } }, - "node_modules/@types/js-yaml": { - "version": "4.0.9", - "resolved": "https://registry.npmjs.org/@types/js-yaml/-/js-yaml-4.0.9.tgz", - "integrity": "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==", - "dev": true - }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -12418,6 +12480,29 @@ } } }, + "node_modules/cosmiconfig/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/create-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", @@ -21082,9 +21167,9 @@ "dev": true }, "node_modules/js-yaml": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz", - "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==", + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.1.tgz", + "integrity": "sha512-zfLtNfQqxVqq3uaTqSkh4x4hZw3KHobGUA0fJUj4wawW8bsQLTVqpHdXSIzidh7o+4lEW36tANuAGdaFx6Zgnw==", "funding": [ { "type": "github", @@ -21100,7 +21185,7 @@ "argparse": "^2.0.1" }, "bin": { - "js-yaml": "bin/js-yaml.js" + "js-yaml": "bin/js-yaml.mjs" } }, "node_modules/jschardet": { @@ -25242,6 +25327,29 @@ "require-from-string": "^2.0.2" } }, + "node_modules/rc-config-loader/node_modules/js-yaml": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz", + "integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, "node_modules/rc/node_modules/strip-json-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", diff --git a/extensions/ql-vscode/package.json b/extensions/ql-vscode/package.json index 4687b260438..0c94eba14ed 100644 --- a/extensions/ql-vscode/package.json +++ b/extensions/ql-vscode/package.json @@ -2082,7 +2082,7 @@ "d3": "^7.9.0", "d3-graphviz": "^5.6.0", "fs-extra": "^11.1.1", - "js-yaml": "^4.2.0", + "js-yaml": "^5.0.0", "koffi": "^2.15.5", "msw": "^2.14.6", "nanoid": "^5.0.7", @@ -2134,7 +2134,6 @@ "@types/fs-extra": "^11.0.1", "@types/gulp": "^4.0.18", "@types/jest": "^30.0.0", - "@types/js-yaml": "^4.0.6", "@types/node": "22.19.*", "@types/proper-lockfile": "^4.1.4", "@types/react": "^19.2.17", diff --git a/extensions/ql-vscode/src/packaging/qlpack-file-loader.ts b/extensions/ql-vscode/src/packaging/qlpack-file-loader.ts index ec3dc6494ca..71ab49e7aff 100644 --- a/extensions/ql-vscode/src/packaging/qlpack-file-loader.ts +++ b/extensions/ql-vscode/src/packaging/qlpack-file-loader.ts @@ -11,7 +11,10 @@ const qlpackFileValidate = ajv.compile(qlpackFileSchemaJson); export async function loadQlpackFile(path: string): Promise { const qlpackFileText = await readFile(path, "utf8"); - let qlPack = load(qlpackFileText) as QlPackFile | undefined; + let qlPack: QlPackFile | undefined; + if (qlpackFileText.trim()) { + qlPack = load(qlpackFileText) as QlPackFile | undefined; + } if (qlPack === undefined || qlPack === null) { // An empty file is not valid according to the schema since it's not an object,