mirror of
				https://github.com/actions/setup-dotnet.git
				synced 2025-10-31 15:33:44 +00:00 
			
		
		
		
	Update fast-xml-parser and dotnet installer scripts (#437)
* chore: update fast-xlm-parser and dotnet installer scripts * chore: update license for the fast-xml-parser
This commit is contained in:
		
							parent
							
								
									9b40770825
								
							
						
					
					
						commit
						a6be55a915
					
				
							
								
								
									
										2
									
								
								.licenses/npm/fast-xml-parser.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/fast-xml-parser.dep.yml
									
									
									
										generated
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: fast-xml-parser | name: fast-xml-parser | ||||||
| version: 4.0.10 | version: 4.2.4 | ||||||
| type: npm | type: npm | ||||||
| summary: Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback. | summary: Validate XML, Parse XML to JS Object, or Build XML from JS Object without C/C++ based libraries and no callback. | ||||||
| homepage: https://github.com/NaturalIntelligence/fast-xml-parser#readme | homepage: https://github.com/NaturalIntelligence/fast-xml-parser#readme | ||||||
|  | |||||||
							
								
								
									
										547
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										547
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							| @ -50842,7 +50842,9 @@ const defaultOptions = { | |||||||
|   ], |   ], | ||||||
|   processEntities: true, |   processEntities: true, | ||||||
|   stopNodes: [], |   stopNodes: [], | ||||||
|   transformTagName: false, |   // transformTagName: false,
 | ||||||
|  |   // transformAttributeName: false,
 | ||||||
