@loaders.gl/xml
Advanced tools
Comparing version 4.3.2 to 4.3.3
@@ -21,4 +21,4 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
Actual: ${this.attribValue}`);else if(s==="xmlns"&&this.attribValue!==this.XMLNS_NAMESPACE)this.strictFail(`xmlns: prefix must be bound to ${this.XMLNS_NAMESPACE} | ||
Actual: ${this.attribValue}`);else{let r=this.tag,n=this.tags[this.tags.length-1]||this;r.ns===n.ns&&(r.ns=Object.create(n.ns)),r.ns[s]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else this.tag.attributes[this.attribName]=this.attribValue,this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){this.strict||(this.tagName=this.tagName[this.looseCase]());let t=this.tags[this.tags.length-1]||this,i=this.tag={name:this.tagName,attributes:{}};this.opt.xmlns&&(i.ns=t.ns),this.attribList.length=0,this.emitNode("onopentagstart",i)}parseEntity(){let t=this.entity,i=t.toLowerCase(),s=NaN,r="";return this.ENTITIES[t]?this.ENTITIES[t]:this.ENTITIES[i]?this.ENTITIES[i]:(t=i,t.charAt(0)==="#"&&(t.charAt(1)==="x"?(t=t.slice(2),s=parseInt(t,16),r=s.toString(16)):(t=t.slice(1),s=parseInt(t,10),r=s.toString(10))),t=t.replace(/^0+/,""),isNaN(s)||r.toLowerCase()!==t?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(s))}beginWhiteSpace(t){t==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):f.isWhitespace(t)||(this.strictFail("Non-whitespace before first tag."),this.textNode=t,this.state=this.S.TEXT)}strictFail(t){if(typeof this!="object"||!(this instanceof A))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(t)}textApplyOptions(t){return this.opt.trim&&(t=t.trim()),this.opt.normalize&&(t=t.replace(/\s+/g," ")),t}emitNode(t,i){this.textNode&&this.closeText(),this.emit(t,i)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let t=Math.max(this.opt.MAX_BUFFER_LENGTH,10),i=0;for(let r=0,n=this.BUFFERS.length;r<n;r++){let a=this[this.BUFFERS[r]]?.length||0;if(a>t)switch(this.BUFFERS[r]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[r]}`)}i=Math.max(i,a)}let s=this.opt.MAX_BUFFER_LENGTH-i;this.bufferCheckPosition=s+this.position}openTag(t){if(this.opt.xmlns){let i=this.tag,s=f.qname(this.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),i.uri=s.prefix);let r=this.tags[this.tags.length-1]||this;if(i.ns&&r.ns!==i.ns){let n=this;Object.keys(i.ns).forEach(a=>{n.emitNode("onopennamespace",{prefix:a,uri:i.ns[a]})})}for(let n=0,a=this.attribList.length;n<a;n++){let h=this.attribList[n],o=h[0],c=h[1],u=f.qname(o,!0),l=u.prefix,p=u.local,N=l===""?"":i.ns[l]||"",d={name:o,value:c,prefix:l,local:p,uri:N};l&&l!=="xmlns"&&!N&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(l)}`),d.uri=l),this.tag.attributes[o]=d,this.emitNode("onattribute",d)}this.attribList.length=0}this.tag.isSelfClosing=Boolean(t),this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),t||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}if(this.script){if(this.tagName!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,i=this.tagName;for(this.strict||(i=i[this.looseCase]());t--&&this.tags[t].name!==i;)this.strictFail("Unexpected close tag");if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=i;let s=this.tags.length;for(;s-- >t;){let r=this.tag=this.tags.pop();this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let n={};for(let h in r.ns)r.ns.hasOwnProperty(h)&&(n[h]=r.ns[h]);let a=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&r.ns!==a.ns){let h=this;Object.keys(r.ns).forEach(o=>{let c=r.ns[o];h.emitNode("onclosenamespace",{prefix:o,uri:c})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},A=class extends f{opt=Ht;events=tt;constructor(t){super(),this.clearBuffers(),this.opt=t={...this.opt,...t},this.events={...this.events,...t},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=Boolean(this.opt.strict),this.noscript=Boolean(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}};J(A,"ENTITIES",_);function v(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function x(e){if(Array.isArray(e))return e.map(t=>x(t));if(e&&typeof e=="object"){let t={};for(let[i,s]of Object.entries(e))t[v(i)]=x(s);return t}return e}var Mt=Z(Bt(),1);function H(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let i={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(r,n,a,h)=>Boolean(t?.arrayPaths?.some(c=>n===c)),...t?._fastXML},s=cs(e,i);return t?.uncapitalizeKeys?x(s):s}function cs(e,t){return new Mt.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var us="4.3.1",y={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:us,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:ls,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>H(new TextDecoder().decode(e),{...y.options.xml,...t?.xml}),parseTextSync:(e,t)=>H(e,{...y.options.xml,...t?.xml})};function ls(e){return e.startsWith("<?xml")}function z(e,t){return Rt(e||{},t)}function Rt(e,t,i=0){if(i>3)return t;let s={...e};for(let[r,n]of Object.entries(t))n&&typeof n=="object"&&!Array.isArray(n)?s[r]=Rt(s[r]||{},t[r],i+1):s[r]=t[r];return s}var vt={...y,name:"HTML",id:"html",extensions:["html","htm"],mimeTypes:["text/html"],testText:fs,parse:async(e,t)=>Vt(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Vt(e,t)};function fs(e){return e.startsWith("<html")}function Vt(e,t){return t=z(t,{xml:{_parser:"fast-xml-parser",_fastXML:{htmlEntities:!0}}}),y.parseTextSync?.(e,t)}function K(e){return Array.isArray(e)?e:(e&&typeof e=="object"&&e[0],e?[e]:[])}function Ut(e,t){e[t]=K(e[t])}return Qt(L);})(); | ||
Actual: ${this.attribValue}`);else{let r=this.tag,n=this.tags[this.tags.length-1]||this;r.ns===n.ns&&(r.ns=Object.create(n.ns)),r.ns[s]=this.attribValue}this.attribList.push([this.attribName,this.attribValue])}else this.tag.attributes[this.attribName]=this.attribValue,this.emitNode("onattribute",{name:this.attribName,value:this.attribValue});this.attribName=this.attribValue=""}newTag(){this.strict||(this.tagName=this.tagName[this.looseCase]());let t=this.tags[this.tags.length-1]||this,i=this.tag={name:this.tagName,attributes:{}};this.opt.xmlns&&(i.ns=t.ns),this.attribList.length=0,this.emitNode("onopentagstart",i)}parseEntity(){let t=this.entity,i=t.toLowerCase(),s=NaN,r="";return this.ENTITIES[t]?this.ENTITIES[t]:this.ENTITIES[i]?this.ENTITIES[i]:(t=i,t.charAt(0)==="#"&&(t.charAt(1)==="x"?(t=t.slice(2),s=parseInt(t,16),r=s.toString(16)):(t=t.slice(1),s=parseInt(t,10),r=s.toString(10))),t=t.replace(/^0+/,""),isNaN(s)||r.toLowerCase()!==t?(this.strictFail("Invalid character entity"),`&${this.entity};`):String.fromCodePoint(s))}beginWhiteSpace(t){t==="<"?(this.state=this.S.OPEN_WAKA,this.startTagPosition=this.position):f.isWhitespace(t)||(this.strictFail("Non-whitespace before first tag."),this.textNode=t,this.state=this.S.TEXT)}strictFail(t){if(typeof this!="object"||!(this instanceof A))throw new Error("bad call to strictFail");this.strict&&this.errorFunction(t)}textApplyOptions(t){return this.opt.trim&&(t=t.trim()),this.opt.normalize&&(t=t.replace(/\s+/g," ")),t}emitNode(t,i){this.textNode&&this.closeText(),this.emit(t,i)}closeText(){this.textNode=this.textApplyOptions(this.textNode),this.textNode!==void 0&&this.textNode!==""&&this.textNode!=="undefined"&&this.emit("ontext",this.textNode),this.textNode=""}checkBufferLength(){let t=Math.max(this.opt.MAX_BUFFER_LENGTH,10),i=0;for(let r=0,n=this.BUFFERS.length;r<n;r++){let a=this[this.BUFFERS[r]]?.length||0;if(a>t)switch(this.BUFFERS[r]){case"textNode":this.closeText();break;case"cdata":this.emitNode("oncdata",this.cdata),this.cdata="";break;case"script":this.emitNode("onscript",this.script),this.script="";break;default:this.errorFunction(`Max buffer length exceeded: ${this.BUFFERS[r]}`)}i=Math.max(i,a)}let s=this.opt.MAX_BUFFER_LENGTH-i;this.bufferCheckPosition=s+this.position}openTag(t){if(this.opt.xmlns){let i=this.tag,s=f.qname(this.tagName);i.prefix=s.prefix,i.local=s.local,i.uri=i.ns[s.prefix]||"",i.prefix&&!i.uri&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(this.tagName)}`),i.uri=s.prefix);let r=this.tags[this.tags.length-1]||this;if(i.ns&&r.ns!==i.ns){let n=this;Object.keys(i.ns).forEach(a=>{n.emitNode("onopennamespace",{prefix:a,uri:i.ns[a]})})}for(let n=0,a=this.attribList.length;n<a;n++){let h=this.attribList[n],o=h[0],c=h[1],u=f.qname(o,!0),l=u.prefix,p=u.local,N=l===""?"":i.ns[l]||"",d={name:o,value:c,prefix:l,local:p,uri:N};l&&l!=="xmlns"&&!N&&(this.strictFail(`Unbound namespace prefix: ${JSON.stringify(l)}`),d.uri=l),this.tag.attributes[o]=d,this.emitNode("onattribute",d)}this.attribList.length=0}this.tag.isSelfClosing=Boolean(t),this.sawRoot=!0,this.tags.push(this.tag),this.emitNode("onopentag",this.tag),t||(!this.noscript&&this.tagName.toLowerCase()==="script"?this.state=this.S.SCRIPT:this.state=this.S.TEXT,this.tag=null,this.tagName=""),this.attribName=this.attribValue="",this.attribList.length=0}closeTag(){if(!this.tagName){this.strictFail("Weird empty close tag."),this.textNode+="</>",this.state=this.S.TEXT;return}if(this.script){if(this.tagName!=="script"){this.script+=`</${this.tagName}>`,this.tagName="",this.state=this.S.SCRIPT;return}this.emitNode("onscript",this.script),this.script=""}let t=this.tags.length,i=this.tagName;for(this.strict||(i=i[this.looseCase]());t--&&this.tags[t].name!==i;)this.strictFail("Unexpected close tag");if(t<0){this.strictFail(`Unmatched closing tag: ${this.tagName}`),this.textNode+=`</${this.tagName}>`,this.state=this.S.TEXT;return}this.tagName=i;let s=this.tags.length;for(;s-- >t;){let r=this.tag=this.tags.pop();this.tagName=this.tag.name,this.emitNode("onclosetag",this.tagName);let n={};for(let h in r.ns)r.ns.hasOwnProperty(h)&&(n[h]=r.ns[h]);let a=this.tags[this.tags.length-1]||this;if(this.opt.xmlns&&r.ns!==a.ns){let h=this;Object.keys(r.ns).forEach(o=>{let c=r.ns[o];h.emitNode("onclosenamespace",{prefix:o,uri:c})})}}t===0&&(this.closedRoot=!0),this.tagName=this.attribValue=this.attribName="",this.attribList.length=0,this.state=this.S.TEXT}},A=class extends f{opt=Ht;events=tt;constructor(t){super(),this.clearBuffers(),this.opt=t={...this.opt,...t},this.events={...this.events,...t},this.q=this.c="",this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.bufferCheckPosition=this.opt.MAX_BUFFER_LENGTH,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=Boolean(this.opt.strict),this.noscript=Boolean(this.opt.strict||this.opt.noscript),this.state=this.S.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?Object.create(this.XML_ENTITIES):Object.create(this.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=Object.create(this.rootNS)),this.trackPosition=this.opt.position!==!1,this.trackPosition&&(this.position=this.line=this.column=0),this.emit("onready")}resume(){return this.error=null,this}close(){return this.write(null)}flush(){this.flushBuffers()}};J(A,"ENTITIES",_);function v(e){return typeof e=="string"?e.charAt(0).toLowerCase()+e.slice(1):e}function x(e){if(Array.isArray(e))return e.map(t=>x(t));if(e&&typeof e=="object"){let t={};for(let[i,s]of Object.entries(e))t[v(i)]=x(s);return t}return e}var Mt=Z(Bt(),1);function H(e,t){if(t?._parser&&t._parser!=="fast-xml-parser")throw new Error(t?._parser);let i={allowBooleanAttributes:!0,ignoreDeclaration:!0,removeNSPrefix:t?.removeNSPrefix,textNodeName:t?.textNodeName,isArray:(r,n,a,h)=>Boolean(t?.arrayPaths?.some(c=>n===c)),...t?._fastXML},s=cs(e,i);return t?.uncapitalizeKeys?x(s):s}function cs(e,t){return new Mt.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",...t}).parse(e)}var us="4.3.2",y={dataType:null,batchType:null,name:"XML",id:"xml",module:"xml",version:us,worker:!1,extensions:["xml"],mimeTypes:["application/xml","text/xml"],testText:ls,options:{xml:{_parser:"fast-xml-parser",uncapitalizeKeys:!1,removeNSPrefix:!1,textNodeName:"value",arrayPaths:[]}},parse:async(e,t)=>H(new TextDecoder().decode(e),{...y.options.xml,...t?.xml}),parseTextSync:(e,t)=>H(e,{...y.options.xml,...t?.xml})};function ls(e){return e.startsWith("<?xml")}function z(e,t){return Rt(e||{},t)}function Rt(e,t,i=0){if(i>3)return t;let s={...e};for(let[r,n]of Object.entries(t))n&&typeof n=="object"&&!Array.isArray(n)?s[r]=Rt(s[r]||{},t[r],i+1):s[r]=t[r];return s}var vt={...y,name:"HTML",id:"html",extensions:["html","htm"],mimeTypes:["text/html"],testText:fs,parse:async(e,t)=>Vt(new TextDecoder().decode(e),t),parseTextSync:(e,t)=>Vt(e,t)};function fs(e){return e.startsWith("<html")}function Vt(e,t){return t=z(t,{xml:{_parser:"fast-xml-parser",_fastXML:{htmlEntities:!0}}}),y.parseTextSync?.(e,t)}function K(e){return Array.isArray(e)?e:(e&&typeof e=="object"&&e[0],e?[e]:[])}function Ut(e,t){e[t]=K(e[t])}return Qt(L);})(); | ||
return __exports__; | ||
}); |
@@ -7,3 +7,3 @@ // loaders.gl | ||
// @ts-ignore TS2304: Cannot find name '__VERSION__'. | ||
const VERSION = typeof "4.3.1" !== 'undefined' ? "4.3.1" : 'latest'; | ||
const VERSION = typeof "4.3.2" !== 'undefined' ? "4.3.2" : 'latest'; | ||
/** | ||
@@ -10,0 +10,0 @@ * Loader for XML files |
{ | ||
"name": "@loaders.gl/xml", | ||
"version": "4.3.2", | ||
"version": "4.3.3", | ||
"description": "Framework-independent loaders for the XML (eXtensible Markup Language) format", | ||
@@ -44,4 +44,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"@loaders.gl/loader-utils": "4.3.2", | ||
"@loaders.gl/schema": "4.3.2", | ||
"@loaders.gl/loader-utils": "4.3.3", | ||
"@loaders.gl/schema": "4.3.3", | ||
"fast-xml-parser": "^4.2.5" | ||
@@ -52,3 +52,3 @@ }, | ||
}, | ||
"gitHead": "b4203b8703f64a38d6f79a3113bc7bb51d45c93a" | ||
"gitHead": "65cb9a984f8aa95d11f50e92189d7fb32786dc41" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
- Removed@loaders.gl/loader-utils@4.3.2(transitive)
- Removed@loaders.gl/schema@4.3.2(transitive)
- Removed@loaders.gl/worker-utils@4.3.2(transitive)
Updated@loaders.gl/schema@4.3.3