Skip to content

Commit

Permalink
Upgrade fast-xml-parser to V4.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva committed Nov 2, 2023
1 parent 0ce0037 commit 1ebfc49
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 16 deletions.
46 changes: 34 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dist/**/*"
],
"dependencies": {
"fast-xml-parser": "^3.17.4",
"fast-xml-parser": "^4.3.2",
"fs-extra": "^9.0.1",
"lodash": "^4.17.21",
"loglevel": "^1.7.1",
Expand Down
4 changes: 3 additions & 1 deletion src/CommonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as os from 'os';
import which from 'which';
import * as lodash from 'lodash';
import * as parser from 'fast-xml-parser';
import { XMLParser } from 'fast-xml-parser';

export class CommonUtils {
/**
Expand Down Expand Up @@ -88,6 +89,7 @@ export class CommonUtils {
* @returns parsed xml object.
*/
public static parseXmlToObject(xmlContent: string): any {
return parser.parse(xmlContent, { ignoreAttributes: false, attributeNamePrefix: '', arrayMode: true });
const parser: parser.XMLParser = new XMLParser({ ignoreAttributes: false, attributeNamePrefix: ''});
return parser.parse(xmlContent);
}
}
2 changes: 1 addition & 1 deletion src/PackagesConfig/Extractor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class PackagesExtractor implements Extractor {
* @param globalPackagesCache
*/
public extract(packagesConfig: any, globalPackagesCache: string) {
const packages: any = CommonUtils.getPropertyOrUndefined(packagesConfig, 'packages[0].package');
const packages: any = CommonUtils.getPropertyOrUndefined(packagesConfig, 'packages.package');
for (const nuget of packages) {
const id: string = nuget.id;
const version: string = nuget.version;
Expand Down
2 changes: 1 addition & 1 deletion src/PackagesConfig/NugetPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export class NugetPackage {
}

// Get metadata dependencies if such exist. Check if fields exist before iterating over, but not strictly.
const metaDataDep: any = lodash.get(nuspec, 'package[0].metadata[0].dependencies[0]');
const metaDataDep: any = lodash.get(nuspec, 'package.metadata.dependencies');
if (!metaDataDep) {
return;
}
Expand Down

0 comments on commit 1ebfc49

Please sign in to comment.