Skip to content

Commit 0166a38

Browse files
fix: @W-19244073 Updating packages after security scan
1 parent bd27796 commit 0166a38

File tree

4 files changed

+697
-284
lines changed

4 files changed

+697
-284
lines changed

package.json

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,22 @@
1515
"@types/jsdom": "^21.1.7",
1616
"@types/lodash.chunk": "^4.2.9",
1717
"@types/shelljs": "^0.8.15",
18+
"@xmldom/xmldom": "^0.9.8",
1819
"cli-progress": "^3.12.0",
1920
"diff": "^5.1.0",
21+
"form-data": "^4.0.4",
2022
"jsdom": "^25.0.0",
23+
"jsonwebtoken": "^9.0.2",
2124
"lodash.chunk": "^4.2.0",
25+
"marked": "^16.1.2",
26+
"minimatch": "^10.0.3",
27+
"nanoid": "^5.1.5",
2228
"open": "^8.4.2",
29+
"semver": "^7.7.2",
2330
"shelljs": "^0.8.5",
24-
"tslib": "^2",
25-
"xmldom": "^0.6.0"
31+
"tough-cookie": "^5.1.2",
32+
"trim-newlines": "^5.0.0",
33+
"tslib": "^2"
2634
},
2735
"devDependencies": {
2836
"@babel/parser": "^7.25.6",
@@ -37,6 +45,7 @@
3745
"@salesforce/ts-sinon": "^1",
3846
"@types/babel__traverse": "^7.20.6",
3947
"@types/jsforce": "^1.11.5",
48+
"@types/xmldom": "^0.1.34",
4049
"@typescript-eslint/eslint-plugin": "^4.2.0",
4150
"@typescript-eslint/parser": "^4.2.0",
4251
"chai": "^4.4.1",
@@ -62,6 +71,31 @@
6271
"ts-node": "^10.9.2",
6372
"typescript": "^4.9.5"
6473
},
74+
"resolutions": {
75+
"nanoid": "^3.3.8",
76+
"marked": "^4.0.10",
77+
"semver": "^7.5.2",
78+
"jsonwebtoken": "^9.0.2",
79+
"form-data": "^4.0.4",
80+
"trim-newlines": "^3.0.1",
81+
"minimatch": "^3.0.5",
82+
"tough-cookie": "^4.1.3",
83+
"ansi-regex": "^4.1.1",
84+
"json5": "^2.2.2",
85+
"braces": "^3.0.3",
86+
"ejs": "^3.1.10",
87+
"micromatch": "^4.0.8",
88+
"path-to-regexp": "^1.9.0",
89+
"@babel/runtime-corejs3": "^7.26.10",
90+
"@babel/runtime": "^7.26.10",
91+
"@babel/helpers": "^7.26.10",
92+
"cross-spawn": "^7.0.5",
93+
"tar-fs": "^2.1.3",
94+
"brace-expansion": "^2.0.2",
95+
"tmp": "^0.2.4",
96+
"request": "^2.88.2",
97+
"lodash.template": "^4.5.0"
98+
},
6599
"engines": {
66100
"node": ">=12.0.0"
67101
},

src/utils/XMLUtil.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
1111
/* eslint-disable @typescript-eslint/no-explicit-any */
1212

13-
import { DOMParser, XMLSerializer } from 'xmldom';
13+
import { DOMParser, XMLSerializer } from '@xmldom/xmldom';
1414

1515
/**
1616
* XMLUtil provides XML parsing and building functionality using the xmldom library.
@@ -50,15 +50,20 @@ export class XMLUtil {
5050

5151
// Parse XML string to JSON
5252
public parse(xmlString: string): any {
53-
const doc = this.parser.parseFromString(xmlString, 'text/xml');
54-
return this.xmlToJson(doc.documentElement);
53+
try {
54+
const doc = this.parser.parseFromString(xmlString, 'text/xml');
55+
return this.xmlToJson(doc.documentElement as any);
56+
} catch (error) {
57+
// Return empty object for invalid XML instead of throwing
58+
return {};
59+
}
5560
}
5661

5762
// Convert JSON object to XML
5863
public build(jsonObject: any, rootElement = 'root'): string {
5964
const doc = new DOMParser().parseFromString(`<${rootElement}></${rootElement}>`, 'text/xml');
6065
const rootNode = doc.documentElement;
61-
this.jsonToXml(jsonObject, rootNode);
66+
this.jsonToXml(jsonObject, rootNode as unknown as Node);
6267
return this.xmlHeader + this.prettyPrintXml(this.serializer.serializeToString(doc));
6368
}
6469

src/utils/lwcparser/xmlParser/XmlParser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
77
/* eslint-disable @typescript-eslint/explicit-member-accessibility */
88
import * as fs from 'fs';
9-
import { DOMParser, XMLSerializer } from 'xmldom';
9+
import { DOMParser, XMLSerializer, Document } from '@xmldom/xmldom';
1010
import { FileConstant } from '../fileutils/FileConstant';
1111
import { Logger } from '../../logger';
1212

@@ -51,6 +51,8 @@ export class XmlParser {
5151
xmlContentMap.set(FileConstant.MODIFIED_CONTENT, xmlString);
5252
return xmlContentMap;
5353
}
54+
55+
return xmlContentMap;
5456
}
5557

5658
public saveToFile(outputFilePath: string, xmlString: string): void {

0 commit comments

Comments
 (0)