|  |   oneListGroup: false | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| function Builder(options) { | function Builder(options) { | ||||||
| @ -50869,20 +50871,6 @@ function Builder(options) { | |||||||
|     this.tagEndChar = '>'; |     this.tagEndChar = '>'; | ||||||
|     this.newLine = ''; |     this.newLine = ''; | ||||||
|   } |   } | ||||||
| 
 |  | ||||||
|   if (this.options.suppressEmptyNode) { |  | ||||||
|     this.buildTextNode = buildEmptyTextNode; |  | ||||||
|     this.buildObjNode = buildEmptyObjNode; |  | ||||||
|   } else { |  | ||||||
|     this.buildTextNode = buildTextValNode; |  | ||||||
|     this.buildObjNode = buildObjectNode; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   this.buildTextValNode = buildTextValNode; |  | ||||||
|   this.buildObjectNode = buildObjectNode; |  | ||||||
| 
 |  | ||||||
|   this.replaceEntitiesValue = replaceEntitiesValue; |  | ||||||
|   this.buildAttrPairStr = buildAttrPairStr; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Builder.prototype.build = function(jObj) { | Builder.prototype.build = function(jObj) { | ||||||
| @ -50909,7 +50897,7 @@ Builder.prototype.j2x = function(jObj, level) { | |||||||
|       else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; |       else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; | ||||||
|       // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
 |       // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
 | ||||||
|     } else if (jObj[key] instanceof Date) { |     } else if (jObj[key] instanceof Date) { | ||||||
|       val += this.buildTextNode(jObj[key], key, '', level); |       val += this.buildTextValNode(jObj[key], key, '', level); | ||||||
|     } else if (typeof jObj[key] !== 'object') { |     } else if (typeof jObj[key] !== 'object') { | ||||||
|       //premitive type
 |       //premitive type
 | ||||||
|       const attr = this.isAttribute(key); |       const attr = this.isAttribute(key); | ||||||
| @ -50921,12 +50909,13 @@ Builder.prototype.j2x = function(jObj, level) { | |||||||
|           let newval = this.options.tagValueProcessor(key, '' + jObj[key]); |           let newval = this.options.tagValueProcessor(key, '' + jObj[key]); | ||||||
|           val += this.replaceEntitiesValue(newval); |           val += this.replaceEntitiesValue(newval); | ||||||
|         } else { |         } else { | ||||||
|           val += this.buildTextNode(jObj[key], key, '', level); |           val += this.buildTextValNode(jObj[key], key, '', level); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } else if (Array.isArray(jObj[key])) { |     } else if (Array.isArray(jObj[key])) { | ||||||
|       //repeated nodes
 |       //repeated nodes
 | ||||||
|       const arrLen = jObj[key].length; |       const arrLen = jObj[key].length; | ||||||
|  |       let listTagVal = ""; | ||||||
|       for (let j = 0; j < arrLen; j++) { |       for (let j = 0; j < arrLen; j++) { | ||||||
|         const item = jObj[key][j]; |         const item = jObj[key][j]; | ||||||
|         if (typeof item === 'undefined') { |         if (typeof item === 'undefined') { | ||||||
| @ -50936,11 +50925,19 @@ Builder.prototype.j2x = function(jObj, level) { | |||||||
|           else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; |           else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar; | ||||||
|           // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
 |           // val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
 | ||||||
|         } else if (typeof item === 'object') { |         } else if (typeof item === 'object') { | ||||||
|           val += this.processTextOrObjNode(item, key, level) |           if(this.options.oneListGroup ){ | ||||||
|  |             listTagVal += this.j2x(item, level + 1).val; | ||||||
|  |           }else{ | ||||||
|  |             listTagVal += this.processTextOrObjNode(item, key, level) | ||||||
|  |           } | ||||||
|         } else { |         } else { | ||||||
|           val += this.buildTextNode(item, key, '', level); |           listTagVal += this.buildTextValNode(item, key, '', level); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       if(this.options.oneListGroup){ | ||||||
|  |         listTagVal = this.buildObjectNode(listTagVal, key, '', level); | ||||||
|  |       } | ||||||
|  |       val += listTagVal; | ||||||
|     } else { |     } else { | ||||||
|       //nested node
 |       //nested node
 | ||||||
|       if (this.options.attributesGroupName && key === this.options.attributesGroupName) { |       if (this.options.attributesGroupName && key === this.options.attributesGroupName) { | ||||||
| @ -50957,7 +50954,7 @@ Builder.prototype.j2x = function(jObj, level) { | |||||||
|   return {attrStr: attrStr, val: val}; |   return {attrStr: attrStr, val: val}; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| function buildAttrPairStr(attrName, val){ | Builder.prototype.buildAttrPairStr = function(attrName, val){ | ||||||
|   val = this.options.attributeValueProcessor(attrName, '' + val); |   val = this.options.attributeValueProcessor(attrName, '' + val); | ||||||
|   val = this.replaceEntitiesValue(val); |   val = this.replaceEntitiesValue(val); | ||||||
|   if (this.options.suppressBooleanAttributes && val === "true") { |   if (this.options.suppressBooleanAttributes && val === "true") { | ||||||
| @ -50968,68 +50965,87 @@ function buildAttrPairStr(attrName, val){ | |||||||
| function processTextOrObjNode (object, key, level) { | function processTextOrObjNode (object, key, level) { | ||||||
|   const result = this.j2x(object, level + 1); |   const result = this.j2x(object, level + 1); | ||||||
|   if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) { |   if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) { | ||||||
|     return this.buildTextNode(object[this.options.textNodeName], key, result.attrStr, level); |     return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level); | ||||||
|   } else { |   } else { | ||||||
|     return this.buildObjNode(result.val, key, result.attrStr, level); |     return this.buildObjectNode(result.val, key, result.attrStr, level); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function buildObjectNode(val, key, attrStr, level) { | Builder.prototype.buildObjectNode = function(val, key, attrStr, level) { | ||||||
|   let tagEndExp = '</' + key + this.tagEndChar; |   if(val === ""){ | ||||||
|   let piClosingChar = ""; |     if(key[0] === "?") return  this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; | ||||||
|    |     else { | ||||||
|   if(key[0] === "?") { |       return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar; | ||||||
|     piClosingChar = "?"; |     } | ||||||
|     tagEndExp = ""; |   }else{ | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   if (attrStr && val.indexOf('<') === -1) { |     let tagEndExp = '</' + key + this.tagEndChar; | ||||||
|     return ( this.indentate(level) + '<' +  key + attrStr + piClosingChar + '>' + val + tagEndExp ); |     let piClosingChar = ""; | ||||||
|   } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { |      | ||||||
|     return this.indentate(level) + `<!--${val}-->` + this.newLine; |     if(key[0] === "?") { | ||||||
|   }else { |       piClosingChar = "?"; | ||||||
|     return ( |       tagEndExp = ""; | ||||||
|       this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar + |     } | ||||||
|       val + |    | ||||||
|       this.indentate(level) + tagEndExp    ); |     if (attrStr && val.indexOf('<') === -1) { | ||||||
|  |       return ( this.indentate(level) + '<' +  key + attrStr + piClosingChar + '>' + val + tagEndExp ); | ||||||
|  |     } else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) { | ||||||
|  |       return this.indentate(level) + `<!--${val}-->` + this.newLine; | ||||||
|  |     }else { | ||||||
|  |       return ( | ||||||
|  |         this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar + | ||||||
|  |         val + | ||||||
|  |         this.indentate(level) + tagEndExp    ); | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | Builder.prototype.closeTag = function(key){ | ||||||
|  |   let closeTag = ""; | ||||||
|  |   if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
 | ||||||
|  |     if(!this.options.suppressUnpairedNode) closeTag = "/" | ||||||
|  |   }else if(this.options.suppressEmptyNode){ //empty
 | ||||||
|  |     closeTag = "/"; | ||||||
|  |   }else{ | ||||||
|  |     closeTag = `></${key}` | ||||||
|  |   } | ||||||
|  |   return closeTag; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| function buildEmptyObjNode(val, key, attrStr, level) { | function buildEmptyObjNode(val, key, attrStr, level) { | ||||||
|   if (val !== '') { |   if (val !== '') { | ||||||
|     return this.buildObjectNode(val, key, attrStr, level); |     return this.buildObjectNode(val, key, attrStr, level); | ||||||
|   } else { |   } else { | ||||||
|     if(key[0] === "?") return  this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; |     if(key[0] === "?") return  this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; | ||||||
|     else return  this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar; |     else { | ||||||
|  |       return  this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar; | ||||||
|  |       // return this.buildTagStr(level,key, attrStr);
 | ||||||
|  |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function buildTextValNode(val, key, attrStr, level) { | Builder.prototype.buildTextValNode = function(val, key, attrStr, level) { | ||||||
|   if (this.options.cdataPropName !== false && key === this.options.cdataPropName) { |   if (this.options.cdataPropName !== false && key === this.options.cdataPropName) { | ||||||
|     return this.indentate(level) + `<![CDATA[${val}]]>` +  this.newLine; |     return this.indentate(level) + `<![CDATA[${val}]]>` +  this.newLine; | ||||||
|   }else if (this.options.commentPropName !== false && key === this.options.commentPropName) { |   }else if (this.options.commentPropName !== false && key === this.options.commentPropName) { | ||||||
|     return this.indentate(level) + `<!--${val}-->` +  this.newLine; |     return this.indentate(level) + `<!--${val}-->` +  this.newLine; | ||||||
|  |   }else if(key[0] === "?") {//PI tag
 | ||||||
|  |     return  this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;  | ||||||
|   }else{ |   }else{ | ||||||
|     let textValue = this.options.tagValueProcessor(key, val); |     let textValue = this.options.tagValueProcessor(key, val); | ||||||
|     textValue = this.replaceEntitiesValue(textValue); |     textValue = this.replaceEntitiesValue(textValue); | ||||||
|    |    | ||||||
|     if( textValue === '' && this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
 |     if( textValue === ''){ | ||||||
|       if(this.options.suppressUnpairedNode){ |       return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar; | ||||||
|         return this.indentate(level) + '<' + key + this.tagEndChar; |     }else{ | ||||||
|       }else{ |       return this.indentate(level) + '<' + key + attrStr + '>' + | ||||||
|         return this.indentate(level) + '<' + key + "/" + this.tagEndChar; |  | ||||||
|       } |  | ||||||
|     } else{ |  | ||||||
|       return ( |  | ||||||
|         this.indentate(level) + '<' + key + attrStr + '>' + |  | ||||||
|          textValue + |          textValue + | ||||||
|         '</' + key + this.tagEndChar  ); |         '</' + key + this.tagEndChar; | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function replaceEntitiesValue(textValue){ | Builder.prototype.replaceEntitiesValue = function(textValue){ | ||||||
|   if(textValue && textValue.length > 0 && this.options.processEntities){ |   if(textValue && textValue.length > 0 && this.options.processEntities){ | ||||||
|     for (let i=0; i<this.options.entities.length; i++) { |     for (let i=0; i<this.options.entities.length; i++) { | ||||||
|       const entity = this.options.entities[i]; |       const entity = this.options.entities[i]; | ||||||
| @ -51039,21 +51055,6 @@ function replaceEntitiesValue(textValue){ | |||||||
|   return textValue; |   return textValue; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function buildEmptyTextNode(val, key, attrStr, level) { |  | ||||||
|   if( val === '' && this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
 |  | ||||||
|     if(this.options.suppressUnpairedNode){ |  | ||||||
|       return this.indentate(level) + '<' + key + this.tagEndChar; |  | ||||||
|     }else{ |  | ||||||
|       return this.indentate(level) + '<' + key + "/" + this.tagEndChar; |  | ||||||
|     } |  | ||||||
|   }else if (val !== '') { //empty
 |  | ||||||
|     return this.buildTextValNode(val, key, attrStr, level); |  | ||||||
|   } else { |  | ||||||
|     if(key[0] === "?") return  this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar; //PI tag
 |  | ||||||
|     else return  this.indentate(level) + '<' + key + attrStr + '/' + this.tagEndChar; //normal
 |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| function indentate(level) { | function indentate(level) { | ||||||
|   return this.options.indentBy.repeat(level); |   return this.options.indentBy.repeat(level); | ||||||
| } | } | ||||||
| @ -51082,108 +51083,131 @@ const EOL = "\n"; | |||||||
|  * @param {any} options  |  * @param {any} options  | ||||||
|  * @returns  |  * @returns  | ||||||
|  */ |  */ | ||||||
| function toXml(jArray, options){ | function toXml(jArray, options) { | ||||||
|     return arrToStr( jArray, options, "", 0); |     let indentation = ""; | ||||||
|  |     if (options.format && options.indentBy.length > 0) { | ||||||
|  |         indentation = EOL; | ||||||
|  |     } | ||||||
|  |     return arrToStr(jArray, options, "", indentation); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function arrToStr(arr, options, jPath, level){ | function arrToStr(arr, options, jPath, indentation) { | ||||||
|     let xmlStr = ""; |     let xmlStr = ""; | ||||||
| 
 |     let isPreviousElementTag = false; | ||||||
|     let indentation = ""; |  | ||||||
|     if(options.format && options.indentBy.length > 0){//TODO: this logic can be avoided for each call
 |  | ||||||
|         indentation = EOL + "" + options.indentBy.repeat(level); |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     for (let i = 0; i < arr.length; i++) { |     for (let i = 0; i < arr.length; i++) { | ||||||
|         const tagObj = arr[i]; |         const tagObj = arr[i]; | ||||||
|         const tagName = propName(tagObj); |         const tagName = propName(tagObj); | ||||||
|         let newJPath = ""; |         let newJPath = ""; | ||||||
|         if(jPath.length === 0) newJPath = tagName |         if (jPath.length === 0) newJPath = tagName | ||||||
|         else newJPath = `${jPath}.${tagName}`; |         else newJPath = `${jPath}.${tagName}`; | ||||||
| 
 | 
 | ||||||
|         if(tagName === options.textNodeName){ |         if (tagName === options.textNodeName) { | ||||||
|             let tagText = tagObj[tagName]; |             let tagText = tagObj[tagName]; | ||||||
|             if(!isStopNode(newJPath, options)){ |             if (!isStopNode(newJPath, options)) { | ||||||
|                 tagText = options.tagValueProcessor( tagName, tagText); |                 tagText = options.tagValueProcessor(tagName, tagText); | ||||||
|                 tagText = replaceEntitiesValue(tagText, options); |                 tagText = replaceEntitiesValue(tagText, options); | ||||||
|             } |             } | ||||||
|             xmlStr += indentation + tagText; |             if (isPreviousElementTag) { | ||||||
|  |                 xmlStr += indentation; | ||||||
|  |             } | ||||||
|  |             xmlStr += tagText; | ||||||
|  |             isPreviousElementTag = false; | ||||||
|             continue; |             continue; | ||||||
|         }else if( tagName === options.cdataPropName){ |         } else if (tagName === options.cdataPropName) { | ||||||
|             xmlStr += indentation + `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`; |             if (isPreviousElementTag) { | ||||||
|  |                 xmlStr += indentation; | ||||||
|  |             } | ||||||
|  |             xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`; | ||||||
|  |             isPreviousElementTag = false; | ||||||
|             continue; |             continue; | ||||||
|         }else if( tagName === options.commentPropName){ |         } else if (tagName === options.commentPropName) { | ||||||
|             xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`; |             xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`; | ||||||
|  |             isPreviousElementTag = true; | ||||||
|             continue; |             continue; | ||||||
|         }else if( tagName[0] === "?"){ |         } else if (tagName[0] === "?") { | ||||||
|             const attStr = attr_to_str(tagObj[":@"], options); |             const attStr = attr_to_str(tagObj[":@"], options); | ||||||
|             const tempInd = tagName === "?xml" ? "" : indentation; |             const tempInd = tagName === "?xml" ? "" : indentation; | ||||||
|             let piTextNodeName = tagObj[tagName][0][options.textNodeName]; |             let piTextNodeName = tagObj[tagName][0][options.textNodeName]; | ||||||
|             piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
 |             piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
 | ||||||
|             xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`; |             xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`; | ||||||
|  |             isPreviousElementTag = true; | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|         const attStr = attr_to_str(tagObj[":@"], options); |         let newIdentation = indentation; | ||||||
|         let tagStart =  indentation + `<${tagName}${attStr}`; |         if (newIdentation !== "") { | ||||||
|         let tagValue = arrToStr(tagObj[tagName], options, newJPath, level + 1); |             newIdentation += options.indentBy; | ||||||
|         if(options.unpairedTags.indexOf(tagName) !== -1){ |  | ||||||
|             if(options.suppressUnpairedNode)  xmlStr += tagStart + ">";  |  | ||||||
|             else xmlStr += tagStart + "/>";  |  | ||||||
|         }else if( (!tagValue || tagValue.length === 0) && options.suppressEmptyNode){  |  | ||||||
|             xmlStr += tagStart + "/>";  |  | ||||||
|         }else{  |  | ||||||
|             //TODO: node with only text value should not parse the text value in next line
 |  | ||||||
|             xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>` ; |  | ||||||
|         } |         } | ||||||
|  |         const attStr = attr_to_str(tagObj[":@"], options); | ||||||
|  |         const tagStart = indentation + `<${tagName}${attStr}`; | ||||||
|  |         const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation); | ||||||
|  |         if (options.unpairedTags.indexOf(tagName) !== -1) { | ||||||
|  |             if (options.suppressUnpairedNode) xmlStr += tagStart + ">"; | ||||||
|  |             else xmlStr += tagStart + "/>"; | ||||||
|  |         } else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) { | ||||||
|  |             xmlStr += tagStart + "/>"; | ||||||
|  |         } else if (tagValue && tagValue.endsWith(">")) { | ||||||
|  |             xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`; | ||||||
|  |         } else { | ||||||
|  |             xmlStr += tagStart + ">"; | ||||||
|  |             if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) { | ||||||
|  |                 xmlStr += indentation + options.indentBy + tagValue + indentation; | ||||||
|  |             } else { | ||||||
|  |                 xmlStr += tagValue; | ||||||
|  |             } | ||||||
|  |             xmlStr += `</${tagName}>`; | ||||||
|  |         } | ||||||
|  |         isPreviousElementTag = true; | ||||||
|     } |     } | ||||||
|      | 
 | ||||||
|     return xmlStr; |     return xmlStr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function propName(obj){ | function propName(obj) { | ||||||
|     const keys = Object.keys(obj); |     const keys = Object.keys(obj); | ||||||
|     for (let i = 0; i < keys.length; i++) { |     for (let i = 0; i < keys.length; i++) { | ||||||
|       const key = keys[i]; |         const key = keys[i]; | ||||||
|       if(key !== ":@") return key; |         if (key !== ":@") return key; | ||||||
|     } |     } | ||||||
|   } | } | ||||||
| 
 | 
 | ||||||
| function attr_to_str(attrMap, options){ | function attr_to_str(attrMap, options) { | ||||||
|     let attrStr = ""; |     let attrStr = ""; | ||||||
|     if(attrMap && !options.ignoreAttributes){ |     if (attrMap && !options.ignoreAttributes) { | ||||||
|         for (let attr in attrMap){ |         for (let attr in attrMap) { | ||||||
|             let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); |             let attrVal = options.attributeValueProcessor(attr, attrMap[attr]); | ||||||
|             attrVal = replaceEntitiesValue(attrVal, options); |             attrVal = replaceEntitiesValue(attrVal, options); | ||||||
|             if(attrVal === true && options.suppressBooleanAttributes){ |             if (attrVal === true && options.suppressBooleanAttributes) { | ||||||
|                 attrStr+= ` ${attr.substr(options.attributeNamePrefix.length)}`; |                 attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`; | ||||||
|             }else{ |             } else { | ||||||
|                 attrStr+= ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; |                 attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     return attrStr; |     return attrStr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function isStopNode(jPath, options){ | function isStopNode(jPath, options) { | ||||||
|     jPath = jPath.substr(0,jPath.length - options.textNodeName.length - 1); |     jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1); | ||||||
|     let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); |     let tagName = jPath.substr(jPath.lastIndexOf(".") + 1); | ||||||
|     for(let index in options.stopNodes){ |     for (let index in options.stopNodes) { | ||||||
|         if(options.stopNodes[index] === jPath || options.stopNodes[index] === "*."+tagName) return true; |         if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true; | ||||||
|     } |     } | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function replaceEntitiesValue(textValue, options){ | function replaceEntitiesValue(textValue, options) { | ||||||
|     if(textValue && textValue.length > 0 && options.processEntities){ |     if (textValue && textValue.length > 0 && options.processEntities) { | ||||||
|       for (let i=0; i< options.entities.length; i++) { |         for (let i = 0; i < options.entities.length; i++) { | ||||||
|         const entity = options.entities[i]; |             const entity = options.entities[i]; | ||||||
|         textValue = textValue.replace(entity.regex, entity.val); |             textValue = textValue.replace(entity.regex, entity.val); | ||||||
|       } |         } | ||||||
|     } |     } | ||||||
|     return textValue; |     return textValue; | ||||||
|   } | } | ||||||
| module.exports = toXml; | module.exports = toXml; | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| 
 | 
 | ||||||
| /***/ 6072: | /***/ 6072: | ||||||
| @ -51202,81 +51226,36 @@ function readDocType(xmlData, i){ | |||||||
|     {     |     {     | ||||||
|         i = i+9; |         i = i+9; | ||||||
|         let angleBracketsCount = 1; |         let angleBracketsCount = 1; | ||||||
|         let hasBody = false, entity = false, comment = false; |         let hasBody = false, comment = false; | ||||||
|         let exp = ""; |         let exp = ""; | ||||||
|         for(;i<xmlData.length;i++){ |         for(;i<xmlData.length;i++){ | ||||||
|             if (xmlData[i] === '<') { |             if (xmlData[i] === '<' && !comment) { //Determine the tag type
 | ||||||
|                 if( hasBody &&  |                 if( hasBody && isEntity(xmlData, i)){ | ||||||
|                      xmlData[i+1] === '!' && |                     i += 7;  | ||||||
|                      xmlData[i+2] === 'E' && |                     [entityName, val,i] = readEntityExp(xmlData,i+1); | ||||||
|                      xmlData[i+3] === 'N' && |                     if(val.indexOf("&") === -1) //Parameter entities are not supported
 | ||||||
|                      xmlData[i+4] === 'T' && |                         entities[ validateEntityName(entityName) ] = { | ||||||
|                      xmlData[i+5] === 'I' && |                             regx : RegExp( `&${entityName};`,"g"), | ||||||
|                      xmlData[i+6] === 'T' && |                             val: val | ||||||
|                      xmlData[i+7] === 'Y' |                         }; | ||||||
|                 ){ |  | ||||||
|                     i += 7; |  | ||||||
|                     entity = true; |  | ||||||
|                 }else if( hasBody &&  |  | ||||||
|                     xmlData[i+1] === '!' && |  | ||||||
|                      xmlData[i+2] === 'E' && |  | ||||||
|                      xmlData[i+3] === 'L' && |  | ||||||
|                      xmlData[i+4] === 'E' && |  | ||||||
|                      xmlData[i+5] === 'M' && |  | ||||||
|                      xmlData[i+6] === 'E' && |  | ||||||
|                      xmlData[i+7] === 'N' && |  | ||||||
|                      xmlData[i+8] === 'T' |  | ||||||
|                 ){ |  | ||||||
|                     //Not supported
 |  | ||||||
|                     i += 8; |  | ||||||
|                 }else if( hasBody &&  |  | ||||||
|                     xmlData[i+1] === '!' && |  | ||||||
|                     xmlData[i+2] === 'A' && |  | ||||||
|                     xmlData[i+3] === 'T' && |  | ||||||
|                     xmlData[i+4] === 'T' && |  | ||||||
|                     xmlData[i+5] === 'L' && |  | ||||||
|                     xmlData[i+6] === 'I' && |  | ||||||
|                     xmlData[i+7] === 'S' && |  | ||||||
|                     xmlData[i+8] === 'T' |  | ||||||
|                 ){ |  | ||||||
|                     //Not supported
 |  | ||||||
|                     i += 8; |  | ||||||
|                 }else if( hasBody &&  |  | ||||||
|                     xmlData[i+1] === '!' && |  | ||||||
|                     xmlData[i+2] === 'N' && |  | ||||||
|                     xmlData[i+3] === 'O' && |  | ||||||
|                     xmlData[i+4] === 'T' && |  | ||||||
|                     xmlData[i+5] === 'A' && |  | ||||||
|                     xmlData[i+6] === 'T' && |  | ||||||
|                     xmlData[i+7] === 'I' && |  | ||||||
|                     xmlData[i+8] === 'O' && |  | ||||||
|                     xmlData[i+9] === 'N' |  | ||||||
|                 ){ |  | ||||||
|                     //Not supported
 |  | ||||||
|                     i += 9; |  | ||||||
|                 }else if( //comment
 |  | ||||||
|                     xmlData[i+1] === '!' && |  | ||||||
|                     xmlData[i+2] === '-' && |  | ||||||
|                     xmlData[i+3] === '-' |  | ||||||
|                 ){ |  | ||||||
|                     comment = true; |  | ||||||
|                 }else{ |  | ||||||
|                     throw new Error("Invalid DOCTYPE"); |  | ||||||
|                 } |                 } | ||||||
|  |                 else if( hasBody && isElement(xmlData, i))  i += 8;//Not supported
 | ||||||
|  |                 else if( hasBody && isAttlist(xmlData, i))  i += 8;//Not supported
 | ||||||
|  |                 else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported
 | ||||||
|  |                 else if( isComment)                         comment = true; | ||||||
|  |                 else                                        throw new Error("Invalid DOCTYPE"); | ||||||
|  | 
 | ||||||
|                 angleBracketsCount++; |                 angleBracketsCount++; | ||||||
|                 exp = ""; |                 exp = ""; | ||||||
|             } else if (xmlData[i] === '>') { |             } else if (xmlData[i] === '>') { //Read tag content
 | ||||||
|                 if(comment){ |                 if(comment){ | ||||||
|                     if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){ |                     if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){ | ||||||
|                         comment = false; |                         comment = false; | ||||||
|                     }else{ |                         angleBracketsCount--; | ||||||
|                         throw new Error(`Invalid XML comment in DOCTYPE`); |  | ||||||
|                     } |                     } | ||||||
|                 }else if(entity){ |                 }else{ | ||||||
|                     parseEntityExp(exp, entities); |                     angleBracketsCount--; | ||||||
|                     entity = false; |  | ||||||
|                 } |                 } | ||||||
|                 angleBracketsCount--; |  | ||||||
|                 if (angleBracketsCount === 0) { |                 if (angleBracketsCount === 0) { | ||||||
|                   break; |                   break; | ||||||
|                 } |                 } | ||||||
| @ -51295,16 +51274,99 @@ function readDocType(xmlData, i){ | |||||||
|     return {entities, i}; |     return {entities, i}; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const entityRegex = RegExp("^\\s([a-zA-z0-0]+)[ \t](['\"])([^&]+)\\2"); | function readEntityExp(xmlData,i){ | ||||||
| function parseEntityExp(exp, entities){ |     //External entities are not supported
 | ||||||
|     const match = entityRegex.exec(exp); |     //    <!ENTITY ext SYSTEM "http://normal-website.com" >
 | ||||||
|     if(match){ | 
 | ||||||
|         entities[ match[1] ] = { |     //Parameter entities are not supported
 | ||||||
|             regx : RegExp( `&${match[1]};`,"g"), |     //    <!ENTITY entityname "&anotherElement;">
 | ||||||
|             val: match[3] | 
 | ||||||
|         }; |     //Internal entities are supported
 | ||||||
|  |     //    <!ENTITY entityname "replacement text">
 | ||||||
|  |      | ||||||
|  |     //read EntityName
 | ||||||
|  |     let entityName = ""; | ||||||
|  |     for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) { | ||||||
|  |         // if(xmlData[i] === " ") continue;
 | ||||||
|  |         // else 
 | ||||||
|  |         entityName += xmlData[i]; | ||||||
|     } |     } | ||||||
|  |     entityName = entityName.trim(); | ||||||
|  |     if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported"); | ||||||
|  | 
 | ||||||
|  |     //read Entity Value
 | ||||||
|  |     const startChar = xmlData[i++]; | ||||||
|  |     let val = "" | ||||||
|  |     for (; i < xmlData.length && xmlData[i] !== startChar ; i++) { | ||||||
|  |         val += xmlData[i]; | ||||||
|  |     } | ||||||
|  |     return [entityName, val, i]; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | function isComment(xmlData, i){ | ||||||
|  |     if(xmlData[i+1] === '!' && | ||||||
|  |     xmlData[i+2] === '-' && | ||||||
|  |     xmlData[i+3] === '-') return true | ||||||
|  |     return false | ||||||
|  | } | ||||||
|  | function isEntity(xmlData, i){ | ||||||
|  |     if(xmlData[i+1] === '!' && | ||||||
|  |     xmlData[i+2] === 'E' && | ||||||
|  |     xmlData[i+3] === 'N' && | ||||||
|  |     xmlData[i+4] === 'T' && | ||||||
|  |     xmlData[i+5] === 'I' && | ||||||
|  |     xmlData[i+6] === 'T' && | ||||||
|  |     xmlData[i+7] === 'Y') return true | ||||||
|  |     return false | ||||||
|  | } | ||||||
|  | function isElement(xmlData, i){ | ||||||
|  |     if(xmlData[i+1] === '!' && | ||||||
|  |     xmlData[i+2] === 'E' && | ||||||
|  |     xmlData[i+3] === 'L' && | ||||||
|  |     xmlData[i+4] === 'E' && | ||||||
|  |     xmlData[i+5] === 'M' && | ||||||
|  |     xmlData[i+6] === 'E' && | ||||||
|  |     xmlData[i+7] === 'N' && | ||||||
|  |     xmlData[i+8] === 'T') return true | ||||||
|  |     return false | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function isAttlist(xmlData, i){ | ||||||
|  |     if(xmlData[i+1] === '!' && | ||||||
|  |     xmlData[i+2] === 'A' && | ||||||
|  |     xmlData[i+3] === 'T' && | ||||||
|  |     xmlData[i+4] === 'T' && | ||||||
|  |     xmlData[i+5] === 'L' && | ||||||
|  |     xmlData[i+6] === 'I' && | ||||||
|  |     xmlData[i+7] === 'S' && | ||||||
|  |     xmlData[i+8] === 'T') return true | ||||||
|  |     return false | ||||||
|  | } | ||||||
|  | function isNotation(xmlData, i){ | ||||||
|  |     if(xmlData[i+1] === '!' && | ||||||
|  |     xmlData[i+2] === 'N' && | ||||||
|  |     xmlData[i+3] === 'O' && | ||||||
|  |     xmlData[i+4] === 'T' && | ||||||
|  |     xmlData[i+5] === 'A' && | ||||||
|  |     xmlData[i+6] === 'T' && | ||||||
|  |     xmlData[i+7] === 'I' && | ||||||
|  |     xmlData[i+8] === 'O' && | ||||||
|  |     xmlData[i+9] === 'N') return true | ||||||
|  |     return false | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | //an entity name should not contains special characters that may be used in regex
 | ||||||
|  | //Eg !?\\\/[]$%{}^&*()<>
 | ||||||
|  | const specialChar = "!?\\\/[]$%{}^&*()<>|+"; | ||||||
|  | 
 | ||||||
|  | function validateEntityName(name){ | ||||||
|  |     for (let i = 0; i < specialChar.length; i++) { | ||||||
|  |         const ch = specialChar[i]; | ||||||
|  |         if(name.indexOf(ch) !== -1) throw new Error(`Invalid character ${ch} in entity name`); | ||||||
|  |     } | ||||||
|  |     return name; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| module.exports = readDocType; | module.exports = readDocType; | ||||||
| 
 | 
 | ||||||
| /***/ }), | /***/ }), | ||||||
| @ -51328,7 +51390,8 @@ const defaultOptions = { | |||||||
|     cdataPropName: false, |     cdataPropName: false, | ||||||
|     numberParseOptions: { |     numberParseOptions: { | ||||||
|       hex: true, |       hex: true, | ||||||
|       leadingZeros: true |       leadingZeros: true, | ||||||
|  |       eNotation: true | ||||||
|     }, |     }, | ||||||
|     tagValueProcessor: function(tagName, val) { |     tagValueProcessor: function(tagName, val) { | ||||||
|       return val; |       return val; | ||||||
| @ -51346,6 +51409,11 @@ const defaultOptions = { | |||||||
|     ignoreDeclaration: false, |     ignoreDeclaration: false, | ||||||
|     ignorePiTags: false, |     ignorePiTags: false, | ||||||
|     transformTagName: false, |     transformTagName: false, | ||||||
|  |     transformAttributeName: false, | ||||||
|  |     updateTag: function(tagName, jPath, attrs){ | ||||||
|  |       return tagName | ||||||
|  |     }, | ||||||
|  |     // skipEmptyListItem: false
 | ||||||
| }; | }; | ||||||
|     |     | ||||||
| const buildOptions = function(options) { | const buildOptions = function(options) { | ||||||
| @ -51383,12 +51451,12 @@ class OrderedObjParser{ | |||||||
|     this.tagsNodeStack = []; |     this.tagsNodeStack = []; | ||||||
|     this.docTypeEntities = {}; |     this.docTypeEntities = {}; | ||||||
|     this.lastEntities = { |     this.lastEntities = { | ||||||
|       "amp" : { regex: /&(amp|#38|#x26);/g, val : "&"}, |  | ||||||
|       "apos" : { regex: /&(apos|#39|#x27);/g, val : "'"}, |       "apos" : { regex: /&(apos|#39|#x27);/g, val : "'"}, | ||||||
|       "gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"}, |       "gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"}, | ||||||
|       "lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"}, |       "lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"}, | ||||||
|       "quot" : { regex: /&(quot|#34|#x22);/g, val : "\""}, |       "quot" : { regex: /&(quot|#34|#x22);/g, val : "\""}, | ||||||
|     }; |     }; | ||||||
|  |     this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"}; | ||||||
|     this.htmlEntities = { |     this.htmlEntities = { | ||||||
|       "space": { regex: /&(nbsp|#160);/g, val: " " }, |       "space": { regex: /&(nbsp|#160);/g, val: " " }, | ||||||
|       // "lt" : { regex: /&(lt|#60);/g, val: "<" },
 |       // "lt" : { regex: /&(lt|#60);/g, val: "<" },
 | ||||||
| @ -51413,6 +51481,7 @@ class OrderedObjParser{ | |||||||
|     this.replaceEntitiesValue = replaceEntitiesValue; |     this.replaceEntitiesValue = replaceEntitiesValue; | ||||||
|     this.readStopNodeData = readStopNodeData; |     this.readStopNodeData = readStopNodeData; | ||||||
|     this.saveTextToParentTag = saveTextToParentTag; |     this.saveTextToParentTag = saveTextToParentTag; | ||||||
|  |     this.addChild = addChild; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| @ -51484,7 +51553,7 @@ function resolveNameSpace(tagname) { | |||||||
| //const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
 | //const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
 | ||||||
| const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm'); | const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm'); | ||||||
| 
 | 
 | ||||||
| function buildAttributesMap(attrStr, jPath) { | function buildAttributesMap(attrStr, jPath, tagName) { | ||||||
|   if (!this.options.ignoreAttributes && typeof attrStr === 'string') { |   if (!this.options.ignoreAttributes && typeof attrStr === 'string') { | ||||||
|     // attrStr = attrStr.replace(/\r?\n/g, ' ');
 |     // attrStr = attrStr.replace(/\r?\n/g, ' ');
 | ||||||
|     //attrStr = attrStr || attrStr.trim();
 |     //attrStr = attrStr || attrStr.trim();
 | ||||||
| @ -51495,8 +51564,12 @@ function buildAttributesMap(attrStr, jPath) { | |||||||
|     for (let i = 0; i < len; i++) { |     for (let i = 0; i < len; i++) { | ||||||
|       const attrName = this.resolveNameSpace(matches[i][1]); |       const attrName = this.resolveNameSpace(matches[i][1]); | ||||||
|       let oldVal = matches[i][4]; |       let oldVal = matches[i][4]; | ||||||
|       const aName = this.options.attributeNamePrefix + attrName; |       let aName = this.options.attributeNamePrefix + attrName; | ||||||
|       if (attrName.length) { |       if (attrName.length) { | ||||||
|  |         if (this.options.transformAttributeName) { | ||||||
|  |           aName = this.options.transformAttributeName(aName); | ||||||
|  |         } | ||||||
|  |         if(aName === "__proto__") aName  = "#__proto__"; | ||||||
|         if (oldVal !== undefined) { |         if (oldVal !== undefined) { | ||||||
|           if (this.options.trimValues) { |           if (this.options.trimValues) { | ||||||
|             oldVal = oldVal.trim(); |             oldVal = oldVal.trim(); | ||||||
| @ -51530,7 +51603,7 @@ function buildAttributesMap(attrStr, jPath) { | |||||||
|       attrCollection[this.options.attributesGroupName] = attrs; |       attrCollection[this.options.attributesGroupName] = attrs; | ||||||
|       return attrCollection; |       return attrCollection; | ||||||
|     } |     } | ||||||
|     return attrs; |     return attrs | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -51564,9 +51637,21 @@ const parseXml = function(xmlData) { | |||||||
|           textData = this.saveTextToParentTag(textData, currentNode, jPath); |           textData = this.saveTextToParentTag(textData, currentNode, jPath); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         jPath = jPath.substr(0, jPath.lastIndexOf(".")); |         //check if last tag of nested tag was unpaired tag
 | ||||||
|          |         const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1); | ||||||
|         currentNode = this.tagsNodeStack.pop();//avoid recurssion, set the parent tag scope
 |         if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){ | ||||||
|  |           throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`); | ||||||
|  |         } | ||||||
|  |         let propIndex = 0 | ||||||
|  |         if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){ | ||||||
|  |           propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1) | ||||||
|  |           this.tagsNodeStack.pop(); | ||||||
|  |         }else{ | ||||||
|  |           propIndex = jPath.lastIndexOf("."); | ||||||
|  |         } | ||||||
|  |         jPath = jPath.substring(0, propIndex); | ||||||
|  | 
 | ||||||
|  |         currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
 | ||||||
|         textData = ""; |         textData = ""; | ||||||
|         i = closeIndex; |         i = closeIndex; | ||||||
|       } else if( xmlData[i+1] === '?') { |       } else if( xmlData[i+1] === '?') { | ||||||
| @ -51583,9 +51668,9 @@ const parseXml = function(xmlData) { | |||||||
|           childNode.add(this.options.textNodeName, ""); |           childNode.add(this.options.textNodeName, ""); | ||||||
|            |            | ||||||
|           if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){ |           if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){ | ||||||
|             childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath); |             childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName); | ||||||
|           } |           } | ||||||
|           currentNode.addChild(childNode); |           this.addChild(currentNode, childNode, jPath) | ||||||
| 
 | 
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| @ -51624,7 +51709,7 @@ const parseXml = function(xmlData) { | |||||||
|          |          | ||||||
|         i = closeIndex + 2; |         i = closeIndex + 2; | ||||||
|       }else {//Opening tag
 |       }else {//Opening tag
 | ||||||
|         let result = readTagExp(xmlData,i, this. options.removeNSPrefix); |         let result = readTagExp(xmlData,i, this.options.removeNSPrefix); | ||||||
|         let tagName= result.tagName; |         let tagName= result.tagName; | ||||||
|         let tagExp = result.tagExp; |         let tagExp = result.tagExp; | ||||||
|         let attrExpPresent = result.attrExpPresent; |         let attrExpPresent = result.attrExpPresent; | ||||||
| @ -51642,23 +51727,22 @@ const parseXml = function(xmlData) { | |||||||
|           } |           } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if(tagName !== xmlObj.tagname){ |  | ||||||
|           jPath += jPath ? "." + tagName : tagName; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         //check if last tag was unpaired tag
 |         //check if last tag was unpaired tag
 | ||||||
|         const lastTag = currentNode; |         const lastTag = currentNode; | ||||||
|         if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){ |         if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){ | ||||||
|           currentNode = this.tagsNodeStack.pop(); |           currentNode = this.tagsNodeStack.pop(); | ||||||
|  |           jPath = jPath.substring(0, jPath.lastIndexOf(".")); | ||||||
|  |         } | ||||||
|  |         if(tagName !== xmlObj.tagname){ | ||||||
|  |           jPath += jPath ? "." + tagName : tagName; | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
 |         if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) { //TODO: namespace
 | ||||||
|           let tagContent = ""; |           let tagContent = ""; | ||||||
|           //self-closing tag
 |           //self-closing tag
 | ||||||
|           if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ |           if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ | ||||||
|             i = result.closeIndex; |             i = result.closeIndex; | ||||||
|           } |           } | ||||||
|           //boolean tag
 |           //unpaired tag
 | ||||||
|           else if(this.options.unpairedTags.indexOf(tagName) !== -1){ |           else if(this.options.unpairedTags.indexOf(tagName) !== -1){ | ||||||
|             i = result.closeIndex; |             i = result.closeIndex; | ||||||
|           } |           } | ||||||
| @ -51673,7 +51757,7 @@ const parseXml = function(xmlData) { | |||||||
| 
 | 
 | ||||||
|           const childNode = new xmlNode(tagName); |           const childNode = new xmlNode(tagName); | ||||||
|           if(tagName !== tagExp && attrExpPresent){ |           if(tagName !== tagExp && attrExpPresent){ | ||||||
|             childNode[":@"] = this.buildAttributesMap(tagExp, jPath); |             childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); | ||||||
|           } |           } | ||||||
|           if(tagContent) { |           if(tagContent) { | ||||||
|             tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); |             tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true); | ||||||
| @ -51682,7 +51766,7 @@ const parseXml = function(xmlData) { | |||||||
|           jPath = jPath.substr(0, jPath.lastIndexOf(".")); |           jPath = jPath.substr(0, jPath.lastIndexOf(".")); | ||||||
|           childNode.add(this.options.textNodeName, tagContent); |           childNode.add(this.options.textNodeName, tagContent); | ||||||
|            |            | ||||||
|           currentNode.addChild(childNode); |           this.addChild(currentNode, childNode, jPath) | ||||||
|         }else{ |         }else{ | ||||||
|   //selfClosing tag
 |   //selfClosing tag
 | ||||||
|           if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ |           if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){ | ||||||
| @ -51699,10 +51783,10 @@ const parseXml = function(xmlData) { | |||||||
| 
 | 
 | ||||||
|             const childNode = new xmlNode(tagName); |             const childNode = new xmlNode(tagName); | ||||||
|             if(tagName !== tagExp && attrExpPresent){ |             if(tagName !== tagExp && attrExpPresent){ | ||||||
|               childNode[":@"] = this.buildAttributesMap(tagExp, jPath); |               childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); | ||||||
|             } |             } | ||||||
|  |             this.addChild(currentNode, childNode, jPath) | ||||||
|             jPath = jPath.substr(0, jPath.lastIndexOf(".")); |             jPath = jPath.substr(0, jPath.lastIndexOf(".")); | ||||||
|             currentNode.addChild(childNode); |  | ||||||
|           } |           } | ||||||
|     //opening tag
 |     //opening tag
 | ||||||
|           else{ |           else{ | ||||||
| @ -51710,9 +51794,9 @@ const parseXml = function(xmlData) { | |||||||
|             this.tagsNodeStack.push(currentNode); |             this.tagsNodeStack.push(currentNode); | ||||||
|              |              | ||||||
|             if(tagName !== tagExp && attrExpPresent){ |             if(tagName !== tagExp && attrExpPresent){ | ||||||
|               childNode[":@"] = this.buildAttributesMap(tagExp, jPath); |               childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName); | ||||||
|             } |             } | ||||||
|             currentNode.addChild(childNode); |             this.addChild(currentNode, childNode, jPath) | ||||||
|             currentNode = childNode; |             currentNode = childNode; | ||||||
|           } |           } | ||||||
|           textData = ""; |           textData = ""; | ||||||
| @ -51726,7 +51810,19 @@ const parseXml = function(xmlData) { | |||||||
|   return xmlObj.child; |   return xmlObj.child; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | function addChild(currentNode, childNode, jPath){ | ||||||
|  |   const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]) | ||||||
|  |   if(result === false){ | ||||||
|  |   }else if(typeof result === "string"){ | ||||||
|  |     childNode.tagname = result | ||||||
|  |     currentNode.addChild(childNode); | ||||||
|  |   }else{ | ||||||
|  |     currentNode.addChild(childNode); | ||||||
|  |   } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| const replaceEntitiesValue = function(val){ | const replaceEntitiesValue = function(val){ | ||||||
|  | 
 | ||||||
|   if(this.options.processEntities){ |   if(this.options.processEntities){ | ||||||
|     for(let entityName in this.docTypeEntities){ |     for(let entityName in this.docTypeEntities){ | ||||||
|       const entity = this.docTypeEntities[entityName]; |       const entity = this.docTypeEntities[entityName]; | ||||||
| @ -51742,6 +51838,7 @@ const replaceEntitiesValue = function(val){ | |||||||
|         val = val.replace( entity.regex, entity.val); |         val = val.replace( entity.regex, entity.val); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |     val = val.replace( this.ampEntity.regex, this.ampEntity.val); | ||||||
|   } |   } | ||||||
|   return val; |   return val; | ||||||
| } | } | ||||||
| @ -51780,7 +51877,7 @@ function isItStopNode(stopNodes, jPath, currentTagName){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
|  * Returns the tag Expression and where it is ending handling single-dobule quotes situation |  * Returns the tag Expression and where it is ending handling single-double quotes situation | ||||||
|  * @param {string} xmlData  |  * @param {string} xmlData  | ||||||
|  * @param {number} i starting index |  * @param {number} i starting index | ||||||
|  * @returns  |  * @returns  | ||||||
| @ -51976,6 +52073,8 @@ class XMLParser{ | |||||||
|             throw new Error("Entity value can't have '&'") |             throw new Error("Entity value can't have '&'") | ||||||
|         }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){ |         }else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){ | ||||||
|             throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'") |             throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'") | ||||||
|  |         }else if(value === "&"){ | ||||||
|  |             throw new Error("An entity with value '&' is not permitted"); | ||||||
|         }else{ |         }else{ | ||||||
|             this.externalEntities[key] = value; |             this.externalEntities[key] = value; | ||||||
|         } |         } | ||||||
| @ -52086,8 +52185,20 @@ function assignAttributes(obj, attrMap, jpath, options){ | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function isLeafTag(obj, options){ | function isLeafTag(obj, options){ | ||||||
|  |   const { textNodeName } = options; | ||||||
|   const propCount = Object.keys(obj).length; |   const propCount = Object.keys(obj).length; | ||||||
|   if( propCount === 0 || (propCount === 1 && obj[options.textNodeName]) ) return true; |    | ||||||
|  |   if (propCount === 0) { | ||||||
|  |     return true; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   if ( | ||||||
|  |     propCount === 1 && | ||||||
|  |     (obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0) | ||||||
|  |   ) { | ||||||
|  |     return true; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
| exports.prettify = prettify; | exports.prettify = prettify; | ||||||
| @ -52109,9 +52220,11 @@ class XmlNode{ | |||||||
|   } |   } | ||||||
|   add(key,val){ |   add(key,val){ | ||||||
|     // this.child.push( {name : key, val: val, isCdata: isCdata });
 |     // this.child.push( {name : key, val: val, isCdata: isCdata });
 | ||||||
|  |     if(key === "__proto__") key = "#__proto__"; | ||||||
|     this.child.push( {[key]: val }); |     this.child.push( {[key]: val }); | ||||||
|   } |   } | ||||||
|   addChild(node) { |   addChild(node) { | ||||||
|  |     if(node.tagname === "__proto__") node.tagname = "#__proto__"; | ||||||
|     if(node[":@"] && Object.keys(node[":@"]).length > 0){ |     if(node[":@"] && Object.keys(node[":@"]).length > 0){ | ||||||
|       this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] }); |       this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] }); | ||||||
|     }else{ |     }else{ | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								externals/install-dotnet.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								externals/install-dotnet.sh
									
									
									
									
										vendored
									
									
								
							| @ -310,6 +310,10 @@ get_machine_architecture() { | |||||||
|             echo "s390x" |             echo "s390x" | ||||||
|             return 0 |             return 0 | ||||||
|             ;; |             ;; | ||||||
|  |         ppc64le) | ||||||
|  |             echo "ppc64le" | ||||||
|  |             return 0 | ||||||
|  |             ;; | ||||||
|         esac |         esac | ||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
| @ -347,6 +351,10 @@ get_normalized_architecture_from_architecture() { | |||||||
|             echo "s390x" |             echo "s390x" | ||||||
|             return 0 |             return 0 | ||||||
|             ;; |             ;; | ||||||
|  |         ppc64le) | ||||||
|  |             echo "ppc64le" | ||||||
|  |             return 0 | ||||||
|  |             ;; | ||||||
|     esac |     esac | ||||||
| 
 | 
 | ||||||
|     say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" |     say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues" | ||||||
| @ -1655,7 +1663,7 @@ do | |||||||
|             echo "      -InstallDir" |             echo "      -InstallDir" | ||||||
|             echo "  --architecture <ARCHITECTURE>      Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." |             echo "  --architecture <ARCHITECTURE>      Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`." | ||||||
|             echo "      --arch,-Architecture,-Arch" |             echo "      --arch,-Architecture,-Arch" | ||||||
|             echo "          Possible values: x64, arm, arm64 and s390x" |             echo "          Possible values: x64, arm, arm64, s390x and ppc64le" | ||||||
|             echo "  --os <system>                    Specifies operating system to be used when selecting the installer." |             echo "  --os <system>                    Specifies operating system to be used when selecting the installer." | ||||||
|             echo "          Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6." |             echo "          Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6." | ||||||
|             echo "          In case any other value is provided, the platform will be determined by the script based on machine configuration." |             echo "          In case any other value is provided, the platform will be determined by the script based on machine configuration." | ||||||
| @ -1735,4 +1743,4 @@ fi | |||||||
| 
 | 
 | ||||||
| say "Note that the script does not resolve dependencies during installation." | say "Note that the script does not resolve dependencies during installation." | ||||||
| say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." | say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section." | ||||||
| say "Installation finished successfully." | say "Installation finished successfully." | ||||||
|  | |||||||
							
								
								
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										28
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -16,7 +16,7 @@ | |||||||
|         "@actions/glob": "^0.3.0", |         "@actions/glob": "^0.3.0", | ||||||
|         "@actions/http-client": "^2.0.1", |         "@actions/http-client": "^2.0.1", | ||||||
|         "@actions/io": "^1.0.2", |         "@actions/io": "^1.0.2", | ||||||
|         "fast-xml-parser": "^4.0.10", |         "fast-xml-parser": "^4.2.4", | ||||||
|         "json5": "^2.2.3", |         "json5": "^2.2.3", | ||||||
|         "semver": "^6.3.0" |         "semver": "^6.3.0" | ||||||
|       }, |       }, | ||||||
| @ -3309,18 +3309,24 @@ | |||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "node_modules/fast-xml-parser": { |     "node_modules/fast-xml-parser": { | ||||||
|       "version": "4.0.10", |       "version": "4.2.4", | ||||||
|       "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz", |       "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz", | ||||||
|       "integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==", |       "integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==", | ||||||
|  |       "funding": [ | ||||||
|  |         { | ||||||
|  |           "type": "paypal", | ||||||
|  |           "url": "https://paypal.me/naturalintelligence" | ||||||
|  |         }, | ||||||
|  |         { | ||||||
|  |           "type": "github", | ||||||
|  |           "url": "https://github.com/sponsors/NaturalIntelligence" | ||||||
|  |         } | ||||||
|  |       ], | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "strnum": "^1.0.5" |         "strnum": "^1.0.5" | ||||||
|       }, |       }, | ||||||
|       "bin": { |       "bin": { | ||||||
|         "fxparser": "src/cli/cli.js" |         "fxparser": "src/cli/cli.js" | ||||||
|       }, |  | ||||||
|       "funding": { |  | ||||||
|         "type": "paypal", |  | ||||||
|         "url": "https://paypal.me/naturalintelligence" |  | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/fastq": { |     "node_modules/fastq": { | ||||||
| @ -9004,9 +9010,9 @@ | |||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "fast-xml-parser": { |     "fast-xml-parser": { | ||||||
|       "version": "4.0.10", |       "version": "4.2.4", | ||||||
|       "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz", |       "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz", | ||||||
|       "integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==", |       "integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==", | ||||||
|       "requires": { |       "requires": { | ||||||
|         "strnum": "^1.0.5" |         "strnum": "^1.0.5" | ||||||
|       } |       } | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ | |||||||
|     "@actions/glob": "^0.3.0", |     "@actions/glob": "^0.3.0", | ||||||
|     "@actions/http-client": "^2.0.1", |     "@actions/http-client": "^2.0.1", | ||||||
|     "@actions/io": "^1.0.2", |     "@actions/io": "^1.0.2", | ||||||
|     "fast-xml-parser": "^4.0.10", |     "fast-xml-parser": "^4.2.4", | ||||||
|     "json5": "^2.2.3", |     "json5": "^2.2.3", | ||||||
|     "semver": "^6.3.0" |     "semver": "^6.3.0" | ||||||
|   }, |   }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user