From 89cc5f7d3386437de4805ce6cf83081cbff2163c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 07:54:14 +0000 Subject: [PATCH 1/2] Bump fast-xml-parser from 3.19.0 to 4.1.2 Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) from 3.19.0 to 4.1.2. - [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases) - [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md) - [Commits](https://github.com/NaturalIntelligence/fast-xml-parser/compare/3.19.0...v4.1.2) --- updated-dependencies: - dependency-name: fast-xml-parser dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- package-lock.json | 36 +++++++++++++++++++------- package.json | 2 +- packages/node/vrdt-common/package.json | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index e5867a3c..227572e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "adm-zip": "^0.5.4", "chokidar": "~3.5.1", "di": "^0.0.1", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.1.2", "fs-extra": "~9.1.0", "jsonc-parser": "^3.0.0", "lodash": "^4.17.21", @@ -5871,11 +5871,14 @@ "dev": true }, "node_modules/fast-xml-parser": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.19.0.tgz", - "integrity": "sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.1.2.tgz", + "integrity": "sha512-CDYeykkle1LiA/uqQyNwYpFbyF6Axec6YapmpUP+/RHWIoR1zKjocdvNaTsxCxZzQ6v9MLXaSYm9Qq0thv0DHg==", + "dependencies": { + "strnum": "^1.0.5" + }, "bin": { - "xml2js": "cli.js" + "fxparser": "src/cli/cli.js" }, "funding": { "type": "paypal", @@ -13760,6 +13763,11 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "node_modules/stubs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", @@ -15762,7 +15770,7 @@ "version": "2.5.3", "license": "MIT", "dependencies": { - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.1.2", "fs-extra": "~9.1.0", "glob": "^7.1.6", "jwt-decode": "^3.1.2", @@ -17332,7 +17340,7 @@ "@types/request": "^2.48.5", "@types/request-promise-native": "^1.0.17", "@types/vscode": "1.54.0", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.1.2", "fs-extra": "~9.1.0", "glob": "^7.1.6", "jest": "^26.6.3", @@ -20467,9 +20475,12 @@ } }, "fast-xml-parser": { - "version": "3.19.0", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.19.0.tgz", - "integrity": "sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==" + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.1.2.tgz", + "integrity": "sha512-CDYeykkle1LiA/uqQyNwYpFbyF6Axec6YapmpUP+/RHWIoR1zKjocdvNaTsxCxZzQ6v9MLXaSYm9Qq0thv0DHg==", + "requires": { + "strnum": "^1.0.5" + } }, "fastest-levenshtein": { "version": "1.0.12", @@ -26646,6 +26657,11 @@ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, + "strnum": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.0.5.tgz", + "integrity": "sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==" + }, "stubs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", diff --git a/package.json b/package.json index 61e75f21..02e4b078 100644 --- a/package.json +++ b/package.json @@ -591,7 +591,7 @@ "adm-zip": "^0.5.4", "chokidar": "~3.5.1", "di": "^0.0.1", - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.1.2", "fs-extra": "~9.1.0", "jsonc-parser": "^3.0.0", "lodash": "^4.17.21", diff --git a/packages/node/vrdt-common/package.json b/packages/node/vrdt-common/package.json index ac9a15e3..5b0c799c 100644 --- a/packages/node/vrdt-common/package.json +++ b/packages/node/vrdt-common/package.json @@ -24,7 +24,7 @@ "typescript": "~4.2.3" }, "dependencies": { - "fast-xml-parser": "3.19.0", + "fast-xml-parser": "4.1.2", "fs-extra": "~9.1.0", "glob": "^7.1.6", "jwt-decode": "^3.1.2", From 75d377b8896272ac385bc5ce28346abca34a8b9c Mon Sep 17 00:00:00 2001 From: Venelin Bakalov Date: Fri, 31 May 2024 15:09:24 +0300 Subject: [PATCH 2/2] Update XML parser usage to match new interfaces --- extension/src/client/lint/rule/ToolchainVersionRule.ts | 8 ++++---- extension/src/client/provider/content/RemoteDocument.ts | 6 +++--- extension/src/client/system/ConfigurationManager.ts | 8 ++++---- packages/node/vrdt-common/src/maven/PomFile.ts | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/extension/src/client/lint/rule/ToolchainVersionRule.ts b/extension/src/client/lint/rule/ToolchainVersionRule.ts index d9e2afbf..a7137277 100644 --- a/extension/src/client/lint/rule/ToolchainVersionRule.ts +++ b/extension/src/client/lint/rule/ToolchainVersionRule.ts @@ -3,9 +3,9 @@ * SPDX-License-Identifier: MIT */ -import * as xmlParser from "fast-xml-parser" -import * as semver from "semver" import { Logger, PomFile } from "@vmware/vrdt-common" +import { XMLParser, XMLValidator } from "fast-xml-parser" +import * as semver from "semver" import * as vscode from "vscode" import { Patterns } from "../../constants" @@ -20,7 +20,7 @@ export class ToolchainVersionRule extends PomLintRule { apply(document: vscode.TextDocument): vscode.Diagnostic[] { const pomXmlContent = document.getText() - if (!xmlParser.validate(pomXmlContent)) { + if (!XMLValidator.validate(pomXmlContent)) { this.logger.info("Not valid XML") return [] } @@ -59,7 +59,7 @@ export class ToolchainVersionRule extends PomLintRule { } private extractParentVersion(pomXmlContent: string): string | null { - const pomXml = xmlParser.parse(pomXmlContent) + const pomXml = new XMLParser().parse(pomXmlContent) if (!pomXml.project || !pomXml.project.parent) { this.logger.warn("Missing parent tag") diff --git a/extension/src/client/provider/content/RemoteDocument.ts b/extension/src/client/provider/content/RemoteDocument.ts index ef98968e..398ef8c4 100644 --- a/extension/src/client/provider/content/RemoteDocument.ts +++ b/extension/src/client/provider/content/RemoteDocument.ts @@ -6,10 +6,10 @@ import * as path from "path" import { Logger, VroRestClient } from "@vmware/vrdt-common" -import * as vscode from "vscode" import * as AdmZip from "adm-zip" +import { XMLParser } from "fast-xml-parser" import * as fs from "fs-extra" -import * as xmlParser from "fast-xml-parser" +import * as vscode from "vscode" import { ContentLocation } from "./ContentLocation" @@ -105,7 +105,7 @@ export class RemoteDocument { "@t": string "#text": string } - let xml = xmlParser.parse(source, { ignoreAttributes: false, attributeNamePrefix: "@" }) + let xml = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: "@" }).parse(source) xml = xml["dunes-script-module"] let js = "/**\n" diff --git a/extension/src/client/system/ConfigurationManager.ts b/extension/src/client/system/ConfigurationManager.ts index 0cd60dcb..5e06d7da 100644 --- a/extension/src/client/system/ConfigurationManager.ts +++ b/extension/src/client/system/ConfigurationManager.ts @@ -5,9 +5,6 @@ import * as path from "path" -import * as chokidar from "chokidar" -import * as xmlParser from "fast-xml-parser" -import * as fs from "fs-extra" import { AutoWire, BaseConfiguration, @@ -16,6 +13,9 @@ import { MavenProfileWrapper, VrealizeSettings } from "@vmware/vrdt-common" +import * as chokidar from "chokidar" +import { XMLParser } from "fast-xml-parser" +import * as fs from "fs-extra" import * as vscode from "vscode" import { BuiltInCommands } from "../constants" @@ -105,7 +105,7 @@ export class ConfigurationManager extends BaseConfiguration implements Registrab return } - const settingsJson = xmlParser.parse(settingsXmlContent.toString("utf8")) + const settingsJson = new XMLParser().parse(settingsXmlContent.toString("utf8")) const allProfiles = settingsJson?.settings?.profiles?.profile const vroProfiles: MavenProfilesMap = {} diff --git a/packages/node/vrdt-common/src/maven/PomFile.ts b/packages/node/vrdt-common/src/maven/PomFile.ts index e8f864b6..6741ccfc 100644 --- a/packages/node/vrdt-common/src/maven/PomFile.ts +++ b/packages/node/vrdt-common/src/maven/PomFile.ts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MIT */ -import * as xmlParser from "fast-xml-parser" +import { XMLParser } from "fast-xml-parser" import * as fs from "fs-extra" export class PomFile { @@ -56,7 +56,7 @@ export class PomFile { constructor(public readonly filePath: string) { const pomContent = fs.readFileSync(filePath, { encoding: "utf8" }) - this.jsonContent = xmlParser.parse(pomContent) + this.jsonContent = new XMLParser().parse(pomContent) if (!this.jsonContent.project || !this.jsonContent.project.parent) { throw new Error(`Missing parent tag [file = ${filePath}]`)