mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 11:31:07 +07: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
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
Binary file not shown.
539
dist/setup/index.js
vendored
539
dist/setup/index.js
vendored
@ -50842,7 +50842,9 @@ const defaultOptions = {
|
||||
],
|
||||
processEntities: true,
|
||||
stopNodes: [],
|
||||
transformTagName: false,
|
||||
// transformTagName: false,
|
||||
// transformAttributeName: false,
|
||||
oneListGroup: false
|
||||
};
|
||||
|
||||
function Builder(options) {
|
||||
@ -50869,20 +50871,6 @@ function Builder(options) {
|
||||
this.tagEndChar = '>';
|
||||
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) {
|
||||
@ -50909,7 +50897,7 @@ Builder.prototype.j2x = function(jObj, level) {
|
||||
else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
||||
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
||||
} 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') {
|
||||
//premitive type
|
||||
const attr = this.isAttribute(key);
|
||||
@ -50921,12 +50909,13 @@ Builder.prototype.j2x = function(jObj, level) {
|
||||
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
|
||||
val += this.replaceEntitiesValue(newval);
|
||||
} else {
|
||||
val += this.buildTextNode(jObj[key], key, '', level);
|
||||
val += this.buildTextValNode(jObj[key], key, '', level);
|
||||
}
|
||||
}
|
||||
} else if (Array.isArray(jObj[key])) {
|
||||
//repeated nodes
|
||||
const arrLen = jObj[key].length;
|
||||
let listTagVal = "";
|
||||
for (let j = 0; j < arrLen; j++) {
|
||||
const item = jObj[key][j];
|
||||
if (typeof item === 'undefined') {
|
||||
@ -50936,11 +50925,19 @@ Builder.prototype.j2x = function(jObj, level) {
|
||||
else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
||||
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
||||
} 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 {
|
||||
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 {
|
||||
//nested node
|
||||
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
||||
@ -50957,7 +50954,7 @@ Builder.prototype.j2x = function(jObj, level) {
|
||||
return {attrStr: attrStr, val: val};
|
||||
};
|
||||
|
||||
function buildAttrPairStr(attrName, val){
|
||||
Builder.prototype.buildAttrPairStr = function(attrName, val){
|
||||
val = this.options.attributeValueProcessor(attrName, '' + val);
|
||||
val = this.replaceEntitiesValue(val);
|
||||
if (this.options.suppressBooleanAttributes && val === "true") {
|
||||
@ -50968,68 +50965,87 @@ function buildAttrPairStr(attrName, val){
|
||||
function processTextOrObjNode (object, key, level) {
|
||||
const result = this.j2x(object, level + 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 {
|
||||
return this.buildObjNode(result.val, key, result.attrStr, level);
|
||||
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
||||
}
|
||||
}
|
||||
|
||||
function buildObjectNode(val, key, attrStr, level) {
|
||||
let tagEndExp = '</' + key + this.tagEndChar;
|
||||
let piClosingChar = "";
|
||||
Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
||||
if(val === ""){
|
||||
if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
||||
else {
|
||||
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
||||
}
|
||||
}else{
|
||||
|
||||
if(key[0] === "?") {
|
||||
piClosingChar = "?";
|
||||
tagEndExp = "";
|
||||
}
|
||||
let tagEndExp = '</' + key + this.tagEndChar;
|
||||
let piClosingChar = "";
|
||||
|
||||
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 );
|
||||
if(key[0] === "?") {
|
||||
piClosingChar = "?";
|
||||
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) {
|
||||
if (val !== '') {
|
||||
return this.buildObjectNode(val, key, attrStr, level);
|
||||
} else {
|
||||
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) {
|
||||
return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
|
||||
}else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
||||
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
||||
}else if(key[0] === "?") {//PI tag
|
||||
return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
||||
}else{
|
||||
let textValue = this.options.tagValueProcessor(key, val);
|
||||
textValue = this.replaceEntitiesValue(textValue);
|
||||
|
||||
if( textValue === '' && 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{
|
||||
return (
|
||||
this.indentate(level) + '<' + key + attrStr + '>' +
|
||||
if( textValue === ''){
|
||||
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
||||
}else{
|
||||
return this.indentate(level) + '<' + key + attrStr + '>' +
|
||||
textValue +
|
||||
'</' + key + this.tagEndChar );
|
||||
'</' + key + this.tagEndChar;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function replaceEntitiesValue(textValue){
|
||||
Builder.prototype.replaceEntitiesValue = function(textValue){
|
||||
if(textValue && textValue.length > 0 && this.options.processEntities){
|
||||
for (let i=0; i<this.options.entities.length; i++) {
|
||||
const entity = this.options.entities[i];
|
||||
@ -51039,21 +51055,6 @@ function replaceEntitiesValue(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) {
|
||||
return this.options.indentBy.repeat(level);
|
||||
}
|
||||
@ -51082,108 +51083,131 @@ const EOL = "\n";
|
||||
* @param {any} options
|
||||
* @returns
|
||||
*/
|
||||
function toXml(jArray, options){
|
||||
return arrToStr( jArray, options, "", 0);
|
||||
function toXml(jArray, options) {
|
||||
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 indentation = "";
|
||||
if(options.format && options.indentBy.length > 0){//TODO: this logic can be avoided for each call
|
||||
indentation = EOL + "" + options.indentBy.repeat(level);
|
||||
}
|
||||
let isPreviousElementTag = false;
|
||||
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
const tagObj = arr[i];
|
||||
const tagName = propName(tagObj);
|
||||
let newJPath = "";
|
||||
if(jPath.length === 0) newJPath = tagName
|
||||
if (jPath.length === 0) newJPath = tagName
|
||||
else newJPath = `${jPath}.${tagName}`;
|
||||
|
||||
if(tagName === options.textNodeName){
|
||||
if (tagName === options.textNodeName) {
|
||||
let tagText = tagObj[tagName];
|
||||
if(!isStopNode(newJPath, options)){
|
||||
tagText = options.tagValueProcessor( tagName, tagText);
|
||||
if (!isStopNode(newJPath, options)) {
|
||||
tagText = options.tagValueProcessor(tagName, tagText);
|
||||
tagText = replaceEntitiesValue(tagText, options);
|
||||
}
|
||||
xmlStr += indentation + tagText;
|
||||
if (isPreviousElementTag) {
|
||||
xmlStr += indentation;
|
||||
}
|
||||
xmlStr += tagText;
|
||||
isPreviousElementTag = false;
|
||||
continue;
|
||||
}else if( tagName === options.cdataPropName){
|
||||
xmlStr += indentation + `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
||||
} else if (tagName === options.cdataPropName) {
|
||||
if (isPreviousElementTag) {
|
||||
xmlStr += indentation;
|
||||
}
|
||||
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
||||
isPreviousElementTag = false;
|
||||
continue;
|
||||
}else if( tagName === options.commentPropName){
|
||||
} else if (tagName === options.commentPropName) {
|
||||
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
|
||||
isPreviousElementTag = true;
|
||||
continue;
|
||||
}else if( tagName[0] === "?"){
|
||||
} else if (tagName[0] === "?") {
|
||||
const attStr = attr_to_str(tagObj[":@"], options);
|
||||
const tempInd = tagName === "?xml" ? "" : indentation;
|
||||
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
|
||||
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
|
||||
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
|
||||
isPreviousElementTag = true;
|
||||
continue;
|
||||
}
|
||||
const attStr = attr_to_str(tagObj[":@"], options);
|
||||
let tagStart = indentation + `<${tagName}${attStr}`;
|
||||
let tagValue = arrToStr(tagObj[tagName], options, newJPath, level + 1);
|
||||
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}>` ;
|
||||
let newIdentation = indentation;
|
||||
if (newIdentation !== "") {
|
||||
newIdentation += options.indentBy;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
function propName(obj){
|
||||
function propName(obj) {
|
||||
const keys = Object.keys(obj);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
if(key !== ":@") return key;
|
||||
const key = keys[i];
|
||||
if (key !== ":@") return key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function attr_to_str(attrMap, options){
|
||||
function attr_to_str(attrMap, options) {
|
||||
let attrStr = "";
|
||||
if(attrMap && !options.ignoreAttributes){
|
||||
for (let attr in attrMap){
|
||||
if (attrMap && !options.ignoreAttributes) {
|
||||
for (let attr in attrMap) {
|
||||
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
||||
attrVal = replaceEntitiesValue(attrVal, options);
|
||||
if(attrVal === true && options.suppressBooleanAttributes){
|
||||
attrStr+= ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
||||
}else{
|
||||
attrStr+= ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
||||
if (attrVal === true && options.suppressBooleanAttributes) {
|
||||
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
||||
} else {
|
||||
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return attrStr;
|
||||
}
|
||||
|
||||
function isStopNode(jPath, options){
|
||||
jPath = jPath.substr(0,jPath.length - options.textNodeName.length - 1);
|
||||
function isStopNode(jPath, options) {
|
||||
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
||||
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
||||
for(let index in options.stopNodes){
|
||||
if(options.stopNodes[index] === jPath || options.stopNodes[index] === "*."+tagName) return true;
|
||||
for (let index in options.stopNodes) {
|
||||
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function replaceEntitiesValue(textValue, options){
|
||||
if(textValue && textValue.length > 0 && options.processEntities){
|
||||
for (let i=0; i< options.entities.length; i++) {
|
||||
const entity = options.entities[i];
|
||||
textValue = textValue.replace(entity.regex, entity.val);
|
||||
}
|
||||
function replaceEntitiesValue(textValue, options) {
|
||||
if (textValue && textValue.length > 0 && options.processEntities) {
|
||||
for (let i = 0; i < options.entities.length; i++) {
|
||||
const entity = options.entities[i];
|
||||
textValue = textValue.replace(entity.regex, entity.val);
|
||||
}
|
||||
}
|
||||
return textValue;
|
||||
}
|
||||
}
|
||||
module.exports = toXml;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6072:
|
||||
@ -51202,81 +51226,36 @@ function readDocType(xmlData, i){
|
||||
{
|
||||
i = i+9;
|
||||
let angleBracketsCount = 1;
|
||||
let hasBody = false, entity = false, comment = false;
|
||||
let hasBody = false, comment = false;
|
||||
let exp = "";
|
||||
for(;i<xmlData.length;i++){
|
||||
if (xmlData[i] === '<') {
|
||||
if( hasBody &&
|
||||
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'
|
||||
){
|
||||
if (xmlData[i] === '<' && !comment) { //Determine the tag type
|
||||
if( hasBody && isEntity(xmlData, i)){
|
||||
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");
|
||||
[entityName, val,i] = readEntityExp(xmlData,i+1);
|
||||
if(val.indexOf("&") === -1) //Parameter entities are not supported
|
||||
entities[ validateEntityName(entityName) ] = {
|
||||
regx : RegExp( `&${entityName};`,"g"),
|
||||
val: val
|
||||
};
|
||||
}
|
||||
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++;
|
||||
exp = "";
|
||||
} else if (xmlData[i] === '>') {
|
||||
} else if (xmlData[i] === '>') { //Read tag content
|
||||
if(comment){
|
||||
if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
|
||||
comment = false;
|
||||
}else{
|
||||
throw new Error(`Invalid XML comment in DOCTYPE`);
|
||||
angleBracketsCount--;
|
||||
}
|
||||
}else if(entity){
|
||||
parseEntityExp(exp, entities);
|
||||
entity = false;
|
||||
}else{
|
||||
angleBracketsCount--;
|
||||
}
|
||||
angleBracketsCount--;
|
||||
if (angleBracketsCount === 0) {
|
||||
break;
|
||||
}
|
||||
@ -51295,16 +51274,99 @@ function readDocType(xmlData, i){
|
||||
return {entities, i};
|
||||
}
|
||||
|
||||
const entityRegex = RegExp("^\\s([a-zA-z0-0]+)[ \t](['\"])([^&]+)\\2");
|
||||
function parseEntityExp(exp, entities){
|
||||
const match = entityRegex.exec(exp);
|
||||
if(match){
|
||||
entities[ match[1] ] = {
|
||||
regx : RegExp( `&${match[1]};`,"g"),
|
||||
val: match[3]
|
||||
};
|
||||
function readEntityExp(xmlData,i){
|
||||
//External entities are not supported
|
||||
// <!ENTITY ext SYSTEM "http://normal-website.com" >
|
||||
|
||||
//Parameter entities are not supported
|
||||
// <!ENTITY entityname "&anotherElement;">
|
||||
|
||||
//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;
|
||||
|
||||
/***/ }),
|
||||
@ -51328,7 +51390,8 @@ const defaultOptions = {
|
||||
cdataPropName: false,
|
||||
numberParseOptions: {
|
||||
hex: true,
|
||||
leadingZeros: true
|
||||
leadingZeros: true,
|
||||
eNotation: true
|
||||
},
|
||||
tagValueProcessor: function(tagName, val) {
|
||||
return val;
|
||||
@ -51346,6 +51409,11 @@ const defaultOptions = {
|
||||
ignoreDeclaration: false,
|
||||
ignorePiTags: false,
|
||||
transformTagName: false,
|
||||
transformAttributeName: false,
|
||||
updateTag: function(tagName, jPath, attrs){
|
||||
return tagName
|
||||
},
|
||||
// skipEmptyListItem: false
|
||||
};
|
||||
|
||||
const buildOptions = function(options) {
|
||||
@ -51383,12 +51451,12 @@ class OrderedObjParser{
|
||||
this.tagsNodeStack = [];
|
||||
this.docTypeEntities = {};
|
||||
this.lastEntities = {
|
||||
"amp" : { regex: /&(amp|#38|#x26);/g, val : "&"},
|
||||
"apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
|
||||
"gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
|
||||
"lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
|
||||
"quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
|
||||
};
|
||||
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
|
||||
this.htmlEntities = {
|
||||
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
||||
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
||||
@ -51413,6 +51481,7 @@ class OrderedObjParser{
|
||||
this.replaceEntitiesValue = replaceEntitiesValue;
|
||||
this.readStopNodeData = readStopNodeData;
|
||||
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('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
|
||||
|
||||
function buildAttributesMap(attrStr, jPath) {
|
||||
function buildAttributesMap(attrStr, jPath, tagName) {
|
||||
if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
|
||||
// attrStr = attrStr.replace(/\r?\n/g, ' ');
|
||||
//attrStr = attrStr || attrStr.trim();
|
||||
@ -51495,8 +51564,12 @@ function buildAttributesMap(attrStr, jPath) {
|
||||
for (let i = 0; i < len; i++) {
|
||||
const attrName = this.resolveNameSpace(matches[i][1]);
|
||||
let oldVal = matches[i][4];
|
||||
const aName = this.options.attributeNamePrefix + attrName;
|
||||
let aName = this.options.attributeNamePrefix + attrName;
|
||||
if (attrName.length) {
|
||||
if (this.options.transformAttributeName) {
|
||||
aName = this.options.transformAttributeName(aName);
|
||||
}
|
||||
if(aName === "__proto__") aName = "#__proto__";
|
||||
if (oldVal !== undefined) {
|
||||
if (this.options.trimValues) {
|
||||
oldVal = oldVal.trim();
|
||||
@ -51530,7 +51603,7 @@ function buildAttributesMap(attrStr, jPath) {
|
||||
attrCollection[this.options.attributesGroupName] = attrs;
|
||||
return attrCollection;
|
||||
}
|
||||
return attrs;
|
||||
return attrs
|
||||
}
|
||||
}
|
||||
|
||||
@ -51564,9 +51637,21 @@ const parseXml = function(xmlData) {
|
||||
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);
|
||||
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 recurssion, set the parent tag scope
|
||||
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
|
||||
textData = "";
|
||||
i = closeIndex;
|
||||
} else if( xmlData[i+1] === '?') {
|
||||
@ -51583,9 +51668,9 @@ const parseXml = function(xmlData) {
|
||||
childNode.add(this.options.textNodeName, "");
|
||||
|
||||
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;
|
||||
}else {//Opening tag
|
||||
let result = readTagExp(xmlData,i, this. options.removeNSPrefix);
|
||||
let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
|
||||
let tagName= result.tagName;
|
||||
let tagExp = result.tagExp;
|
||||
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
|
||||
const lastTag = currentNode;
|
||||
if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
|
||||
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
|
||||
let tagContent = "";
|
||||
//self-closing tag
|
||||
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
||||
i = result.closeIndex;
|
||||
}
|
||||
//boolean tag
|
||||
//unpaired tag
|
||||
else if(this.options.unpairedTags.indexOf(tagName) !== -1){
|
||||
i = result.closeIndex;
|
||||
}
|
||||
@ -51673,7 +51757,7 @@ const parseXml = function(xmlData) {
|
||||
|
||||
const childNode = new xmlNode(tagName);
|
||||
if(tagName !== tagExp && attrExpPresent){
|
||||
childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
|
||||
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
||||
}
|
||||
if(tagContent) {
|
||||
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
||||
@ -51682,7 +51766,7 @@ const parseXml = function(xmlData) {
|
||||
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
||||
childNode.add(this.options.textNodeName, tagContent);
|
||||
|
||||
currentNode.addChild(childNode);
|
||||
this.addChild(currentNode, childNode, jPath)
|
||||
}else{
|
||||
//selfClosing tag
|
||||
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
||||
@ -51699,10 +51783,10 @@ const parseXml = function(xmlData) {
|
||||
|
||||
const childNode = new xmlNode(tagName);
|
||||
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("."));
|
||||
currentNode.addChild(childNode);
|
||||
}
|
||||
//opening tag
|
||||
else{
|
||||
@ -51710,9 +51794,9 @@ const parseXml = function(xmlData) {
|
||||
this.tagsNodeStack.push(currentNode);
|
||||
|
||||
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;
|
||||
}
|
||||
textData = "";
|
||||
@ -51726,7 +51810,19 @@ const parseXml = function(xmlData) {
|
||||
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){
|
||||
|
||||
if(this.options.processEntities){
|
||||
for(let entityName in this.docTypeEntities){
|
||||
const entity = this.docTypeEntities[entityName];
|
||||
@ -51742,6 +51838,7 @@ const replaceEntitiesValue = function(val){
|
||||
val = val.replace( entity.regex, entity.val);
|
||||
}
|
||||
}
|
||||
val = val.replace( this.ampEntity.regex, this.ampEntity.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 {number} i starting index
|
||||
* @returns
|
||||
@ -51976,6 +52073,8 @@ class XMLParser{
|
||||
throw new Error("Entity value can't have '&'")
|
||||
}else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
|
||||
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{
|
||||
this.externalEntities[key] = value;
|
||||
}
|
||||
@ -52086,8 +52185,20 @@ function assignAttributes(obj, attrMap, jpath, options){
|
||||
}
|
||||
|
||||
function isLeafTag(obj, options){
|
||||
const { textNodeName } = options;
|
||||
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;
|
||||
}
|
||||
exports.prettify = prettify;
|
||||
@ -52109,9 +52220,11 @@ class XmlNode{
|
||||
}
|
||||
add(key,val){
|
||||
// this.child.push( {name : key, val: val, isCdata: isCdata });
|
||||
if(key === "__proto__") key = "#__proto__";
|
||||
this.child.push( {[key]: val });
|
||||
}
|
||||
addChild(node) {
|
||||
if(node.tagname === "__proto__") node.tagname = "#__proto__";
|
||||
if(node[":@"] && Object.keys(node[":@"]).length > 0){
|
||||
this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
|
||||
}else{
|
||||
|
10
externals/install-dotnet.sh
vendored
10
externals/install-dotnet.sh
vendored
@ -310,6 +310,10 @@ get_machine_architecture() {
|
||||
echo "s390x"
|
||||
return 0
|
||||
;;
|
||||
ppc64le)
|
||||
echo "ppc64le"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@ -347,6 +351,10 @@ get_normalized_architecture_from_architecture() {
|
||||
echo "s390x"
|
||||
return 0
|
||||
;;
|
||||
ppc64le)
|
||||
echo "ppc64le"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
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 " --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
|
||||
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 " 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."
|
||||
|
28
package-lock.json
generated
28
package-lock.json
generated
@ -16,7 +16,7 @@
|
||||
"@actions/glob": "^0.3.0",
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"@actions/io": "^1.0.2",
|
||||
"fast-xml-parser": "^4.0.10",
|
||||
"fast-xml-parser": "^4.2.4",
|
||||
"json5": "^2.2.3",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
@ -3309,18 +3309,24 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/fast-xml-parser": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz",
|
||||
"integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==",
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz",
|
||||
"integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/naturalintelligence"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/NaturalIntelligence"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"strnum": "^1.0.5"
|
||||
},
|
||||
"bin": {
|
||||
"fxparser": "src/cli/cli.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/naturalintelligence"
|
||||
}
|
||||
},
|
||||
"node_modules/fastq": {
|
||||
@ -9004,9 +9010,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"fast-xml-parser": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.0.10.tgz",
|
||||
"integrity": "sha512-mYMMIk7Ho1QOiedyvafdyPamn1Vlda+5n95lcn0g79UiCQoLQ2xfPQ8m3pcxBMpVaftYXtoIE2wrNTjmLQnnkg==",
|
||||
"version": "4.2.4",
|
||||
"resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.4.tgz",
|
||||
"integrity": "sha512-fbfMDvgBNIdDJLdLOwacjFAPYt67tr31H9ZhWSm45CDAxvd0I6WTlSOUo7K2P/K5sA5JgMKG64PI3DMcaFdWpQ==",
|
||||
"requires": {
|
||||
"strnum": "^1.0.5"
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
"@actions/glob": "^0.3.0",
|
||||
"@actions/http-client": "^2.0.1",
|
||||
"@actions/io": "^1.0.2",
|
||||
"fast-xml-parser": "^4.0.10",
|
||||
"fast-xml-parser": "^4.2.4",
|
||||
"json5": "^2.2.3",
|
||||
"semver": "^6.3.0"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user