ipx 4.0.0-alpha.2 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ var n = e(((e) => {
3
3
  (function(e) {
4
4
  e.parser = function(e, t) {
5
5
  return new r(e, t);
6
- }, e.SAXParser = r, e.SAXStream = d, e.createStream = l, e.MAX_BUFFER_LENGTH = 64 * 1024;
6
+ }, e.SAXParser = r, e.SAXStream = d, e.createStream = l, e.MAX_BUFFER_LENGTH = 65536;
7
7
  var n = [
8
8
  `comment`,
9
9
  `sgmlDecl`,
@@ -80,7 +80,7 @@ var n = e(((e) => {
80
80
  end: function() {
81
81
  L(this);
82
82
  },
83
- write: q,
83
+ write: J,
84
84
  resume: function() {
85
85
  return this.error = null, this;
86
86
  },
@@ -163,7 +163,7 @@ var n = e(((e) => {
163
163
  t.splice(0, 0, e), n.emit.apply(n, t);
164
164
  }), s.prototype.on.call(n, e, t);
165
165
  };
166
- var f = `[CDATA[`, p = `DOCTYPE`, m = `http://www.w3.org/XML/1998/namespace`, h = `http://www.w3.org/2000/xmlns/`, g = {
166
+ var f = /^\[CDATA\[$/i, p = /^DOCTYPE$/i, m = `http://www.w3.org/XML/1998/namespace`, h = `http://www.w3.org/2000/xmlns/`, g = {
167
167
  xml: m,
168
168
  xmlns: h
169
169
  }, _ = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, v = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, y = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, b = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
@@ -221,13 +221,13 @@ var n = e(((e) => {
221
221
  CLOSE_TAG_SAW_WHITE: E++,
222
222
  SCRIPT: E++,
223
223
  SCRIPT_ENDING: E++
224
- }, e.XML_ENTITIES = {
224
+ }, e.XML_ENTITIES = Object.assign(Object.create(null), {
225
225
  amp: `&`,
226
226
  gt: `>`,
227
227
  lt: `<`,
228
228
  quot: `"`,
229
229
  apos: `'`
230
- }, e.ENTITIES = {
230
+ }), e.ENTITIES = Object.assign(Object.create(null), {
231
231
  amp: `&`,
232
232
  gt: `>`,
233
233
  lt: `<`,
@@ -481,7 +481,7 @@ var n = e(((e) => {
481
481
  clubs: 9827,
482
482
  hearts: 9829,
483
483
  diams: 9830
484
- }, Object.keys(e.ENTITIES).forEach(function(t) {
484
+ }), Object.keys(e.ENTITIES).forEach(function(t) {
485
485
  var n = e.ENTITIES[t], r = typeof n == `number` ? String.fromCharCode(n) : n;
486
486
  e.ENTITIES[t] = r;
487
487
  }), e.STATE) e.STATE[e.STATE[D]] = D;
@@ -501,7 +501,7 @@ var n = e(((e) => {
501
501
  return !n || !r ? !0 : r === `utf16` ? n === `utf16le` || n === `utf16be` : n === r;
502
502
  }
503
503
  function M(e, t) {
504
- if (!(!e.strict || !e.encoding || !t || t.name !== `xml`)) {
504
+ if (e.strict && e.encoding && t && t.name === `xml`) {
505
505
  var n = k(t.body);
506
506
  n && !j(e.encoding, n) && R(e, `XML declaration encoding ` + n + ` does not match detected stream encoding ` + e.encoding.toUpperCase());
507
507
  }
@@ -544,26 +544,27 @@ Char: ` + e.c), t = Error(t), e.error = t, O(e, `onerror`, t), e;
544
544
  };
545
545
  }
546
546
  function V(e) {
547
- if (e.strict || (e.attribName = e.attribName[e.looseCase]()), e.attribList.indexOf(e.attribName) !== -1 || e.tag.attributes.hasOwnProperty(e.attribName)) {
548
- e.attribName = e.attribValue = ``;
549
- return;
550
- }
551
- if (e.opt.xmlns) {
552
- var t = B(e.attribName, !0), n = t.prefix, r = t.local;
553
- if (n === `xmlns`) if (r === `xml` && e.attribValue !== m) R(e, `xml: prefix must be bound to ` + m + `
547
+ if (e.strict || (e.attribName = e.attribName[e.looseCase]()), e.attribList.indexOf(e.attribName) !== -1 || e.tag.attributes.hasOwnProperty(e.attribName)) e.attribName = e.attribValue = ``;
548
+ else {
549
+ if (e.opt.xmlns) {
550
+ var t = B(e.attribName, !0), n = t.prefix, r = t.local;
551
+ if (n === `xmlns`) {
552
+ if (r === `xml` && e.attribValue !== m) R(e, `xml: prefix must be bound to ` + m + `
554
553
  Actual: ` + e.attribValue);
555
- else if (r === `xmlns` && e.attribValue !== h) R(e, `xmlns: prefix must be bound to ` + h + `
554
+ else if (r === `xmlns` && e.attribValue !== h) R(e, `xmlns: prefix must be bound to ` + h + `
556
555
  Actual: ` + e.attribValue);
557
- else {
558
- var i = e.tag, a = e.tags[e.tags.length - 1] || e;
559
- i.ns === a.ns && (i.ns = Object.create(a.ns)), i.ns[r] = e.attribValue;
560
- }
561
- e.attribList.push([e.attribName, e.attribValue]);
562
- } else e.tag.attributes[e.attribName] = e.attribValue, N(e, `onattribute`, {
563
- name: e.attribName,
564
- value: e.attribValue
565
- });
566
- e.attribName = e.attribValue = ``;
556
+ else {
557
+ var i = e.tag, a = e.tags[e.tags.length - 1] || e;
558
+ i.ns === a.ns && (i.ns = Object.create(a.ns)), i.ns[r] = e.attribValue;
559
+ }
560
+ }
561
+ e.attribList.push([e.attribName, e.attribValue]);
562
+ } else e.tag.attributes[e.attribName] = e.attribValue, N(e, `onattribute`, {
563
+ name: e.attribName,
564
+ value: e.attribValue
565
+ });
566
+ e.attribName = e.attribValue = ``;
567
+ }
567
568
  }
568
569
  function H(e, t) {
569
570
  if (e.opt.xmlns) {
@@ -588,73 +589,74 @@ Actual: ` + e.attribValue);
588
589
  }
589
590
  e.attribList.length = 0;
590
591
  }
591
- e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), N(e, `onopentag`, e.tag), t || (!e.noscript && e.tagName.toLowerCase() === `script` ? e.state = E.SCRIPT : e.state = E.TEXT, e.tag = null, e.tagName = ``), e.attribName = e.attribValue = ``, e.attribList.length = 0;
592
+ e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), N(e, `onopentag`, e.tag), t || (e.state = !e.noscript && e.tagName.toLowerCase() === `script` ? E.SCRIPT : E.TEXT, e.tag = null, e.tagName = ``), e.attribName = e.attribValue = ``, e.attribList.length = 0;
592
593
  }
593
594
  function U(e) {
594
- if (!e.tagName) {
595
- R(e, `Weird empty close tag.`), e.textNode += `</>`, e.state = E.TEXT;
596
- return;
597
- }
598
- if (e.script) {
599
- if (e.tagName !== `script`) {
600
- e.script += `</` + e.tagName + `>`, e.tagName = ``, e.state = E.SCRIPT;
601
- return;
595
+ if (!e.tagName) R(e, `Weird empty close tag.`), e.textNode += `</>`, e.state = E.TEXT;
596
+ else {
597
+ if (e.script) {
598
+ if (e.tagName !== `script`) {
599
+ e.script += `</` + e.tagName + `>`, e.tagName = ``, e.state = E.SCRIPT;
600
+ return;
601
+ }
602
+ N(e, `onscript`, e.script), e.script = ``;
603
+ }
604
+ var t = e.tags.length, n = e.tagName;
605
+ e.strict || (n = n[e.looseCase]());
606
+ for (var r = n; t-- && e.tags[t].name !== r;) R(e, `Unexpected close tag`);
607
+ if (t < 0) R(e, `Unmatched closing tag: ` + e.tagName), e.textNode += `</` + e.tagName + `>`, e.state = E.TEXT;
608
+ else {
609
+ e.tagName = n;
610
+ for (var i = e.tags.length; i-- > t;) {
611
+ var a = e.tag = e.tags.pop();
612
+ e.tagName = e.tag.name, N(e, `onclosetag`, e.tagName);
613
+ var o = {};
614
+ for (var s in a.ns) o[s] = a.ns[s];
615
+ var c = e.tags[e.tags.length - 1] || e;
616
+ e.opt.xmlns && a.ns !== c.ns && Object.keys(a.ns).forEach(function(t) {
617
+ var n = a.ns[t];
618
+ N(e, `onclosenamespace`, {
619
+ prefix: t,
620
+ uri: n
621
+ });
622
+ });
623
+ }
624
+ t === 0 && (e.closedRoot = !0), e.tagName = e.attribValue = e.attribName = ``, e.attribList.length = 0, e.state = E.TEXT;
602
625
  }
603
- N(e, `onscript`, e.script), e.script = ``;
604
- }
605
- var t = e.tags.length, n = e.tagName;
606
- e.strict || (n = n[e.looseCase]());
607
- for (var r = n; t-- && e.tags[t].name !== r;) R(e, `Unexpected close tag`);
608
- if (t < 0) {
609
- R(e, `Unmatched closing tag: ` + e.tagName), e.textNode += `</` + e.tagName + `>`, e.state = E.TEXT;
610
- return;
611
- }
612
- e.tagName = n;
613
- for (var i = e.tags.length; i-- > t;) {
614
- var a = e.tag = e.tags.pop();
615
- e.tagName = e.tag.name, N(e, `onclosetag`, e.tagName);
616
- var o = {};
617
- for (var s in a.ns) o[s] = a.ns[s];
618
- var c = e.tags[e.tags.length - 1] || e;
619
- e.opt.xmlns && a.ns !== c.ns && Object.keys(a.ns).forEach(function(t) {
620
- var n = a.ns[t];
621
- N(e, `onclosenamespace`, {
622
- prefix: t,
623
- uri: n
624
- });
625
- });
626
626
  }
627
- t === 0 && (e.closedRoot = !0), e.tagName = e.attribValue = e.attribName = ``, e.attribList.length = 0, e.state = E.TEXT;
628
627
  }
629
628
  function W(e) {
630
629
  var t = e.entity, n = t.toLowerCase(), r, i = ``;
631
- return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === `#` && (t.charAt(1) === `x` ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ``), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (R(e, `Invalid character entity`), `&` + e.entity + `;`) : String.fromCodePoint(r));
630
+ return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === `#` && (t.charAt(1) === `x` ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ``), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 || !G(r) ? (R(e, `Invalid character entity`), `&` + e.entity + `;`) : String.fromCodePoint(r));
632
631
  }
633
- function G(e, t) {
634
- t === `<` ? (e.state = E.OPEN_WAKA, e.startTagPosition = e.position) : x(t) || (R(e, `Non-whitespace before first tag.`), e.textNode = t, e.state = E.TEXT);
632
+ function G(e) {
633
+ return e === 9 || e === 10 || e === 13 || e >= 32 && e <= 55295 || e >= 57344 && e <= 65533 || e >= 65536 && e <= 1114111;
635
634
  }
636
635
  function K(e, t) {
636
+ t === `<` ? (e.state = E.OPEN_WAKA, e.startTagPosition = e.position) : x(t) || (R(e, `Non-whitespace before first tag.`), e.textNode = t, e.state = E.TEXT);
637
+ }
638
+ function q(e, t) {
637
639
  var n = ``;
638
640
  return t < e.length && (n = e.charAt(t)), n;
639
641
  }
640
- function q(t) {
642
+ function J(t) {
641
643
  var n = this;
642
644
  if (this.error) throw this.error;
643
645
  if (n.closed) return I(n, `Cannot write after close. Assign an onready handler.`);
644
646
  if (t === null) return L(n);
645
647
  typeof t == `object` && (t = t.toString());
646
- for (var r = 0, a = ``; a = K(t, r++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === `
648
+ for (var r = 0, a = ``; a = q(t, r++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === `
647
649
  ` ? (n.line++, n.column = 0) : n.column++), n.state) {
648
650
  case E.BEGIN:
649
651
  if (n.state = E.BEGIN_WHITESPACE, a === ``) continue;
650
- G(n, a);
652
+ K(n, a);
651
653
  continue;
652
654
  case E.BEGIN_WHITESPACE:
653
- G(n, a);
655
+ K(n, a);
654
656
  continue;
655
657
  case E.TEXT:
656
658
  if (n.sawRoot && !n.closedRoot) {
657
- for (var o = r - 1; a && a !== `<` && a !== `&`;) a = K(t, r++), a && n.trackPosition && (n.position++, a === `
659
+ for (var o = r - 1; a && a !== `<` && a !== `&`;) a = q(t, r++), a && n.trackPosition && (n.position++, a === `
658
660
  ` ? (n.line++, n.column = 0) : n.column++);
659
661
  n.textNode += t.substring(o, r - 1);
660
662
  }
@@ -668,15 +670,17 @@ Actual: ` + e.attribValue);
668
670
  continue;
669
671
  case E.OPEN_WAKA:
670
672
  if (a === `!`) n.state = E.SGML_DECL, n.sgmlDecl = ``;
671
- else if (!x(a)) if (w(_, a)) n.state = E.OPEN_TAG, n.tagName = a;
672
- else if (a === `/`) n.state = E.CLOSE_TAG, n.tagName = ``;
673
- else if (a === `?`) n.state = E.PROC_INST, n.procInstName = n.procInstBody = ``;
674
- else {
675
- if (R(n, `Unencoded <`), n.startTagPosition + 1 < n.position) {
676
- var s = n.position - n.startTagPosition;
677
- a = Array(s).join(` `) + a;
673
+ else if (!x(a)) {
674
+ if (w(_, a)) n.state = E.OPEN_TAG, n.tagName = a;
675
+ else if (a === `/`) n.state = E.CLOSE_TAG, n.tagName = ``;
676
+ else if (a === `?`) n.state = E.PROC_INST, n.procInstName = n.procInstBody = ``;
677
+ else {
678
+ if (R(n, `Unencoded <`), n.startTagPosition + 1 < n.position) {
679
+ var s = n.position - n.startTagPosition;
680
+ a = Array(s).join(` `) + a;
681
+ }
682
+ n.textNode += `<` + a, n.state = E.TEXT;
678
683
  }
679
- n.textNode += `<` + a, n.state = E.TEXT;
680
684
  }
681
685
  continue;
682
686
  case E.SGML_DECL:
@@ -684,7 +688,7 @@ Actual: ` + e.attribValue);
684
688
  n.state = E.COMMENT, n.comment = ``, n.sgmlDecl = ``;
685
689
  continue;
686
690
  }
687
- n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = E.DOCTYPE_DTD, n.doctype += `<!` + n.sgmlDecl + a, n.sgmlDecl = ``) : (n.sgmlDecl + a).toUpperCase() === f ? (N(n, `onopencdata`), n.state = E.CDATA, n.sgmlDecl = ``, n.cdata = ``) : (n.sgmlDecl + a).toUpperCase() === p ? (n.state = E.DOCTYPE, (n.doctype || n.sawRoot) && R(n, `Inappropriately located doctype declaration`), n.doctype = ``, n.sgmlDecl = ``) : a === `>` ? (N(n, `onsgmldeclaration`, n.sgmlDecl), n.sgmlDecl = ``, n.state = E.TEXT) : (S(a) && (n.state = E.SGML_DECL_QUOTED), n.sgmlDecl += a);
691
+ n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = E.DOCTYPE_DTD, n.doctype += `<!` + n.sgmlDecl + a, n.sgmlDecl = ``) : f.test(n.sgmlDecl + a) ? (N(n, `onopencdata`), n.state = E.CDATA, n.sgmlDecl = ``, n.cdata = ``) : p.test(n.sgmlDecl + a) ? (n.state = E.DOCTYPE, (n.doctype || n.sawRoot) && R(n, `Inappropriately located doctype declaration`), n.doctype = ``, n.sgmlDecl = ``) : a === `>` ? (N(n, `onsgmldeclaration`, n.sgmlDecl), n.sgmlDecl = ``, n.state = E.TEXT) : (S(a) && (n.state = E.SGML_DECL_QUOTED), n.sgmlDecl += a);
688
692
  continue;
689
693
  case E.SGML_DECL_QUOTED:
690
694
  a === n.q && (n.state = E.SGML_DECL, n.q = ``), n.sgmlDecl += a;
@@ -708,10 +712,10 @@ Actual: ` + e.attribValue);
708
712
  a === `-` ? (n.state = E.COMMENT_ENDED, n.comment = F(n.opt, n.comment), n.comment && N(n, `oncomment`, n.comment), n.comment = ``) : (n.comment += `-` + a, n.state = E.COMMENT);
709
713
  continue;
710
714
  case E.COMMENT_ENDED:
711
- a === `>` ? n.doctype && n.doctype !== !0 ? n.state = E.DOCTYPE_DTD : n.state = E.TEXT : (R(n, `Malformed comment`), n.comment += `--` + a, n.state = E.COMMENT);
715
+ a === `>` ? n.state = n.doctype && n.doctype !== !0 ? E.DOCTYPE_DTD : E.TEXT : (R(n, `Malformed comment`), n.comment += `--` + a, n.state = E.COMMENT);
712
716
  continue;
713
717
  case E.CDATA:
714
- for (var o = r - 1; a && a !== `]`;) a = K(t, r++), a && n.trackPosition && (n.position++, a === `
718
+ for (var o = r - 1; a && a !== `]`;) a = q(t, r++), a && n.trackPosition && (n.position++, a === `
715
719
  ` ? (n.line++, n.column = 0) : n.column++);
716
720
  n.cdata += t.substring(o, r - 1), a === `]` && (n.state = E.CDATA_ENDING);
717
721
  continue;
@@ -801,9 +805,7 @@ Actual: ` + e.attribValue);
801
805
  case E.ATTRIB_VALUE_ENTITY_Q:
802
806
  c = E.ATTRIB_VALUE_QUOTED, l = `attribValue`;
803
807
  break;
804
- case E.ATTRIB_VALUE_ENTITY_U:
805
- c = E.ATTRIB_VALUE_UNQUOTED, l = `attribValue`;
806
- break;
808
+ case E.ATTRIB_VALUE_ENTITY_U: c = E.ATTRIB_VALUE_UNQUOTED, l = `attribValue`;
807
809
  }
808
810
  if (a === `;`) {
809
811
  var u = W(n);